@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;650;700&family=Manrope:wght@400;500;600;650;700;750;800&display=swap');

:root { color-scheme: light; --paper: #f5f1e8; --ink: #30483d; --muted: #8b9081; --line: #dfdfd2; --green: #577458; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif; font-size: 14px; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid #c08a41; outline-offset: 4px; }
.topbar { max-width: 1480px; height: 86px; margin: auto; padding: 0 48px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); text-decoration: none; font-family: 'Manrope', sans-serif; font-size: 31px; font-weight: 800; letter-spacing: -1.7px; display: flex; align-items: center; }
.brand-icon { display: inline-grid; place-items: center; color: #f3e7c8; background: #6b8c68; width: 35px; height: 35px; border-radius: 11px; margin-right: 11px; font-size: 28px; line-height: 1; transform: rotate(-8deg); }
.brand-dot { color: #d69759; }
.tagline, .eyebrow, .section-label { font-size: 10px; letter-spacing: 1.8px; font-weight: 700; }
.tagline { color: var(--muted); }
.icon-button { border: 1px solid var(--line); border-radius: 50%; background: transparent; height: 36px; width: 36px; display: inline-grid; place-items: center; font-size: 16px; font-weight: 600; transition: background .15s; }
.icon-button:hover { background: #e8e8da; }
.icon-button:disabled { opacity: .35; cursor: default; background: transparent; }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.layout { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 520px) minmax(180px, 220px); gap: clamp(28px, 4.3vw, 74px); justify-content: center; max-width: 1440px; margin: 0 auto; padding: 28px 48px 16px; }
.sidebar { padding-top: 37px; }
.eyebrow { color: var(--muted); font-size: 9px; letter-spacing: 1.7px; }
.live-dot { display: inline-block; width: 5px; height: 5px; background: #d49b61; border-radius: 50%; vertical-align: 1px; margin-right: 5px; }
h1 { font-family: 'Manrope', sans-serif; font-weight: 500; font-size: clamp(34px, 3.1vw, 46px); line-height: 1.19; letter-spacing: -2.1px; margin: 27px 0 18px; }
h1 em { font-family: Georgia, serif; font-weight: 400; color: #7b8d69; }
.intro { color: #899080; line-height: 1.9; font-size: 13px; }
.level-picker { margin-top: 38px; }
.section-label { color: #7c8575; font-size: 9px; letter-spacing: 1.4px; }
.section-label > span { float: right; color: #a6aa9b; letter-spacing: 0; }
#level-list { margin-top: 14px; display: grid; gap: 8px; }
.level-option { width: 100%; text-align: left; border: 1px solid transparent; background: transparent; padding: 9px 10px; border-radius: 12px; display: flex; align-items: center; gap: 12px; }
.level-option:hover { background: #eaeadd; }
.level-option.active { border-color: #d8decc; background: #e9ecdf; }
.level-thumb { width: 44px; height: 33px; border-radius: 5px; image-rendering: pixelated; }
.level-option strong { display: block; font-size: 11px; font-weight: 600; }
.level-option small { display: block; color: #8e9586; font-size: 10px; margin-top: 4px; }
.level-option .level-check { margin-left: auto; color: #7c9972; text-align: center; flex-shrink: 0; }
.level-option .level-undos { white-space: nowrap; }
.tip-card { margin-top: 25px; border-top: 1px solid var(--line); padding-top: 20px; display: flex; gap: 12px; }
.tip-icon { font-size: 24px; color: #bf935f; }
.tip-card p { font-size: 11px; line-height: 1.7; color: #8b9081; margin: 0; }
.sidebar-footer { display: block; font-size: 8px; letter-spacing: 1.3px; color: #a7ab9e; margin-top: 38px; }
.play-column { width: 100%; min-width: 0; }
.game-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 1px 15px; height: 43px; }
.game-heading .eyebrow { font-size: 8px; margin-bottom: 5px; color: #a28b67; }
h2 { font-family: 'Manrope', sans-serif; font-size: 19px; letter-spacing: -.6px; line-height: 1.25; font-weight: 700; margin: 0; }
.game-actions { display: flex; gap: 8px; }
.game-actions .icon-button { height: 32px; width: 32px; }
#speed-button { font-size: 13px; font-weight: 700; }
#speed-button[aria-pressed="true"] { background: #426c4c; border-color: #426c4c; color: #fff9e9; }
.game-shell { position: relative; width: 100%; aspect-ratio: 1840/880; border-radius: 22px; overflow: hidden; box-shadow: 0 14px 35px #6053390d, 0 2px 5px #60533908; background: #eee4cc; border: 1px solid #e0d6be; }
#game { display: block; width: 100%; height: 100%; }
#truck-controls { position: absolute; inset: 0; pointer-events: none; }
.truck-hit { position: absolute; border: 0; padding: 0; background: transparent; border-radius: 8px; pointer-events: auto; touch-action: manipulation; }
.truck-hit:hover { background: #ffffff20; }
.truck-hit:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; background: #ffffff40; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.text-button { padding: 3px 0; border: 0; background: none; font-size: 10px; color: #6c8061; white-space: nowrap; }
.text-button:hover { text-decoration: underline; }
.text-button span { margin-left: 5px; }
.howto { padding-top: 86px; }
.how-step { display: flex; gap: 13px; margin-top: 27px; }
.how-step > b { font-size: 10px; padding-top: 1px; font-weight: 500; color: #b0b29f; }
.how-step h3 { font-size: 12px; font-weight: 600; margin: 0 0 7px; }
.how-step p { color: #929586; font-size: 11px; line-height: 1.8; margin: 0; }
.palette-card { border-top: 1px solid var(--line); margin-top: 36px; padding-top: 21px; }
#palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.swatch { width: 23px; height: 23px; border: 2px solid #ffffff80; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #30483d; }
.palette-card p { font-family: Georgia, serif; font-style: italic; font-size: 12px; color: #929586; margin-top: 16px; }
.motion-setting { display: flex; align-items: center; gap: 7px; font-size: 10px; margin-top: 28px; color: #929586; }
.motion-setting input { accent-color: #6b8c68; width: 13px; height: 13px; }
.fleet-card { margin-top: 25px; }
.fleet-types { display: flex; align-items: end; gap: 17px; margin-top: 15px; }
.fleet-types > span { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 9px; color: #899080; }
.fleet-sprite { display: block; width: 54px; height: 37px; }
.modal-layer { position: absolute; inset: 0; background: #f4eedacc; backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 22px; }
[hidden] { display: none !important; }
.modal-card { background: #faf7ef; border: 1px solid #e1decb; width: 100%; padding: 30px 24px 26px; border-radius: 19px; text-align: center; box-shadow: 0 12px 25px #4a503212; }
.modal-mark { font-size: 40px; color: #b99655; margin-bottom: 17px; }
.modal-card h2 { margin-top: 10px; font-size: 30px; font-weight: 500; letter-spacing: -1.4px; }
.modal-card p { font-size: 12px; color: #818a78; line-height: 1.8; margin: 16px auto 23px; max-width: 260px; white-space: pre-line; }
.primary-button { display: flex; justify-content: space-between; align-items: center; background: #617f5c; color: #faf7ef; border: 0; width: 100%; border-radius: 10px; padding: 14px 17px; font-size: 12px; }
.primary-button:hover { background: #4e6d49; }
.modal-card .text-button { margin-top: 14px; }
#mobile-levels { display: none; }

/* The playfield owns the viewport. Collection and guide are separate views. */
body { height: 100dvh; overflow: hidden; }
.topbar { height: 52px; max-width: none; padding: 0 22px; gap: 20px; }
.brand { font-size: 25px; }
.brand-icon { width: 28px; height: 28px; font-size: 23px; border-radius: 8px; }
.top-nav { display: flex; gap: 8px; align-items: center; }
.top-nav button { border: 0; border-radius: 8px; background: transparent; padding: 8px 12px; font-size: 12px; }
.top-nav button:hover { background: #e5e8da; }
.layout { display: block; max-width: none; height: calc(100dvh - 52px); padding: 8px 12px 10px; margin: 0; }
.play-column { width: min(100%, calc((100dvh - 72px) * 1840 / 880)); min-width: 0; height: 100%; margin: auto; }
.game-shell { aspect-ratio: 1840 / 880; border-radius: 16px; width: 100%; container-type: inline-size; }
.game-heading { position: absolute; inset: 0; height: auto; margin: 0; pointer-events: none; }
.game-heading > div:first-child { position: absolute; left: 70.109%; top: 17.045%; width: 39.13%; transform: translate(-50%, -50%); text-align: center; }
.game-heading h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(12px, 1.4cqw, 26px); }
.game-heading .eyebrow { white-space: nowrap; font-size: clamp(7px, .65cqw, 11px); margin-bottom: 5px; }
.game-actions { position: absolute; right: 3%; top: 4%; pointer-events: auto; }
.game-actions .icon-button { width: clamp(28px, 2.4cqw, 40px); height: clamp(28px, 2.4cqw, 40px); background: #fff9e94d; }
.game-actions .icon-button:hover { background: #fff9e9aa; }
.sidebar, .howto { display: none; }
body[data-view="levels"] .play-column, body[data-view="guide"] .play-column { display: none; }
body[data-view="levels"] .sidebar, body[data-view="guide"] .howto { display: block; max-width: 1000px; height: 100%; overflow: auto; margin: auto; padding: 24px; }
.sidebar h1 { font-size: 36px; margin: 12px 0; }
.sidebar .intro, .sidebar .tip-card, .sidebar-footer { display: none; }
.level-picker { margin-top: 24px; }
#level-list { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.level-option { padding: 12px; }
.level-thumb { width: 72px; height: 50px; }
.level-option strong { font-size: 13px; }
.howto .how-step { max-width: 600px; }
.how-step h3 { font-size: 17px; }
.how-step p { font-size: 14px; }
.palette-card, .fleet-card { max-width: 600px; }
.motion-setting { font-size: 14px; }
.modal-card { max-width: 440px; max-height: 100%; overflow: auto; }
.modal-card p { max-width: 340px; }
@media (max-width: 720px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .top-nav { gap: 0; }
  .top-nav button { padding: 8px; font-size: 11px; }
  .brand { font-size: 21px; }
  .brand-icon { display: none; }
  .layout { padding: 4px; }
  h2 { font-size: 15px; }
  .game-actions { gap: 4px; top: 1%; }
  .game-actions .icon-button { width: clamp(18px, 3.8cqw, 28px); height: clamp(18px, 3.8cqw, 28px); padding: 0; }
  .game-actions .icon-button svg { width: clamp(12px, 2.5cqw, 18px); height: clamp(12px, 2.5cqw, 18px); }
  #speed-button { font-size: clamp(10px, 2cqw, 13px); }
  .game-shell { border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
