*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Dark game palette — inspired by Stitch design */
  --bg:         #0F0A1E;
  --surface:    #1A1433;
  --surface-hi: #241C45;
  --surface-br: #2E2456;
  --border:     #3D3168;

  --primary:    #61F4D8;   /* teal accent */
  --primary-dk: #2DD4BF;
  --primary-dim:#0D3D36;

  --secondary:  #A78BFA;   /* soft purple */
  --sec-dim:    #1E1040;

  --gold:       #FCD34D;
  --red-live:   #F87171;
  --green:      #4ADE80;
  --red:        #F87171;

  --text:       #E2E8F0;
  --text-muted: #94A3B8;

  --cell-size:  40px;
  --grid-gap:   2px;
  --radius:     8px;
}

html, body {
  height: 100%;
  height: var(--app-height, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  /* dot texture like Stitch */
  background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  overscroll-behavior: none;
}

/* ── Header ─────────────────────────────────────────────────────────── */
header {
  background: rgba(26,20,51,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  user-select: none;
  z-index: 20;
}

.header-left .puz-name {
  font-size: 13px; font-weight: 700;
  color: var(--text);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-counter {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: .04em;
}

.header-left       { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-title-wrap { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Hint token display in header */
.header-hints {
  display: flex; align-items: center; gap: 3px;
  background: var(--surface-hi);
  border: 1px solid rgba(252,211,77,.35);
  border-radius: 10px;
  padding: 4px 9px;
  cursor: default;
}
.hint-icon  { font-size: 13px; }
#hintTokenCount { font-size: 13px; font-weight: 800; color: var(--gold); }

/* Lives — kept for backwards compat */
.header-lives {
  display: flex; align-items: center; gap: 3px;
  color: var(--red-live);
  font-size: 13px; font-weight: 700;
}
.heart-icon { font-size: 15px; }

/* Score chip */
.header-score {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 10px;
}
.score-icon  { font-size: 14px; }
.score-num   { font-size: 13px; font-weight: 800; color: var(--gold); }

/* Level badge */
.level-badge {
  font-size: 9px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
  background: var(--sec-dim);
  color: var(--secondary);
  border: 1px solid var(--secondary);
  padding: 2px 7px;
  border-radius: 20px;
}

.nav-btn {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px; height: 32px;
  border-radius: 8px; cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.nav-btn:active { background: var(--surface-br); }

#puzzleSelect {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 7px;
  border-radius: 8px; font-size: 11px;
  cursor: pointer; max-width: 110px;
  touch-action: manipulation;
}
#puzzleSelect option { background: #1A1433; color: var(--text); }

/* ── Clue Bar ────────────────────────────────────────────────────────────── */
#clueBar {
  margin: 8px 12px 0;
  background: rgba(26,20,51,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(97,244,216,.25);
  border-radius: 16px;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}

.clue-bar-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Direction Picker ─────────────────────────────────────────────────────── */
.dir-picker {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0;
}
.dir-picker.hidden { display: none; }

.dir-pick-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  border-radius: 10px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s;
}
.dir-pick-btn:active { background: var(--surface-hi); }

.dir-pick-arrow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: rgba(97,244,216,.15);
  color: var(--primary);
  border: 1px solid rgba(97,244,216,.4);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}
.dir-pick-num {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  min-width: 18px;
}
.dir-pick-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dir-pick-divider {
  height: 1px;
  background: var(--border);
  margin: 0 4px;
}

.clue-bar-dir {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(97,244,216,.15);
  color: var(--primary);
  border: 1px solid rgba(97,244,216,.4);
  font-size: 12px; font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  line-height: 1;
  height: 22px;
}
.clue-bar-num {
  flex: 0 0 auto;
  font-weight: 800;
  color: var(--primary);
  font-size: 14px;
}
.clue-bar-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

/* Mini letter slots */
.clue-bar-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.clue-slot {
  width: 28px; height: 28px;
  border: 1.5px solid rgba(97,244,216,.35);
  border-bottom: 2.5px solid rgba(0,0,0,.5);
  border-radius: 5px;
  background: var(--surface-br);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
  flex-shrink: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s, border-color .1s;
}
.clue-slot:active { transform: scale(.9); }
.clue-slot.slot-empty {
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: rgba(0,0,0,.3);
}
.clue-slot.slot-active {
  background: var(--primary);
  border-color: var(--primary-dk);
  border-bottom-color: var(--primary-dk);
  color: #0A1E1C;
  box-shadow: 0 0 8px rgba(97,244,216,.4);
}
.clue-slot.slot-hinted {
  color: var(--secondary);
}

/* ── Main layout ─────────────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

@media (min-width: 768px) {
  main { flex-direction: row; }
}

/* ── Grid area ───────────────────────────────────────────────────────── */
#gridArea {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px 6px;
  touch-action: none;
  overflow: hidden;
}

@media (min-width: 768px) {
  #gridArea { flex: 0 0 auto; padding: 16px; align-items: flex-start; }
}

/* ── Crossword Grid ──────────────────────────────────────────────────── */
.cw-grid {
  display: grid;
  gap: var(--grid-gap);
  background: var(--border);
  border: 3px solid var(--primary);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(97,244,216,.15), 0 8px 32px rgba(0,0,0,.5);
  flex-shrink: 0;
  touch-action: none;
  max-width: 100%;
}

/* ── Cell ────────────────────────────────────────────────────────────── */
.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background: var(--bg);   /* black cells */
  position: relative;
  flex-shrink: 0;
}

.cell.white {
  /* 3D tile effect like Stitch */
  background: var(--surface-br);
  border-bottom: 3px solid var(--bg);
  border-right: 1px solid rgba(0,0,0,.4);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cell-num {
  position: absolute;
  top: 2px; left: 2px;
  font-size: clamp(6px, calc(var(--cell-size) * .22), 10px);
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  pointer-events: none;
  z-index: 3;
  user-select: none;
}

.cell-letter {
  position: absolute;
  inset: 0 0 3px 0;   /* account for border-bottom */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(11px, calc(var(--cell-size) * .46), 22px);
  font-weight: 900;
  color: var(--text);
  pointer-events: none;
  z-index: 2;
  user-select: none;
}

/* ── Highlight states ────────────────────────────────────────────────── */
.cell.hl-word {
  background: var(--primary-dim);
  border-bottom-color: rgba(0,0,0,.5);
}
.cell.hl-word .cell-num    { color: var(--primary); }
.cell.hl-word .cell-letter { color: rgba(97,244,216,.9); }

.cell.hl-active {
  background: var(--primary);
  border-bottom-color: var(--primary-dk);
  box-shadow: 0 0 14px rgba(97,244,216,.5);
}
.cell.hl-active .cell-num    { color: rgba(10,30,28,.7); }
.cell.hl-active .cell-letter { color: #0A1E1C; font-weight: 900; }

/* Inner ring for active cell */
.cell.hl-active::after {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 3px;
  pointer-events: none;
  z-index: 5;
}

/* Blinking cursor */
.cell-cursor {
  display: none;
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: clamp(10px, calc(var(--cell-size) * .36), 16px);
  background: rgba(10,30,28,.75);
  border-radius: 2px;
  animation: blink .85s step-end infinite;
  pointer-events: none;
  z-index: 4;
}
.cell.hl-active.is-empty .cell-cursor { display: block; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Hinted cell */
.cell.hinted .cell-letter { color: var(--secondary); opacity: .85; }
.cell.hl-active.hinted .cell-letter { color: rgba(10,30,28,.7); }

/* Feedback */
.cell.correct {
  background: var(--green) !important;
  border-bottom-color: #16a34a !important;
  box-shadow: 0 0 10px rgba(74,222,128,.4);
}
.cell.correct .cell-letter { color: #052e16; }
.cell.correct .cell-num    { color: rgba(5,46,22,.7); }
.cell.correct::after       { display: none; }

.cell.wrong {
  background: var(--red) !important;
  border-bottom-color: #dc2626 !important;
}
.cell.wrong .cell-letter { color: #fff; }
.cell.wrong .cell-num    { color: rgba(255,255,255,.7); }
.cell.wrong::after       { display: none; }

/* Hidden keyboard input */
#hiddenInput {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  /* Grid'e yakın konumlandır — Android scroll-to-input'u minimize eder */
  top: 120px; left: 50%;
  transform: translateX(-50%);
  width: 1px; height: 1px;
  border: none; outline: none;
  font-size: 16px; /* 16px altı iOS'ta zoom yapar */
}

/* ── Bottom Sheet ─────────────────────────────────────────────────────── */
.bottom-sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 40px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  height: clamp(220px, 42dvh, 360px);
}

/* Drag handle */
.bottom-sheet::before {
  content: '';
  display: block;
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 8px auto 4px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .bottom-sheet {
    flex: 1; height: auto;
    border-radius: 0;
    box-shadow: none;
    border-top: none;
    border-left: 1px solid var(--border);
  }
  .bottom-sheet::before { display: none; }
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.clue-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
  flex-shrink: 0;
}
.clue-tab {
  flex: 1;
  padding: 8px 8px;
  text-align: center;
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  transition: all .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.clue-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Klavye açıkken bottom sheet ve clue bar gizle */
.bottom-sheet.keyboard-hidden { display: none; }
#clueBar.keyboard-hidden { display: none; }

/* ── Mobil Klavye Clue Overlay ───────────────────────────────────────────── */
.clue-overlay {
  position: fixed;
  left: 0;
  width: 100%;
  background: var(--bg);
  background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 22px 22px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px 20px;
  animation: fadeIn .15s ease;
}
.clue-overlay.hidden { display: none; }

.clue-overlay .clue-overlay-top {
  width: 100%;
  max-width: 400px;
  flex-wrap: wrap;
  row-gap: 6px;
}
.clue-overlay .clue-bar-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  width: 100%;
  flex: 0 0 100%;
  margin-top: 2px;
}
.clue-overlay .clue-bar-slots {
  justify-content: center;
  gap: 7px;
}
.clue-overlay .clue-slot {
  width: 36px;
  height: 36px;
  font-size: 15px;
  border-radius: 7px;
}

/* Slot animasyonları */
@keyframes slotFlashGreen {
  0%   { background: var(--green); border-color: #16a34a; color: #052e16; }
  100% { background: var(--surface-br); border-color: rgba(97,244,216,.35); color: var(--text); }
}
.clue-slot.slot-flash-correct { animation: slotFlashGreen .6s ease forwards; }
.clue-slot.slot-shake         { animation: shake .35s ease; }
.clue-overlay-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Sadece mobilde göster */
@media (min-width: 768px) {
  .clue-overlay { display: none !important; }
}

@media (min-width: 768px) { .clue-tabs { display: none; } }

/* ── Clue columns ────────────────────────────────────────────────────── */
.clue-list-area { flex: 1; overflow: hidden; display: flex; overscroll-behavior: contain; }

.clue-col {
  flex: 1; min-width: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}
.clue-col-head {
  font-size: 10px; font-weight: 700;
  color: var(--primary); text-transform: uppercase;
  letter-spacing: .07em;
  padding: 6px 12px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 5;
  display: none;
}

@media (max-width: 767px) {
  .clue-col { display: none; }
  .clue-col.tab-active { display: block; }
}
@media (min-width: 768px) {
  .clue-col-head { display: block; }
  .clue-col { padding: 0; }
}

.clue-item {
  display: flex; gap: 8px; align-items: baseline;
  padding: 7px 12px;
  border-radius: 8px;
  margin: 1px 4px;
  cursor: pointer;
  font-size: 13px; line-height: 1.4;
  color: var(--text-muted);
  transition: background .1s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.clue-item:active,
.clue-item:hover { background: var(--surface-hi); color: var(--text); }
.clue-item.active {
  background: var(--primary-dim);
  border: 1px solid rgba(97,244,216,.25);
  color: var(--text);
  font-weight: 600;
}
.clue-item.solved { opacity: .3; }

.clue-num {
  flex: 0 0 20px;
  font-size: 11px; font-weight: 700;
  color: var(--primary);
  text-align: right;
}

/* ── Action bar ─────────────────────────────────────────────────────── */
.actions {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.actions-row { display: flex; gap: 7px; align-items: center; }

.btn {
  padding: 10px 14px;
  border: none; border-radius: 10px;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
}
.btn:active { transform: scale(.95); }

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #0A1E1C;
  font-weight: 800;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(97,244,216,.3);
}
.btn-hint {
  flex: 1;
  background: var(--surface-hi);
  color: var(--gold);
  border: 1.5px solid rgba(252,211,77,.4);
  justify-content: center;
}
.btn-clear {
  width: 44px; height: 44px; padding: 0;
  background: var(--surface-hi);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  justify-content: center;
  font-size: 17px;
}
.btn-vazgec {
  flex: 1;
  background: transparent;
  color: var(--red);
  border: 1.5px solid rgba(248,113,113,.35);
  font-size: 13px; font-weight: 700;
  justify-content: center;
  border-radius: 10px;
}
.btn-vazgec:hover { background: rgba(248,113,113,.08); }

.result-msg {
  font-size: 12px; font-weight: 700;
  padding: 5px 10px; border-radius: 8px; display: none;
}
.result-msg.show { display: block; }
.result-msg.all-correct { background: rgba(74,222,128,.15); color: var(--green); border: 1px solid rgba(74,222,128,.3); }
.result-msg.partial     { background: rgba(252,211,77,.1);  color: var(--gold);  border: 1px solid rgba(252,211,77,.2); }

/* ── Level Complete Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,6,25,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 22px 22px;
  max-width: 320px; width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(97,244,216,.1);
  animation: slideUp .28s ease;
}
@keyframes slideUp {
  from { transform: translateY(32px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-emoji    { font-size: 52px; line-height: 1; margin-bottom: 6px; }
.modal-title    { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 3px; }
.modal-puzzle-name { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }

.modal-stars { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.star        { font-size: 30px; color: var(--border); transition: color .3s, transform .3s; }
.star.active { color: var(--gold); transform: scale(1.12); }

.modal-score-display {
  background: var(--surface-hi); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 16px 8px; margin-bottom: 10px;
}
.modal-score-num   { font-size: 34px; font-weight: 900; color: var(--primary); line-height: 1; }
.modal-score-max   { font-size: 18px; color: var(--text-muted); }
.modal-score-label { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.modal-message { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.modal-stats   { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.modal-best    { font-size: 11px; color: var(--gold); margin-bottom: 12px; font-weight: 700; min-height: 16px; }

.modal-card-sm { max-width: 280px; }

.modal-actions { display: flex; flex-direction: column; gap: 7px; }
.modal-actions .btn { width: 100%; padding: 12px; font-size: 14px; justify-content: center; }
.modal-actions .btn-hint { color: var(--text-muted); border-color: var(--border); }
.modal-actions .btn-vazgec { border-radius: 10px; }

/* ── Shake animation (wrong word) ─────────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-4px); }
  40%     { transform: translateX(4px); }
  60%     { transform: translateX(-3px); }
  80%     { transform: translateX(3px); }
}
.cell.shake { animation: shake .35s ease; }

/* ── Word flash (correct) ─────────────────────────────────────────────── */
@keyframes flashGreen {
  0%   { background: var(--green); }
  100% { background: var(--surface-br); }
}
.cell.flash-correct { animation: flashGreen .6s ease forwards; }

/* ── Level Map ────────────────────────────────────────────────────────── */
.map-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 90;
  display: flex; flex-direction: column;
  animation: fadeIn .2s ease;
}
.map-overlay.hidden { display: none; }

.map-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(26,20,51,.85);
  backdrop-filter: blur(16px);
}
.map-title {
  font-size: 16px; font-weight: 800; color: var(--primary);
}

.map-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  align-content: start;
}

.map-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  min-height: 82px;
}
.map-card:active { transform: scale(.95); }
.map-card:hover  { background: var(--surface-hi); border-color: var(--primary); }

.map-card.map-current {
  border-color: var(--primary);
  background: var(--primary-dim);
  box-shadow: 0 0 12px rgba(97,244,216,.3);
}
.map-card.map-completed { border-color: rgba(97,244,216,.4); }

.map-num {
  font-size: 11px; font-weight: 800; color: var(--text-muted);
}
.map-card.map-current .map-num { color: var(--primary); }

.map-card-title {
  font-size: 9px; color: var(--text-muted);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  width: 100%;
}

.map-stars {
  display: flex; gap: 1px; justify-content: center;
  font-size: 12px;
}
.map-star        { color: var(--border); }
.map-star.earned { color: var(--gold); }

/* ── Info Modal ───────────────────────────────────────────────────────── */
.modal-card-info {
  max-width: 360px;
  max-height: 88dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.info-content { display: flex; flex-direction: column; gap: 14px; margin: 12px 0; text-align: left; }

.info-section h3 {
  font-size: 13px; font-weight: 700; color: var(--primary);
  margin-bottom: 5px;
}
.info-section p, .info-section li {
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
}
.info-section ul { padding-left: 14px; display: flex; flex-direction: column; gap: 3px; }

.info-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 10px;
}
.info-badge-green  { background: rgba(74,222,128,.15);  color: var(--green);  border: 1px solid rgba(74,222,128,.3); }
.info-badge-yellow { background: rgba(252,211,77,.12);  color: var(--gold);   border: 1px solid rgba(252,211,77,.3); }
.info-badge-gray   { background: var(--surface-hi);     color: var(--text-muted); border: 1px solid var(--border); }

/* ═══════════════════════════════════════════════════════════════════
   DESKTOP OVERRIDES  (min-width: 768px)
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {

  /* Header: wider padding, bigger fonts */
  header { padding: 12px 28px; }
  .header-left .puz-name { font-size: 15px; max-width: 260px; }
  .header-counter        { font-size: 12px; }
  .score-num             { font-size: 15px; }
  #puzzleSelect          { max-width: 200px; font-size: 12px; }

  /* Clue bar: flat full-width bar on desktop */
  #clueBar {
    margin: 0;
    border-radius: 0;
    background: var(--surface);
    border: none;
    border-bottom: 1px solid var(--border);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    padding: 10px 28px 12px;
  }

  /* Main: side-by-side, fills remaining height */
  main { flex-direction: row; overflow: hidden; height: 100%; min-height: 0; }

  /* Grid area: fixed width, fills height, grid centred vertically */
  #gridArea {
    flex: 0 0 auto;
    width: min(54vw, 620px);
    height: 100%;
    padding: 24px 28px;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Side panel (was "bottom-sheet") */
  .bottom-sheet {
    flex: 1;
    min-width: 260px;
    min-height: 0;
    height: auto;
    border-radius: 0;
    box-shadow: none;
    border-top: none;
    border-left: 1px solid var(--border);
  }
  .bottom-sheet::before { display: none; }

  /* Clue list: both columns visible side-by-side, each scrolls */
  .clue-list-area { overflow: hidden; min-height: 0; }

  .clue-col { display: block !important; }   /* override mobile hide */
  .clue-col-head {
    display: block;
    background: var(--surface-hi);
    padding: 8px 14px 6px;
  }

  /* Separator between the two clue columns */
  #acrossCol { border-right: 1px solid var(--border); }

  /* Action bar: horizontal row on desktop */
  .actions { padding: 10px 16px 14px; }
  .actions-row { flex-wrap: wrap; }

  .btn-primary { font-size: 14px; padding: 11px 20px; }
  .btn-hint    { font-size: 14px; padding: 11px 16px; }
}
