/* Shared paper, chrome, forms, auth, footer.
   Tokens live in ./tokens.css so Pages can ship without the design-system junction. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700;800&family=Sora:wght@500;600;700&display=swap");
@import url("./tokens.css?v=5ba10a6bf2d654655f2c972a254d9669690195ad");

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .hero-title, .top h1 {
  font-family: var(--font-display);
}

body {
  background-image:
    var(--washi),
    radial-gradient(1100px 520px at 8% -12%, var(--paper-bright) 0%, transparent 58%);
  background-size: 180px 180px, auto;
  overflow-x: hidden;
}

.page,
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 22px 28px 48px;
}

/* Header/footer chrome: shared/site-chrome.css */

/* —— Buttons & fields —— */
.btn,
button.primary,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--paper-shade, #FFF6DF);
  color: var(--ink-strong, #2B2419);
  text-decoration: none;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.btn:hover { border-color: var(--cta, #C88708); background: color-mix(in srgb, var(--cta, #C88708) 18%, var(--paper-shade, #FFF6DF)); }

.btn.primary,
button.primary {
  background: var(--cta, #946526);
  color: var(--cta-ink, #FFF9E8);
  border-color: var(--cta, #946526);
  font-weight: 500;
}

.btn.primary:hover,
button.primary:hover { background: var(--cta-hover, #7E541F); border-color: var(--cta-hover, #7E541F); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 8px 12px;
}

textarea { min-height: 8rem; resize: vertical; }

.name-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  margin: 0 0 20px;
  max-width: 22rem;
}

@media (max-width: 760px) {
  .name-form {
    width: var(--mobile-content-width, 95%);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }
}

.name-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.name-form input,
.name-form textarea,
.name-form select { width: 100%; min-width: 0; }

.name-form input:focus-visible,
.name-form textarea:focus-visible,
.name-form select:focus-visible {
  border-color: var(--cta, #C88708);
}

.name-form .btn,
.name-form button { width: 100%; }

.name-form .field-error {
  display: block;
  margin: 4px 0 0;
  color: var(--danger, #b42318);
  font-size: 0.8rem;
  font-weight: 500;
}

.name-form .field-error[hidden] { display: none; }

.name-form .password-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.name-form .password-row input { flex: 1; }

.name-form .pw-toggle {
  width: auto;
  min-width: 4.5rem;
  padding: 8px 10px;
}

.name-form .field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  line-height: 1.4;
}

/* —— Home hero + cards —— */
.hero {
  margin: 8px 0 36px;
  padding: 8px 0 4px;
}

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

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.hero-lead {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.5;
}

.games > .card {
  transition: none;
}

.games > .card:hover {
  transform: none;
  box-shadow: none;
}

.continue-link {
  border-radius: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
}

.home-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 32px 0 8px;
}

.home-panel,
.board-shell {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.home-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 0 12px;
}

.home-panel-head h2 {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink);
  font-weight: 600;
}

.times-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.times-table thead,
.times-table tbody,
.times-table tr {
  width: 100%;
}

.times-table tbody tr {
  border-bottom: 1px solid var(--line);
}

.times-table th,
.times-table td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
  border: 0;
  box-sizing: border-box;
}

.times-table thead th {
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
}

.times-table th:first-child,
.times-table td:first-child {
  width: 2.4rem;
  color: var(--gold);
  font-weight: 600;
}

.times-table th:last-child,
.times-table td:last-child {
  width: 7.2rem;
  text-align: right;
  white-space: nowrap;
}

.times-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.times-name .lb-star {
  margin-left: 0.2em;
}

@media (max-width: 430px) {
  .times-table th:last-child,
  .times-table td:last-child {
    width: 5.6rem;
    white-space: normal;
    line-height: 1.2;
  }
}

.times-table tbody tr:last-child {
  border-bottom: 0;
}

.times-rank {
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.times-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.times-game {
  color: var(--muted);
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.times-time {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: right;
}

.board-head { margin: 0 0 16px; }
.board-head h1 { font-size: 1.7rem; letter-spacing: 0.02em; }
.board-note,
.home-panel .lede {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.board-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 0 0 16px;
}

.board-filters label,
.board-filters .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.board-filters select { min-width: 10rem; }

.times-list {
  list-style: none !important;
  margin: 0;
  padding: 0;
}

.times-empty {
  margin: 0;
  padding: 18px 4px 8px;
  color: var(--muted);
  text-align: center;
}

td.times-empty {
  text-align: center;
}

.read-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.read-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.read-list a:hover { color: var(--gold); }
.read-list li:last-child a { border-bottom: 0; }

@media (max-width: 760px) {
  .home-split {
    grid-template-columns: 1fr;
  }
}

/* —— Auth —— */
.auth-shell {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  padding: 12px 0 36px;
}

.auth-card {
  width: min(26rem, 100%);
  padding: 8px 0 24px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  position: relative;
}

.auth-card::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--gold);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
  letter-spacing: 0.03em;
}

.auth-lead {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.45;
}

.auth-card .name-form { max-width: none; margin-bottom: 4px; }

.auth-or {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-or::before,
.auth-or::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-or[hidden] { display: none; }

.auth-ok {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cta, #C88708) 12%, var(--paper-bright));
  color: var(--ink);
  line-height: 1.45;
}

.auth-ok[hidden] { display: none; }

.auth-links,
.auth-alt {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: center;
}

.auth-alt {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
}

.auth-links a,
.auth-alt a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}

.auth-links a:hover,
.auth-alt a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.auth-alt-dot {
  color: var(--line);
}

button.auth-google,
.auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  min-width: 44px;
  margin: 4px 0 18px;
  padding: 10px 16px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  z-index: 1;
}

button.auth-google:hover,
.auth-google:hover { background: var(--btn-hover); }

.auth-google-mark {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: block;
}

button.auth-google:focus-visible,
.auth-google:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

button.auth-google:disabled,
.auth-google:disabled,
.auth-google[aria-disabled="true"] {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--paper);
}

button.auth-google[hidden],
.auth-google[hidden] {
  display: none;
}

html[data-ds-theme="dark"] input:-webkit-autofill,
html[data-ds-theme="dark"] input:-webkit-autofill:hover,
html[data-ds-theme="dark"] input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--paper-bright) inset;
  caret-color: var(--ink);
  transition: background-color 99999s ease-out;
}

.auth-google-hint {
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.err { color: var(--bad); }

/* —— Start gate —— */
.start-card {
  box-shadow: none;
  position: relative;
}

.start-card::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--gold);
}

.start-card h2 {
  letter-spacing: 0.04em;
}

.start-card .primary {
  width: auto;
  margin-top: 8px;
  min-height: 36px;
  padding: 0;
  background: transparent;
  color: var(--accent);
  border: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.start-gate.is-dismissed { display: none !important; }

button.is-busy,
.btn.is-busy {
  opacity: 0.72;
  cursor: wait;
  pointer-events: none;
}

@media (max-width: 760px) {
  .page {
    width: var(--mobile-content-width, 95%);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    padding: 12px 0 36px;
  }

  .hero-title { font-size: clamp(2rem, 10vw, 2.6rem); }

  .auth-card {
    width: var(--mobile-content-width, 95%);
    max-width: none;
    padding: 8px 0 18px;
  }
}

@media (max-width: 390px) {
  .auth-shell { padding: 8px 0 28px; }
}

.legal-id {
  margin: 0 0 16px;
  line-height: 1.55;
}

.publisher-card {
  margin: 12px 0 20px;
  padding: 12px;
  max-width: 28rem;
  background: #FBF6EA;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.publisher-card figcaption {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.publisher-card img {
  display: block;
  width: 100%;
  height: auto;
}

.publisher-name {
  display: inline-block;
  height: 1.4em;
  width: auto;
  max-width: 12rem;
  vertical-align: middle;
  margin-left: 8px;
  background: #FBF6EA;
  border-radius: 2px;
}
