/* Railmache site styles. Shared by every page. Colours come from Art/design-reference/palette.md. */
:root {
  --paper: #F7F0E4;
  --paper-2: #EFE6D6;
  --card: #FFFAF2;
  --line: #E5D7C2;
  --ink: #3A2E28;
  --ink-2: #5A4B40;
  --ink-3: #6F5F53;
  --clay: #B5523B;
  --red: #E0524A;          /* trains, histograms */
  --btn-red: #C63D36;      /* buttons: darker so white text passes AA */
  --btn-red-shadow: #8F2B26;
  --night: #201C30;
  --night-2: #2A2540;
  --wood: #C4945E;
  --font-body: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-slab: "Alfa Slab One", Georgia, serif;
  --shadow-card: 0 2px 0 rgba(58,46,40,.06), 0 10px 26px rgba(58,46,40,.10);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { overflow-x: hidden; overflow-x: clip; margin: 0; font-family: var(--font-body); color: var(--ink); background: var(--paper); line-height: 1.5; -webkit-text-size-adjust: 100%; }
img { max-width: 100%; }
a { color: var(--clay); }
a:hover { color: #8E3C2A; }
:focus-visible { outline: 3px solid #2F63B8; outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding-top: 88px; padding-bottom: 88px; }
.slab { font-family: var(--font-slab); font-weight: 400; line-height: 1.1; margin: 0; }
h2.slab { font-size: clamp(2rem, 4vw, 3rem); }
.eyebrow { margin: 0; font-size: 14px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--clay); }
.lead { margin: 0; font-size: 1.15rem; line-height: 1.6; color: var(--ink-2); }
.note { margin: 0; font-size: 14px; color: var(--ink-3); }

/* header */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding-top: 14px; padding-bottom: 14px; }
.site-nav .logo { display: block; line-height: 0; }
.site-nav .logo img { height: 64px; width: auto; }
.site-nav .spacer { flex: 1 1 auto; }
.site-nav .navlink { color: var(--ink); text-decoration: none; font-weight: 800; font-size: 17px; padding: 10px 4px; border-bottom: 3px solid transparent; }
.site-nav .navlink:hover { border-bottom-color: var(--wood); color: var(--ink); }
.site-nav .navlink[aria-current="page"] { border-bottom-color: var(--red); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px; border-radius: 14px; border: 0; cursor: pointer; font-family: inherit; font-weight: 900; font-size: 18px; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px); }
.btn-red { background: var(--btn-red); color: #FFFAF2; box-shadow: 0 4px 0 var(--btn-red-shadow), 0 8px 18px rgba(58,46,40,.18); }
.btn-red:hover { color: #fff; }
.btn-light { background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--wood), 0 8px 18px rgba(58,46,40,.12); }
.btn-light:hover { color: var(--ink); }
.btn-dark { background: var(--night-2); color: #FFFAF2; box-shadow: 0 4px 0 #14111F; }
.btn-dark:hover { color: #fff; }
.btn-small { min-height: 46px; font-size: 16px; padding: 0 18px; }
.btn[aria-disabled="true"] { background: #5B536E; box-shadow: 0 4px 0 #3A344A; cursor: default; }
.btn[aria-disabled="true"]:hover { transform: none; }

/* cards */
.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-card); }

/* hero */
.hero { position: relative; overflow: hidden; background: #D7ECF5; }
.hero .sun { position: absolute; right: 12%; top: 64px; width: 96px; height: 96px; border-radius: 50%; background: #EE7A4C; box-shadow: 0 6px 14px rgba(58,46,40,.15); }
.parallax { position: absolute; left: 0; right: 0; height: 400px; background-repeat: repeat-x; background-size: auto 100%; }
.px-far { bottom: 120px; background-image: url(assets/bg-far.svg); animation: drift 160s linear infinite; }
.px-mid { bottom: 60px; background-image: url(assets/bg-mid.svg); animation: drift 100s linear infinite; }
.px-near { bottom: 0; background-image: url(assets/bg-near.svg); animation: drift 60s linear infinite; }
@keyframes drift { from { background-position-x: 0; } to { background-position-x: -1600px; } }
@media (prefers-reduced-motion: reduce) { .parallax { animation: none !important; } html { scroll-behavior: auto; } .btn { transition: none; } }
.hero-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 28px; text-align: center; padding-top: 64px; }
.pill { margin: 0; display: inline-flex; padding: 8px 16px; border-radius: 999px; background: var(--card); font-weight: 900; font-size: 15px; letter-spacing: .06em; box-shadow: 0 2px 0 var(--line); }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); max-width: 900px; }
.hero .lead { max-width: 640px; color: var(--ink); font-size: 1.25rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }

/* trailer slot */
.trailer { position: relative; width: min(960px, 100%); margin: 12px auto -6px; aspect-ratio: 16 / 9; border-radius: 22px 22px 0 0; overflow: hidden; background: var(--night); box-shadow: 0 18px 24px rgba(20,30,20,.28); border: 8px solid var(--night-2); border-bottom: 0; }
.trailer iframe, .trailer video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.trailer .poster { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #D7ECF5; }
.trailer .poster img { width: 86%; height: auto; filter: drop-shadow(0 10px 14px rgba(20,30,20,.25)); }
.trailer .badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-radius: 999px; background: rgba(32,28,48,.9); color: #FFFAF2; font-weight: 900; font-size: 18px; white-space: nowrap; }
.trailer .badge svg { flex: none; }

/* sections */
.split { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.split > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.bg-paper-2 { background: var(--paper-2); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.step { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.step .icon { width: 96px; height: 96px; border-radius: 16px; background: #CFE6C4; display: flex; align-items: center; justify-content: center; }
.step .icon img { width: 84px; height: auto; }
.step h3 { font-size: 28px; margin: 0; }
.step p { margin: 0; font-size: 18px; color: var(--ink-2); }
.step .eyebrow { letter-spacing: .12em; }
.shapes { margin: 0; padding: 18px 22px; list-style: none; display: flex; flex-wrap: wrap; gap: 14px 30px; align-items: center; background: var(--card); border-radius: 16px; }
.shapes li { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.shapes li:first-child { font-weight: 900; color: var(--ink-3); }

.worlds { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; }
.world { overflow: hidden; display: flex; flex-direction: column; }
.world img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; display: block; }
.world .body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.world h3 { font-size: 26px; margin: 0; }
.world p { margin: 0; font-size: 16px; color: var(--ink-2); }
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; background: #CFE6C4; color: #1F4A27; }
.tag.later { background: #E9DFCF; color: var(--ink-3); }

.score-row { display: flex; gap: 16px; align-items: flex-start; }
.chip { flex: none; min-width: 84px; padding: 10px 14px; border-radius: 12px; font-weight: 900; font-size: 18px; text-align: center; }
.chip-cost { background: #EECF9F; } .chip-time { background: #CFE3F5; } .chip-area { background: #CFE6C4; }
.score-row p { margin: 6px 0 0; font-size: 18px; color: var(--ink-2); }
.histo { height: 200px; display: flex; align-items: flex-end; gap: 8px; border-bottom: 3px solid var(--ink); }
.histo > div { flex: 1; border-radius: 6px 6px 0 0; background: #D9CCBA; }
.histo > div.you { background: var(--red); }

.wish { background: var(--night); color: #F4EADB; }
.wish .slab { font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.15; }
.wish img { width: min(460px, 100%); height: auto; }
.wish .note { color: #B9AC9C; }

/* footer */
.site-footer { background: var(--night-2); color: #F4EADB; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: center; padding-top: 40px; padding-bottom: 40px; }
.site-footer img { width: 48px; height: 48px; }
.site-footer p { margin: 0; font-size: 15px; color: #B9AC9C; max-width: 720px; }
.site-footer a { color: #F4EADB; font-weight: 800; }
.site-footer .spacer { flex: 1 1 auto; }

/* ---- the board (used by the daily puzzle and the yesterday's-best player) ---- */
.board-card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-card); overflow: hidden; }
.board-sky { position: relative; height: 150px; background: #D7ECF5; overflow: hidden; transition: filter .6s ease, opacity .6s ease; }
.board-sky.is-rest { filter: grayscale(1) contrast(.55) brightness(1.18); opacity: .55; }
.board-sky .sun { position: absolute; right: 14%; top: 22px; width: 44px; height: 44px; border-radius: 50%; background: #EE7A4C; }
.board-sky .parallax { height: 400px; }
.board-sky .px-far { bottom: -150px; } .board-sky .px-mid { bottom: -190px; } .board-sky .px-near { bottom: -250px; }
.board-sky.is-rest .parallax { animation-play-state: paused; }
.board-frame { padding: 18px; background: var(--wood); }
.board { position: relative; width: 100%; aspect-ratio: 8 / 6; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 6px; overflow: hidden; }
.board.is-interactive { cursor: crosshair; }
.board .cell { position: relative; transition: background-color .5s ease; }
.board .cell img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.board .train { position: absolute; width: 10%; height: auto; pointer-events: none; filter: drop-shadow(0 3px 2px rgba(30,20,10,.35)); transition-property: left, top, transform; transition-timing-function: linear; }

.scorebar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.score { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 120px; padding: 10px 16px; border-radius: 12px; font-weight: 900; font-size: 18px; }
.score b { font-size: 24px; }
.score-cost { background: #EECF9F; } .score-time { background: #CFE3F5; } .score-area { background: #CFE6C4; }
.mode { padding: 8px 14px; border-radius: 999px; color: #FFFAF2; font-weight: 900; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; background: var(--ink); }
.mode.is-run { background: #25712F; }

/* yesterday's best */
.best-card { padding: 18px; transform: rotate(1.2deg); }
.best-card.flat { transform: none; }
.best-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.best-tab { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.best-tab[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFFAF2; }
.best-board { border-radius: 14px; overflow: hidden; }
.best-board .board-frame { padding: 12px; }
.best-meta { padding: 14px 4px 2px; display: flex; flex-direction: column; gap: 10px; }
.best-awards { margin: 0; font-size: 13px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--clay); }
.best-who { margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-weight: 900; font-size: 20px; }
.best-who span:last-child { color: var(--ink-3); font-weight: 800; font-size: 16px; }
.best-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.best-stats .score { min-width: 0; padding: 6px 12px; font-size: 15px; gap: 10px; }
.best-stats .score b { font-size: 18px; }
.best-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.icon-btn { min-width: 48px; min-height: 48px; border-radius: 12px; border: 0; background: var(--paper); color: var(--ink); font: inherit; font-weight: 900; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; box-shadow: 0 3px 0 var(--line); }
.icon-btn:hover { background: #fff; }
.best-pic { padding: 12px; background: var(--paper); }
.best-pic svg { display: block; width: 100%; height: auto; max-height: 420px; }
.best-empty { padding: 28px; text-align: center; color: var(--ink-3); font-weight: 800; }

/* daily page */
.daily-main { padding-top: 36px; padding-bottom: 72px; display: flex; flex-direction: column; gap: 24px; }
.daily-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.daily-head h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 6px 0 0; }
.daily-head .sub { margin: 10px 0 0; font-size: 1.1rem; color: var(--ink-2); font-weight: 700; }
.daily-grid { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.daily-play { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.daily-side { flex: 1 1 320px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.controls p { margin: 0; flex: 1 1 280px; color: var(--ink-2); font-size: 16px; }
.panel { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { font-size: 24px; margin: 0; }
.panel p { margin: 0; font-size: 17px; color: var(--ink-2); }
.panel.win { border: 3px solid #2E7D3A; } .panel.win .eyebrow { color: #25712F; }
.panel.crash { border: 3px solid #B73328; } .panel.crash .eyebrow { color: #B73328; }
.panel.wishlist { background: var(--night); color: #F4EADB; align-items: flex-start; }
.panel.wishlist p { color: #B9AC9C; font-size: 14px; }
.panel.wishlist h2 { line-height: 1.2; }
.namebox { display: flex; flex-direction: column; gap: 8px; }
.namebox label { font-weight: 900; }
.namebox input { min-height: 48px; padding: 0 14px; border-radius: 12px; border: 2px solid #CDBFA8; background: #fff; font: inherit; font-size: 17px; color: var(--ink); }
.histo-sm { height: 140px; padding-top: 8px; gap: 6px; }
.histo-labels { display: flex; gap: 6px; font-size: 12px; font-weight: 800; color: var(--ink-3); }
.histo-labels span { flex: 1; text-align: center; }
[hidden] { display: none !important; }

@media (max-width: 600px) {
  .section { padding-top: 60px; padding-bottom: 60px; }
  .wrap { padding: 0 16px; }
  .site-nav { gap: 8px 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: nowrap; }
  .site-nav .logo img { height: 44px; }
  .site-nav .navlink { display: none; }
  .site-nav .btn-small { min-height: 42px; font-size: 14px; padding: 0 12px; gap: 6px; }
  .scorebar { gap: 8px; }
  .scorebar .score { flex: 1 1 28%; min-width: 0; padding: 8px 12px; font-size: 16px; gap: 8px; }
  .scorebar .mode { flex: 1 1 100%; text-align: center; }
  .scorebar .score b { font-size: 22px; }
  .scorebar > div[style] { display: none; }
  .daily-main { padding-top: 24px; gap: 18px; }
  .board-sky { height: 72px; }
  .board-sky .sun { width: 30px; height: 30px; top: 14px; }
  .board-sky .px-far { bottom: -250px; } .board-sky .px-mid { bottom: -290px; } .board-sky .px-near { bottom: -340px; }
  .board-frame { padding: 10px; }
  .hero-inner { padding-top: 40px; }
  .best-card { transform: none; }
  .trailer { border-width: 5px; border-radius: 16px 16px 0 0; }
  .trailer .badge { font-size: 15px; padding: 10px 16px; }
}
.steam-badge { display: inline-block; vertical-align: middle; font-size: 12px; font-weight: 900; letter-spacing: .04em; padding: 2px 9px; border-radius: 999px; background: #1B2838; color: #C7D5E0; }
