:root {
  --ink: #111;
  --paper: #f5f0e8;
  --paper2: #eae5d8;
  --paper3: #ddd8cc;
  --accent: #e8d84c;
  --accent2: #c8b800;
  --muted: #888;
  --cell: 52px;
  --gap: 5px;
  --step: 57px;
  --slide-btn-h: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--ink);
  font-family: 'Courier Prime', monospace;
  overscroll-behavior: none;
}

/* ── APP + CARD ── */
#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--ink);
}

#card {
  width: 100%;
  height: 100%;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

/* Desktop: row layout — ads fill sides, card centered */
@media (hover: hover) and (pointer: fine) {
  #app  { height: 100dvh; overflow: hidden; flex-direction: row; align-items: stretch; }
  #card { max-width: 25vw; min-width: 280px; height: 100dvh; overflow: hidden; flex-shrink: 0; }
}

/* ── AD SIDE COLUMNS ── */
.ad-side { display: none; }
@media (hover: hover) and (pointer: fine) {
  .ad-side {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 24px 32px 24px 24px;
  }
  #ad-right { padding: 24px 24px 24px 32px; }
  #ad-left, #ad-right {
    min-width: 160px;
    min-height: 600px;
  }
}

/* ── WIN POPUP AD ── */
#popup-win-ad {
  display: block;
  width: 100%;
  min-width: 250px;
  min-height: 150px;
}

/* Force non-zero dimensions on all AdSense slots so push() never sees availableWidth=0 */
.adsbygoogle {
  display: block !important;
  min-width: 160px !important;
  min-height: 90px !important;
}
#ad-left .adsbygoogle,
#ad-right .adsbygoogle  { min-height: 600px !important; }
#popup-win-ad .adsbygoogle { min-width: 250px !important; min-height: 150px !important; }

/* Mobile: card fills full screen as a fixed flex column */
@media (hover: none) and (pointer: coarse) {
  #app  { height: 100dvh; overflow: hidden; }
  #card { height: 100dvh; }
}

/* ── HEADER ── */
header {
  background: var(--ink); color: var(--paper);
  padding: 10px 16px;
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
header h1 { font-family: 'Bebas Neue', sans-serif; font-size: 30px; letter-spacing: 5px; user-select: none; }
header h1 a { color: inherit; text-decoration: none; cursor: pointer; }
.header-right { display: flex; flex-direction: row; align-items: center; gap: 12px; }
.header-info  { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.puzzle-num  { font-size: 14px; letter-spacing: 2px; opacity: 0.55; }
.puzzle-date { font-size: 12px; opacity: 0.4; letter-spacing: 1px; }

#menu-btn {
  background: none; border: none; color: var(--paper);
  font-size: 22px; line-height: 1; cursor: pointer;
  padding: 4px 2px; display: flex; align-items: center;
  opacity: 0.8; transition: opacity 0.1s;
}
#menu-btn:hover { opacity: 1; }

/* ── SIDE MENU ── */
#side-menu-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 200;
}
#side-menu-overlay.active { display: block; }

#side-menu {
  position: fixed; top: 0; right: 0;
  width: 260px; max-width: 80vw; height: 100dvh;
  background: var(--paper);
  border-left: 2px solid var(--ink);
  display: flex; flex-direction: column;
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
#side-menu.open { transform: translateX(0); }

#side-menu-header {
  background: var(--ink); color: var(--paper);
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; flex-shrink: 0;
  font-family: 'Bebas Neue', sans-serif; font-size: 16px; letter-spacing: 3px;
}
#side-menu-close {
  background: none; border: none; color: var(--paper);
  font-size: 14px; cursor: pointer; opacity: 0.7; padding: 2px 4px;
  transition: opacity 0.1s;
}
#side-menu-close:hover { opacity: 1; }

#side-menu-body { display: flex; flex-direction: column; overflow-y: auto; flex: 1; }

.menu-item {
  width: 100%; background: none; border: none; border-bottom: 1px solid var(--paper3);
  font-family: 'Bebas Neue', sans-serif; font-size: 16px; letter-spacing: 2px;
  color: var(--ink); text-align: left; padding: 14px 16px;
  cursor: pointer; transition: background 0.1s;
}
.menu-item:hover { background: var(--paper2); }
.menu-item-danger { color: #b00; }
.menu-item-danger:hover { background: #fff0f0; }

#archive-list {
  overflow: hidden; max-height: 0;
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--paper2);
}
#archive-list.open { max-height: 50dvh; overflow-y: auto; }

.archive-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px 10px 24px;
  border-bottom: 1px solid var(--paper3);
  cursor: pointer; transition: background 0.1s;
}
.archive-item:last-child { border-bottom: none; }
.archive-item:hover { background: var(--paper3); }
.archive-date { font-family: 'Bebas Neue', sans-serif; font-size: 13px; letter-spacing: 1.5px; }
.archive-item.archive-error { cursor: default; color: var(--muted); font-size: 10px; letter-spacing: 1px; justify-content: center; }
.archive-item.archive-error:hover { background: none; }

/* ── MAIN ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 0 12px;
  background-image: repeating-linear-gradient(
    to bottom, transparent 0px, transparent 27px, rgba(0,0,0,0.045) 28px);
}

/* Desktop: no scroll — grid-outer grows, clues/buttons fixed at bottom */
@media (hover: hover) and (pointer: fine) {
  #main {
    overflow: hidden;
    padding: 12px 0 0;
  }
  #grid-outer {
    flex: 1;           /* take all remaining space above clues */
    min-height: 0;
    justify-content: center;  /* vertically centre the grid within its space */
    overflow: hidden;  /* clip col-btn elements that stray outside the grid area */
  }
}

/* Mobile: grid fills remaining space between header and keyboard */
@media (hover: none) and (pointer: coarse) {
  #main { overflow-y: auto; flex: 1; min-height: 0; padding-bottom: 8px; }
  #main #clues-panel, #main #check-row, #main #result { display: none; }
}

/* ── GRID OUTER ── */
#grid-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
  flex-shrink: 0;
}

/* ── SLIDE ROWS (hidden — kept as empty placeholders in DOM) ── */
.slide-row { display: none; }

/* ── PER-COLUMN SLIDE BUTTONS (desktop only) ── */
.col-btn {
  position: absolute;
  left: 0;
  width: var(--cell);
  height: var(--col-btn-h, 39px);
  font-size: calc(var(--cell) * 0.52);
  background: var(--paper2);
  border: 1.5px solid var(--ink);
  cursor: pointer;
  display: none; align-items: center; justify-content: center;
  font-weight: 700; color: var(--ink);
  user-select: none;
  transition: background 0.1s, top 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3;
}
.col-btn:hover { background: var(--accent); }
.col-btn.inactive { opacity: 0.18; pointer-events: none; }
.col-btn.flash { animation: btnFlash 0.18s ease-out; }
@keyframes btnFlash { 0% { background: var(--accent2); } 100% { background: var(--paper2); } }

@media (hover: hover) and (pointer: fine) { .col-btn { display: flex; } }

/* ── GRID WRAP ── */
#grid-wrap { display: flex; justify-content: center; gap: var(--gap); }

.col { width: var(--cell); flex-shrink: 0; position: relative; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .col { cursor: grab; } .col:active { cursor: grabbing; } }
.col-window { width: var(--cell); overflow: hidden; position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
.col-rail {
  display: flex; flex-direction: column; gap: var(--gap);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.col-hcell-fixed { position: absolute; left: 0; width: var(--cell); height: var(--cell); z-index: 2; pointer-events: auto; }

/* ── CELLS ── */
.cell {
  width: var(--cell); height: var(--cell);
  border: 2px solid #ccc;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--cell) * 0.52); font-weight: 700; font-family: 'Courier Prime', monospace;
  background: #f2f2ed; position: relative; flex-shrink: 0;
  user-select: none; cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.v-cell.filled { background: #fafaf6; border-color: var(--ink); }
.v-cell.h-hole { background: transparent !important; border-color: transparent !important; pointer-events: none; }
.col.active .v-cell        { background: #fffde0; border-color: #bba800; }
.col.active .v-cell.filled { background: #fffde0; border-color: #bba800; }

.h-cell { border-width: 2.5px; border-color: var(--ink); }
.h-cell.free        { background: #fff; }
.h-cell.free:hover  { background: #fffef0; }
.h-cell.intersect   { background: var(--accent); border-color: var(--ink); }
.h-cell.intersect:hover { background: #f0d030; }
.col.active .h-cell.intersect { border-color: #bba800; }
.col.active .h-cell.free      { background: #fffde0; border-color: #bba800; }

/* ── BADGE ── */
.cell-badge {
  position: absolute; top: 2px; left: 3px;
  font-size: 18px; font-weight: 700; color: #ccc;
  line-height: 1; pointer-events: none; z-index: 3;
  font-family: 'Courier Prime', monospace;
}
.v-cell.filled .cell-badge     { color: var(--ink); }
.col.active .cell-badge         { color: #bba800; }
.h-cell.intersect .cell-badge   { color: rgba(0,0,0,0.4); }
.col.active .h-cell .cell-badge { color: rgba(0,0,0,0.35); }

/* ── CURSOR: top-right + bottom-left corners ── */
.cell.has-cursor::before, .cell.has-cursor::after {
  content: ''; position: absolute; width: 10px; height: 10px;
  border-color: var(--ink); border-style: solid;
  animation: cursorPulse 0.85s ease-in-out infinite alternate;
  z-index: 4; pointer-events: none;
}
.cell.has-cursor::before { top: 3px; right: 3px; border-width: 2px 2px 0 0; }
.cell.has-cursor::after  { bottom: 3px; left: 3px; border-width: 0 0 2px 2px; }
@keyframes cursorPulse {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0.2; transform: scale(0.75); }
}
.h-cell.intersect.has-cursor::before,
.h-cell.intersect.has-cursor::after { border-color: rgba(0,0,0,0.5); }

/* ── DESKTOP CLUES PANEL ── */
#clues-panel {
  margin: 10px 10px 0;
  border: 1.5px solid var(--ink);
  background: var(--paper2);
  position: relative;
  flex-shrink: 0;
}
#clues-panel::before {
  content: 'PISTES'; position: absolute; top: -13px; left: 8px;
  background: var(--paper2); padding: 0 4px;
  font-size: 20px; letter-spacing: 2px; color: var(--muted);
}
.clue-row {
  display: flex; gap: 8px; padding: 7px 10px;
  border-bottom: 1px solid var(--paper3);
  transition: background 0.15s; cursor: default;
}
.clue-row:last-child { border-bottom: none; }
.clue-num { font-size: 20px; font-weight: 700; letter-spacing: 1px; color: var(--muted); flex-shrink: 0; width: 34px; padding-top: 1px; }
.clue-body { font-size: 17px; color: var(--ink); line-height: 1.45; font-style: italic; opacity: 0.5; }
.clue-row.active-clue { background: #fffde0; }
.clue-row.active-clue .clue-num  { color: var(--ink); }
.clue-row.active-clue .clue-body { opacity: 1; font-weight: 700; font-style: normal; }

/* ── DESKTOP CHECK / CLEAR ── */
#check-row {
  margin: 8px 10px 10px;
  display: flex; gap: 8px;
  flex-shrink: 0;
}
@media (hover: none) and (pointer: coarse) { #check-row { display: none; } }
#btn-check {
  flex: 1; background: var(--ink); color: var(--paper);
  border: 2px solid var(--ink);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px; letter-spacing: 3px; padding: 10px;
  cursor: pointer; transition: background 0.1s;
}
#btn-check:hover { background: #333; }
#btn-clear {
  background: transparent; color: var(--ink);
  border: 2px solid var(--ink);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px; letter-spacing: 3px; padding: 10px 18px;
  cursor: pointer;
}
#btn-clear:hover { background: var(--paper2); }

/* ── DESKTOP RESULT (inline) ── */
#result {
  margin: 6px 10px 0; padding: 10px 12px;
  font-size: 13px; font-weight: 700; letter-spacing: 1px;
  text-align: center; display: none;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
#result.correct { background: var(--accent); }
#result.wrong   { background: #fff; }

/* ══════════════════════════════════════════
   FLOATING RESULT TOAST (mobile)
   ══════════════════════════════════════════ */
#result-toast {
  display: none;
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 488px;
  padding: 14px 16px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px; letter-spacing: 3px;
  text-align: center;
  border: 2.5px solid var(--ink);
  z-index: 500;
  animation: toastIn 0.22s ease-out;
}
#result-toast.correct { background: var(--accent); color: var(--ink); }
#result-toast.wrong   { background: var(--ink); color: var(--paper); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (hover: none) and (pointer: coarse) {
  #result-toast { bottom: var(--kb-h, 170px); }
}

/* ══════════════════════════════════════════
   MOBILE BOTTOM PANEL
   ══════════════════════════════════════════ */
#bottom-panel { display: none; }

@media (hover: none) and (pointer: coarse) {
  #bottom-panel {
    display: flex; flex-direction: column;
    position: relative;
    width: 100%;
    background: var(--paper);
    flex-shrink: 0;
    z-index: 10;
  }
}

/* ── CLUES DRAWER ── */
#clues-drawer {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--paper2);
  border-top: 1.5px solid var(--ink);
  position: absolute;
  bottom: 100%;
  left: 0; right: 0;
}
#clues-drawer.open { max-height: 46vh; }
#clues-drawer-inner {
  overflow-y: auto; max-height: 46vh;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
}
.clues-close-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px 4px;
  border-bottom: 1px solid var(--paper3);
  cursor: pointer; user-select: none; flex-shrink: 0;
}
.clues-close-bar span:first-child { font-size: 15px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.clues-close-bar .close-x { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 1px; }
#clues-mobile-list { flex: 1; }

/* ── ACTIVE CLUE BAR ── */
#active-clue-bar { display: none; }
@media (hover: none) and (pointer: coarse) {
  #active-clue-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px 8px; min-height: 46px;
    border-top: 1.5px solid var(--ink);
    background: var(--paper2);
    position: relative;
  }
  #active-clue-num {
    font-family: 'Courier Prime', monospace;
    font-size: 20px; font-weight: 700; letter-spacing: 1px;
    color: var(--muted); flex-shrink: 0; width: 34px;
  }
  #active-clue-text {
    font-family: 'Courier Prime', monospace;
    font-size: 14px; color: var(--ink); line-height: 1.3;
    font-style: italic; flex: 1;
  }
}

/* ── KEYBOARD BAR ── */
#kb-bar { display: flex; align-items: stretch; border-top: 2.5px solid var(--ink); }

#clues-toggle-btn {
  position: absolute; top: -16px; right: 10px;
  font-family: 'Bebas Neue', sans-serif; font-size: 16px; letter-spacing: 3px;
  color: var(--ink); background: var(--paper3);
  border: 1.5px solid var(--ink);
  padding: 2px 8px; cursor: pointer;
  user-select: none; transition: background 0.1s;
  display: none;
}
@media (hover: none) and (pointer: coarse) {
  #clues-toggle-btn { display: block; }
}
#clues-toggle-btn:active { background: var(--accent); }
#clues-toggle-btn.active { background: var(--accent); }

#keyboard { flex: 1; background: var(--paper2); padding: 6px 4px 10px; }

.kb-row { display: flex; justify-content: center; gap: 3px; margin-bottom: 3px; }

.key {
  flex: 1; max-width: 36px; height: 50px;
  background: #fff; border: 1.5px solid #aaa; border-bottom: 3px solid #777;
  font-family: 'Courier Prime', monospace; font-size: 14px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; border-radius: 3px;
  transition: background 0.08s; -webkit-tap-highlight-color: transparent;
}
.key:active, .key.pressed { background: var(--paper3); transform: translateY(1px); border-bottom-width: 2px; }
.key.del {
  background: var(--ink); color: var(--paper);
  border-color: var(--ink); border-bottom-color: #000;
  flex: 1.8; max-width: 62px;
  font-size: 32px;
}
.key.check-key {
  background: var(--ink); color: var(--paper);
  border-color: var(--ink); border-bottom-color: #000;
  font-family: 'Bebas Neue', sans-serif; font-size: 14px; letter-spacing: 1.5px;
  flex: 2.2; max-width: 82px;
}
.key.check-key.disabled { opacity: 0.3; pointer-events: none; }

/* ══════════════════════════════════════════
   POPUP SYSTEM
   ══════════════════════════════════════════ */
#popup-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.72); z-index: 900;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
#popup-overlay.active { display: block; }

.popup {
  display: none; position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 910; width: calc(100vw - 48px); max-width: 360px;
}
.popup.active {
  display: block;
  animation: popupIn 0.22s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}
@keyframes popupIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.88); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.popup-inner {
  background: var(--paper); border: 2.5px solid var(--ink);
  padding: 32px 24px 24px;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; text-align: center; position: relative;
}
.popup-icon { font-size: 36px; line-height: 1; margin-bottom: 4px; }
.popup-title { font-family: 'Bebas Neue', sans-serif; font-size: 28px; letter-spacing: 4px; color: var(--ink); line-height: 1.1; }
.popup-sub { font-family: 'Courier Prime', monospace; font-size: 12px; color: var(--muted); letter-spacing: 0.5px; line-height: 1.5; max-width: 260px; }
.popup-btn {
  margin-top: 16px; background: var(--ink); color: var(--paper);
  border: 2px solid var(--ink); font-family: 'Bebas Neue', sans-serif;
  font-size: 18px; letter-spacing: 3px; padding: 10px 32px;
  cursor: pointer; transition: background 0.1s; width: 100%;
}
.popup-btn:hover { background: #333; }
.popup-btn-secondary {
  background: var(--paper); color: var(--ink);
}
.popup-btn-secondary:hover { background: var(--paper2); }
.popup-btn-row {
  display: flex; gap: 8px; width: 100%; margin-top: 16px;
}
.popup-btn-row .popup-btn { margin-top: 0; }

.popup-spinner {
  width: 36px; height: 36px; border: 3px solid var(--paper3);
  border-top-color: var(--ink); border-radius: 50%;
  animation: spin 0.75s linear infinite; margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#popup-win .popup-inner  { border-color: var(--accent2); }
#popup-win .popup-icon   { color: var(--accent2); }
#popup-win .popup-btn    { background: var(--accent); color: var(--ink); border-color: var(--accent2); }
#popup-win .popup-btn:hover { background: var(--accent2); }

.popup-streak {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px; letter-spacing: 3px;
  color: var(--accent2);
}

#popup-fail .popup-icon { color: var(--ink); }

/* ══════════════════════════════════════════
   STATS POPUP
   ══════════════════════════════════════════ */

.stats-grid {
  display: flex;
  gap: 16px;
  width: 100%;
  margin: 8px 0 4px;
}

.stats-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: 1.5px solid var(--ink);
  background: var(--paper2);
}

.stats-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  line-height: 1;
  color: var(--ink);
}

.stats-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.stats-solved   { color: var(--accent2); }
.stats-unsolved { color: var(--muted); }

/* ══════════════════════════════════════════
   HELP POPUP
   ══════════════════════════════════════════ */

#popup-help .popup-inner {
  padding: 24px 20px 20px;
  gap: 0;
  max-height: 90dvh;
  overflow-y: auto;
}

#popup-help .popup-title { margin-bottom: 14px; }

@media (hover: hover) and (pointer: fine) {
  #popup-help {
    width: 22vw;
    min-width: 280px;
    max-width: none;
  }
  #popup-help .popup-title { font-size: 36px; }
}

.help-demo-wrap {
  width: 100%;
  background: var(--paper2);
  border: 1.5px solid var(--ink);
  padding: 14px 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.help-demo-caption {
  margin-top: 9px;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
  font-family: 'Bebas Neue', sans-serif;
}

#help-demo-cols {
  display: flex;
  gap: var(--dg, 3px);
  justify-content: center;
}

.hdemo-col {
  width: var(--dc, 30px);
  position: relative;
  flex-shrink: 0;
}

.hdemo-win {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}

.hdemo-rail {
  display: flex;
  flex-direction: column;
  gap: var(--dg, 3px);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.hdemo-cell {
  width: var(--dc, 30px);
  height: var(--dc, 30px);
  border: 1.5px solid #ccc;
  background: #f2f2ed;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--dc, 30px) * 0.52);
  font-weight: 700;
  font-family: 'Courier Prime', monospace;
  color: var(--ink);
  flex-shrink: 0;
}

.hdemo-cell.hdemo-hole {
  background: transparent !important;
  border-color: transparent !important;
}

.hdemo-hcell {
  position: absolute;
  left: 0;
  width: var(--dc, 30px);
  height: var(--dc, 30px);
  background: var(--accent);
  border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--dc, 30px) * 0.52);
  font-weight: 700;
  font-family: 'Courier Prime', monospace;
  color: var(--ink);
  z-index: 2;
}

.hdemo-free { background: white; }

.help-rules {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.help-rule {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  font-family: 'Courier Prime', monospace;
  text-align: left;
}

.help-rule-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  color: var(--accent2);
  flex-shrink: 0;
  line-height: 1.2;
  width: 16px;
}

@media (hover: hover) and (pointer: fine) {
  .help-rule { font-size: 17px; }
  .help-rule-num { font-size: 28px; }
  .help-demo-caption { font-size: 14px; }
}

/* ══════════════════════════════════════════
   LOADING STATE
   ══════════════════════════════════════════ */
body.loading #main,
body.loading #bottom-panel,
body.loading header { visibility: hidden; }

/* ══════════════════════════════════════════
   SOLVED STATE
   ══════════════════════════════════════════ */
body.solved #btn-check,
body.solved #btn-clear,
body.solved #kb-check { opacity: 0.35; pointer-events: none; }
body.solved .col       { cursor: default; }
