*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: clip;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  color: #f6efe2;
  background:
    radial-gradient(900px 420px at 50% -12%, rgba(225, 6, 0, 0.32), transparent 58%),
    radial-gradient(700px 360px at 110% 8%, rgba(240, 193, 75, 0.16), transparent 46%),
    #07080c;
  font-family: "Noto Sans Khmer", "Khmer OS", "Khmer Sangam MN", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
body[data-screen="journey"] {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}
img { max-width: 100%; display: block; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
h1, h2, p { overflow-wrap: break-word; }
h1 { font-size: clamp(26px, 7.4vw, 40px); line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: clamp(18px, 4.8vw, 24px); line-height: 1.3; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.kicker {
  margin: 0 0 4px;
  color: #f0c14b;
  font-size: 12px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  padding: 12px 14px 10px;
  background: linear-gradient(180deg, rgba(7, 8, 12, 0.96), rgba(7, 8, 12, 0.88));
}
.topbar::before {
  content: "";
  display: block;
  height: 4px;
  margin: -12px -14px 12px;
  background: linear-gradient(90deg, #e10600, #f0c14b, #e10600, #f0c14b, #e10600);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; width: min(100%, 680px); margin: 0 auto; }
.brand__mark {
  width: 54px;
  height: 54px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2a1208;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  background: radial-gradient(circle at 35% 30%, #fff6d2, #f0c14b 42%, #a56b12);
  box-shadow: 0 0 0 2px #5a1014, 0 0 0 4px #f0c14b;
}
.brand__text { min-width: 0; }
.brand__name {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 8vw, 36px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  background: linear-gradient(180deg, #fff6d4, #f0c14b 46%, #a56b12);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand__sub { margin: 2px 0 0; color: #d9cbb4; font-size: 13px; }
.ticker {
  overflow: hidden;
  border-block: 1px solid rgba(240, 193, 75, 0.35);
  background: #100d0a;
  color: #f0c14b;
  font-size: 13px;
}
.ticker__move { display: flex; width: max-content; animation: slide 28s linear infinite; }
.ticker span { padding: 7px 0; white-space: nowrap; }
@keyframes slide { to { transform: translateX(-50%); } }
body[data-screen="journey"] .topbar,
body[data-screen="journey"] .ticker { display: none; }
.screen { display: none; }
.screen.is-on {
  display: block;
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 14px 14px calc(132px + env(safe-area-inset-bottom));
}
.card {
  border-radius: 22px;
  border: 1px solid rgba(240, 193, 75, 0.55);
  background: linear-gradient(180deg, rgba(255, 220, 150, 0.07), rgba(0, 0, 0, 0.25)), #12100c;
  box-shadow: inset 0 0 0 1px rgba(255, 236, 190, 0.16), 0 16px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.hero { margin-bottom: 14px; }
.hero__img { width: 100%; height: clamp(168px, 34vh, 280px); object-fit: cover; }
.hero__copy, .zone-card__body { padding: 14px; }
.hero__actions { display: grid; gap: 8px; }
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 12px 16px;
  font-weight: 700;
  color: #2a1208;
  background: linear-gradient(180deg, #fff1c2 0%, #f0c14b 40%, #c4841d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 3px 0 #8a5a10, 0 8px 16px rgba(0, 0, 0, 0.28);
}
.btn-red {
  color: #fff8ee;
  background: linear-gradient(180deg, #ff5a4a, #e10600 46%, #8d0c18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 3px 0 #5a0a10, 0 8px 16px rgba(225, 6, 0, 0.28);
}
.btn:disabled { opacity: 0.45; box-shadow: none; }
.btn-ghost {
  width: 100%;
  margin-top: 14px;
  color: #f6efe2;
  background: transparent;
  border: 1px solid rgba(240, 193, 75, 0.55);
  box-shadow: none;
}
.btn-block { width: 100%; margin-top: 16px; }
.steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(240, 193, 75, 0.28);
  background: rgba(16, 13, 10, 0.9);
}
.step b, .rules b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2a1208;
  background: linear-gradient(180deg, #fff1c2, #c4841d);
}
.step h2, .step p { margin: 0; }
.step p { color: #d9cbb4; font-size: 14px; }
.block-title { margin: 16px 0 10px; }
.zone-list { display: grid; gap: 12px; }
.shot { width: 100%; height: 168px; object-fit: cover; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(240, 193, 75, 0.65);
  color: #f0c14b;
  font-size: 12px;
}
.progress { color: #d9cbb4; font-size: 13px; }
.zone-card.is-locked img { filter: grayscale(0.85) brightness(0.55); }
.zone-card .btn { width: 100%; }
.people {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.people figure { margin: 0; min-width: 0; }
.people img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid rgba(240, 193, 75, 0.45);
}
.people figcaption {
  margin-top: 6px;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.banner {
  width: 100%;
  height: clamp(160px, 32vh, 240px);
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid rgba(240, 193, 75, 0.45);
  margin-bottom: 12px;
}
.keeps { display: grid; gap: 8px; }
.keep {
  min-width: 0;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(240, 193, 75, 0.32);
  background: #12100d;
}
.keep:not(.is-owned) { opacity: 0.62; }
.keep p:last-child { margin: 0; color: #d9cbb4; }
.rules, .legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rules li, .legend li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(240, 193, 75, 0.28);
  background: rgba(16, 13, 10, 0.92);
}
.legend li { grid-template-columns: auto minmax(0, 1fr); }
.swatch { width: 22px; height: 22px; border-radius: 6px; }
.swatch-veil { background: #0b0c10; box-shadow: inset 0 0 0 1px rgba(240, 193, 75, 0.25); }
.swatch-path { background: linear-gradient(160deg, #5a4632, #2a1d14); }
.swatch-gem { background: linear-gradient(180deg, #fff6d4, #f0c14b); }
.swatch-relic { background: linear-gradient(180deg, #ffb0a6, #e10600); }
.swatch-door { background: linear-gradient(180deg, #5a141c, #14080c); border: 1px solid #e10600; }
.screen-play.is-on {
  display: flex;
  flex-direction: column;
  width: min(100%, 680px);
  height: 100vh;
  height: 100dvh;
  padding: 8px 10px calc(118px + env(safe-area-inset-bottom));
  overflow: hidden;
}
.play-top, .questline, .pad, .hint { flex: none; }
.play-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.play-title { min-width: 0; }
.play-top h1 {
  font-size: clamp(18px, 5vw, 28px);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.oil { display: flex; align-items: center; gap: 6px; flex: none; }
.oil-num { color: #f0c14b; font-weight: 700; min-width: 1.2em; text-align: right; }
.oil-bar {
  width: 64px;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: #1a140f;
  border: 1px solid rgba(240, 193, 75, 0.55);
}
.oil-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e10600, #f0c14b); }
.questline {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(225, 6, 0, 0.16);
  border: 1px solid rgba(240, 193, 75, 0.45);
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.board-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  width: 100%;
}
.board {
  width: min(100%, 420px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: clamp(2px, 1vw, 5px);
  padding: 6px;
  border-radius: 18px;
  background: linear-gradient(180deg, #3a2a14, #120e0a);
  box-shadow: inset 0 0 0 1px #f0c14b, 0 12px 28px rgba(0, 0, 0, 0.45);
  touch-action: none;
  user-select: none;
}
.board.is-bump { animation: bump 0.18s linear; }
@keyframes bump { 40% { transform: translateX(4px); } }
.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: clamp(4px, 1.4vw, 9px);
  overflow: hidden;
}
.cell.veil { background: #0b0c10; box-shadow: inset 0 0 12px #000; }
.cell.veil::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(240, 193, 75, 0.35);
  transform: translate(-50%, -50%);
}
.cell.kind-W { background: repeating-linear-gradient(135deg, #1c1612 0 3px, #100e0c 3px 6px); }
.cell.kind-P, .cell.kind-S, .cell.kind-N, .cell.kind-M, .cell.kind-V, .cell.kind-F, .cell.kind-L, .cell.kind-H, .cell.kind-G {
  background: linear-gradient(160deg, #5a4632, #2a1d14);
}
.gem, .mark, .token, .folk {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-style: normal;
}
.gem-v, .gem-f { width: 28%; height: 28%; }
.gem-v {
  background: linear-gradient(180deg, #fff6d4, #f0c14b);
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 8px rgba(240, 193, 75, 0.9);
}
.gem-f {
  background: linear-gradient(180deg, #ffb0a6, #e10600);
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 8px rgba(225, 6, 0, 0.85);
}
.gem-empty {
  width: 24%;
  height: 24%;
  border-radius: 50%;
  border: 1px dashed rgba(240, 193, 75, 0.75);
}
.mark-lamp {
  width: 26%;
  height: 26%;
  border-radius: 50% 50% 50% 0;
  transform: translate(-50%, -50%) rotate(-45deg);
  background: radial-gradient(circle at 40% 40%, #fff6d4, #f0c14b 45%, #e10600);
}
.mark-shrine {
  width: 42%;
  height: 24%;
  border-radius: 40% 40% 6px 6px;
  background: #6d1218;
  box-shadow: 0 -7px 0 -2px #f0c14b;
}
.mark-shrine.lit { background: #f0c14b; box-shadow: 0 0 10px #f0c14b; }
.mark-gate {
  width: 38%;
  height: 56%;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, #5a141c, #14080c);
  border: 1px solid #e10600;
}
.mark-gate.lit {
  background: linear-gradient(180deg, #fff1c2, #e0b03a);
  border-color: #fff6d4;
  box-shadow: 0 0 10px rgba(240, 193, 75, 0.9);
}
.token, .folk-n {
  width: 68%;
  height: 68%;
  border-radius: 50%;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow: 0 0 0 2px #f0c14b, 0 0 10px rgba(240, 193, 75, 0.75);
}
.token { background-image: url("traveler.jpg"); }
.folk-n { background-image: var(--face); }
.folk-m {
  width: 62%;
  height: 62%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #2a1208;
  font-size: clamp(11px, 3.2vw, 16px);
  font-weight: 700;
  background: radial-gradient(circle at 30% 30%, #fff1c2, #c4841d);
  box-shadow: 0 0 0 2px #f0c14b;
}
.pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 440px);
  margin: 8px auto 0;
}
.pad-btn {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 700;
  color: #2a1208;
  background: linear-gradient(180deg, #fff1c2, #e0b03a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 3px 0 #8a5a10;
  touch-action: manipulation;
}
.pad-word { font-size: 15px; }
.pad-btn.is-hot { box-shadow: 0 0 0 2px #fff1c2, 0 0 16px rgba(240, 193, 75, 0.85); }
.hint {
  min-height: 2.6em;
  margin: 6px 0 0;
  text-align: center;
  color: #f0c14b;
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dock-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 0 10px calc(8px + env(safe-area-inset-bottom));
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(7, 8, 12, 0.94) 28%);
}
.dock-caption {
  width: min(100%, 680px);
  margin: 0 auto 6px;
  text-align: center;
  font-size: 13px;
  color: #f6efe2;
}
.dock {
  width: min(100%, 680px);
  margin: 0 auto;
  pointer-events: auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
  padding: 8px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(58, 42, 20, 0.35), rgba(0, 0, 0, 0.2)), #100d0a;
  border: 1px solid rgba(240, 193, 75, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 244, 200, 0.28), 0 12px 30px rgba(0, 0, 0, 0.5);
}
.dock a {
  min-width: 0;
  width: 100%;
  max-width: 72px;
  height: 48px;
  justify-self: center;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #f0c14b;
  text-decoration: none;
  background: radial-gradient(circle at 40% 30%, #3a301c, #14110e 72%);
  border: 1px solid rgba(240, 193, 75, 0.4);
}
.dock svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.dock a.is-main {
  width: 56px;
  height: 56px;
  max-width: 56px;
  border-radius: 50%;
  z-index: 2;
  color: #2a1208;
  background: radial-gradient(circle at 35% 30%, #fff6d2, #f0c14b 45%, #c4841d);
  border-color: #fff1c4;
  box-shadow: 0 0 0 2px #5a1014, 0 0 0 4px #f0c14b, 0 10px 18px rgba(0, 0, 0, 0.4);
  animation: seal 2.8s ease-in-out infinite;
}
.dock a.is-on:not(.is-main) {
  color: #1a0c08;
  background: linear-gradient(165deg, #ff5a45, #e10600 48%, #f0c14b);
  border-color: #fff1c4;
}
@keyframes seal {
  50% { box-shadow: 0 0 0 2px #5a1014, 0 0 0 5px #f0c14b, 0 0 18px rgba(225, 6, 0, 0.55); }
}
.sheet, .modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: 12px;
  background: rgba(0, 0, 0, 0.62);
}
.sheet { display: grid; align-items: end; }
.modal { z-index: 50; display: grid; place-items: center; }
.sheet[hidden], .modal[hidden] { display: none; }
.sheet__card, .modal__card {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 14px;
  overflow: auto;
  max-height: min(70vh, 480px);
  max-height: min(70dvh, 480px);
}
.sheet__card { margin-bottom: calc(96px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px 12px; }
.sheet__face {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid #f0c14b;
  background-position: center;
  background-size: cover;
  display: grid;
  place-items: center;
  color: #2a1208;
  font-weight: 700;
  font-size: 22px;
}
.sheet__name { margin: 0; color: #f0c14b; font-weight: 700; }
.sheet__text { margin: 4px 0 0; max-height: 28vh; max-height: 28dvh; overflow: auto; }
.sheet__card .btn, .modal__actions { grid-column: 1 / -1; }
.modal__actions { display: flex; gap: 8px; }
.modal__actions .btn { flex: 1; margin-top: 0; }
.modal__card p { margin-bottom: 14px; }
@media (min-width: 520px) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .keeps { grid-template-columns: 1fr 1fr; }
  .shot { height: 190px; }
}
@media (max-width: 340px) {
  .shot { height: 136px; }
  .brand__mark { width: 46px; height: 46px; }
  .pad { gap: 6px; }
  .pad-btn { min-height: 44px; }
  .dock a { height: 44px; }
  .dock a.is-main { width: 48px; height: 48px; max-width: 48px; }
  .dock svg { width: 22px; height: 22px; }
}
@media (max-height: 700px) {
  .pad-btn { min-height: 42px; }
  .questline { -webkit-line-clamp: 1; margin: 6px 0; }
  .screen-play.is-on { padding-top: 6px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  body[data-screen="journey"] { overflow: hidden; height: 100vh; height: 100dvh; }
  .screen-play.is-on {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 210px);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "top top"
      "quest quest"
      "board pad"
      "hint hint";
    column-gap: 8px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .screen-play.is-on { padding-top: 4px; padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .play-top { grid-area: top; }
  .play-top h1 { font-size: 18px; -webkit-line-clamp: 1; }
  .questline { grid-area: quest; margin: 4px 0; -webkit-line-clamp: 1; }
  .board-wrap { grid-area: board; height: 100%; min-height: 0; }
  .pad { grid-area: pad; width: 100%; margin: 0; align-self: center; }
  .hint { grid-area: hint; min-height: 1.3em; -webkit-line-clamp: 1; margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker__move, .dock a.is-main, .board.is-bump { animation: none; }
}
button:focus-visible, a:focus-visible {
  outline: 2px solid #f0c14b;
  outline-offset: 2px;
}
