:root {
  --trail-cyan: #20d7d7;
  --trail-bright: #78ffff;
  --trail-ink: #050708;
  --trail-panel: rgba(8, 12, 14, 0.94);
  --trail-bone: #e7dfcf;
  --trail-muted: #9db2b3;
  --trail-burgundy: #5b1f32;
  --trail-danger: #e05a65;
  --trail-good: #63d89b;
}

* { box-sizing: border-box; }

body {
  color: var(--trail-bone);
}

button,
select,
input,
a { color: var(--trail-cyan); cursor: url("/images/cursors/hover.png"), pointer; }
a:hover, a:focus-visible { color: var(--trail-cyan-bright); }

body,
.road-scene { cursor: url("/images/cursors/pointer.png"), auto; }

button,
input,
select { font: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--trail-bright);
  outline-offset: 3px;
}

button:disabled { opacity: 0.42; cursor: not-allowed; }

.trail-shell { position: relative; }
.game-toolbar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(32, 215, 215, 0.25);
  border-radius: 7px;
  background: rgba(1, 4, 5, 0.78);
  text-align: center;
}
.eyebrow, .step-label { margin: 0 0 5px; color: var(--trail-cyan); text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.7rem; }
.subtitle { margin: -2px 0 0; color: #b1c4c4; font-size: 0.78rem; letter-spacing: 0.28em; text-transform: uppercase; }
.header-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }

.icon-button,
.small-button,
.danger-button {
  border: 1px solid rgba(32, 215, 215, 0.56);
  border-radius: 5px;
  background: rgba(32, 215, 215, 0.07);
  color: #bffafa;
  padding: 9px 12px;
  font-size: 0.72rem;
}

.icon-button:hover,
.small-button:hover { background: rgba(32, 215, 215, 0.16); }
.danger-button { border-color: rgba(224, 90, 101, 0.6); color: #ffadb4; background: rgba(224, 90, 101, 0.07); }

.game-root { padding: 0; }
.screen { display: none; }
.screen.is-active { display: block; }

.title-screen { max-width: 900px; margin: 0 auto; }
.title-card {
  display: grid;
  grid-template-columns: minmax(220px, 38%) 1fr;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid rgba(32, 215, 215, .42);
  border-radius: 8px;
  background: linear-gradient(135deg, #060b0d, #0a1113);
  box-shadow: 0 16px 52px #000, inset 0 0 0 1px rgba(255,255,255,.025);
}
.title-card > img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  image-rendering: pixelated;
  border-right: 1px solid rgba(32, 215, 215, .25);
}
.title-card-copy { align-self: center; padding: clamp(24px, 5vw, 48px); }
.title-card-copy h2 { margin: 0; color: #eefafa; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1; }
.title-card-subtitle { margin: 7px 0 18px; color: var(--trail-cyan); text-transform: uppercase; letter-spacing: .22em; font-size: .78rem; }
.title-card-copy > p:not(.eyebrow):not(.title-card-subtitle) { color: #aebfc0; font-size: .9rem; line-height: 1.65; }
.title-card .title-actions { justify-content: flex-start; padding: 13px 0 0; }
.hero-art {
  position: relative;
  min-height: clamp(420px, 60vw, 610px);
  overflow: hidden;
  border: 1px solid rgba(32, 215, 215, 0.48);
  border-radius: 10px;
  background: #05090b;
  box-shadow: 0 20px 70px #000, 0 0 35px rgba(32, 215, 215, 0.12);
}
.hero-art > img { width: 100%; height: 100%; min-height: inherit; display: block; object-fit: cover; }
.hero-vignette { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(1, 2, 3, 0.92) 0%, rgba(1, 2, 3, 0.35) 52%, transparent 80%), linear-gradient(0deg, rgba(1, 2, 3, 0.85), transparent 48%); }
.hero-copy { position: absolute; z-index: 2; left: clamp(22px, 6vw, 80px); bottom: clamp(30px, 8vw, 82px); width: min(560px, 80%); }
.hero-copy h2 { margin: 0 0 16px; color: #f1ede5; font-size: clamp(2rem, 4.6vw, 4.5rem); line-height: 1.02; text-shadow: 0 3px 18px #000; }
.hero-copy > p:last-child { margin: 0; max-width: 510px; color: #d0dddd; line-height: 1.7; font-size: clamp(0.95rem, 1.5vw, 1.15rem); }
.title-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; padding: 22px; }
.release-note { text-align: center; color: #7d9293; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; }

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 11px 22px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.primary-button {
  border: 1px solid var(--trail-bright);
  color: #001112;
  background: linear-gradient(180deg, var(--trail-bright), #28bcbc);
  box-shadow: 0 0 16px rgba(32, 215, 215, 0.28);
  font-weight: 700;
}
.secondary-button { border: 1px solid rgba(32, 215, 215, 0.64); color: #bbffff; background: rgba(7, 31, 33, 0.85); }
.primary-button:hover,
.secondary-button:hover { transform: translateY(-2px); box-shadow: 0 0 22px rgba(32, 215, 215, 0.38); }
.text-link { color: var(--trail-cyan); font-size: 0.78rem; }

.panel,
.ledger-card,
.event-log {
  border: 1px solid rgba(32, 215, 215, 0.3);
  background: var(--trail-panel);
  border-radius: 8px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.55);
}
.setup-panel,
.outfitter-screen > .panel { max-width: 940px; margin: 20px auto; padding: clamp(20px, 5vw, 54px); }
.setup-panel { text-align: center; }
.panel h2 { margin: 0 0 10px; color: var(--trail-bright); font-size: clamp(1.5rem, 3vw, 2.35rem); }
.panel > p { color: #b4c5c5; line-height: 1.6; }

.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 26px 0; }
.name-grid label,
.ledger-card label { display: grid; gap: 7px; color: #91baba; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.name-grid label { grid-template-columns: 68px 1fr 34px 34px; align-items: center; padding: 8px; border: 1px solid rgba(32,215,215,.16); background: rgba(255,255,255,.015); }
.name-grid label > :not(.portrait-picker) { grid-column: 2 / -1; }
.portrait-picker { grid-row: 1 / span 4; display: grid; grid-template-columns: 1fr 1fr; align-items: end; width: 60px; overflow: hidden; border: 1px solid rgba(32,215,215,.38); background: #061012; }
.portrait-picker canvas { grid-column: 1 / -1; display: block; width: 60px; height: 60px; image-rendering: pixelated; }
.portrait-picker button { height: 22px; padding: 0; border: 0; color: var(--trail-bright); background: rgba(32,215,215,.08); font-size: .7rem; }
.portrait-picker button:hover { background: rgba(32,215,215,.22); }
.required-note { color: #c8a870; font-size: .58rem; text-transform: none; letter-spacing: 0; }
.field-error { min-height: 1em; color: #ff9099; font-size: .66rem; text-transform: none; letter-spacing: 0; }
input[aria-invalid="true"] { border-color: var(--trail-danger); box-shadow: 0 0 0 2px rgba(224,90,101,.18); }
.setup-options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.setup-options-grid label { display: grid; gap: 7px; color: #91baba; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.setup-panel input,
.setup-panel select { text-align: center; }
.setup-panel select { text-align-last: center; }
input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(32, 215, 215, 0.5);
  border-radius: 5px;
  color: #e9ffff;
  background: #05090b;
  padding: 11px 12px;
}
textarea { min-height: 130px; resize: vertical; font: inherit; }
.difficulty-fieldset { border: 0; padding: 0; margin: 24px 0; }
.difficulty-fieldset legend { width: 100%; margin-bottom: 10px; color: var(--trail-cyan); text-align: center; }
.choice-card { position: relative; display: grid; place-items: center; padding: 13px 52px; margin: 8px 0; border: 1px solid rgba(32, 215, 215, 0.23); background: rgba(255,255,255,0.018); border-radius: 6px; text-align: center; }
.choice-card:has(input:checked) { border-color: var(--trail-cyan); background: rgba(32, 215, 215, 0.08); }
.choice-card input { position: absolute; left: 24px; top: 50%; width: auto; margin: 0; accent-color: var(--trail-cyan); transform: translateY(-50%); }
.choice-card span { display: grid; gap: 4px; }
.choice-card strong { color: #e5f5f4; }
.choice-card small { color: #91a5a6; text-transform: none; letter-spacing: 0; font-size: 0.76rem; }
.form-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.setup-panel .form-actions button { min-width: min(220px, 100%); }

.shop-heading { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; text-align: center; }
.npc-card { width: 100px; margin: 0; text-align: center; }
.npc-card canvas { display: block; width: 96px; height: 96px; border: 1px solid rgba(32,215,215,.4); background: #071012; image-rendering: pixelated; }
.npc-card figcaption { padding-top: 4px; color: #76a7a8; font-size: .55rem; }
.coin-purse { min-width: 105px; padding: 11px 18px; border: 1px solid #9f7f37; text-align: center; background: rgba(110, 79, 22, 0.12); }
.coin-purse span { display: block; color: #b9a676; font-size: 0.65rem; text-transform: uppercase; }
.coin-purse strong { color: #f3d684; font-size: 1.6rem; }
.shop-grid { display: grid; gap: 9px; margin: 26px 0 18px; }
.shop-row { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(170px, 1.3fr) 90px 132px; gap: 14px; align-items: center; padding: 12px; border-bottom: 1px solid rgba(32, 215, 215, 0.18); }
.shop-row h3 { margin: 0 0 4px; color: #defefe; font-size: 0.92rem; }
.shop-row p { margin: 0; color: #899d9e; font-size: 0.72rem; }
.shop-price { color: #e8ca77; font-size: 0.8rem; }
.quantity-stepper { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; border: 1px solid rgba(32, 215, 215, 0.35); }
.quantity-stepper button { height: 34px; border: 0; color: var(--trail-bright); background: rgba(32, 215, 215, 0.09); font-size: 1.1rem; }
.quantity-stepper strong { text-align: center; font-size: 0.85rem; }
.shop-summary { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; color: #a2b3b3; font-size: 0.75rem; text-align: center; }
.shop-advice { text-align: center; }

.journey-topbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 10px; border: 1px solid rgba(32,215,215,.32); background: rgba(32,215,215,.2); }
.journey-topbar > div { padding: 10px 14px; background: #070c0e; text-align: center; }
.journey-topbar span { display: block; color: #6e999a; font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; }
.journey-topbar strong { display: block; margin-top: 3px; color: #d8ffff; font-size: .86rem; }
.journey-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 12px; }
.road-column { min-width: 0; }

.road-scene {
  position: relative;
  min-height: clamp(320px, 45vw, 560px);
  overflow: hidden;
  border: 1px solid rgba(32,215,215,.45);
  border-radius: 8px;
  background: linear-gradient(180deg, #07131a 0%, #151723 45%, #171312 46%, #050606 100%);
  isolation: isolate;
}
.road-scene::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 74% 20%, rgba(72, 216, 224, 0.13), transparent 25%), linear-gradient(180deg, transparent 50%, rgba(0,0,0,.66)); z-index: 5; pointer-events: none; }
.moon { position: absolute; right: 13%; top: 10%; width: clamp(50px, 7vw, 90px); aspect-ratio: 1; border-radius: 50%; background: #c9f9f4; box-shadow: 0 0 40px rgba(99,247,237,.48); opacity: .82; }
.mountains { position: absolute; left: -10%; width: 120%; height: 48%; bottom: 26%; background: #0b1117; clip-path: polygon(0 100%,0 62%,8% 39%,15% 64%,23% 22%,32% 59%,39% 36%,48% 71%,57% 25%,68% 66%,78% 31%,87% 59%,94% 24%,100% 58%,100% 100%); }
.mountains.back { transform: translateY(-24px) scale(1.06); background: #101b27; opacity: .85; }
.mountains.front { z-index: 1; }
.road { position: absolute; z-index: 2; left: 0; bottom: 0; width: 100%; height: 48%; background: linear-gradient(168deg, transparent 0 28%, #0c1010 29% 44%, #19211e 45% 60%, #080b0a 61%); clip-path: polygon(0 32%,100% 8%,100% 100%,0 100%); }
.road::after { content: ""; position: absolute; inset: 26% 0 0; opacity: .18; background: repeating-linear-gradient(172deg, transparent 0 34px, #7ce3dc 35px 37px, transparent 38px 72px); }
.wagon-sprite {
  position: absolute;
  z-index: 4;
  width: clamp(330px, 46vw, 620px);
  aspect-ratio: 256 / 150;
  left: 5%;
  bottom: -1%;
  background: url("/minigames/cryptic-trail/assets/sprites/caravan-travel.png?v=20260724.3") 0 0 / 400% 100% no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 18px 18px #000);
  transform-origin: 50% 100%;
}
.road-scene.is-traveling .wagon-sprite { animation: wagon-roll 1.2s ease-in-out infinite, wagon-frames .56s steps(1) infinite; }
.road-scene.is-traveling .road::after { animation: road-scroll .55s linear infinite; opacity: .35; }
@keyframes road-scroll { to { background-position: -92px 0; } }
@keyframes wagon-roll {
  0%,100% { transform: translate(0,0) rotate(0); }
  25% { transform: translate(2vw,-5px) rotate(-.6deg); }
  55% { transform: translate(4vw,1px) rotate(.5deg); }
}
@keyframes wagon-frames {
  0%, 24.9% { background-position: 0% 0; }
  25%, 49.9% { background-position: 33.333% 0; }
  50%, 74.9% { background-position: 66.666% 0; }
  75%, 100% { background-position: 100% 0; }
}
.mist { position: absolute; z-index: 3; left: -20%; width: 140%; height: 22%; border-radius: 50%; background: rgba(116,230,230,.08); filter: blur(20px); animation: mist 18s linear infinite; }
.mist-one { bottom: 28%; }
.mist-two { bottom: 12%; animation-direction: reverse; animation-duration: 24s; }
@keyframes mist { 50% { transform: translateX(9%); } }
.procedural-scenery { position: absolute; z-index: 2; inset: 0; overflow: hidden; pointer-events: none; }
.scenery-object { position: absolute; right: -15%; bottom: 25%; width: var(--size, 48px); height: var(--size, 48px); opacity: .75; filter: drop-shadow(0 6px 4px #000); }
.road-scene.is-traveling .scenery-object { animation: scenery-pass var(--speed, 4.4s) linear forwards; }
.scenery-object.tree { background: #07100f; clip-path: polygon(48% 0,62% 27%,54% 27%,75% 57%,59% 57%,84% 91%,57% 91%,57% 100%,42% 100%,42% 91%,15% 91%,40% 57%,24% 57%,45% 27%,37% 27%); }
.scenery-object.grave { width: calc(var(--size) * .58); background: #15201e; clip-path: polygon(35% 0,65% 0,72% 10%,72% 31%,100% 31%,100% 48%,72% 48%,72% 100%,28% 100%,28% 48%,0 48%,0 31%,28% 31%,28% 10%); }
.scenery-object.ruin { background: #101817; clip-path: polygon(0 100%,0 23%,15% 23%,15% 7%,27% 7%,27% 37%,49% 37%,49% 0,64% 0,64% 56%,82% 56%,82% 20%,100% 20%,100% 100%); }
.scenery-object.crystal { background: #14656a; clip-path: polygon(45% 0,65% 28%,100% 52%,70% 100%,28% 87%,0 50%,30% 32%); box-shadow: 0 0 14px #2dd; }
@keyframes scenery-pass { from { transform: translateX(0) scale(.55); } to { transform: translateX(-1120px) scale(1.35); } }
.biome-river { background: linear-gradient(180deg,#071a20 0%,#172735 45%,#091e24 46%,#020708 100%); }
.biome-woods { background: linear-gradient(180deg,#081417 0%,#101a1a 45%,#07100d 46%,#020504 100%); }
.biome-market { background: linear-gradient(180deg,#17101b 0%,#281725 45%,#17100f 46%,#050304 100%); }
.biome-ash { background: linear-gradient(180deg,#1b1b20 0%,#373136 45%,#211b18 46%,#090706 100%); }
.biome-sanctuary { background: linear-gradient(180deg,#071820 0%,#12333a 45%,#14201d 46%,#030807 100%); }
.biome-wastes { background: linear-gradient(180deg,#11121c 0%,#272638 45%,#171418 46%,#050405 100%); }
.biome-lantern { background: linear-gradient(180deg,#071c22 0%,#15424a 45%,#16241e 46%,#030807 100%); }
.scene-caption { position: absolute; z-index: 7; left: 14px; bottom: 12px; padding: 9px 12px; background: rgba(1,5,6,.82); border-left: 2px solid var(--trail-cyan); }
.scene-caption span { display: block; color: #e5ffff; font-size: .86rem; }
.scene-caption small { color: #8cb0b0; font-size: .64rem; }
.weather-fx { position: absolute; z-index: 6; inset: 0; pointer-events: none; }
.weather-rain .weather-fx { background: repeating-linear-gradient(105deg, transparent 0 18px, rgba(160,238,241,.18) 19px 20px, transparent 21px 38px); animation: rain .45s linear infinite; }
.weather-ash .weather-fx { background-image: radial-gradient(circle, rgba(205,201,190,.48) 0 1px, transparent 2px); background-size: 28px 28px; animation: ash 6s linear infinite; }
.weather-fog .weather-fx { background: linear-gradient(90deg, rgba(190,235,232,.16), rgba(190,235,232,.03), rgba(190,235,232,.17)); filter: blur(16px); }
@keyframes rain { to { background-position: -35px 55px; } }
@keyframes ash { to { background-position: 40px 70px; } }

.progress-wrap { padding: 12px 8px 16px; }
.landmark-track { display: flex; justify-content: space-between; }
.landmark-dot { position: relative; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #477274; background: #071011; }
.landmark-dot.is-passed { background: var(--trail-cyan); border-color: var(--trail-bright); box-shadow: 0 0 8px var(--trail-cyan); }
.landmark-dot span { display: none; position: absolute; top: 16px; left: 50%; transform: translateX(-50%); width: 130px; color: #789494; text-align: center; font-size: .53rem; }
.landmark-dot.is-current span,
.landmark-dot.is-next span { display: block; }
.landmark-dot.is-current span { top: 15px; transform: translateX(-86%); color: #c8ffff; text-align: right; }
.landmark-dot.is-next span { top: 29px; transform: translateX(-14%); color: #89aaaa; text-align: left; }
.landmark-dot.is-current.is-next span { top: 16px; transform: translateX(-50%); text-align: center; }
.landmark-dot.is-current.is-endpoint:first-child span { left: 0; transform: none; text-align: left; }
.landmark-dot.is-next.is-endpoint:last-child span { right: 0; left: auto; transform: none; text-align: right; }
.progress-rail { height: 4px; margin: -8px 5px 24px; background: #183233; }
.progress-bar { height: 100%; width: 0; background: var(--trail-bright); box-shadow: 0 0 8px var(--trail-cyan); transition: width .5s ease; }

.event-log { padding: 16px 18px; min-height: 160px; }
.log-heading { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; text-align: center; }
.log-heading h2, .ledger-card h2 { margin: 0 0 12px; color: var(--trail-cyan); font-size: .82rem; text-transform: uppercase; letter-spacing: .11em; }
.current-event .event-date { margin: 3px 0; color: #758f90; font-size: .62rem; }
.current-event h3 { margin: 3px 0 8px; color: #ebeeee; font-size: 1.05rem; }
.current-event > p:last-child { margin: 0; color: #afc1c1; line-height: 1.55; font-size: .82rem; }
.action-bar { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 9px; margin-top: 10px; }
.action-button { display: grid; justify-items: center; padding: 9px 12px; }
.action-button span { font-weight: 700; }
.action-button small { margin-top: 3px; opacity: .72; font-size: .58rem; text-transform: none; letter-spacing: 0; }

.ledger-column { display: grid; align-content: start; gap: 10px; }
.ledger-card { padding: 14px; }
.ledger-card label + label { margin-top: 12px; }
.party-list { display: grid; gap: 8px; }
.party-member { display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: center; padding: 7px; background: rgba(255,255,255,.02); border-left: 2px solid var(--trail-cyan); }
.party-member.is-dead { opacity: .45; border-color: #545454; }
.party-avatar { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(32,215,215,.45); border-radius: 50%; color: var(--trail-bright); font-size: .72rem; }
.party-portrait { display: block; width: 42px; height: 42px; border: 1px solid rgba(32,215,215,.45); background: #061012; image-rendering: pixelated; }
.party-member { grid-template-columns: 44px 1fr auto; }
.party-member.is-dead .party-portrait { filter: grayscale(1) brightness(.42); }
.party-member strong { display: block; font-size: .72rem; color: #e1eeee; overflow: hidden; text-overflow: ellipsis; }
.party-member small { display: block; color: #789091; font-size: .55rem; }
.health-pips { color: var(--trail-good); font-size: .65rem; }
.inventory-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.inventory-item { padding: 8px; background: rgba(32,215,215,.04); }
.inventory-item span { display: block; color: #759293; font-size: .55rem; text-transform: uppercase; }
.inventory-item strong { color: #d6ffff; font-size: .84rem; }
.compact-card { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.modal-backdrop,
.hunt-overlay,
.crossing-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(7px);
}
.modal-backdrop[hidden],
.hunt-overlay[hidden],
.crossing-overlay[hidden] { display: none; }
.game-modal,
.hunt-panel,
.crossing-panel { position: relative; width: min(680px, 100%); max-height: 92vh; overflow: auto; padding: clamp(20px, 5vw, 42px); border: 1px solid var(--trail-cyan); border-radius: 8px; background: #080d0f; box-shadow: 0 0 80px rgba(32,215,215,.22); }
.game-modal h2 { margin: 0 0 12px; color: #e5ffff; font-size: clamp(1.35rem, 3vw, 2rem); }
.game-modal { text-align: center; }
.modal-npc-portrait { display: block; width: 112px; height: 112px; margin: 0 auto 14px; border: 1px solid rgba(32,215,215,.45); background: #061012; image-rendering: pixelated; }
.modal-npc-portrait[hidden] { display: none; }
.modal-choices { clear: both; }
.modal-body { color: #b9c9c8; line-height: 1.65; font-size: .88rem; }
.modal-choices { display: grid; gap: 9px; margin-top: 22px; }
.choice-button { display: grid; gap: 4px; width: 100%; padding: 13px 15px; text-align: center; border: 1px solid rgba(32,215,215,.45); color: #d9ffff; background: rgba(32,215,215,.055); }
.choice-button:hover:not(:disabled) { border-color: var(--trail-bright); background: rgba(32,215,215,.14); }
.choice-button small { color: #7e9c9c; font-size: .66rem; }
.modal-close { position: absolute; right: 12px; top: 10px; border: 0; background: transparent; color: var(--trail-cyan); font-size: 1.7rem; }

.hunt-panel { width: min(980px, 100%); padding: 18px; }
.crossing-panel { width: min(980px, 100%); padding: 18px; }
.hunt-heading { display: flex; flex-direction: column; justify-content: center; gap: 8px; align-items: center; text-align: center; }
.crossing-heading { display: flex; flex-direction: column; justify-content: center; gap: 8px; align-items: center; text-align: center; }
.hunt-heading h2 { margin: 0 0 12px; color: #eaffff; font-size: 1.2rem; }
.hunt-stats { display: flex; gap: 16px; padding-bottom: 12px; color: #759b9c; font-size: .65rem; text-transform: uppercase; }
.hunt-stats strong { color: var(--trail-bright); }
#huntCanvas { display: block; width: 100%; height: auto; border: 1px solid rgba(32,215,215,.58); background: #071116; touch-action: none; }
#crossingCanvas { display: block; width: 100%; height: auto; border: 1px solid rgba(32,215,215,.58); background: #06161c; image-rendering: pixelated; touch-action: none; }
.crossing-stats { display: flex; gap: 16px; padding-bottom: 12px; color: #759b9c; font-size: .65rem; text-transform: uppercase; }
.crossing-stats strong { color: var(--trail-bright); }
.crossing-controls { display: grid; justify-content: center; gap: 5px; margin-top: 10px; }
.crossing-controls > button { margin: auto; }
.crossing-controls button { min-width: 58px; min-height: 42px; border: 1px solid rgba(32,215,215,.55); color: #caffff; background: rgba(32,215,215,.1); touch-action: none; }
.portrait-gate { display: none; }
.hunt-help { margin: 9px 0 0; color: #88a2a3; font-size: .68rem; text-align: center; }

.ending-screen { position: relative; min-height: 680px; overflow: hidden; border-radius: 8px; }
.ending-art { position: absolute; inset: 0; }
.ending-art img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.4); }
.ending-panel { position: relative; z-index: 2; width: min(620px, calc(100% - 30px)); margin: 80px auto; padding: clamp(24px,5vw,50px); text-align: center; }
.ending-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 24px 0 4px; }
.ending-stat { padding: 13px 8px; border: 1px solid rgba(32,215,215,.25); }
.ending-stat span { display: block; color: #728f90; font-size: .58rem; text-transform: uppercase; }
.ending-stat strong { color: #dcffff; font-size: 1.15rem; }

.trail-ledger { max-width: 1160px; margin: 22px auto 34px; padding: clamp(16px, 3vw, 28px); }
.trail-ledger { text-align: center; }
.ledger-heading { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; text-align: center; }
.trail-ledger h2 { margin: 0; color: var(--trail-bright); font-size: 1.35rem; }
.ledger-intro { color: #8da1a2; font-size: .74rem; line-height: 1.5; }
.table-wrap { overflow-x: auto; border: 1px solid rgba(32,215,215,.22); }
.trail-table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: .72rem; }
.trail-table th { padding: 10px; color: var(--trail-cyan); text-align: center; text-transform: uppercase; letter-spacing: .06em; background: rgba(32,215,215,.07); }
.trail-table td { padding: 10px; color: #bed0d0; text-align: center; border-top: 1px solid rgba(32,215,215,.14); }
.trail-table td:nth-child(3) { max-width: 330px; color: #9fb0b0; }
.result-victory { color: var(--trail-good) !important; }
.result-lost { color: #ff9ca4 !important; }

@media (max-width: 880px) {
  .journey-layout { grid-template-columns: 1fr; }
  .ledger-column { grid-template-columns: 1fr 1fr; }
  .compact-card { grid-column: 1 / -1; }
  .shop-row { grid-template-columns: 1fr 1fr; }
  .shop-row > div:nth-child(2) { display: none; }
}

@media (orientation: portrait) and (max-width: 900px) {
  body > .wrapper { display: none; }
  .portrait-gate { position: fixed; z-index: 9999; inset: 0; display: grid; place-items: center; padding: 24px; color: #dfffff; background: #030708; text-align: center; }
  .portrait-gate div { max-width: 390px; padding: 28px; border: 1px solid var(--trail-cyan); background: #071012; }
  .portrait-gate span { display: block; color: var(--trail-bright); font-size: 3rem; }
  .portrait-gate strong { display: block; margin: 10px 0; font-size: 1.2rem; }
  .portrait-gate p { color: #9eb3b4; font-size: .84rem; line-height: 1.6; }
}

@media (max-width: 600px) {
  .game-root { padding: 8px; }
  .game-toolbar { align-items: flex-start; }
  .game-toolbar .subtitle { display: none; }
  .subtitle { font-size: .58rem; }
  .title-card { grid-template-columns: 1fr; }
  .title-card > img { min-height: 180px; max-height: 220px; border-right: 0; border-bottom: 1px solid rgba(32,215,215,.25); }
  .name-grid { grid-template-columns: 1fr; }
  .shop-heading, .shop-summary { display: block; text-align: center; }
  .coin-purse { margin-top: 12px; }
  .shop-advice { text-align: center; }
  .journey-topbar { grid-template-columns: 1fr 1fr; }
  .road-scene { min-height: 330px; }
  .wagon-sprite { width: 390px; max-width: 94%; left: 0; bottom: 2%; }
  .landmark-dot span { display: none; }
  .action-bar { grid-template-columns: 1fr; }
  .ledger-column { grid-template-columns: 1fr; }
  .compact-card { grid-column: auto; }
  .hunt-heading { display: block; }
  .hunt-stats { justify-content: space-between; }
  .ending-stats { grid-template-columns: 1fr; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .wrapper > header, .trail-shell > .back-link, .game-toolbar, .trail-ledger, .wrapper > footer { display: none; }
  .trail-shell { max-width: none; padding: 6px; }
  .journey-topbar { margin-bottom: 5px; }
  .journey-topbar > div { padding: 5px 8px; }
  .journey-layout { grid-template-columns: minmax(0, 1fr) 250px; gap: 6px; }
  .ledger-column { grid-template-columns: 1fr; min-width: 0; overflow: hidden; }
  .ledger-column > * { min-width: 0; }
  .health-pips, .landmark-dot span { display: none; }
  .party-member { min-width: 0; }
  .party-member strong { white-space: normal; }
  .road-scene { min-height: 235px; }
  .event-log { min-height: 82px; padding: 8px 10px; }
  .current-event > p:last-child { display: none; }
  .progress-wrap { padding: 7px 5px 9px; }
  .ledger-card { padding: 8px; }
  .ledger-card h2 { margin-bottom: 6px; }
  .party-list { gap: 3px; }
  .party-member { padding: 3px; }
  .inventory-list { gap: 3px; }
  .inventory-item { padding: 4px; }
  .action-button { min-height: 38px; padding: 5px 8px; }
  .modal-backdrop, .hunt-overlay, .crossing-overlay { padding: 5px; }
  .hunt-panel, .crossing-panel { max-height: 98vh; padding: 7px; }
  .hunt-heading h2, .crossing-heading h2 { margin-bottom: 4px; }
  #huntCanvas, #crossingCanvas { max-height: 68vh; object-fit: contain; }
  .crossing-controls { position: absolute; right: 14px; bottom: 14px; opacity: .84; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
