/* adFreeCell - styles. Card geometry (--cw / --ch) is set by game.js; the
   layout is fluid and works from phones to widescreen. */

:root {
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-size: 16px;
}

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

html, body {
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

/* ---------------- themes ---------------- */
#app {
  --text: #f2f6f4;
  --muted: #b9c7c0;
  --accent: #ffd166;
  --accent-2: #37c978;
  --danger: #ff6b6b;
  --red-suit: #d40000;         /* ink for the red suits (hearts/diamonds), via currentColor */
  --bar: rgba(0, 0, 0, 0.28);
  --panel: #1c2733;
  --panel-2: #26333f;
  --line: rgba(255, 255, 255, 0.16);
  --slot-bg: rgba(255, 255, 255, 0.07);
  --slot-line: rgba(255, 255, 255, 0.28);
  --felt-a: #157347; --felt-b: #0d5132; --felt-c: #0a3d26;

  position: relative;
  height: 100%;
  height: 100dvh;               /* modern browsers */
  height: var(--appvh, 100dvh); /* JS pins the real visible height here (iOS dvh is unreliable in landscape) */
  display: flex;
  flex-direction: column;
  color: var(--text);
  background:
    radial-gradient(120% 80% at 50% -10%, var(--felt-a) 0%, var(--felt-b) 45%, var(--felt-c) 100%);
  /* No safe-area padding at the BOTTOM here: it changes with iOS Safari's address
     bar (20px shown / 0 hidden) and would push the whole board up, exposing a felt
     strip under the control bar. The bottom safe-area lives on #controls instead,
     so the bar reaches the screen edge and only its text clears the home bar. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
#app[data-theme="midnight"] {
  --accent: #7cc7ff; --accent-2: #7cffd0;
  --felt-a: #24324f; --felt-b: #151e33; --felt-c: #0c1220;
}
#app[data-theme="slate"] {
  --accent: #ffd166; --accent-2: #8bd3a0;
  --felt-a: #4a5560; --felt-b: #333c46; --felt-c: #232a32;
}
#app[data-theme="coffee"] {
  --accent: #ffce9e; --accent-2: #e6b980;
  --felt-a: #6b4a34; --felt-b: #472f20; --felt-c: #2c1c12;
}
#app[data-theme="ocean"] {
  --accent: #8fe3ff; --accent-2: #63dcc0;
  --felt-a: #12667a; --felt-b: #0b4351; --felt-c: #072d37;
}
#app[data-theme="rose"] {
  --accent: #ffc0d2; --accent-2: #f0a3bb;
  --felt-a: #7a2f48; --felt-b: #531e30; --felt-c: #35131f;
}
/* visually hidden, still read by screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------------- top bar ---------------- */
#topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
#brand {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.brand-ad { color: var(--accent); }

#hud {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: clamp(10px, 4vw, 34px);
}
.hud-item { display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.hud-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.hud-value { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
/* per-deal difficulty badge (green = easy … purple = brutal) */
.diff-badge {
  align-self: center; padding: 2px 9px; border-radius: 999px;
  font-size: 0.66rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
  border: 1px solid currentColor;
}
.diff-badge[data-tier="1"] { color: #4ade80; background: rgba(74, 222, 128, .13); }
.diff-badge[data-tier="2"] { color: #a3e635; background: rgba(163, 230, 53, .13); }
.diff-badge[data-tier="3"] { color: #ffd166; background: rgba(255, 209, 102, .13); }
.diff-badge[data-tier="4"] { color: #fb923c; background: rgba(251, 146, 60, .14); }
.diff-badge[data-tier="5"] { color: #f87171; background: rgba(248, 113, 113, .16); }
.diff-badge[data-tier="6"] { color: #c084fc; background: rgba(192, 132, 252, .16); }
.diff-badge[data-tier="9"] { color: #9ca3af; background: rgba(156, 163, 175, .13); }
.deadend-tag {
  align-self: center; color: #ff6b6b; font-size: 0.78rem; font-weight: 800;
  padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.12); white-space: nowrap; animation: deadpulse 1.4s ease infinite;
}
@keyframes deadpulse { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.45; } }

.top-right { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.donate-btn svg { fill: #ff7a8a; }
.donate-btn:hover svg { fill: #ff5c70; }
/* sound toggle: show the speaker or the muted-speaker, never both */
.icon-btn .i-off { display: none; }
.icon-btn.muted .i-on { display: none; }
.icon-btn.muted .i-off { display: block; }
.icon-btn.muted { opacity: .68; }

/* right-to-left languages (Arabic): flow the chrome RTL, but keep the card
   board itself left-to-right (its layout is computed, order matters) */
[dir="rtl"] #play { direction: ltr; }
[dir="rtl"] .set-hint { text-align: inherit; }

/* ---------------- play area ---------------- */
#play {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  overflow: hidden;
  /* 'none', NOT 'manipulation': manipulation still allows panning, so Android
     (Chrome/WebView) claimed a card drag as a scroll gesture and fired
     pointercancel mid-drag — the card froze in mid-air. The board never scrolls,
     so giving the browser no gestures here is safe; it also kills iOS
     double-tap-to-zoom (which a body-level rule wouldn't). */
  touch-action: none;
}
#cards { position: absolute; inset: 0; touch-action: none; }
/* belt-and-suspenders: the tap can land on a card's inner <svg>/<path>, and iOS
   reads touch-action from the exact hit element — so cover every descendant too. */
#play * { touch-action: none; }

/* slots (free cells, foundations, empty-column markers) */
.slot {
  position: absolute;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * 0.07);
  background: var(--slot-bg);
  border: 1.5px solid var(--slot-line);
  display: grid; place-items: center;
  transition: box-shadow .12s ease, background .12s ease;
  touch-action: none;   /* board gestures belong to the game (see #play) */
}
.slot .pip {
  font-size: calc(var(--cw) * 0.42);
  opacity: 0.28;
  line-height: 1;
}
.slot.suit-red .pip { color: #ff5b6a; }
.slot.suit-black .pip { color: #e9edf1; }
.slot.drop-ok { box-shadow: 0 0 0 3px var(--accent-2), 0 0 18px rgba(55, 201, 120, 0.5); background: rgba(55, 201, 120, 0.14); }
/* live drop target on an occupied pile: the ring sits on the TOP CARD (the
   slot underneath is invisible then) */
.card.drop-ok { box-shadow: 0 0 0 3px var(--accent-2), 0 0 18px rgba(55, 201, 120, 0.55); }

/* every legal destination for the picked-up card (subtler than drop-ok) */
.card.legal-target { box-shadow: 0 0 0 2px rgba(90, 220, 150, 0.9), 0 2px 6px rgba(0, 0, 0, 0.4); }
.slot.legal-target { box-shadow: inset 0 0 0 2px rgba(90, 220, 150, 0.75); background: rgba(90, 220, 150, 0.12); }

/* keyboard cursor (arrow keys + Enter) */
.card.kb-cursor { box-shadow: 0 0 0 3px #4aa3ff, 0 0 16px rgba(74, 163, 255, 0.65); }
.slot.kb-cursor { box-shadow: inset 0 0 0 3px #4aa3ff, 0 0 16px rgba(74, 163, 255, 0.5); }

/* cards */
.card {
  position: absolute;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * 0.07);
  will-change: transform;
  transition: transform .19s cubic-bezier(.2, .7, .3, 1), box-shadow .12s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  background: #fdfdfd;
  /* the new deck has no baked-in border; add a hairline so fanned cards read */
  border: 1px solid rgba(0, 0, 0, 0.32);
  overflow: hidden;
  touch-action: none;   /* no browser gestures on a card (drag + no dbl-tap zoom) */
}
.card svg { display: block; width: 100%; height: 100%; }
.card.red-suit { color: var(--red-suit); }   /* drives the red ink via currentColor */
.card.dragging { transition: none; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5); cursor: grabbing; }
.card.selected { box-shadow: 0 0 0 3px var(--accent), 0 6px 16px rgba(0, 0, 0, 0.5); }
/* hint: source card pulses amber, destination gets a green ring (matches arrow) */
.card.hintful { animation: hintpulse 0.7s ease 3; z-index: 900 !important; }
@keyframes hintpulse {
  0%, 100% { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 0 0 4px var(--accent), 0 0 20px rgba(255, 209, 102, 0.8); }
}
.card.hint-target, .slot.hint-target {
  box-shadow: 0 0 0 4px var(--accent-2), 0 0 22px rgba(55, 201, 120, 0.7);
}
.slot.hint-target { background: rgba(55, 201, 120, 0.14); }
.card.no-anim { transition: none; }
.card.hint-fly { transition: transform 0.55s cubic-bezier(.35, .85, .35, 1); } /* slow hint glide */
.card.win-fly { transition: none !important; will-change: transform; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45); }

/* animation setting: full forces motion on; reduced turns card motion off */
#app[data-motion="full"] .card { transition: transform .19s cubic-bezier(.2, .7, .3, 1), box-shadow .12s ease !important; }
#app[data-motion="full"] .card.hint-fly { transition: transform 0.55s cubic-bezier(.35, .85, .35, 1) !important; }
#app[data-motion="full"] .card.win-fly { transition: none !important; }
#app[data-motion="reduced"] .card, #app[data-motion="reduced"] .card.hint-fly { transition: none !important; }

/* ---------------- bottom controls ---------------- */
#controls {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  /* Keep the buttons close to the bottom edge. iOS reports safe-area-inset-bottom
     as ~20px only while the Safari address bar is shown, which made the buttons
     jump up and look detached from the edge; a small fixed padding is steadier. */
  padding-bottom: 8px;
  background: var(--bar);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.ctl {
  flex: 1 1 0;
  min-width: 0;                 /* allow shrinking so labels never overflow */
  padding: 10px 6px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: clamp(0.72rem, 1.9vw, 0.9rem);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;      /* worst case: ellipsis, not overlap */
  transition: background .12s ease, transform .12s ease, opacity .12s;
}
.ctl:hover { background: rgba(255, 255, 255, 0.16); }
.ctl:active { transform: scale(.96); }
.ctl:disabled { opacity: 0.38; cursor: default; }
.ctl-accent { background: var(--accent-2); color: #06281a; border-color: transparent; }
.ctl-accent:hover { background: var(--accent-2); filter: brightness(1.08); }

/* ---------------- overlays & panels ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 8, 0.62);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}
.overlay.show { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.card-panel {
  width: min(440px, 100%);
  max-height: calc(100% - 20px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
  text-align: center;
}
.card-panel h2 { font-size: 1.3rem; margin-bottom: 14px; }
.row { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent-2); color: #06281a; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: rgba(255, 255, 255, 0.06); }
.danger { color: var(--danger); }
.hidden { display: none !important; }

.win-emoji { font-size: 3rem; }
.win-msg { color: var(--muted); margin-top: 6px; }

.select-row { display: flex; gap: 10px; margin-top: 6px; }
#select-number {
  flex: 1;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 1rem;
}

.howto-list { text-align: left; margin: 6px 4px; line-height: 1.5; }
.howto-list li { margin: 9px 0 9px 18px; color: var(--text); }

.set-list { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.set-label { display: flex; flex-direction: column; font-weight: 600; }
.set-hint { font-weight: 400; font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.set-actions { justify-content: center; flex-wrap: wrap; border-bottom: none; }
.select {
  padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel); color: var(--text);
  font-size: 0.9rem;
}
.seg {
  display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.seg button {
  border: none; background: transparent; color: var(--muted);
  padding: 8px 14px; font-weight: 700; cursor: pointer; font-size: 0.85rem;
}
.seg button.active { background: var(--accent-2); color: #06281a; }
.seg-wrap { flex-wrap: wrap; }
.seg-wrap button { flex: 1 0 auto; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.stat-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.stat-num { font-size: 1.5rem; font-weight: 800; }
.stat-cap { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }

.stats-tiers { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; text-align: left; }
.stats-tier-row { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.stats-tier-name { width: 92px; font-weight: 700; font-size: 0.8rem; }
.stats-tier-bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.stats-tier-fill { height: 100%; border-radius: 4px; }
.stats-tier-num { min-width: 92px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.license-note { font-size: 0.72rem; color: var(--muted); margin: 14px 0 4px; }
.made-with { margin-top: 2px; opacity: 0.75; }   /* deliberately subtle */
/* rating ask inside the tip overlay (Android app only): set apart from the tip row */
.tip-rate { margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.tip-rate .license-note { margin: 0 0 8px; }
.muted-line { font-size: 0.85rem; color: var(--muted); margin: 2px 0 10px; }
.select-status { font-size: 0.9rem; font-weight: 600; margin: 10px 0; min-height: 1.2em; }
.select-status.is-solved { color: var(--accent-2); }
.select-status.is-unsolvable { color: var(--danger); }
.diff-choices { margin: 4px 0 10px; }
.diff-label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.diff-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.diff-btn {
  border: 1.5px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--text);
  border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 0.85rem; cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.diff-btn:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.diff-btn[data-tier="1"] { border-color: #4ade80; }
.diff-btn[data-tier="2"] { border-color: #a3e635; }
.diff-btn[data-tier="3"] { border-color: #ffd166; }
.diff-btn[data-tier="4"] { border-color: #fb923c; }
.diff-btn[data-tier="5"] { border-color: #f87171; }
.diff-btn[data-tier="6"] { border-color: #c084fc; }

/* deal browser */
.browse-panel { width: min(700px, 100%); }
.browse-filters { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.filt {
  border: 1.5px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 0.8rem; font-weight: 700; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.filt.small { padding: 4px 10px; font-size: 0.72rem; }
.filt:hover { background: rgba(255, 255, 255, 0.12); }
.filt.active { background: var(--accent-2); color: #06281a; border-color: transparent; }
.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(44px, 12vw, 58px), 1fr));
  gap: 6px; max-height: 44vh; overflow-y: auto; padding: 4px; margin-top: 4px;
}
.deal-cell {
  position: relative; aspect-ratio: 1.35;
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums;
  cursor: pointer; color: var(--text);
  background: rgba(225, 60, 70, 0.16);   /* unsolved -> red */
}
.deal-cell:hover { background: rgba(225, 60, 70, 0.30); }
.deal-cell.solved { background: rgba(55, 201, 120, 0.22); }        /* solved -> green */
.deal-cell.solved:hover { background: rgba(55, 201, 120, 0.34); }
.deal-cell.solved::after { content: '✓'; position: absolute; top: 0; right: 3px; font-size: 0.62rem; color: var(--accent-2); }
.deal-cell.current { outline: 2px solid var(--accent); outline-offset: -1px; }
/* left stripe still encodes difficulty (6 tiers) */
.deal-cell.tier-1 { border-left-color: #4ade80; }
.deal-cell.tier-2 { border-left-color: #a3e635; }
.deal-cell.tier-3 { border-left-color: #ffd166; }
.deal-cell.tier-4 { border-left-color: #fb923c; }
.deal-cell.tier-5 { border-left-color: #f87171; }
.deal-cell.tier-6 { border-left-color: #c084fc; }
.deal-cell.tier-0 { border-left-color: var(--line); }
.deal-cell.tier-9 { border-left-color: var(--danger); background: rgba(255, 255, 255, 0.05); } /* #11982: unsolvable, neutral */
.deal-cell.tier-9:hover { background: rgba(255, 255, 255, 0.12); }
.browse-pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 12px 0 8px; }
.browse-page { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 120px; text-align: center; }

/* toast */
.toast {
  position: fixed;
  left: 50%; bottom: 84px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 55; }

/* ---------------- rotate-to-landscape notice ---------------- */
/* adFreeCell is a landscape game. On a touch device held in portrait we cover
   the board with a friendly "please rotate" hint instead of cramming 8 columns
   into a narrow width. Desktop (fine pointer) is never affected. */
#rotate-notice {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: linear-gradient(180deg, var(--felt-a), var(--felt-c));
  color: var(--text);
}
.rotate-inner { max-width: 320px; }
.rotate-inner h2 { font-size: 1.35rem; margin: 18px 0 8px; }
.rotate-inner p { color: var(--muted); line-height: 1.5; }
.rotate-ico {
  width: 84px; height: 84px;
  fill: var(--accent);
  transform-origin: 50% 50%;
  animation: rotatehint 2.6s ease-in-out infinite;
}
@keyframes rotatehint {
  0%, 38% { transform: rotate(0deg); }
  58%, 92% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

@media (orientation: portrait) and (pointer: coarse) {
  #rotate-notice { display: flex; }
}

/* Landscape phones: tighten the bars so the board gets the room */
@media (max-height: 520px) {
  #topbar { padding: 3px 10px; }
  #brand { font-size: 1.05rem; }
  .hud-label { font-size: 0.52rem; }
  .hud-value { font-size: 0.85rem; }
  .top-right { gap: 5px; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn svg { width: 17px; height: 17px; }
  #controls { padding: 4px 8px; padding-bottom: 6px; }
  .ctl { padding: 6px 5px; font-size: 0.72rem; }
}
@media (max-height: 400px) {
  #topbar { padding: 2px 8px; }
  #brand { font-size: 0.95rem; }
  .icon-btn { width: 29px; height: 29px; }
  .icon-btn svg { width: 15px; height: 15px; }
  #controls { padding: 3px 6px; padding-bottom: 6px; }
  .ctl { padding: 5px 4px; font-size: 0.68rem; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
