/* Fourword Thinking
   Ported from the build artifact. The palette, the rules and the four-column
   geometry are unchanged; what is added below the divider is state the
   prototype had no need for (loading, errors, the all-time fallback). */

/* ---------- type, self-hosted ---------- */
@font-face {
  font-family: "Archivo Black";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/archivo-black-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plex-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/plex-sans-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/plex-mono-500.woff2") format("woff2");
}

:root {
  --ground: #FAFAF7;
  --ink: #16161A;
  --cobalt: #2A4BD7;
  --coral: #FF5A47;
  /* The brand coral is 2.95:1 on the ground: fine for a filled pip, a caret or
     a 3px ring, not fine for the small uppercase labels it was also carrying.
     This is the same coral deepened to 4.70:1, used ONLY where coral is text.
     Fills, marks, rules and bars keep --coral. */
  --coral-text: #CC3D2A;
  --muted: #6E6E78;
  --rule: #E2E2DD;
  --gutter: 16px;
  --display: "Archivo Black", "Arial Black", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

img { max-width: 100%; }
[hidden] { display: none !important; }

.fw { max-width: 1180px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; text-wrap: balance; letter-spacing: -0.02em; line-height: 0.98; }

a { color: var(--ink); text-decoration: none; }

.eyebrow {
  font-family: var(--mono); font-weight: 500; font-size: 0.6875rem;
  letter-spacing: 0.17em; text-transform: uppercase; color: var(--muted); margin: 0;
}
.eyebrow strong { color: var(--ink); font-weight: 500; }
.eyebrow .hot { color: var(--coral-text); }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }

/* ---------- masthead ---------- */
.masthead { border-bottom: 2px solid var(--ink); }
.masthead .fw { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand svg { display: block; flex: none; }
.brand-name { font-family: var(--display); font-size: 1.0625rem; letter-spacing: -0.03em; }
.brand-name span { color: var(--muted); font-family: var(--mono); font-weight: 500; font-size: 0.6875rem; letter-spacing: 0.08em; }
.mast-meta { font-family: var(--mono); font-weight: 500; font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); text-align: right; }
.mast-meta b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

.subnav { border-bottom: 1px solid var(--rule); background: var(--ground); }
.subnav .fw { display: grid; grid-template-columns: repeat(4, 1fr); }
.subnav a {
  font-family: var(--mono); font-weight: 500; font-size: 0.625rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted); padding: 11px 0; text-align: center;
  border-right: 1px solid var(--rule);
}
.subnav a:first-child { color: var(--ink); }
.subnav a:last-child { border-right: 0; }
.subnav a:hover { color: var(--cobalt); }

/* ---------- hero ---------- */
.hero { padding: 30px 0 34px; position: relative; }
.hero-head { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; align-items: baseline; padding-bottom: 20px; }
.prompt {
  font-family: var(--display); font-size: clamp(2.125rem, 8.4vw, 4.6rem);
  line-height: 0.95; letter-spacing: -0.035em; max-width: 17ch; margin: 0 0 6px;
}
.prompt em { font-style: normal; color: var(--cobalt); }
.prompt-rule { font-family: var(--sans); font-size: 1rem; color: var(--muted); max-width: 40ch; margin: 0 0 26px; }
.prompt-rule b { color: var(--ink); font-weight: 500; }

/* ---------- the four-slot field ---------- */
.field { position: relative; }
.slots {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 2px; background: var(--ink); border: 2px solid var(--ink);
}
.field.is-focused .slots { box-shadow: 0 0 0 3px rgba(42, 75, 215, 0.35); }
.slot {
  background: #FFFFFF; position: relative; min-height: clamp(78px, 17vw, 124px);
  display: flex; align-items: center; justify-content: center; padding: 22px 10px 14px;
  cursor: text; overflow: hidden;
}
.slot-n {
  position: absolute; top: 7px; left: 9px; font-family: var(--mono); font-weight: 500;
  font-size: 0.625rem; letter-spacing: 0.1em; color: var(--rule);
}
.slot.is-filled .slot-n { color: var(--muted); }
.slot.is-active .slot-n { color: var(--coral-text); }
.slot.is-active::after {
  content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--coral); pointer-events: none;
}
.slot-w {
  font-family: var(--mono); font-weight: 500; font-size: clamp(1.0625rem, 4.6vw, 1.875rem);
  letter-spacing: -0.02em; line-height: 1; white-space: nowrap;
}
.slot-w[data-len="mid"] { font-size: clamp(0.8125rem, 3.5vw, 1.5rem); }
.slot-w[data-len="long"] { font-size: clamp(0.6875rem, 2.9vw, 1.1875rem); }
.caret {
  display: none; width: 2px; height: clamp(22px, 5vw, 38px); background: var(--coral);
  margin-left: 3px; animation: blink 1.05s steps(2, start) infinite;
}
.slot.is-active .caret { display: inline-block; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.ghost-input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none;
  font-size: 16px; border: 0; padding: 0; background: transparent; color: transparent;
}

.field-foot { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: center; margin-top: 18px; }
.btn {
  font-family: var(--mono); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.14em;
  text-transform: uppercase; padding: 15px 26px; border: 2px solid var(--ink);
  background: var(--cobalt); color: var(--ground); cursor: pointer; border-radius: 0;
  border-color: var(--cobalt); transition: background 0.15s linear, color 0.15s linear;
}
.btn:hover { background: var(--ink); border-color: var(--ink); }
.btn[disabled] { background: transparent; color: var(--rule); border-color: var(--rule); cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--ground); }
.btn.is-busy { color: var(--ground); background: var(--muted); border-color: var(--muted); cursor: progress; }
.counter { font-family: var(--mono); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.counter b { color: var(--coral-text); font-weight: 500; font-variant-numeric: tabular-nums; }
.counter.is-ready b { color: var(--cobalt); }

/* ---------- locked state ---------- */
.locked { display: none; border: 2px solid var(--ink); background: #FFFFFF; padding: 22px 16px 24px; }
.locked.on { display: block; }
.field-wrap.off { display: none; }
.locked h2 { font-size: clamp(1.5rem, 6vw, 2.25rem); margin-bottom: 4px; }
.locked h2 .stamp { color: var(--coral-text); }
.locked-words { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; background: var(--rule); border: 1px solid var(--rule); margin: 18px 0 16px; }
.locked-words span {
  background: var(--ground); padding: 16px 8px; text-align: center; font-family: var(--mono); font-weight: 500;
  font-size: clamp(0.875rem, 3.6vw, 1.5rem); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.locked p { color: var(--muted); max-width: 46ch; margin: 0 0 18px; font-size: 0.9375rem; }
.locked p b { color: var(--ink); font-weight: 500; }

/* ---------- stat band ---------- */
.band { border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.band .fw { display: grid; grid-template-columns: repeat(2, 1fr); }
/* The child combinator matters: a bare `.band div` also matches .fw, which is
   itself a div, and its padding shorthand then wipes out the page gutter. That
   is what pushed the first stat flush against the left edge on a phone. */
.band .fw > div { padding: 16px 12px 16px 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.band .fw > div:nth-child(2n) { border-right: 0; padding-left: 12px; }
.band .fw > div:nth-child(n + 3) { border-bottom: 0; }
.band b { display: block; font-family: var(--display); font-size: 1.375rem; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.band span { font-family: var(--mono); font-weight: 500; font-size: 0.625rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* ---------- sections ---------- */
section { padding: 44px 0; border-bottom: 1px solid var(--rule); }
.sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 26px; }
.sec-head h2 { font-size: clamp(1.5rem, 5.4vw, 2.125rem); max-width: 18ch; }
.sec-head .eyebrow { margin-bottom: 10px; }

/* ---------- vote meter ---------- */
.meter { display: flex; align-items: center; gap: 10px; }
.meter-pips { display: flex; gap: 3px; }
.meter-pips i { width: 14px; height: 14px; border: 2px solid var(--ink); background: transparent; display: block; }
.meter-pips i.spent { background: var(--coral); border-color: var(--coral); }
.meter-label { font-family: var(--mono); font-weight: 500; font-size: 0.625rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* ---------- answers ---------- */
.answer { border-top: 1px solid var(--rule); padding: 18px 0; }
.answer:last-of-type { border-bottom: 1px solid var(--rule); }
.answer-top { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.rank { font-family: var(--display); font-size: 1.5rem; letter-spacing: -0.04em; color: var(--rule); flex: none; width: 1.4em; }
.answer.voted .rank { color: var(--coral-text); }
.answer-meta { margin-left: auto; font-family: var(--mono); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.08em; color: var(--muted); font-variant-numeric: tabular-nums; }
.answer-meta b { color: var(--ink); font-weight: 500; }
.answer-meta .mine { color: var(--coral-text); }
.answer-meta .whence { color: var(--muted); }
.quad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.quad span {
  background: var(--ground); padding: 11px 4px; text-align: center; font-family: var(--mono); font-weight: 500;
  font-size: clamp(0.5625rem, 2.5vw, 0.9375rem); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden;
}
.answer.voted .quad span { background: #FFFFFF; }
.answer.mine-own .quad span { background: #FFFFFF; }
.answer-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.bar { flex: 1; height: 6px; background: var(--rule); position: relative; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--cobalt); transition: width 0.2s ease-out; width: 0; }
.answer.voted .bar i { background: var(--coral); }
.vote {
  flex: none; font-family: var(--mono); font-weight: 500; font-size: 0.6875rem; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 9px 16px; border: 2px solid var(--ink); background: transparent;
  color: var(--ink); cursor: pointer; border-radius: 0; transition: background 0.14s linear, color 0.14s linear;
}
.vote:hover { background: var(--coral-text); border-color: var(--coral-text); color: var(--ground); }
.vote[disabled] { border-color: var(--rule); color: var(--rule); cursor: not-allowed; background: transparent; }
.vote-note { font-family: var(--mono); font-weight: 500; font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 16px; }
.vote-note.done { color: var(--coral-text); }

/* ---------- how ---------- */
.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.step { background: var(--ground); padding: 20px 14px 24px; }
.step b { display: block; font-family: var(--display); font-size: 1.75rem; letter-spacing: -0.04em; color: var(--cobalt); line-height: 1; margin-bottom: 12px; }
.step h3 { font-size: 0.9375rem; letter-spacing: 0.02em; margin-bottom: 7px; }
.step p { margin: 0; font-size: 0.875rem; color: var(--muted); line-height: 1.5; }

/* ---------- archive ---------- */
.archive { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.arch { background: var(--ground); padding: 16px 12px 18px; display: block; }
.arch:hover { background: #FFFFFF; }
.arch:hover .arch-q { color: var(--cobalt); }
.arch .eyebrow { margin-bottom: 9px; font-size: 0.625rem; }
.arch-q { font-family: var(--display); font-size: 0.9375rem; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 12px; min-height: 2.3em; }
.arch-w { font-family: var(--mono); font-weight: 500; font-size: 0.6875rem; letter-spacing: -0.01em; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 9px; }
.arch-w b { color: var(--ink); font-weight: 500; display: block; margin-bottom: 2px; }
/* A day the archive has not reached yet. Holds the four-card shape open so a
   young game looks unfinished rather than broken. */
.arch-waiting { color: var(--rule); }
.arch-waiting:hover { background: var(--ground); }
.arch-waiting .eyebrow, .arch-waiting .arch-w { color: var(--rule); }

/* ---------- footer ---------- */
footer { padding: 34px 0 46px; }
.foot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin: 22px 0 26px; }
.foot-grid a, .foot-grid button {
  font-family: var(--mono); font-weight: 500; font-size: 0.6875rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); background: none; border: 0; padding: 0;
  text-align: left; cursor: pointer;
}
.foot-grid a:hover, .foot-grid button:hover { color: var(--cobalt); }
.colophon { font-family: var(--mono); font-weight: 500; font-size: 0.625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); line-height: 1.9; }

/* ================================================================
   Added for the live build. The prototype had no server to disagree
   with it, so none of this existed.
   ================================================================ */

/* Notices: validation failures, blocked words, offline. */
.notice {
  font-family: var(--mono); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.06em;
  border-left: 3px solid var(--coral); padding: 10px 0 10px 12px; margin-top: 16px;
  color: var(--ink); background: #FFFFFF;
}
.notice[hidden] { display: none !important; }
.notice.calm { border-left-color: var(--cobalt); color: var(--muted); }

/* The all-time fallback banner: shown when yesterday was too thin to be a game. */
.fallback {
  border: 2px solid var(--ink); background: #FFFFFF; padding: 16px 14px; margin-bottom: 22px;
}
.fallback p { margin: 6px 0 0; font-size: 0.9375rem; color: var(--muted); max-width: 52ch; }
.fallback p b { color: var(--ink); font-weight: 500; }

/* Loading: the shape is already right, so hold the shape and dim it. */
.is-loading { opacity: 0.38; pointer-events: none; }
.skeleton { color: transparent !important; background: var(--rule); border-radius: 0; }

/* Turnstile sits under the field. It collapses to nothing when unconfigured. */
.challenge { margin-top: 16px; }
.challenge:empty { display: none; }

/* Suggest a prompt */
dialog.suggest {
  border: 2px solid var(--ink); background: var(--ground); color: var(--ink);
  padding: 22px 18px; max-width: 34rem; width: calc(100vw - 32px);
}
dialog.suggest::backdrop { background: rgba(22, 22, 26, 0.55); }
dialog.suggest h2 { font-size: 1.5rem; margin-bottom: 8px; }
dialog.suggest p { color: var(--muted); font-size: 0.9375rem; margin: 0 0 14px; }
dialog.suggest textarea {
  width: 100%; min-height: 5.5rem; font-family: var(--sans); font-size: 1rem; color: var(--ink);
  background: #FFFFFF; border: 2px solid var(--ink); padding: 10px 12px; resize: vertical;
}
dialog.suggest .row { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* Empty board, when there is genuinely nothing anywhere yet. Spans the whole
   grid: dropped into one cell of the archive it leaves the other showing the
   grid's own rule color as a grey slab. */
.empty-board {
  /* margin:0 matters: this is a <p>, and its default 1em margin leaves a band
     of the grid's own rule color showing above and below it. */
  grid-column: 1 / -1; background: var(--ground); margin: 0;
  border: 1px dashed var(--rule); padding: 26px 16px; text-align: center;
  font-family: var(--mono); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}

@media (min-width: 560px) {
  .band .fw { grid-template-columns: repeat(4, 1fr); }
  .band .fw > div { border-bottom: 0; padding-left: 12px; border-right: 1px solid var(--rule); }
  .band .fw > div:first-child { padding-left: 0; }
  .band .fw > div:nth-child(2n) { padding-left: 12px; border-right: 1px solid var(--rule); }
  .band .fw > div:last-child { border-right: 0; }
  .foot-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 720px) {
  :root { --gutter: 32px; }
  .hero { padding: 54px 0 56px; }
  .hero-inner {
    background-image: linear-gradient(to right, var(--rule) 1px, transparent 1px);
    background-size: 25% 100%; background-position: 0 0;
  }
  .prompt { margin-bottom: 10px; }
  .slots { grid-template-columns: repeat(4, 1fr); }
  .locked-words { grid-template-columns: repeat(4, 1fr); }
  .steps { grid-template-columns: repeat(4, 1fr); }
  .archive { grid-template-columns: repeat(4, 1fr); }
  section { padding: 64px 0; }
  .answer-top { gap: 18px; }
  .rank { font-size: 2rem; }
  .arch-q { font-size: 1.0625rem; }
  .brand-name { font-size: 1.1875rem; }
  .subnav .fw { grid-template-columns: repeat(4, 180px); }
  .subnav a { text-align: left; padding: 12px 0; border-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .caret { opacity: 1; }
}
