/*
 * The stylesheet of the pages the server renders (internal/ssr): the
 * landing page, the account pages a mail links to, and the information
 * pages. It carries the game's own look without the app's bundle: the
 * colour tokens below are src/theme/tokens.css's, value for value
 * (src/theme/tokens.test.ts fails when the two differ), and the wordmark is
 * the same channel-split lockup.
 *
 * No inline style anywhere on these pages: the site's policy allows styles
 * from this file and nothing else.
 */

:root {
  color-scheme: light;
  --font-size-base: 14px;
  --bg: #f6f4ec;
  --bg-inset: #efebdd;
  --panel: #fffdf6;
  --panel-alt: #efebdd;
  --control: #e9e4d2;
  --border: #ddd7c6;
  --border-strong: #7d7766;
  --ink: #171410;
  --muted: #55503f;
  --dim: #7d7766;
  --accent: #fcee0a;
  --accent-ink: #171410;
  --brand-ink: #171410;
  --brand-ink-invert: #fcee0a;
  --brand-split-cyan: #0a6d7a;
  --brand-split-red: #a8102f;
  --link: #0a6d7a;
  --focus: #0a1a33;
  --ok: #18683f;
  --warn: #8a5a00;
  --alert: #a8102f;
  --stat-credits: #171410;
  --stat-compute: #171410;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="daylight"]) {
    color-scheme: dark;
    --bg: #0b0c10;
    --bg-inset: #08090d;
    --panel: #16181f;
    --panel-alt: #141620;
    --control: #242834;
    --border: #23262f;
    --border-strong: #6b7280;
    --ink: #e6edf3;
    --muted: #8b93a1;
    --dim: #6b7280;
    --accent: #fcee0a;
    --accent-ink: #0b0c10;
    --brand-ink: #fcee0a;
    --brand-ink-invert: #0b0c10;
    --brand-split-cyan: #00f0ff;
    --brand-split-red: #ff003c;
    --link: #00f0ff;
    --focus: #00f0ff;
    --ok: #3fd68c;
    --warn: #ffb020;
    --alert: #ff5c7a;
    --stat-credits: #fcee0a;
    --stat-compute: #00f0ff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c10;
  --bg-inset: #08090d;
  --panel: #16181f;
  --panel-alt: #141620;
  --control: #242834;
  --border: #23262f;
  --border-strong: #6b7280;
  --ink: #e6edf3;
  --muted: #8b93a1;
  --dim: #6b7280;
  --accent: #fcee0a;
  --accent-ink: #0b0c10;
  --brand-ink: #fcee0a;
  --brand-ink-invert: #0b0c10;
  --brand-split-cyan: #00f0ff;
  --brand-split-red: #ff003c;
  --link: #00f0ff;
  --focus: #00f0ff;
  --ok: #3fd68c;
  --warn: #ffb020;
  --alert: #ff5c7a;
  --stat-credits: #fcee0a;
  --stat-compute: #00f0ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-size: var(--font-size-base);
  line-height: 1.5;
  font-family:
    ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

h1,
h2,
p,
ol,
ul,
dl,
dd,
figure {
  margin: 0;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

/* --- The frame ------------------------------------------------------------ */

.page {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.head {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.brand-heading {
  font-size: inherit;
  font-weight: inherit;
}

.brand {
  display: inline-flex;
  align-items: stretch;
  gap: 0.75rem;
  color: var(--brand-ink);
  text-decoration: none;
}

.mark {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.mark-block {
  fill: var(--brand-ink);
}

.mark-text {
  fill: var(--brand-ink-invert);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.back {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.foot ul,
.filters ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.main {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.foot {
  border-top: 1px solid var(--border);
  margin: 0 1rem;
  padding: 0.75rem 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

.foot .current {
  font-weight: 700;
}

.notice {
  margin: 1rem 1rem 0;
  border: 2px solid var(--warn);
  background: var(--panel);
  padding: 0.5rem 0.75rem;
}

.notice-head {
  font-weight: 700;
  color: var(--warn);
}

/* --- The wordmark ----------------------------------------------------------
 * tokens.css's lockup, rule for rule: two offset channels behind the words
 * and two tear-lines in the header's surface across them. */

.wordmark-lockup {
  position: relative;
  display: inline-block;
  line-height: 1;
  z-index: 0;
  color: var(--brand-ink);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.wordmark-lockup::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: 0.145em;
  height: 0.13em;
  background: var(--panel);
}

.wordmark-lockup::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 42%;
  width: 40%;
  top: 0.51em;
  height: 0.105em;
  background: var(--panel);
}

.wordmark-decoys {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.wordmark-decoys::before,
.wordmark-decoys::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
}

.wordmark-decoys::before {
  color: var(--brand-split-cyan);
  opacity: 0.85;
  transform: translateX(-0.085em);
}

.wordmark-decoys::after {
  color: var(--brand-split-red);
  opacity: 0.7;
  transform: translateX(0.085em);
}

@keyframes wordmark-split-cyan {
  0%,
  98%,
  100% {
    transform: translateX(-0.085em);
  }
  96% {
    transform: translateX(-0.135em);
  }
  97% {
    transform: translateX(-0.05em);
  }
}

@keyframes wordmark-split-red {
  0%,
  98%,
  100% {
    transform: translateX(0.085em);
  }
  96% {
    transform: translateX(0.135em);
  }
  97% {
    transform: translateX(0.045em);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .wordmark-decoys::before {
    animation: wordmark-split-cyan 14s steps(1, end) infinite;
  }
  .wordmark-decoys::after {
    animation: wordmark-split-red 14s steps(1, end) infinite;
  }
}

/* --- Panels and text ---------------------------------------------------------- */

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 1rem;
}

.narrow {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
}

.panel-title {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.prose {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prose h2,
.guide h2 {
  margin-top: 0.5rem;
  font-size: 1em;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.rules h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: normal;
  text-transform: none;
}

/*
 * Lists that show a number or a bullet keep it inside the content box: the
 * marker sits in the list's own padding, which is wide enough for two
 * digits and the point, rather than hanging out past the text's left edge.
 */
ol,
ul {
  padding-inline-start: 2.5em;
  list-style-position: outside;
}

ul {
  padding-inline-start: 1.75em;
}

.prose li + li,
.guide li + li {
  margin-top: 0.25rem;
}

.rules li + li {
  margin-top: 0.75rem;
}

.strong {
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.ok {
  color: var(--ok);
}

.player-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-width: 0;
}

.player-title,
.player-name {
  overflow-wrap: anywhere;
  min-width: 0;
}

.label {
  font-weight: 700;
}

/* --- Forms ------------------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field > label,
.field > legend {
  padding: 0;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  background: var(--bg-inset);
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

input[type="radio"],
input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--link);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
}

/* A field's description is the 12px step on a 20px line, as in the app
 * (src/theme/type.ts's TEXT_SMALL). */
.hint {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.25rem;
}

.field-error,
.form-error {
  color: var(--alert);
  overflow-wrap: anywhere;
}

.form-links {
  margin-top: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid var(--border-strong);
  background: var(--control);
  box-shadow: 0 2px 0 var(--border-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  align-self: flex-start;
}

/* A button is filled and raised, and loses its lower edge while pressed, so
 * it never reads as a label (the app's own buttons, src/theme/buttons.ts). */
.button:active {
  transform: translateY(2px);
  box-shadow: none;
}

.button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

/* The support form names the player only for the kinds that are about one,
 * and labels the note for the kind chosen. */
.support-form:has(#support-kind-question:checked) .support-name {
  display: none;
}

.support-form:has(#support-kind-question:checked)
  .note-for:not(.note-for-question),
.support-form:has(#support-kind-multi_account:checked)
  .note-for:not(.note-for-multi_account),
.support-form:has(#support-kind-player:checked)
  .note-for:not(.note-for-player) {
  display: none;
}

/* --- The landing page ------------------------------------------------------- */

.play {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  border: 1px solid var(--border);
  background: var(--panel);
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 0.625rem 0.75rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 3px solid transparent;
}

.tab[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
  background: var(--bg-inset);
}

/* Both forms are drawn in the one cell, the other tab's invisible, so the
 * box is always as tall as the taller of the two and switching tabs moves
 * nothing under it (the owner's play of 2026-10-01: the page jumped). An
 * invisible form takes no focus and is not read out. */
.tab-panel {
  padding: 1rem;
  display: grid;
}

.tab-pane {
  grid-area: 1 / 1;
  min-width: 0;
}

.tab-pane-hidden {
  visibility: hidden;
}

.guide {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline,
.faq,
.figures {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline > div {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) 1fr;
  gap: 0 1rem;
}

.timeline dt,
.faq dt {
  font-weight: 700;
}

@media (width < 40rem) {
  .timeline > div {
    grid-template-columns: 1fr;
  }
}

/* --- Tables, figures and news ------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 26rem;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: var(--bg-inset);
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

th,
td {
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}

.figures dt {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.figures dd {
  font-weight: 700;
}

.filters {
  margin-bottom: 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border-strong);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.chip[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.news-item + .news-item {
  margin-top: 1.25rem;
}

.news-item h2 {
  font-size: 1em;
  font-weight: 700;
}

.meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
}
