/* Noggin — the shelf the games sit on.
   Shares Spectrum's palette and type so stepping into a game feels continuous. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --card: #ffffff;
  --card-border: #d9dee5;
  --ink: #131720;
  --ink-soft: #5c6673;
  --ink-faint: #97a1ae;
  --accent: #2f6df6;
  --shadow: 0 1px 2px rgba(16, 22, 34, .08), 0 4px 14px rgba(16, 22, 34, .06);
  --shadow-lift: 0 6px 22px rgba(16, 22, 34, .13);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #171c23;
    --card: #1c222b;
    --card-border: #2c3540;
    --ink: #eef2f7;
    --ink-soft: #9aa5b3;
    --ink-faint: #6b7684;
    --accent: #5c8dff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lift: 0 6px 22px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

/* [hidden] must win, always.
   Any author `display` rule outranks the UA stylesheet's `[hidden] { display: none }`,
   so an element flagged hidden in js stays on screen and stays clickable. That has now
   caught the hub's feedback form and "Play another" in ALL THREE games, where
   `.primary, .secondary { display: block }` outranked it. That one stayed invisible for
   as long as PRACTICE was hardcoded true; making practice a server decision production
   answers no to is what finally showed it. One rule closes the whole class. */
[hidden] { display: none !important; }


html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI",
               Roboto, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- hero ---------- */
.hero {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px 24px;
  text-align: center;
}

.wordmark {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .24em;
  text-indent: .24em;
}

.tagline {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ---------- the shelf ---------- */
.shelf {
  flex: 1;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px;
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform .16s cubic-bezier(.2, .8, .3, 1), box-shadow .16s, border-color .16s;
}

.game:active { transform: scale(.985); }

@media (hover: hover) {
  .game:not(.soon):hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lift);
  }
}

.game:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.game-icon {
  /* Top-aligned rather than centred on the card. The blurbs are two and three lines
     depending on the viewport, so a centred icon sits at a different height on every
     card and the column of icons looks unaligned. Against the title it never moves. */
  align-self: flex-start;
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--bg);
  border-radius: 12px;
}

.game-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.game-name { font-size: 17px; font-weight: 700; }

.game-blurb {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.game-meta { display: flex; gap: 6px; margin-top: 4px; }

.tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.tag.quiet {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--ink-faint);
}

.game-go { flex: none; color: var(--ink-faint); font-size: 20px; }

/* a placeholder slot, so the shelf reads as having room */
.game.soon {
  border-style: dashed;
  box-shadow: none;
  opacity: .55;
}
.game.soon .game-icon { color: var(--ink-faint); }

/* ---------- feedback ----------
   Sits between the shelf and the foot, shut by default. It should read as an offer, not
   as a third thing competing with the games — so it is the quietest element on the page
   until it is opened. */
.feedback {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px 20px;
}

.feedback summary {
  font-size: 13px;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 6px 2px;
  list-style: none;
  text-align: center;
}
.feedback summary::-webkit-details-marker { display: none; }
.feedback summary:hover { color: var(--ink-soft); }
.feedback summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}
.feedback details[open] summary { color: var(--ink-soft); margin-bottom: 10px; }

/* Must come with the display rule below, not after it as an afterthought: `display: flex`
   is an author rule and beats the UA stylesheet's `[hidden] { display: none }`, so setting
   .hidden in js leaves the form on screen and re-submittable. Caught by a screenshot after
   an assertion on `form.hidden` passed and the form was plainly still there. */
.feedback form[hidden] { display: none; }

.feedback form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.fb-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: 6px;
}
.fb-label:first-child { margin-top: 0; }
.fb-label span { font-weight: 400; color: var(--ink-faint); }

.fb-input {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  padding: 9px 10px;
  width: 100%;
}
.fb-input:focus-visible {
  outline: none;
  border-color: var(--accent);
}
/* Resize vertically only. A textarea that can be dragged wider than its parent is the
   one way this layout can be made to overflow sideways on a phone. */
textarea.fb-input { resize: vertical; min-height: 84px; line-height: 1.45; }

.fb-send {
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  margin-top: 12px;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.fb-send:active { transform: scale(.985); }
.fb-send:disabled { opacity: .55; cursor: default; }
.fb-send:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.fb-note {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-faint);
}

.fb-status {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  /* Feedback can come back as a sentence from the server; keep a long one inside the
     column instead of pushing the page wide. */
  overflow-wrap: break-word;
}

/* ---------- foot ---------- */
.foot {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
}
.foot p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-faint);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
