/* styles.css - Name the Hue
   A warm "gallery placard" aesthetic: paper ground, ink type, colour swatches
   as the exhibits. Typographic, restrained, intentionally not a dark dashboard. */

:root {
  --paper: #efe9dd;
  --paper-2: #f6f1e7;
  --panel: #fbf8f1;
  --ink: #211d18;
  --ink-soft: #6f675a;
  --ink-faint: #a49a88;
  --line: #ded6c6;
  --line-strong: #cabda6;
  --accent: #c0472d; /* vermilion */
  --correct: #2f7d4f;
  --shadow: 0 1px 2px rgba(33, 29, 24, 0.08), 0 8px 24px rgba(33, 29, 24, 0.06);
  --radius: 10px;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-ui: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Dark theme: the same tokens, dark values. Everything reads these tokens, so
   nothing else needs to change. "System" tracks the OS via prefers-color-scheme
   (unless the player forced light); an explicit choice via [data-theme] wins. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #17130e;
    --paper-2: #1f1913;
    --panel: #241d15;
    --ink: #efe7d6;
    --ink-soft: #b6ab95;
    --ink-faint: #82775f;
    --line: #382f24;
    --line-strong: #4b4030;
    --accent: #d95b40;
    --correct: #55b079;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 26px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme='dark'] {
  --paper: #17130e;
  --paper-2: #1f1913;
  --panel: #241d15;
  --ink: #efe7d6;
  --ink-soft: #b6ab95;
  --ink-faint: #82775f;
  --line: #382f24;
  --line-strong: #4b4030;
  --accent: #d95b40;
  --correct: #55b079;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 26px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  background-image: radial-gradient(circle at 50% -10%, var(--paper-2), var(--paper) 60%);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 18px 64px;
  position: relative;
}

/* ---- Masthead ---- */
.masthead {
  text-align: center;
  margin-bottom: 30px;
}
/* Corner icon-button groups. Top-right is reserved for a future profile button. */
.corner {
  position: absolute;
  top: 40px;
  display: flex;
  gap: 8px;
}
.corner--left {
  left: 20px;
}
.corner--right {
  right: 20px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}
.icon-btn:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
  transform: translateY(-1px);
}
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* display:grid above beats the [hidden] attribute, so make hiding explicit
   (used to keep the archive button Pro-only). */
.icon-btn[hidden] {
  display: none;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.wordmark-text {
  /* This is the page's <h1> (the visible site name); reset the UA heading
     margin so it sits inline in the wordmark flex row exactly as before. */
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.5rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.swatch-dots {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow:
    -12px 0 0 -1px #e0a53f,
    12px 0 0 -1px #3f7fb0;
  margin-right: 12px;
}
.kicker {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

/* ---- Placard (colour to find + day nav) ---- */
.plate {
  display: flex;
  align-items: stretch;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  margin-bottom: 18px;
}
.plate-body {
  flex: 1;
  text-align: center;
  padding: 12px 4px 14px;
}
.plate-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--ink-faint);
}
.target-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.1;
  margin: 6px 0 8px;
  text-transform: capitalize;
  letter-spacing: -0.015em;
}
.day-label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.today-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-2);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.nav-btn {
  flex: 0 0 auto;
  width: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.nav-btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper-2);
  border-color: var(--ink);
}
.nav-btn:disabled {
  color: var(--ink-faint);
  opacity: 0.4;
  cursor: default;
}
.nav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Meta row ---- */
.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.meta-block--right {
  text-align: right;
}
.meta-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.meta-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}
.pips {
  display: flex;
  gap: 7px;
  align-items: center;
  height: 24px;
}
.pip {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
  transition: background 0.15s ease, transform 0.15s ease;
}
.pip--spent {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
/* Unlimited-guess mode: #pips holds a running count instead of dots. */
.pips--count {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
}

/* ---- Grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 8), 1fr);
  gap: 7px;
  margin-bottom: 20px;
}
.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(33, 29, 24, 0.14);
  border-radius: 7px;
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
  transition: transform 0.09s ease, box-shadow 0.14s ease, filter 0.16s ease;
}
.tile:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 16px rgba(33, 29, 24, 0.24);
  z-index: 2;
}
.tile:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  z-index: 2;
}

/* Mark over a swatch: a legible chip for %, or a bare ✕ for eliminated. */
.tile-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mark-inner {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tile.is-guessed .mark-inner {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(20, 17, 14, 0.72);
  color: #fff;
  backdrop-filter: blur(1px);
}
.tile.is-guessed {
  cursor: default;
}
.tile.is-eliminated {
  filter: brightness(0.42) saturate(0.55);
  cursor: default;
}
.tile.is-eliminated .mark-inner {
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
}
.tile.is-correct,
.tile.is-answer {
  border-color: var(--correct);
  box-shadow: 0 0 0 2px var(--correct), 0 0 0 5px rgba(47, 125, 79, 0.25);
}
.tile.is-answer .mark-inner::after {
  content: '★';
  color: #fff;
  font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ---- Message banner ---- */
.message {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
}
.message[hidden] {
  display: none;
}
.message em {
  font-style: normal;
  font-weight: 600;
  text-transform: capitalize;
}
.message--win {
  border-color: var(--correct);
}
.message--lose {
  border-color: var(--accent);
}
.message-swatch {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid rgba(33, 29, 24, 0.2);
}

/* ---- Guess history (compact chips) ---- */
.guess-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.guess-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px 4px 5px;
  font-size: 0.82rem;
  cursor: default;
}
/* Hover reveals the guessed colour's hex code. */
.guess-chip:hover::after {
  content: attr(data-hex);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow);
  z-index: 5;
}
.guess-chip--correct {
  border-color: var(--correct);
  background: rgba(47, 125, 79, 0.08);
}
.guess-chip-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(33, 29, 24, 0.18);
}
.guess-chip-pct {
  font-family: var(--font-display);
  font-weight: 600;
}
/* Guess counter tints red once you go past par. */
.pips--overpar {
  color: var(--accent);
}

/* ---- Help & footer ---- */
.help-list {
  margin: 6px 0 0;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.help-list li {
  margin-bottom: 9px;
}
.help-list strong {
  color: var(--ink);
}

/* ---- Profile / auth ---- */
.profile-lead {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 16px;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, filter 0.14s ease;
}
.btn:hover {
  border-color: var(--ink-faint);
}
.btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.btn--primary {
  background: var(--ink);
  color: var(--paper-2);
  border-color: var(--ink);
}
.btn--primary:hover {
  filter: brightness(1.15);
}
/* Guest "Create account" CTA in the accent, to sit with the page's vermilion. */
#results-signup-form .btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--wide {
  width: 100%;
  margin-top: 16px;
}
/* Admin-only stats link, styled as a button (it's an <a>, so it needs the
   block/centered/no-underline bits a <button> gets for free). */
.profile-admin {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-bottom: 8px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.field {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 12px 14px;
}
.field:focus {
  outline: none;
  border-color: var(--ink-faint);
}
.auth-actions {
  display: flex;
  gap: 8px;
}
.auth-actions .btn {
  flex: 1;
}
.auth-msg {
  margin: 2px 0 0;
  min-height: 1.1em;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.auth-msg--error {
  color: var(--accent);
}
.auth-msg--ok {
  color: var(--correct);
}
.profile-account {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.name-form {
  display: flex;
  gap: 8px;
}
.name-form .field {
  flex: 1;
  padding: 9px 12px;
}
.name-form .btn {
  padding: 9px 18px;
}
.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper-2);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}
.profile-email {
  font-weight: 600;
}
.profile-synced {
  font-size: 0.8rem;
  color: var(--correct);
}
.profile-hint {
  margin: 14px 0 4px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.profile-note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.auth-switch {
  margin: 4px 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.linkbtn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Guest account-creation block on the results screen */
#results-signup {
  margin: 4px 0 8px;
  padding: 0 0 8px;
}
/* When no outcome sits above it (stats icon opened by a guest), the block is the
   first thing in the card - sit its (left-aligned) heading tight to the top; the
   close ✕ is off to the right and clears it. */
#results-outcome[hidden] + #results-signup {
  margin-top: 2px;
}
.results-signup-h {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ink);
}
.results-signup-sub {
  margin: 6px 0 12px;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--ink-soft);
}
#results-signup .auth-form {
  margin: 0;
}

/* Results-screen support/archive CTAs, side by side as compact tiles */
.results-ctas {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.cta2 {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-align: center;
  padding: 16px 14px;
  border: 1px solid;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-ui);
  transition: background 0.14s ease, transform 0.1s ease;
}
.cta2:hover {
  transform: translateY(-1px);
}
.cta2[hidden] {
  display: none;
}
.cta2-ico {
  font-size: 1.35rem;
  line-height: 1;
}
.cta2-t {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.2;
}
.cta2--coffee {
  border-color: var(--accent);
  background: rgba(192, 71, 45, 0.08);
}
.cta2--coffee:hover {
  background: rgba(192, 71, 45, 0.15);
}
.cta2--archive {
  border-color: var(--correct);
  background: rgba(47, 125, 79, 0.08);
}
.cta2--archive:hover {
  background: rgba(47, 125, 79, 0.15);
}

/* Floating "buy me a coffee" widget, bottom-right during play */
.coffee-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40; /* below modals (z-50), so a modal backdrop covers it */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #ffdd00; /* Buy Me a Coffee brand yellow */
  color: #0d0c22;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(33, 29, 24, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.coffee-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(33, 29, 24, 0.24);
}
.coffee-fab-cup {
  font-size: 1.05rem;
}
/* Hidden while the multiplayer page is open (the FAB is a later sibling of #mp) */
#mp:not([hidden]) ~ .coffee-fab {
  display: none;
}
/* On narrow phones, collapse to just the cup so it doesn't crowd the board */
@media (max-width: 400px) {
  .coffee-fab-label {
    display: none;
  }
  .coffee-fab {
    padding: 12px;
  }
}

.profile-note code,
.help-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  background: var(--paper);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
}
/* ---- About / on-page SEO content ---- */
/* A calm, readable article below the game. All colours are tokens, so it
   themes itself in dark mode with no extra rules. */
.about {
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.65;
}
.about h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ink);
  margin: 0 0 14px;
}
.about h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
  margin: 28px 0 10px;
}
.about h4 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  margin: 16px 0 4px;
}
.about p {
  margin: 0 0 12px;
}
.about strong {
  color: var(--ink);
}
.about-list {
  margin: 0 0 12px;
  padding-left: 20px;
}
.about-list li {
  margin-bottom: 7px;
}
.about .faq h4:first-child {
  margin-top: 4px;
}

.footer {
  margin-top: 28px;
  text-align: center;
  font-size: 0.76rem;
  color: var(--ink-faint);
}
.footer a {
  color: var(--ink-soft);
}

/* ---- Results modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  background: rgba(33, 29, 24, 0.45);
  backdrop-filter: blur(2px);
  animation: fade 0.18s ease;
}
.modal-card {
  margin: auto; /* keeps it centred, and scrollable if ever taller than the screen */
}
.modal[hidden] {
  display: none;
}
@keyframes fade {
  from { opacity: 0; }
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(33, 29, 24, 0.28);
  padding: 26px 24px 22px;
  animation: pop 0.2s ease;
}
@keyframes pop {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1rem;
  cursor: pointer;
}
.modal-close:hover {
  background: var(--line);
  color: var(--ink);
}
/* Section labels inside a modal - the page's small-caps eyebrow style, so they
   read as subordinate to the modal's own title. */
.modal-h {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
  margin: 22px 0 12px;
}
/* The modal's main title (directly under the close ✕): the display heading,
   pulled up tight to the top. */
.modal-close + .modal-h {
  font-family: var(--font-display);
  text-transform: none;
  letter-spacing: -0.01em;
  font-size: 1.5rem;
  color: var(--ink);
  margin: 2px 0 16px;
}

/* Outcome header */
.results-outcome {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  padding: 4px 0 6px;
}
.results-outcome[hidden] {
  display: none;
}
.results-swatch {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  border: 1px solid rgba(33, 29, 24, 0.2);
  flex: 0 0 auto;
}
.results-outcome-text {
  display: flex;
  flex-direction: column;
}
.results-outcome-text strong {
  font-family: var(--font-display);
  font-size: 1.5rem;
}
.results-answer {
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-transform: capitalize;
}

/* Stats numbers */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 4px;
  }
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
}
.stat-cap {
  font-size: 0.64rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.2;
}

/* Distribution bars */
.dist {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dist-key {
  width: 1ch;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.dist-key--x {
  color: var(--accent);
}
.dist-track {
  flex: 1;
  display: flex;
}
.dist-fill {
  background: var(--ink-soft);
  color: var(--paper-2);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-align: right;
  min-width: 2.4ch;
  white-space: nowrap;
  transition: width 0.4s ease;
}
.dist-fill--now {
  background: var(--correct);
}
.dist-fill--lost {
  background: var(--accent);
}
/* Footer: countdown + share */
.modal-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.countdown {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.countdown-cap {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}
.countdown-time {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.countdown-note {
  font-size: 0.64rem;
  color: var(--ink-faint);
  margin-top: 2px;
}
.share-btn {
  border: none;
  border-radius: 10px;
  background: var(--correct);
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 26px;
  cursor: pointer;
  transition: filter 0.14s ease;
}
.share-btn:hover {
  filter: brightness(1.06);
}
.share-btn[hidden] {
  display: none;
}
.share-btn:disabled {
  opacity: 0.8;
  cursor: default;
}

@media (max-width: 420px) {
  .app {
    padding: 28px 14px 48px;
  }
  .corner {
    top: 28px;
  }
  .corner--left {
    left: 14px;
  }
  .corner--right {
    right: 14px;
  }
  /* Drop the wordmark below the absolutely-positioned corner buttons so a wide
     title ("Name the Hue") gets its own full-width line instead of running under
     the icons. The corners end at ~66px (top 28 + 38 tall); clear them. */
  .masthead {
    padding-top: 46px;
  }
  .wordmark-text {
    font-size: 2.1rem;
  }
  .target-name {
    font-size: 1.65rem;
  }
  .grid {
    gap: 5px;
  }
  .mark-inner {
    font-size: 0.62rem;
  }
}

/* ---- Multiplayer ---- */
:root {
  --mp-them: #3c73a8; /* opponent accent (blue), pairs with --accent (you) */
}

/* Entry buttons: the header pill + the block button in the results modal. */
.mp-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 8px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-2);
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.14s ease;
}
.mp-cta:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}
.mp-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.mp-cta--block {
  display: flex;
  width: 100%;
  justify-content: center;
  margin: 16px 0 4px;
}

/* Full-page multiplayer view (takes over from the daily game). */
.mp-page {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow-y: auto;
  background: var(--paper);
  background-image: radial-gradient(circle at 50% -10%, var(--paper-2), var(--paper) 60%);
}
.mp-page[hidden] {
  display: none;
}
.mp-shell {
  max-width: 540px;
  margin: 0 auto;
  padding: 14px 18px 40px;
}
.mp-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 18px;
}
.mp-navbtn {
  flex: 0 0 auto;
  min-width: 96px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.mp-navbtn:hover {
  background: var(--ink);
  color: var(--paper-2);
  border-color: var(--ink);
}
.mp-navbtn--ghost {
  visibility: hidden; /* balances the back button so the title stays centred */
}
.mp-topbar-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Lobby subpage */
.mp-hero {
  text-align: center;
  margin: 8px 0 22px;
}
.mp-hero-emoji {
  font-size: 2.4rem;
  line-height: 1;
}
.mp-h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.9rem;
  margin: 10px 0 8px;
}
.mp-hero-sub {
  margin: 0 auto;
  max-width: 34ch;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.mp-lobby-status {
  margin: 10px 2px 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
}
/* Lobby panels: "Invite a friend" and "Join a game". */
.mp-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.mp-panel-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
/* The big tap-to-copy room code shown when hosting. */
.mp-code {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-indent: 0.28em; /* balance the trailing letter-spacing so it looks centred */
  text-align: center;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.mp-code:hover {
  border-color: var(--accent);
  background: var(--paper-2);
}
.mp-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 2px;
  color: var(--ink-faint);
  font-size: 0.82rem;
}
.mp-or::before,
.mp-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.mp-join-error {
  margin: 10px 2px 0;
  font-size: 0.82rem;
  color: var(--accent);
}
.mp-join-error[hidden] {
  display: none;
}
.mp-link--editable {
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.mp-linkrow {
  display: flex;
  gap: 8px;
}
.mp-link {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}
.mp-hint {
  margin: 14px 2px 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* Scoreboard */
.mp-scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 4px 0 14px;
}
.mp-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 92px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.mp-player--me {
  border-color: var(--accent);
  background: rgba(192, 71, 45, 0.08);
}
.mp-player--them {
  border-color: var(--mp-them);
  background: rgba(60, 115, 168, 0.09);
}
.mp-pname {
  font-size: 0.78rem;
  color: var(--ink-soft);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-pscore {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
}
.mp-vs {
  font-family: var(--font-display);
  color: var(--ink-faint);
}

/* Target + turn */
.mp-target {
  text-align: center;
  margin-bottom: 6px;
}
.mp-target .target-name {
  margin: 4px 0 0;
  font-size: 1.6rem;
}
.mp-turn {
  text-align: center;
  margin: 6px 0 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  min-height: 1.2em;
}
.mp-turn--mine {
  color: var(--accent);
}

/* Grid picks, colour-coded by who claimed the swatch. */
.mp-grid {
  margin-bottom: 6px;
}
.tile.mp-mine {
  box-shadow: 0 0 0 2px var(--accent);
}
.tile.mp-theirs {
  box-shadow: 0 0 0 2px var(--mp-them);
}
.tile.mp-theirs .mark-inner {
  background: rgba(60, 115, 168, 0.85);
}
.tile.is-correct,
.tile.mp-mine.is-correct,
.tile.mp-theirs.is-correct {
  box-shadow: 0 0 0 2px var(--correct), 0 0 0 5px rgba(47, 125, 79, 0.25);
}

/* Round-over banner */
.mp-roundover {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
}
.mp-roundover-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.mp-roundover[hidden] {
  display: none;
}
.mp-roundover-text {
  font-weight: 600;
}

/* ---- Placard without arrows ---- */
.plate--solo {
  justify-content: center;
}

/* The grid's own display:grid beats the [hidden] attribute's UA display:none,
   so make hiding it explicit (used when Hard Mode takes over). */
.grid[hidden] {
  display: none;
}

/* ---- Pro: Hard Mode mixer ---- */
.hard[hidden] { display: none; }
.hard {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
/* The 2D colour field + draggable marker. */
.hard-field-wrap {
  position: relative;
  line-height: 0;
}
.hard-field {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid rgba(33, 29, 24, 0.14);
  box-shadow: var(--shadow);
  cursor: crosshair;
  touch-action: none; /* let us drag without the page scrolling */
}
.hard-marker {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.hard-marker.on-dark { border-color: #fff; }
.hard-marker[hidden] { display: none; }
.hard-gray {
  width: 100%;
  height: 22px;
  display: block;
  border-radius: 7px;
  border: 1px solid rgba(33, 29, 24, 0.14);
  cursor: crosshair;
  touch-action: none;
}
.hard-bottom {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hard-pickbox {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* The large circle showing the currently selected colour. */
.hard-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #808080;
  border: 1px solid rgba(33, 29, 24, 0.18);
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, 0.55);
  flex: 0 0 auto;
}
.hard-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.hard--locked .hard-field,
.hard--locked .hard-gray { cursor: default; opacity: 0.7; }
.hard-guess { flex: 1; }
/* Hard-Mode board inside the multiplayer page. */
.mp-hard { display: flex; flex-direction: column; gap: 12px; margin-bottom: 6px; }
.mp-hard[hidden] { display: none; }
.hard-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}

/* ---- Pro toggles in the profile ---- */
.pro-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.pro-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
}
.pro-toggle-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.pro-toggle .pro-sub {
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.pro-toggle input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: 0 0 auto;
}
.pro-toggle--off { opacity: 0.55; }
.pro-toggle--status { cursor: default; }
.pro-subscribe { flex: 0 0 auto; padding: 8px 18px; }
/* Monthly / yearly subscribe choice (with the trial note above it). */
.pro-subscribe-box { margin: 6px 0 2px; }
.pro-subscribe-box .pro-sub { display: block; margin-bottom: 10px; line-height: 1.45; }
.pro-plan-choice { display: flex; gap: 8px; }
.pro-plan-choice .share-btn { flex: 1; padding: 10px 12px; }
/* Yearly reads as the secondary/outline option next to the solid monthly one. */
.pro-subscribe--alt {
  background: transparent;
  color: var(--correct);
  box-shadow: inset 0 0 0 1px var(--correct);
}
/* Plan buttons stack a name over the real price. */
.plan-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.2;
}
.plan-btn[hidden] { display: none; }
.plan-name { font-weight: 600; font-size: 0.95rem; }
.plan-price { font-size: 0.78rem; font-weight: 500; opacity: 0.92; }
.plan-save {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--correct);
  color: #fff;
  vertical-align: 1px;
}
.plan-savings {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--correct);
}
/* Price line in the shared upsell popup. */
.pro-upsell-price {
  margin: -6px auto 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}
.pro-status-pill {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
}
.pro-status-pill.is-on {
  border-color: var(--correct);
  color: var(--correct);
}
.pro-status-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.set-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* Free-vs-Pro comparison: makes the tier split legible at a glance. */
.tier-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 2px 0 8px;
}
.tier {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px 14px;
}
.tier--pro {
  border-color: var(--accent);
  background: rgba(192, 71, 45, 0.06);
}
.tier-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--ink-faint);
}
.tier--pro .tier-name { color: var(--accent); }
/* The plan you're on gets a bolder outline so it's obvious at a glance. */
.tier--current { box-shadow: 0 0 0 2px var(--accent); }
.tier--free.tier--current { box-shadow: 0 0 0 2px var(--line-strong); }
.tier-badge {
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}
.tier-badge--plain { background: var(--line-strong); color: var(--ink); }
/* "You're on the … plan." line above the comparison. */
.plan-line {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.plan-line strong { color: var(--ink); }
.tier-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tier-list li {
  position: relative;
  padding-left: 18px;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--ink-soft);
}
.tier-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
  color: var(--ink-faint);
}
.tier--pro .tier-list li::before { color: var(--accent); }
@media (max-width: 380px) {
  .tier-compare { grid-template-columns: 1fr; }
}

/* ---- Archive modal ---- */
.modal-card--archive { max-width: 460px; }
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  margin-top: 6px;
}
.archive-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}
.archive-row:hover { transform: translateY(-1px); border-color: var(--ink-faint); }
.archive-row--done { border-color: var(--correct); background: rgba(47, 125, 79, 0.06); }
.archive-row--current { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(192, 71, 45, 0.06); }
.archive-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.archive-day { font-weight: 600; }
.archive-date { color: var(--ink-soft); font-size: 0.82rem; }
.archive-status {
  flex: 0 0 auto;
  font-size: 0.82rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.archive-todo { color: var(--ink-faint); }
.archive-go {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--ink-faint);
}
/* Shown in the archive when the player isn't Pro. */
.archive-upsell {
  text-align: center;
  padding: 20px 12px 8px;
}
.archive-upsell-emoji {
  font-size: 2.4rem;
  line-height: 1;
}
.archive-upsell-text {
  margin: 12px auto 18px;
  max-width: 34ch;
  color: var(--ink-soft);
  line-height: 1.5;
}
.archive-upsell .share-btn {
  width: 100%;
}
/* Shared Pro upsell popup (archive + practice gates). */
.modal-card--upsell { max-width: 400px; }
.modal-card--upsell .archive-upsell { padding-top: 8px; }
.modal-card--upsell .archive-upsell .modal-h { margin: 8px 0 0; }

/* ---- Settings panel ---- */
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}
.set-row-text strong { font-size: 0.98rem; }
.set-seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
}
.set-seg-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 13px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.set-seg-btn.is-active { background: var(--ink); color: var(--paper-2); }
.set-data { margin-top: 2px; }
.set-data-note {
  margin: 0 0 12px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.set-danger {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-ui);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.set-danger:hover { background: var(--accent); color: #fff; }
.profile-delete { margin-top: 10px; }
.profile-delete:disabled { opacity: 0.6; cursor: default; }

/* Reduce-motion: kill transitions, animations, and hover lifts. */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  transition: none !important;
  animation: none !important;
}
.reduce-motion *:hover { transform: none !important; }

/* ---- Masthead action pills (Play a friend / Practice) ---- */
.masthead-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}
.masthead-actions .mp-cta { margin-top: 0; }

/* ---- Practice mode bar ---- */
.practice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 8px 8px 8px 14px;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  background: rgba(192, 71, 45, 0.06);
}
.practice-bar[hidden] { display: none; }
.practice-tag { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.practice-actions { display: flex; gap: 8px; }
.practice-actions .share-btn { padding: 8px 14px; }

/* ---- Toast (payment status / billing messages) ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 12px);
  z-index: 100;
  max-width: min(92vw, 440px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper-2);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 10px 34px rgba(33, 29, 24, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Legal / content pages (terms.html, privacy.html) ---- */
.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 34px 20px 80px;
}
.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}
.legal-back:hover { color: var(--ink); }
.legal h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  margin: 0 0 6px;
  color: var(--ink);
}
.legal-updated { color: var(--ink-faint); font-size: 0.82rem; margin: 0 0 30px; }
.legal h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 30px 0 8px;
  color: var(--ink);
}
.legal p,
.legal li { line-height: 1.65; color: var(--ink-soft); }
.legal ul { padding-left: 20px; }
.legal a { color: var(--accent); }
.legal-note {
  margin-top: 38px;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  font-size: 0.84rem;
  color: var(--ink-faint);
}
