:root {
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #e8e8e8;
  --accent: #ee6c4d;
  --found: #62b6cb;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100dvh;
}

body.dock-visible {
  padding-bottom: calc(88px + var(--safe-bottom));
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  background: #111;
  color: #fff;
  padding: 8px 12px;
  z-index: 20;
}

.skip-link:focus { top: 12px; }

.topbar, .stage, .about, .faq, .site-footer {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 24px;
  align-items: start;
  padding: 16px 0 8px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

h1, h2 {
  margin: 2px 0 0;
  font-weight: 650;
  letter-spacing: -0.03em;
}

h1 { font-size: 22px; }

.puzzle-meta {
  text-align: right;
}

.puzzle-panel {
  background: #fff;
  padding: 0 0 24px;
}

.date-line {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.stop-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#today-title {
  margin-top: 2px;
  font-size: clamp(20px, 4.5vw, 28px);
}

.status-line {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hud {
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: center;
  margin: 4px 0 8px;
}

.timer, .remaining {
  margin: 0;
  min-width: 92px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
}

.selection-hud {
  margin: 0 0 8px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  min-height: 22px;
}

.selection-hud.active { color: var(--accent); }

.toast {
  margin: 0 0 12px;
  text-align: center;
  font-weight: 700;
  min-height: 22px;
}

.toast.ok { color: #2f7f8e; }
.toast.err { color: var(--accent); }

.grid-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.grid-wrap:active { cursor: grabbing; }

.grid-trails {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0;
  width: min(100%, 440px);
  cursor: grab;
  touch-action: none;
}

.grid:active { cursor: grabbing; }

.cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  font-weight: 650;
  font-size: clamp(15px, 3.8vw, 20px);
  color: var(--ink);
}

.cell.selected {
  transform: scale(1.08);
}

.hint-line {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.nudge-btn {
  display: block;
  margin: 12px auto 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.word-chip.nudge {
  border-color: var(--accent);
  color: var(--accent);
}

.word-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0 0;
  margin: 0;
}

.word-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.word-chip.done {
  color: var(--muted);
  text-decoration: line-through;
}

.sponsor {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.sponsor img {
  height: 28px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

.store-float {
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 8;
  display: flex;
  gap: 10px;
  align-items: center;
}

.store-btn {
  display: block;
  line-height: 0;
  text-decoration: none;
}

.store-btn img {
  display: block;
  height: 40px;
  width: auto;
}

.about, .faq { padding: 8px 0 4px; }
.about p, .faq p, .site-footer { color: var(--muted); line-height: 1.55; font-size: 14px; }
.about h2, .faq h2 { font-size: 16px; margin-bottom: 8px; }
.faq details { margin: 0 0 6px; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.site-footer { padding: 16px 0 28px; }
.site-footer a { color: var(--ink); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.86);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 12;
}

.modal[hidden], [hidden] { display: none !important; }

.modal-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  padding: 24px;
}

.share-btn, .text-btn { font: inherit; cursor: pointer; }

.share-btn {
  width: 100%;
  border: 1px solid #111;
  border-radius: 999px;
  min-height: 48px;
  margin: 14px 0 16px;
  background: #111;
  color: #fff;
  font-size: 16px;
  font-weight: 650;
}

.open-app-btn {
  width: 100%;
  border: 1px solid #111;
  border-radius: 999px;
  min-height: 48px;
  margin: 0 0 16px;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
}

.archive-gate {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 20px 8px;
  text-align: center;
}

.archive-gate h2 {
  font-size: 24px;
  margin: 0 0 10px;
}

.archive-gate p {
  color: var(--muted);
  line-height: 1.55;
  font-size: 15px;
}

.countdown {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.share-preview {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 14px auto 0;
  border-radius: 12px;
}

.stores-copy { margin: 12px 0 10px; font-size: 14px; color: var(--muted); }

.store-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.store-buttons .store-btn img {
  height: 40px;
  width: auto;
}

.text-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.noscript {
  margin: 16px auto;
  width: min(720px, calc(100% - 32px));
  color: var(--accent);
}

@media (max-width: 720px) {
  .store-float {
    left: 16px;
    right: 16px;
    justify-content: center;
  }
  .store-float .store-btn img {
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cell.selected { transform: none; }
}
