:root {
  color-scheme: dark;
  --night: #101f1d;
  --pine: #17312d;
  --cream: #fff1d2;
  --gold: #ebc888;
  --mist: #b9cbc0;
  --edge: #557068;
  font-family: system-ui, sans-serif;
  background: radial-gradient(ellipse at top, #25463d, var(--night) 65%);
  color: var(--cream);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
button { cursor: pointer; font: inherit; font-weight: 700; min-height: 44px; border: 1px solid transparent; border-radius: 9px; background: var(--gold); color: var(--night); padding: .55rem .9rem; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #ffe298; outline-offset: 3px; }
h2:focus, h3:focus { outline: none; }
button:not(:disabled) { transition: filter .16s, transform .16s; }
button:not(:disabled):hover { filter: brightness(1.13); }
button:not(:disabled):active { transform: translateY(2px); }
.quiet { background: #132c28; color: var(--cream); border-color: var(--edge); }
.quiet:disabled { opacity: .5; }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 920px; padding: 20px 18px; margin: auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand p, .eyebrow, footer { color: var(--gold); font-weight: 750; letter-spacing: .17em; font-size: .69rem; }
.brand p, .eyebrow { margin: 0 0 5px; }
h1, h2, h3 { font-family: Georgia, serif; margin: 0; line-height: 1.05; font-weight: 500; }
h1 { font-size: clamp(1.2rem, 4vw, 1.85rem); }
h2 { font-size: clamp(2rem, 7vw, 3.4rem); }
h3 { font-size: clamp(1.65rem, 5vw, 2.5rem); }
main { max-width: 920px; margin: auto; padding: 0 12px; }
footer { text-align: center; padding: 18px; color: var(--mist); }
.terrain-2 { --terrain: url('assets/terrain-2.png'); }
.terrain-3 { --terrain: url('assets/terrain-3.png'); }
.terrain-5 { --terrain: url('assets/terrain-5.png'); }
.game, #map { border: 1px solid var(--edge); border-radius: 22px; overflow: hidden; animation: enter .35s ease-out both; }
.game { padding: clamp(12px, 3.8vw, 32px); background: linear-gradient(150deg, #112925e8, #0d2623f5), var(--terrain) center 45% / cover; }
.deal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.guide { margin-top: 15px; padding: 10px 13px; background: #0f2421c9; border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0; }
#instruction { margin: 0; line-height: 1.35; color: var(--cream); }
.table { --card: clamp(42px, 13vw, 86px); --overlap: calc(var(--card) * -.92); padding: 24px 0 12px; display: grid; justify-items: center; }
.row { display: flex; gap: clamp(3px, 1vw, 8px); }
.row + .row { margin-top: var(--overlap); }
.card { width: var(--card); aspect-ratio: 584 / 810; display: block; min-height: 0; position: relative; padding: 0; border: 0; border-radius: 9%; background: transparent; box-shadow: 0 4px 9px #0007; }
.card img { width: 100%; height: 100%; border-radius: inherit; display: block; object-fit: fill; user-select: none; }
.card.empty { visibility: hidden; }
.card:not(button):not(.waste) { filter: brightness(.72); }
button.card:not(:disabled):hover { transform: translateY(-4px); z-index: 1; }
.piles { --card: clamp(44px, 12vw, 73px); display: flex; justify-content: center; align-items: end; gap: clamp(16px, 7vw, 52px); padding: 8px 0 10px; }
.pile { display: grid; justify-items: center; gap: 7px; color: var(--mist); font-size: .85rem; }
.pile strong { color: var(--cream); font: 2.5rem Georgia, serif; }
.draw:disabled { opacity: .45; }
.highlight { outline: 2px solid var(--gold); outline-offset: 4px; animation: pulse 1.6s ease-in-out infinite; }
.controls { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
#status { text-align: center; margin: .5rem 0 0; min-height: 1.3em; color: var(--mist); font-size: .9rem; }
.result { text-align: center; background: #101f1df5; border: 1px solid var(--edge); border-radius: 14px; margin-top: 12px; padding: 16px; animation: enter .25s ease-out both; }
.result.won { border-color: var(--gold); box-shadow: 0 0 28px #efc27330; }
.result p:not(.eyebrow) { margin: .65rem 0; color: var(--mist); }
.result button { margin: 3px; }
.map-intro { padding: clamp(17px, 4vw, 33px); background: #17312d; }
.map-intro p:not(.eyebrow) { color: var(--mist); margin: .65rem 0 0; }
.map-intro .journal { font-weight: 700; }
.route { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: clamp(12px, 3vw, 24px); background: linear-gradient(#0d2422b8,#0d2422ed), url('assets/terrain-2.png') center / cover; }
.stop { display: grid; justify-items: start; gap: 5px; min-height: 102px; border: 1px solid var(--edge); color: var(--cream); text-align: left; background: linear-gradient(95deg, #142a26 10%, #142a26ac), var(--terrain) center 45% / cover; }
.stop:disabled { opacity: .72; }
.stop strong { font: 1.3rem Georgia, serif; }
.stop span { font-size: .75rem; }
.stop .badge { color: var(--gold); letter-spacing: .15em; font-weight: 800; }
.stop-camp, .stop-dunes, .stop-summit { grid-column: 1 / -1; }
.stop-camp { background-position: center, center 20%; }
.stop-summit { background-position: center, center 10%; }
dialog { width: min(500px, calc(100% - 24px)); border: 1px solid var(--edge); border-radius: 18px; background: var(--pine); color: var(--cream); padding: 22px; }
dialog::backdrop { background: #091a17c9; }
dialog p { line-height: 1.55; }
.deal-in { animation: deal .36s cubic-bezier(.2,.8,.25,1.08) both; }
.delay-1 { animation-delay: 35ms; } .delay-2 { animation-delay: 70ms; }
.delay-3 { animation-delay: 105ms; } .delay-4 { animation-delay: 140ms; }
.flip { animation: flip .29s ease-out both; }
.land { animation: land .23s ease-out both; }
@keyframes enter { from { opacity: 0; translate: 0 8px; } }
@keyframes deal { from { opacity: 0; translate: 15px -18px; rotate: -5deg; } }
@keyframes flip { from { transform: perspective(400px) rotateY(-90deg); } }
@keyframes land { from { translate: 0 -10px; scale: .9; opacity: .5; } }
@keyframes pulse { 50% { box-shadow: 0 0 14px #ffdc94a0; } }
@media (max-width: 360px) { .brand img { width: 32px; } .brand { gap: 6px; } .masthead { padding-inline: 12px; } .stop strong { font-size: 1.13rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; } }
