/* ============ wordl.buzz — minimal-modern, amber accent ============ */
:root {
  /* Honey & meadow: cream honeycomb paper, honey-gold accent, leaf green.
   * Light-only on purpose (no dark mode). */
  --bg: #fff7e0;
  --comb: #f6e7bd;
  --surface: #ffffff;
  --surface-2: #fff0c7;
  --border: #e5d3a8;
  --border-soft: #efe2c2;
  --text: #2a1f14;
  --muted: #5f4e3b;
  --faint: #7a6650;
  --accent: #f5b400;       /* honey */
  --accent-soft: #ffd54f;
  --accent-ink: #2a1a00;
  --accent-text: #8a5600;  /* honey dark enough for text on cream */
  --correct: #26834a;      /* leaf green */
  --present: #f5b400;
  --absent: #7d7264;
  --key: #efe3c8;
  --key-hover: #e6d6b2;
  --key-absent: #7d7264;
  --danger: #c93434;
  --shadow: 0 2px 0 #e5d3a8;
  --radius: 12px;
  --radius-lg: 18px;
  --tile-size: clamp(46px, 11vw, 60px);
  --maxw: 720px;
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
}

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

/* The `hidden` attribute must always win, even over display rules like
 * `.ghost-btn { display: inline-flex }` (same specificity would otherwise let
 * the class override it, keeping "hidden" elements like the install button visible). */
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0l28 16v32L28 64 0 48V16zM28 64v33M0 16L-28 0M56 16l28-16' fill='none' stroke='%23f6e7bd' stroke-width='2'/%3E%3C/svg%3E");
  background-size: 56px 97px;
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: -0.011em;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Glow removed: subtle radial gradients band visibly on the near-black
 * background (8-bit color stepping shows as a faint horizontal line). */
#bg-glow { display: none; }

::selection { background: rgba(245, 180, 0, 0.35); }

/* ============ Screens ============ */
/* --app-gap (set by device.js) lifts the bottom edge to what is actually visible:
 * iOS home-screen apps lay out `inset: 0` taller than the screen. */
.screen { position: fixed; inset: 0; bottom: var(--app-gap, 0px); display: none; z-index: 1; }
.screen.active { display: flex; flex-direction: column; }

/* ============ Start screen ============ */
#screen-start { align-items: center; justify-content: flex-start; padding: 28px 24px; padding-top: max(28px, env(safe-area-inset-top)); padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px)); overflow-y: auto; }
.start-inner { max-width: var(--maxw); width: 100%; text-align: center; margin-block: auto; }  /* auto margins centre without clipping the top when it overflows */

.logo { display: inline-flex; align-items: baseline; margin-bottom: 18px; }
.logo h1 {
  font-size: clamp(2.6rem, 9vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.logo h1 em { font-style: normal; color: var(--accent-text); }

.tagline {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 400;
  max-width: 30ch;
  margin: 0 auto 44px;
  line-height: 1.5;
}

.mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.mode-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 28px 16px 22px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.mode-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-3px);
}
.mode-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mode-card.featured { border-color: var(--border); }

.mode-badge {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
}
.mode-len {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}
.mode-card:hover .mode-len { color: var(--accent-text); }
.mode-name { font-size: 1.05rem; font-weight: 600; }
.mode-desc { font-size: 0.8rem; color: var(--faint); font-weight: 400; }

.start-footer { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============ Buttons ============ */
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); background: var(--surface); }
.ghost-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ghost-btn svg { width: 17px; height: 17px; }

.primary-btn {
  display: block;
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 14px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.1s ease;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 20px; height: 20px; }

.hint-btn { width: auto; padding: 0 14px; color: var(--accent-text); }
.hint-btn .hint-cost { font-size: 0.8rem; font-weight: 800; white-space: nowrap; }
.hint-btn:disabled { opacity: 0.32; cursor: not-allowed; }
.hint-btn:disabled:hover { color: var(--accent-text); border-color: var(--border-soft); }

/* ============ HUD ============ */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  padding-top: max(16px, env(safe-area-inset-top));
  gap: 10px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}
.hud-stats {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 7px 8px;
}
.hud-item { display: flex; flex-direction: column; align-items: center; min-width: 62px; padding: 0 6px; }
.hud-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.hud-value { font-size: 1.1rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
.hud-value.hearts { display: flex; gap: 3px; align-items: center; }
.hearts svg { width: 15px; height: 15px; }
.heart-full { color: var(--danger); fill: var(--danger); }
.heart-empty { color: var(--absent); fill: none; }

@keyframes scorePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); color: var(--accent-text); }
  100% { transform: scale(1); }
}
.hud-value.pop { animation: scorePop 0.5s ease; }

/* ============ Board ============ */
.board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}
#board { display: grid; gap: 8px; }
.board-row { display: grid; grid-auto-flow: column; gap: 8px; }

.tile {
  width: var(--tile-size);
  height: var(--tile-size);
  display: grid;
  place-items: center;
  font-size: calc(var(--tile-size) * 0.44);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  border-radius: 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.3s ease, color 0.3s ease;
}
.tile.filled { border-color: var(--faint); transform: scale(1.03); }
.tile.hinted { border-color: var(--accent-text); color: var(--accent-text); border-style: dashed; }

.tile.reveal { animation: flipIn 0.5s ease both; }
@keyframes flipIn {
  0% { transform: rotateX(0); }
  45% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

.tile.correct {
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
}
.tile.present {
  background: var(--present);
  border-color: var(--present);
  color: var(--accent-ink);
}
.tile.absent {
  background: var(--absent);
  border-color: var(--absent);
  color: #fff;
}

.board-row.shake { animation: shake 0.45s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.board-row.win .tile { animation: bounce 0.55s ease both; }
.board-row.win .tile:nth-child(2) { animation-delay: 0.06s; }
.board-row.win .tile:nth-child(3) { animation-delay: 0.12s; }
.board-row.win .tile:nth-child(4) { animation-delay: 0.18s; }
.board-row.win .tile:nth-child(5) { animation-delay: 0.24s; }
.board-row.win .tile:nth-child(6) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-14px); }
}

/* ============ Toast ============ */
#toast {
  position: fixed;
  left: 50%;
  top: 16%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  padding: 11px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(90, 60, 10, 0.18);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Keyboard ============ */
.kb-wrap { padding: 8px 6px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
#keyboard {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.kb-row { display: flex; gap: 6px; justify-content: center; }

.key {
  flex: 1;
  max-width: 46px;
  height: 54px;
  border: none;
  border-radius: 9px;
  background: var(--key);
  color: var(--text);
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
  display: grid;
  place-items: center;
}
.key:hover { background: var(--key-hover); }
.key:active { transform: translateY(1px); }
.key.wide { max-width: 72px; flex: 1.6; font-size: 0.7rem; letter-spacing: 0.04em; }
.key svg { width: 22px; height: 22px; }

.key.correct { background: var(--correct); color: #fff; }
.key.present { background: var(--present); color: var(--accent-ink); }
.key.absent { background: var(--key-absent); color: #fff; box-shadow: none; }

/* ============ Overlays ============ */
.overlay {
  position: fixed;
  inset: 0;
  bottom: var(--app-gap, 0px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(70, 50, 20, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 20px;
  overflow-y: auto;
}
.overlay[hidden] { display: none; }
/* Centre the card but let tall cards scroll instead of losing their top on short phones. */
.overlay > .overlay-card { margin-block: auto; }

.overlay-card {
  width: 100%;
  max-width: 384px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: cardIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.overlay-card.wide { max-width: 460px; text-align: left; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.overlay-card h2 { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.03em; }

.result-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(38, 131, 74, 0.13);
  color: var(--correct);
}
.result-icon.fail { background: rgba(201, 52, 52, 0.12); color: var(--danger); }
.result-icon svg { width: 32px; height: 32px; }

.result-word { color: var(--muted); font-size: 0.98rem; }
.result-word strong { color: var(--text); text-transform: uppercase; letter-spacing: 0.05em; }

.result-points {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-text);
  min-height: 1.4em;
}

.final-stats { display: flex; gap: 10px; }
.final-stats div {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.final-stats span { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; }
.final-stats label { font-size: 0.64rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }

.how-list { list-style: none; display: flex; flex-direction: column; gap: 15px; color: var(--muted); font-size: 0.94rem; line-height: 1.45; }
.how-list strong { color: var(--text); font-weight: 600; }
.how-tiles { display: flex; gap: 5px; margin-bottom: 7px; }
.demo-tile {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  font-weight: 700;
  color: var(--text);
}
.demo-tile.correct { background: var(--correct); border-color: var(--correct); color: #fff; }
.demo-tile.present { background: var(--present); border-color: var(--present); color: var(--accent-ink); }

/* ============ Continue run / round options ============ */
.continue-wrap { display: flex; flex-direction: column; gap: 12px; margin-bottom: 26px; }
.continue-wrap[hidden] { display: none; }
.continue-or {
  font-size: 0.8rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  text-align: center;
  margin: 4px 0;
}

.hud-left { display: flex; gap: 8px; }

.options-menu { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.options-menu .primary-btn,
.options-menu .ghost-btn { width: 100%; justify-content: center; }
.options-menu .ghost-btn { margin-top: 10px; }
.option-note { font-size: 0.78rem; color: var(--faint); margin: 2px 2px 6px; }

.install-steps {
  text-align: left;
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}
.install-steps strong { color: var(--text); font-weight: 600; }

.ghost-btn.danger { color: var(--danger); border-color: rgba(201, 52, 52, 0.4); }
.ghost-btn.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(201, 52, 52, 0.07);
}

/* ============ Cookie consent banner ============ */
.consent-banner {
  position: fixed;
  left: 50%;
  bottom: calc(var(--app-gap, 0px) + max(16px, env(safe-area-inset-bottom)));
  transform: translateX(-50%);
  z-index: 200;
  width: min(640px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 40px rgba(90, 60, 10, 0.2);
  animation: consentIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes consentIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateX(-50%); }
}
.consent-banner[hidden] { display: none; }
.consent-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
}
.consent-text {
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}
.consent-text a { color: var(--accent-text); text-decoration: none; font-weight: 600; }
.consent-text a:hover { text-decoration: underline; }
.consent-actions { display: flex; gap: 10px; flex-shrink: 0; }
.consent-actions .ghost-btn { padding: 10px 16px; }
.primary-btn.consent-accept { display: inline-block; width: auto; padding: 10px 22px; }

/* ============ Legal pages (privacy) ============ */
.legal-line { margin-top: 26px; }
.legal-line a {
  color: var(--faint);
  font-size: 0.78rem;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.legal-line a:hover { color: var(--muted); text-decoration: underline; }
.app-version {
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  margin-left: 8px;
}

/* ============ New-icon tip (old iOS home-screen installs, see device.js) ============ */
.icon-tip {
  position: fixed;
  left: 50%;
  bottom: calc(var(--app-gap, 0px) + max(16px, env(safe-area-inset-bottom)));
  transform: translateX(-50%);
  z-index: 290;
  width: min(420px, calc(100vw - 24px));
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(60, 40, 20, 0.18);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  user-select: text;
  -webkit-user-select: text;
}
.icon-tip img { flex: none; border-radius: 12px; }
.icon-tip-body { display: flex; flex-direction: column; gap: 6px; }
.icon-tip-title { color: var(--text); font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.icon-tip b { color: var(--text); }
.icon-tip-note { font-size: 0.82rem; color: var(--faint); }
.icon-tip .primary-btn { align-self: flex-start; width: auto; padding: 9px 22px; margin-top: 4px; }

/* ============ Update / refresh toast ============ */
.update-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--app-gap, 0px) + max(16px, env(safe-area-inset-bottom)));
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(420px, calc(100vw - 28px));
  padding: 14px 14px 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(90, 60, 10, 0.2);
  color: var(--text);
  animation: consentIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.update-toast span {
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}
.update-toast button {
  flex-shrink: 0;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: 11px;
  cursor: pointer;
}
.update-toast button:disabled { opacity: 0.6; cursor: default; }

#btn-install-dismiss { margin-top: 10px; width: 100%; justify-content: center; font-size: 0.85rem; }

.legal-page {
  position: static;
  min-height: 100%;
  overflow-y: auto;
  display: block;
  user-select: text;
  -webkit-user-select: text;
}
.legal-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px max(40px, env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}
.legal-wrap h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 800; letter-spacing: -0.03em; }
.legal-wrap h2 { font-size: 1.15rem; font-weight: 700; margin-top: 30px; letter-spacing: -0.02em; }
.legal-wrap p, .legal-wrap li { color: var(--muted); font-size: 0.96rem; line-height: 1.6; }
.legal-wrap p { margin-top: 12px; }
.legal-wrap ul { margin: 12px 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.legal-wrap a { color: var(--accent-text); text-decoration: none; }
.legal-wrap a:hover { text-decoration: underline; }
.legal-wrap strong { color: var(--text); font-weight: 600; }
.legal-updated { color: var(--faint); font-size: 0.82rem; margin-top: 8px; }
.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.legal-back:hover { color: var(--text); }
.legal-back svg { width: 17px; height: 17px; }

/* ============ Responsive ============ */
@media (max-width: 560px) {
  .consent-inner { flex-direction: column; align-items: stretch; gap: 12px; }
  .consent-actions { justify-content: flex-end; }
  .mode-cards { grid-template-columns: 1fr; gap: 11px; }
  .mode-card { flex-direction: row; justify-content: flex-start; padding: 16px 20px; gap: 16px; }
  .mode-len { font-size: 1.9rem; min-width: 38px; }
  .mode-card .mode-desc { margin-left: auto; text-align: right; }
  .mode-badge { left: auto; right: 16px; transform: none; }
  .hud-item { min-width: 52px; }
  :root { --tile-size: clamp(40px, 12.5vw, 56px); }
}

/* Narrow phones (360px Androids): keep the HUD on screen. */
@media (max-width: 380px) {
  .hud { padding-left: 12px; padding-right: 12px; gap: 6px; }
  .hud-item { min-width: 44px; padding: 0 3px; }
  .hint-btn { padding: 0 11px; }
  .hint-free { display: none; }
  .hud-left { gap: 6px; }
  .hud-stats { padding: 6px 4px; }
}

/* Short phones: tighter HUD and keyboard leave the board room to breathe. */
@media (max-height: 720px) {
  .hud { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 6px; }
  .key { height: 48px; }
  #keyboard { gap: 6px; }
}
@media (max-height: 600px) {
  .key { height: 42px; }
  .kb-wrap { padding-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============ First-run coachmarks ============ */
.coach-backdrop {
  position: fixed;
  inset: 0;
  bottom: var(--app-gap, 0px);
  z-index: 110;
  background: rgba(70, 50, 20, 0.45);
  animation: coachFade 0.25s ease both;
}
@keyframes coachFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.coach-highlight {
  position: fixed;
  z-index: 111;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 28px rgba(90, 60, 10, 0.25);
  pointer-events: none;
  transition: top 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
    width 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.coach-tip {
  position: fixed;
  z-index: 112;
  width: min(330px, calc(100vw - 28px));
  padding: 16px 16px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 40px rgba(90, 60, 10, 0.2);
  animation: coachFade 0.25s ease both;
  transition: top 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.coach-tip p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}
.coach-tip p strong { color: var(--accent-text); }
.coach-tip-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
}
.coach-step {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.coach-actions { display: flex; align-items: center; gap: 6px; }
.coach-skip {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 10px;
  cursor: pointer;
}
.coach-skip:hover { color: var(--text); }
.coach-next {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 9px 18px;
  cursor: pointer;
}
.coach-next:hover { filter: brightness(1.08); }

/* ============ Word list + guide pages ============ */
.crumbs { font-size: 0.82rem; color: var(--faint); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 6px; }
.words-page .lead { font-size: 1.02rem; }
.letter-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.letter-nav a {
  min-width: 36px; height: 36px; display: inline-grid; place-items: center;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
  color: var(--text) !important; font-weight: 700; font-size: 0.9rem;
}
.letter-nav a:hover { border-color: var(--accent); text-decoration: none !important; }
.letter-nav a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) !important; }
.letter-nav.big a { min-width: 44px; height: 44px; font-size: 1rem; }
.word-grid {
  list-style: none; margin: 14px 0 0 !important; display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 6px !important;
}
.word-grid li {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px;
  padding: 7px 4px; text-align: center; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text) !important; font-size: 0.9rem !important; line-height: 1.2 !important;
}
.words-cta { display: inline-flex; margin-top: 28px; text-decoration: none !important; color: var(--accent-ink) !important; width: auto; }
.words-cta-note { color: var(--faint) !important; font-size: 0.85rem !important; margin-top: 8px !important; }
.words-foot { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--border-soft); color: var(--faint); font-size: 0.85rem; line-height: 1.9; }
.words-foot a { color: var(--muted) !important; }
.faq h3 { font-size: 1rem; font-weight: 700; margin-top: 20px; color: var(--text); }
.faq p { margin-top: 6px; }
.legal-line .sep { color: var(--faint); font-size: 0.78rem; margin: 0 6px; }

/* ============ 1.2 refresh: honey theme, daily word ============ */
.logo h1, .mode-len, .mode-name, .tile, .hud-value, .overlay-card h2, .final-stats span,
.legal-wrap h1, .legal-wrap h2, .primary-btn, .result-points, .daily-title, .demo-tile,
.word-grid li, .letter-nav a, .coach-next {
  font-family: var(--display);
  letter-spacing: 0;
}
.logo h1 { font-weight: 700; }
.logo h1 em { position: relative; }
.tile { font-weight: 600; border-radius: 12px; }
.tile:not(.correct):not(.present):not(.absent) { background: var(--surface); }
.primary-btn { font-weight: 600; box-shadow: 0 3px 0 #c98f00; }
.primary-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #c98f00; }
.mode-card, .icon-btn, .hud-stats, .overlay-card, .final-stats div { box-shadow: var(--shadow); }
.mode-card:hover { border-color: var(--accent); background: var(--surface-2); }
.mode-card.featured { border-color: var(--accent); }
.key { box-shadow: 0 2px 0 #d9c9a3; }
.key.correct, .key.present { box-shadow: none; }
.tagline { margin-bottom: 26px; }
.legal-line a, .app-version, .legal-line .sep { color: var(--faint); }

.daily-card {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "kicker go" "title go" "sub go";
  align-items: center;
  text-align: left;
  gap: 2px 14px;
  padding: 18px 20px;
  margin-bottom: 26px;
  border: 2px solid #e0a100;
  border-radius: 20px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 0 #c98f00;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.daily-card:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #c98f00; }
.daily-card:active { transform: translateY(2px); box-shadow: 0 1px 0 #c98f00; }
.daily-card:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.daily-kicker { grid-area: kicker; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.daily-title { grid-area: title; font-size: 1.45rem; font-weight: 600; line-height: 1.2; }
.daily-sub { grid-area: sub; font-size: 0.88rem; font-weight: 600; opacity: 0.85; }
.daily-go {
  grid-area: go;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--text);
  color: var(--accent);
}
.daily-go svg { width: 22px; height: 22px; }
.daily-card.done { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.daily-card.done .daily-go { background: var(--correct); color: #fff; }

.section-label {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  margin: 0 2px 10px;
}

.daily-grid { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.daily-grid div { display: flex; gap: 4px; }
.daily-grid span { width: 22px; height: 22px; border-radius: 5px; background: var(--absent); }
.daily-grid span.correct { background: var(--correct); }
.daily-grid span.present { background: var(--present); }
.daily-next { color: var(--muted); font-size: 0.92rem; }
.daily-next strong { font-family: var(--display); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.ghost-btn.block { width: 100%; justify-content: center; }
#overlay-daily .final-stats label { font-size: 0.58rem; }

/* Daily mode: no lives or score. Hints are a clue plus one letter. */
.is-daily .hud-item:nth-child(3) { display: none; }

/* Meaning clue shown by the first hint. */
.clue-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 16px 0;
  padding: 9px 14px;
  border-radius: 14px;
  background: #fff1c2;
  border: 1.5px solid var(--accent-soft);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.35;
  max-width: 520px;
  align-self: center;
  width: calc(100% - 32px);
  box-sizing: border-box;
  animation: clue-in 0.25s ease-out;
}
.clue-bar[hidden] { display: none; }
.clue-bar svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--accent-text); }
.clue-bar b { color: var(--accent-text); font-weight: 700; margin-right: 2px; }
@keyframes clue-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .clue-bar { animation: none; } }

@media (max-width: 400px) {
  .hud { padding-left: 12px; padding-right: 12px; gap: 6px; }
  .hud-left { gap: 6px; }
  .hud-item { min-width: 44px; padding: 0 4px; }
  .hint-btn { padding: 0 10px; }
  .daily-title { font-size: 1.25rem; }
}

/* ============ Word solver ============ */
.sv-card {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  user-select: none;
  -webkit-user-select: none;
}
.sv-lens { display: flex; gap: 6px; }
.sv-len {
  flex: 1;
  padding: 9px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.sv-len[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.sv-entry { margin-top: 16px; }
.sv-label { display: block; font-weight: 700; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.sv-input-row { display: flex; gap: 8px; }
.sv-input-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  user-select: text;
  -webkit-user-select: text;
}
.sv-input-row input:focus { outline: none; border-color: var(--accent-text); }
.sv-input-row input::placeholder { text-transform: none; letter-spacing: 0; color: var(--faint); font-size: 1rem; }
.sv-input-row .primary-btn { width: auto; padding: 10px 22px; }
.sv-input-row .primary-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.legal-wrap .sv-msg { min-height: 1.4em; margin-top: 6px; font-size: 0.86rem; color: var(--accent-text); }
.sv-rows { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.sv-row { display: flex; gap: 6px; align-items: center; }
.sv-tile { --tile-size: clamp(40px, 12vw, 52px); cursor: pointer; font-family: var(--display); padding: 0; }
.sv-tile:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.sv-del {
  width: 32px; height: 32px; margin-left: 4px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.legal-wrap .sv-hint { font-size: 0.88rem; color: var(--muted); }
.sv-key { display: inline-block; padding: 0 7px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 0.82rem; }
.sv-key.absent { background: var(--absent); }
.sv-key.present { background: var(--present); color: var(--accent-ink); }
.sv-key.correct { background: var(--correct); }
.legal-wrap .sv-best {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 12px;
  color: var(--text);
}
.sv-results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.legal-wrap .sv-results-head h2 { margin-top: 0; font-size: 1.05rem; }
.sv-results-head .ghost-btn { padding: 6px 14px; font-size: 0.85rem; }
.sv-others { margin-top: 14px; }
.sv-others summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: 0.92rem; }
.overlay-card > .ghost-btn { justify-content: center; }

/* ============ Cross-links: next daily puzzle, archive ============ */
.next-puzzle {
  display: grid;
  gap: 1px;
  text-align: left;
  padding: 12px 16px;
  border-radius: 14px;
  background: #fff0f3;
  border: 1px solid #f2c9d5;
  border-left: 6px solid #c8205e;
  text-decoration: none;
  color: var(--text);
}
.next-puzzle:hover { border-color: #c8205e; }
.np-kicker { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #a01a4c; }
.np-name { font-family: var(--display); font-size: 1.15rem; font-weight: 600; }
.np-pitch { font-size: 0.85rem; color: var(--muted); }
.past-link { font-size: 0.88rem; font-weight: 700; color: var(--accent-text); }
.archive-list { list-style: none; margin-left: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 16px !important; }
.archive-list a {
  display: grid; padding: 10px 12px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); text-decoration: none !important; color: var(--text) !important; box-shadow: var(--shadow);
}
.archive-list a b { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.archive-list a span { font-size: 0.82rem; color: var(--muted); }
.archive-list a.done { border-color: var(--correct); }
.archive-list a.done b::after { content: " \2713"; color: var(--correct); }

/* ============ Share sheet ============ */
.share-sheet { gap: 14px; padding: 24px 22px 18px; max-width: 400px; }
.share-title { font-size: 1.25rem; }
.share-frame {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: var(--comb, #f6e7bd);
  box-shadow: 0 6px 18px rgba(60, 40, 10, 0.16);
}
.share-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.share-frame img:not([src]) { visibility: hidden; }
.share-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.share-chip svg { width: 22px; height: 22px; }
.share-chip:hover { border-color: var(--accent); }
.share-chip:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.share-wa svg { color: #128c4b; }
.share-done {
  background: none;
  border: none;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  padding: 8px;
  cursor: pointer;
}
@media (max-height: 640px) { .share-frame { width: 78%; margin: 0 auto; } }
.share-sheet .primary-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.share-sheet .primary-btn svg { width: 20px; height: 20px; flex: none; }
