/* ==========================================================================
   ScorePerch — glass theme (shared look with MusicalSlides)
   No inline styles anywhere: the pages' CSP is style-src 'self'.
   ========================================================================== */

/* Wordmark font: Cormorant Garamond (SIL Open Font License, /fonts/OFL.txt). */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-600.woff2") format("woff2");
}

@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-600-italic.woff2") format("woff2");
}

:root {
  --accent: #ffb36b;
  --accent-soft: rgba(255, 179, 107, 0.16);
  --text: #f7f4ef;
  --text-dim: rgba(247, 244, 239, 0.72);
  --glass: rgba(16, 16, 24, 0.55);
  --glass-strong: rgba(18, 18, 27, 0.92);
  --glass-border: rgba(255, 255, 255, 0.14);
  --gold: #ffd36b;
  --silver: #d9dee8;
  --bronze: #e0a07a;
  --radius: 20px;
  --radius-pill: 999px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background-color: #12121a;
  overflow-x: hidden;
}

/* ---------- Background ---------- */

.bg-fallback,
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-fallback {
  z-index: 0;
  background: linear-gradient(160deg, #252c42 0%, #171a26 45%, #0e1017 100%);
}

.bg-glow {
  z-index: 1;
  background:
    radial-gradient(ellipse 60% 45% at 85% 0%, rgba(255, 179, 107, 0.18), transparent 70%),
    radial-gradient(ellipse 55% 50% at 5% 100%, rgba(120, 140, 255, 0.14), transparent 70%);
}

/* ---------- Page layout ---------- */

.page {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 18px 20px 14px;
}

.page > section,
.page > article {
  width: min(820px, 100%);
}

/* ---------- Header ---------- */

.site-header {
  width: min(1000px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-home { color: inherit; text-decoration: none; }

.brand-mark {
  color: var(--accent);
  filter: drop-shadow(0 4px 14px rgba(255, 179, 107, 0.45));
}

/* Wordmark: "Score" upright, "Perch" in orange italic. */
.brand-name {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.6vw, 46px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.5);
}

.brand-name em { font-style: italic; color: var(--accent); }

.site-nav {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  transition: background 0.2s ease, color 0.2s ease;
}

.site-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }

.site-nav a.active { color: #1b1308; background: var(--accent); }

/* ---------- Glass surfaces ---------- */

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow);
}

.card {
  border-radius: 24px;
  padding: 26px 30px;
}

.narrow { width: min(620px, 100%) !important; }

.dim { color: var(--text-dim); }

.small { font-size: 13px; }

.strong { font-weight: 600; }

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

h1 { font-size: 28px; line-height: 1.2; }

h2 { font-size: 19px; margin-bottom: 10px; }

a { color: var(--text); }

.card p a,
.policy a {
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  text-decoration: none;
}

.card p a:hover,
.policy a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Home ---------- */

.hero {
  text-align: center;
  padding: 26px 10px 6px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 600;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.5);
}

.lead {
  margin: 12px auto 0;
  max-width: 560px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-dim);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 320px));
  justify-content: center;
  gap: 14px;
}

.game-card {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.game-card:hover { transform: translateY(-2px); border-color: rgba(255, 179, 107, 0.5); }

.game-card > span { display: flex; flex-direction: column; gap: 4px; }

.game-card strong { font-size: 18px; }

.game-card .dim { font-size: 14px; }

.game-icon {
  border-radius: 22%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  flex: none;
}

/* ---------- Game page ---------- */

.game-head {
  display: flex;
  align-items: center;
  gap: 22px;
}

.game-head p { margin-top: 8px; line-height: 1.6; }

.store-links { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #1b1308 !important;
  font: 600 14px var(--font);
  padding: 8px 16px;
  text-decoration: none;
  cursor: pointer;
}

.pill.ghost {
  background: transparent;
  color: var(--text) !important;
  border-color: var(--glass-border);
}

.pill:hover { filter: brightness(1.08); }

.board-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.board-bar h2 { margin: 0; }

.board-picker { display: flex; gap: 8px; }

.board-picker select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.08) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23f7f4ef' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center;
  color: var(--text);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  font: 14px var(--font);
  padding: 8px 38px 8px 16px;
}

.board-picker select option { color: #12121a; }

.js .js-hide { display: none; }

table.board {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 15px;
}

table.board th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 10px;
  border-bottom: 1px solid var(--glass-border);
}

table.board td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

table.board .num { text-align: right; font-variant-numeric: tabular-nums; }

table.board th.num { text-align: right; }

table.board .rank { width: 3em; color: var(--text-dim); }

table.board tr.podium-1 .rank { color: var(--gold); font-weight: 700; }

table.board tr.podium-2 .rank { color: var(--silver); font-weight: 700; }

table.board tr.podium-3 .rank { color: var(--bronze); font-weight: 700; }

table.board tbody tr:hover { background: rgba(255, 255, 255, 0.04); }

/* ---------- Policy / docs ---------- */

.policy h1 { margin-bottom: 6px; }

.policy .updated { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }

.policy h2 { font-size: 18px; margin: 26px 0 10px; color: var(--accent); }

.policy > h2:first-child { margin-top: 0; }

.policy h3 { font-size: 15px; margin: 18px 0 6px; }

.policy p,
.policy li {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-dim);
}

.policy p + p { margin-top: 10px; }

.policy ul { padding-left: 22px; margin: 8px 0; }

.policy strong { color: var(--text); }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--text);
}

pre {
  margin: 12px 0;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: auto;
  padding-top: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.site-footer nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.site-footer a { color: var(--text-dim); text-decoration: none; }

.site-footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .page { padding: 12px 14px 10px; gap: 16px; }
  .site-header { justify-content: center; }
  .card { padding: 22px 18px; }
  .game-head { flex-direction: column; text-align: center; }
  .store-links { justify-content: center; }
  .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .game-card,
  .site-nav a { transition: none; }
}

/* ---------- Generated game privacy page ---------- */

.policy .notice {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 179, 107, 0.35);
  color: var(--text);
  font-size: 14px;
}

.policy ol.steps { padding-left: 22px; margin: 8px 0; }

.policy ol.steps li { font-size: 15px; line-height: 1.65; color: var(--text-dim); margin-bottom: 6px; }

.cta { margin-top: 14px; }
