/* Dune Scholars Play: the games site always uses the night palette (an "arcade" take on the brand).
   Used by every page in play/ (home, privacy, 404, move). Home-only rules use home-only classes. */
:root {
  --bg: #0B1B3D; --surface: #13264D; --ink: #F5ECD7; --heading: #F5ECD7; --muted: #C9C0A8; --line: #2C3D66; --field-line: #8A9A9A;
  --logo-tile: #0B1B3D; --accent: #C9A24A; --accent-soft: #2A2F3E; --on-accent: #0B1B3D; --link: #C9A24A; --eyebrow: #C9A24A; --focus: #C9A24A;
  --chrome: #13264D; --chrome-ink: #F5ECD7; --chrome-muted: #C9C0A8; --chrome-line: #2C3D66; --panel: #13264D; --panel-ink: #F5ECD7;
  --badge: #F5ECD7; --on-badge: #0B1B3D; --sky: #0E2147; --grid: rgba(201, 162, 74, 0.08); --card-line: rgba(201, 162, 74, 0.3);
  --band: var(--slate); --band-edge: var(--gold); /* page-head band: slate with a gold hairline, as in dark mode on the main site */
  color-scheme: dark;
}
.brand em { font-style: normal; color: var(--accent); }

/* site.css keeps these looks behind prefers-color-scheme: dark. The games site is always dark,
   so they apply here whatever the visitor's setting. */
.play .btn.primary { box-shadow: 0 0 0 1px rgba(212,175,90,.5), 0 0 22px rgba(212,175,90,.28); }
.play .card:hover { box-shadow: 0 0 0 1px rgba(212,175,90,.4), 0 0 24px rgba(212,175,90,.16); }
.play .cta { border-color: rgba(212,175,90,.35); box-shadow: 0 0 40px rgba(212,175,90,.08); }

/* ---------- Home: short intro ---------- */
/* Soft gold and blue glows behind the top of the page; they fade out under the cards (no hard edge). */
body.play-home {
  background:
    radial-gradient(ellipse 900px 520px at 88% 40px, rgba(212,175,90,.12), transparent 70%),
    radial-gradient(ellipse 760px 560px at 0% 320px, rgba(74,111,196,.13), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
}
.play-hero { background: transparent; }
.play-hero::before {
  -webkit-mask-image: radial-gradient(ellipse 70% 100% at 80% 0%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 100% at 80% 0%, #000 20%, transparent 75%);
}
.play-hero .wrap { padding-block: clamp(28px, 5vw, 52px) clamp(22px, 3.5vw, 34px); gap: 16px; }
.play-intro { display: flex; flex-direction: column; gap: 10px; }
.play-hero h1 { font-size: clamp(2rem, 4.6vw, 3rem); max-width: none; }
.play-hero .lede { font-size: clamp(1.02rem, 1.6vw, 1.15rem); color: var(--ink); max-width: 52ch; text-wrap: pretty; }
/* Facts read as a plain line of text with gold dots, not as buttons. */
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.facts li {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 .9rem/1.3 var(--f-body); letter-spacing: 0; text-transform: none; color: var(--heading);
  padding: 0;
}
.facts li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(212,175,90,.7); flex: none; }

/* ---------- Home: game cards ---------- */
.games-band { padding-block: 4px clamp(32px, 5vw, 48px); }
.games-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 700px) { .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; } }
.game { position: relative; background: var(--surface); border-color: rgba(212,175,90,.28); }
.game .card-art { border-block-end: 1px solid var(--line); position: relative; }
/* A few seconds of the game, over its own picture, for whoever hovers. It is
   never fetched until then, so the page costs the same as it always did. */
.card-loop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .4s ease; pointer-events: none; }
.card-art.playing .card-loop { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .card-loop { display: none; } }
.game .card-art img { object-position: center; }
.game .card-body { padding: 18px 20px 20px; gap: 8px; }
.game-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.game h3 { font-size: clamp(1.25rem, 2vw, 1.4rem); line-height: 1.25; }
.game h3 .subtitle { display: block; font-size: .9rem; font-weight: 500; color: var(--muted); margin-block-start: 2px; }
.game .card-body p { color: var(--ink); opacity: .86; }
.game .card-body .actions { padding-block-start: 10px; }
.game .tag.status { background: rgba(212,175,90,.12); color: var(--heading); border-color: var(--accent); }
.game .card-art picture { display: contents; }
/* Wide screens: all four games side by side, so every Play button is on the first screen. */
@media (min-width: 1080px) {
  .games-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
  .game .card-body { padding: 16px 18px 18px; }
  .game h3 { font-size: 1.15rem; }
}

/* Play button: big tap target, and its ::after covers the whole card so a tap anywhere on it plays. */
.play-link { min-height: 48px; padding: 13px 26px; font-size: 1.05rem; }
.play-link::before { content: ""; width: 11px; height: 13px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); flex: none; }
.play-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
[dir="rtl"] .play-link::before { transform: scaleX(-1); }
.game:hover { border-color: rgba(212,175,90,.7); box-shadow: 0 0 0 1px rgba(212,175,90,.45), 0 0 28px rgba(212,175,90,.2); }
.game:hover .play-link { filter: brightness(1.08); }
/* Keyboard focus: one ring around the whole card (mouse clicks do not trigger it). */
/* (Separate from the :hover rule so browsers without :has() still get the hover style.) */
.game:has(.play-link:focus-visible) { border-color: rgba(212,175,90,.7); box-shadow: 0 0 0 1px rgba(212,175,90,.45), 0 0 28px rgba(212,175,90,.2); outline: 3px solid var(--focus); outline-offset: 3px; }
@supports selector(:has(*)) { .game .play-link:focus-visible { outline: none; } } /* older browsers keep the button's own ring */
@media (prefers-reduced-motion: no-preference) {
  .game { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
  .game .card-art img { transition: transform .4s ease; }
  .game:hover { transform: translateY(-3px); }
  .game:hover .card-art img { transform: scale(1.03); }
}
.games-band .more-soon { margin-block-start: 22px; color: var(--muted); font-size: .98rem; }

/* Ad spaces (games site): hidden unless src/play-worker.js puts an ad in them. Kept clearly apart
   from the games, with a label, as Google recommends for games pages. */
.ad-space:not([data-filled]) { display: none; }
.ad-space { margin-block: 48px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; min-height: 120px; }
.ad-space .ad-label { margin: 0 0 8px; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ad-wrap:has(.ad-space:not([data-filled])) { display: none; }

/* ---------- Home: link to the educational games ---------- */
.play .learn-band { padding-block: 8px 0; }

/* Quick links to every game, with each game's logo (top of the games home page): icon-over-name
   tiles, four to a row on a phone so the first game card still shows on the first screen, and all
   seven in one row on wider screens. A longer name wraps to a second line; the tiles stay level. */
.quick-play ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .quick-play ul { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; } }
.quick-play li { display: flex; min-width: 0; }
.quick-play a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; min-width: 0;
  padding: 10px 4px 8px; border: 1px solid rgba(212,175,90,.35); border-radius: 14px; background: rgba(255,255,255,.04);
  color: var(--heading); font-size: .82rem; font-weight: 500; line-height: 1.2; text-align: center; text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.quick-play a:hover { border-color: var(--accent); background: rgba(212,175,90,.10); }
.quick-play a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.quick-play img { width: 48px; height: 48px; flex: none; border-radius: 12px; }
.quick-play a span { overflow-wrap: anywhere; }
@media (min-width: 700px) { .quick-play a { font-size: .92rem; padding: 12px 6px 10px; } .quick-play img { width: 52px; height: 52px; } }
@media (prefers-reduced-motion: no-preference) { .quick-play a:hover { transform: translateY(-1px); } }
/* Each game's logo next to its name on the cards. */
.game-head { align-items: center; }
.game-logo { width: 48px; height: 48px; flex: none; border-radius: 12px; }
.game-head { justify-content: flex-start; }
.game-head h3 { flex: 1 1 10ch; min-width: 0; }

/* ---------- Account page (/account/) ---------- */
.account-app { display: flex; flex-direction: column; gap: 22px; max-width: 760px; }
.account-panel {
  background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius);
  padding: clamp(18px, 3vw, 26px); display: flex; flex-direction: column; gap: 14px; max-width: 760px;
}
#view-account { display: flex; flex-direction: column; gap: 22px; }
#view-account[hidden], .account-app [hidden] { display: none; }
.account-panel h2, .account .prose h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); }
.account-panel h3 { font-size: 1.1rem; }
.account-message:empty { display: none; }
.account-form { display: flex; flex-direction: column; gap: 14px; }
.account-form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.account-form legend { font-weight: 600; color: var(--heading); margin-block-end: 8px; padding: 0; }
.account-form .field input { background: var(--bg); border-color: var(--field-line); }
.choice { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.4; }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
#add-form { border-block-start: 1px solid var(--line); padding-block-start: 18px; }
.btn.small { padding: 10px 16px; font-size: .92rem; min-height: 44px; }
.btn.danger { border-color: #E07A6A; color: #F4B4A8; }
.btn.danger:hover { background: rgba(224,122,106,.14); }
.danger-zone { border-color: rgba(224,122,106,.45); }
.confirm-box { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; border: 1px solid rgba(224,122,106,.6); border-radius: 12px; background: rgba(224,122,106,.07); }
.profile-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.profile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.03); }
.profile.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(212,175,90,.35); }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
/* Body font, not the display font: Cinzel has capitals only and draws 1 like I, so nicknames would
   not look as typed ("Kai1" and "KaiI", "sam" and "Sam" would look the same). */
.profile-name { font-family: var(--f-body); font-weight: 700; font-size: 1.1rem; color: var(--heading); overflow-wrap: anywhere; border-radius: 4px; }
.profile-name:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.profile-name:focus:not(:focus-visible) { outline: none; }
.profile .tag.status { background: rgba(212,175,90,.12); color: var(--heading); border-color: var(--accent); }
.profile .actions { gap: 8px; }
.profile > form, .profile > .confirm-box { flex: 1 1 100%; }
.signin { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-block-start: 8px; }
/* An error under a form field (linked to it with aria-describedby). */
.field-error { margin: 2px 0 0; color: #F4B4A8; font-weight: 600; font-size: .95rem; }
.field-error::before { content: "! "; }
.account-form input[aria-invalid="true"] { border-color: #E07A6A; }
#view-under13:focus { outline: none; }

/* Privacy page: blocks shown only while accounts are on (or off) take part in the page's layout
   as if the wrapper were not there. */
.wrap.prose > div[data-ds-accounts] { display: contents; }
.wrap.prose > div[data-ds-accounts] > * { max-width: 66ch; }

/* Phones without the menu script (assets/js/nav.js): Games, Privacy, Account and the main-site
   link fit on one row of the header. With the script the links are in the Menu, all of them. */
@media (max-width: 480px) {
  body.play .site-header:not(.has-menu) .wrap { gap: 8px 12px; }
  body.play .site-header:not(.has-menu) .nav { gap: 2px 0; }
  body.play .site-header:not(.has-menu) .nav a { padding: 10px 7px; }
}
@media (max-width: 420px) {
  /* Too narrow for four links: the link to the main site is left to the footer ("dunescholars.com"). */
  body.play .site-header:not(.has-menu) .nav a[href="https://dunescholars.com/"] { display: none; }
}
/* A long nickname in the header's Account link (pages without ads) is shortened on phones. */
@media (max-width: 480px) {
  body.play .nav a[data-ds-account-link] { max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 1100px) {
  body.play .site-header.has-menu .nav a[data-ds-account-link] { max-width: none; }
}

/* ---------- Leaderboards (/leaderboards/ and the Account page's Leaderboards panel) ---------- */
.lb-app { display: flex; flex-direction: column; gap: 18px; }
.lb-about { max-width: 66ch; color: var(--ink); }
.lb-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.lb-toolbar p { margin: 0; }
/* Week / all-time toggle: two pill buttons, the chosen one gold (aria-pressed, not colour alone: it also gets a tick). */
.lb-period { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 4px; border: 1px solid var(--card-line); border-radius: var(--pill); background: var(--surface); }
.lb-toggle {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--pill); background: transparent; color: var(--ink); cursor: pointer;
  font: 500 var(--fs-label)/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase;
}
.lb-toggle:hover { background: rgba(245, 236, 215, 0.10); }
.lb-toggle[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
/* The tick is a span with aria-hidden in the HTML, so it is not part of the button's name. */
.lb-toggle .lb-tick { display: none; }
.lb-toggle[aria-pressed="true"] .lb-tick { display: inline; }
.lb-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.lb-board-field { flex-direction: row; align-items: center; gap: 10px; }
.lb-board-field select { width: auto; min-height: 44px; background: var(--bg); }
.lb-board-field[hidden] { display: none; }
.lb-list { display: flex; flex-direction: column; gap: 18px; }
.lb-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 860px) { .lb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lb-game { gap: 12px; min-width: 0; }
.lb-single { max-width: 760px; }
.lb-game-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-game-head h2, .lb-game-head h3 { flex: 1 1 auto; min-width: 0; font-size: clamp(1.2rem, 2.4vw, 1.45rem); }
.lb-game-head .game-logo { width: 40px; height: 40px; }
.lb-more { flex: none; font-weight: 600; white-space: nowrap; }
.lb-empty { margin: 0; }
.lb-table { width: 100%; border-collapse: collapse; font-size: .98rem; font-variant-numeric: tabular-nums; }
.lb-table th { text-align: start; font: 500 var(--fs-label)/1.3 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 8px 8px; border-block-end: 1px solid var(--line); }
.lb-table td { padding: 9px 8px; border-block-end: 1px solid var(--line); vertical-align: top; }
.lb-table tbody tr:last-child td { border-block-end: 0; }
.lb-table th:first-child, .lb-table td:first-child { padding-inline-start: 0; }
.lb-table th:last-child, .lb-table td:last-child { padding-inline-end: 0; }
.lb-table .lb-rank { width: 3.2em; color: var(--muted); }
.lb-table td.lb-rank { font-weight: 600; color: var(--heading); }
/* Names break between words; only a single word too long for the column is split. */
.lb-table .lb-name { overflow-wrap: break-word; font-weight: 600; color: var(--heading); }
.lb-table .lb-score { text-align: end; white-space: nowrap; }
.lb-table .lb-date { text-align: end; white-space: nowrap; color: var(--muted); }
/* The top three get a gold rank number. */
.lb-table tbody tr:nth-child(-n+3) td.lb-rank { color: var(--accent); }
.lb-table .lb-rank-note { white-space: nowrap; }
@media (max-width: 480px) {
  .lb-table { font-size: .92rem; }
  .lb-table th, .lb-table td { padding-inline: 5px; }
  .lb-table .lb-rank { width: 2.4em; }
}
/* Very narrow screens: give the player's name room; the date ("10 Nov 2026") and "(rank N)" wrap instead. */
@media (max-width: 379px) {
  .lb-table .lb-date, .lb-mine .lb-table .lb-score { white-space: normal; }
}

/* "Report name" on each public leaderboard row: a small flag button, the word shown from 481px up;
   the confirmation opens in a row of its own under the name. */
.lb-table .lb-act { width: 1%; text-align: end; padding-inline-start: 4px; }
.lb-table td.lb-act { vertical-align: middle; padding-block: 2px; }
.lb-report {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; min-height: 40px;
  padding: 6px 10px; border: 1px solid transparent; border-radius: var(--pill); background: transparent;
  color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer;
}
.lb-report:hover { color: var(--heading); border-color: var(--card-line); background: rgba(255,255,255,.05); }
.lb-report:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.lb-report[aria-expanded="true"] { color: var(--heading); border-color: var(--accent); }
.lb-report.is-done { color: var(--muted); opacity: .75; }
.lb-report svg { flex: none; }
.lb-table tr.lb-report-row td { padding-block: 4px 12px; }
.lb-report-box { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid var(--card-line); border-radius: 12px; background: rgba(255,255,255,.04); white-space: normal; }
.lb-report-box p { margin: 0; overflow-wrap: anywhere; }
.lb-report-box .actions { gap: 8px; }
@media (max-width: 480px) {
  .lb-report { padding: 6px; }
  .lb-report .lb-report-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 379px) {
  /* Room for a long game name next to the flag on the narrowest phones. */
  .lb-table .lb-act { padding-inline-start: 0; }
  .lb-report { min-width: 32px; min-height: 36px; padding: 4px; }
  .lb-public .lb-rank { width: 2em; }
  .lb-public th, .lb-public td { padding-inline: 3px; }
}
/* Account page: a profile a moderator has hidden from the public leaderboards. */
.lb-hidden-note { margin: 0; padding: 10px 12px; border: 1px solid rgba(224,122,106,.6); border-radius: 10px; background: rgba(224,122,106,.07); }

/* Account page: one block per profile. */
.lb-profiles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.lb-profile { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.03); }
.lb-profile h3 { font-family: var(--f-body); font-weight: 700; font-size: 1.1rem; color: var(--heading); overflow-wrap: anywhere; }
.lb-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.lb-name-row p { margin: 0; }
.lb-game-name { font-weight: 700; color: var(--accent); }
.lb-switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; line-height: 1.4; }
.lb-switch input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.lb-reauth { border-color: var(--card-line); background: rgba(255,255,255,.04); }
.lb-reauth p { margin: 0; }
.lb-profile h4 { font-family: var(--f-body); font-size: 1rem; font-weight: 600; color: var(--heading); margin: 0; }
.lb-mine .lb-table td.lb-rank { font-weight: 500; }
