@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("bevietnam-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("bevietnam-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("bevietnam-400.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("bevietnam-700.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  color-scheme: dark;
  --ink: #f6f1e6;
  --muted: #b4a89a;
  --gold: #ffc300;
  --gold-deep: #c09962;
  --green: #1fbf6a;
  --green-deep: #0c8a45;
  --field: #07140f;
  --card: #10281c;
  --line: rgba(192, 153, 98, 0.48);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% -12%, rgba(255, 195, 0, 0.16), transparent 46%),
    radial-gradient(80% 50% at 100% 100%, rgba(31, 191, 106, 0.14), transparent 50%),
    var(--field);
  color: var(--ink);
  font-family: "Be Vietnam Pro", "Roboto", "Segoe UI", sans-serif;
  font-size: clamp(14px, 3.5vw, 16px);
  line-height: 1.4;
}

body {
  min-height: 100%;
  height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
}

button { font: inherit; color: inherit; cursor: pointer; }

img { max-width: 100%; display: block; }

p { margin: 0; }

h1, h2 { margin: 0; line-height: 1.15; }

.app {
  width: min(100%, 520px);
  height: 100%;
  max-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.mast {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(7, 20, 15, 0.98), rgba(10, 28, 20, 0.92));
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -1px 0 rgba(255, 195, 0, 0.18);
}

.mark {
  width: 42px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #1a1204;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  background: linear-gradient(160deg, #ffe98a, #ffc300 46%, #c09962);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.mast-copy { min-width: 0; }

.mast-copy b,
.mast-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mast-copy b { font-size: 16px; }

.mast-copy span {
  color: var(--muted);
  font-size: 12px;
}

.live, .icon-btn {
  min-width: 46px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255, 195, 0, 0.5);
  background: rgba(8, 22, 16, 0.72);
  color: var(--gold);
  display: grid;
  place-items: center;
  padding: 0 8px;
  font-weight: 700;
}

.icon-btn { width: 42px; min-width: 42px; padding: 0; }

.icon-btn svg { width: 18px; height: 18px; display: block; }

.stage {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.stage::-webkit-scrollbar { width: 0; height: 0; }

body[data-view="play"] .stage { overflow: hidden; }

body[data-view="play"] .plinth { display: none; }

.pad {
  padding: 12px 12px 18px;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.kicker {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 { font-size: clamp(28px, 8vw, 40px); }

.lead { color: #f0e6d4; }

.frame {
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 195, 0, 0.42);
  background: linear-gradient(180deg, rgba(22, 52, 38, 0.95), rgba(10, 28, 20, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 224, 150, 0.16), 0 14px 28px rgba(0, 0, 0, 0.24);
  min-width: 0;
}

.copy { padding: 12px; display: grid; gap: 8px; }

.shot, .hero-shot {
  width: 100%;
  object-fit: cover;
  background: #0c2418;
}

.hero-shot { height: clamp(156px, 30dvh, 240px); }

.shot { height: clamp(128px, 34vw, 200px); }

.shot-wrap { position: relative; }

.lock {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(6, 16, 12, 0.86);
  border: 1px solid rgba(255, 195, 0, 0.65);
  color: #ffe7a8;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frame.locked img { filter: grayscale(0.7) brightness(0.72); }

.actions, .stack { display: grid; gap: 8px; }

.stack { gap: 14px; }

.go, .ghost, .switch {
  width: 100%;
  min-height: 48px;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 700;
}

.go {
  border: 1px solid #ffe08a;
  background: linear-gradient(180deg, #2ad67a 0%, #0c8a45 100%);
  color: #f6fff8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 8px 16px rgba(0, 0, 0, 0.24);
}

.ghost, .switch {
  border: 1px solid rgba(255, 195, 0, 0.72);
  background: rgba(8, 22, 16, 0.45);
  color: var(--ink);
}

.go:active, .ghost:active, .level:active, .basket:active, .spin button:active, .nav-btn:active {
  transform: scale(0.985);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  min-width: 0;
  padding: 8px;
  border-radius: 16px;
  background: rgba(8, 24, 18, 0.76);
  border: 1px solid rgba(192, 153, 98, 0.35);
}

.stat b, .stat span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat b { font-size: 15px; }

.stat span { color: var(--muted); font-size: 10px; }

.rail {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
}

.seg {
  height: 8px;
  border-radius: 99px;
  background: #163328;
}

.seg.on { background: linear-gradient(180deg, #ffe14a, #e0a000); }

.level-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.level {
  text-align: left;
  min-width: 0;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(192, 153, 98, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 195, 0, 0.95) 0 9px, transparent 9px),
    linear-gradient(180deg, #173528, #0d2219);
  display: grid;
  gap: 4px;
  align-content: start;
}

.level.locked { opacity: 0.52; }

.level.focus { box-shadow: inset 0 0 0 1px rgba(31, 191, 106, 0.8); }

.level-id { color: var(--gold); font-size: 11px; font-weight: 700; }

.level strong {
  font-size: 14px;
  line-height: 1.25;
  min-height: 2.5em;
}

.level em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}

.stars { display: inline-flex; gap: 3px; align-items: center; }

.star {
  width: 11px;
  height: 11px;
  background: #2a3a30;
  clip-path: polygon(50% 0, 62% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 38% 35%);
}

.star.on { background: linear-gradient(#fff1b0, #ffc300); }

.block h2 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #ffe7a8;
}

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.step i {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 700;
  color: #1a1204;
  background: linear-gradient(180deg, #ffe14a, #e0a800);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.goods-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.good {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 16px;
  background: rgba(8, 22, 16, 0.65);
  border: 1px solid rgba(192, 153, 98, 0.3);
}

.good b, .good small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.good small { color: var(--muted); font-size: 11px; }

.token-lg, .pip, .sat, .gate-card {
  background: radial-gradient(circle at 30% 20%, #24543c, #0c2418 72%);
}

.token-lg {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 195, 0, 0.45);
}

.token-lg svg, .pip svg, .sat svg, .gate-card svg { display: block; }

.token-lg svg { width: 28px; height: 28px; }

.hall-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(192, 153, 98, 0.25);
}

.hall-row b { color: var(--gold); font-variant-numeric: tabular-nums; }

.hall-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty { color: var(--muted); }

.switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.switch small { color: var(--muted); font-weight: 400; }

.note { color: var(--muted); font-size: 12px; }

.play {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "hud"
    "hint"
    "susan"
    "spin"
    "baskets";
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 6px;
  padding: 8px 10px 10px;
  position: relative;
}

.hud { grid-area: hud; }
.hint { grid-area: hint; }
.susan-slot { grid-area: susan; }
.spin { grid-area: spin; }
.baskets { grid-area: baskets; }

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.cell {
  min-width: 0;
  padding: 4px 6px;
  border-radius: 12px;
  background: rgba(8, 22, 16, 0.72);
  border: 1px solid rgba(192, 153, 98, 0.28);
}

.cell b, .cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell b { font-size: clamp(12px, 3.4vw, 16px); color: #ffe7a8; }

.cell span { font-size: 10px; color: var(--muted); }

.hint {
  margin: 0;
  min-height: 2.5em;
  color: #e7d7b0;
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.baskets {
  display: grid;
  grid-template-columns: repeat(var(--guests, 1), minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  min-height: 0;
  align-content: start;
}

.basket {
  min-width: 0;
  text-align: left;
  border-radius: 16px;
  padding: 6px;
  border: 1px solid rgba(192, 153, 98, 0.45);
  background: linear-gradient(180deg, rgba(20, 48, 36, 0.96), rgba(8, 24, 18, 0.96));
}

.basket.ready {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold), 0 0 14px rgba(255, 195, 0, 0.22);
}

.who, .need {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who { font-weight: 700; font-size: 13px; }

.need { margin: 1px 0 4px; color: #e7d7b0; font-size: 11px; }

.meter {
  display: block;
  height: 5px;
  border-radius: 99px;
  background: #08140f;
  overflow: hidden;
  margin-bottom: 4px;
}

.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ff5d6c, #ffc300 55%, #2ee59a);
}

.pips { display: flex; flex-wrap: wrap; gap: 3px; }

.pip {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.pip svg { width: 12px; height: 12px; }

.pip.done { opacity: 0.35; }

.pip.now { border-color: var(--gold); }

.fruit { border-color: #2ee59a; }
.drink { border-color: #ffc300; }
.pantry { border-color: #e7d7b0; }

.susan-slot {
  min-height: 0;
  min-width: 0;
  display: grid;
  place-items: center;
}

.susan {
  position: relative;
  width: min(100%, 72vw, 280px);
  aspect-ratio: 1;
  max-height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(255, 195, 0, 0.58);
  background: radial-gradient(circle at 50% 42%, rgba(32, 78, 52, 0.98), rgba(8, 22, 16, 0.98) 70%);
  box-shadow: inset 0 0 0 8px rgba(255, 195, 0, 0.08), inset 0 0 28px rgba(0, 0, 0, 0.45), 0 12px 24px rgba(0, 0, 0, 0.32);
  display: grid;
  place-items: center;
  touch-action: none;
}

.susan.in-zone { box-shadow: inset 0 0 0 2px var(--gold), 0 0 18px rgba(255, 195, 0, 0.35); }

.gate { position: relative; z-index: 2; width: 44%; }

.gate-card {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 18px;
  border: 1px solid rgba(255, 195, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  position: relative;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
  animation: pop 0.18s ease;
}

.gate-card svg { width: 52%; height: 46%; }

.gate-card b {
  font-size: 11px;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gate-card em {
  position: absolute;
  top: 4px;
  right: 6px;
  font-style: normal;
  font-size: 10px;
  color: #ffb4b8;
}

.gate-card em:empty { display: none; }

.gate-card.spoiled { filter: grayscale(0.45); border-color: #ff5d6c; }

.sat {
  position: absolute;
  width: 20%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 195, 0, 0.4);
  display: grid;
  place-items: center;
}

.sat svg { width: 68%; height: 68%; }

.sat.spoiled { filter: grayscale(0.75); border-color: #ff5d6c; }

.sat { width: 18%; }
.s1 { top: 2%; left: 50%; transform: translateX(-50%); }
.s2 { top: 50%; right: 0; transform: translateY(-50%); }
.s3 { bottom: 2%; left: 50%; transform: translateX(-50%); }
.s4 { top: 50%; left: 0; transform: translateY(-50%); }

.spin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.spin.with-discard { grid-template-columns: 1fr auto 1fr; }

.spin button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 195, 0, 0.75);
  background: rgba(8, 22, 16, 0.78);
  color: #ffe7a8;
  font-weight: 700;
  padding: 0 10px;
}

.spin .discard { border-color: #ff5d6c; color: #ffd0d4; min-width: 64px; }

.spin .discard:not(:disabled) { background: #3a1218; }

.spin button:disabled { opacity: 0.38; }

.rhythm {
  position: relative;
  height: 10px;
  border-radius: 99px;
  background: #07140f;
  border: 1px solid rgba(192, 153, 98, 0.45);
  overflow: hidden;
}

.zone {
  position: absolute;
  left: 38%;
  width: 24%;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 195, 0, 0.9), transparent);
}

.needle {
  position: absolute;
  top: 0;
  height: 100%;
  width: 4px;
  border-radius: 99px;
  background: #fff8ea;
  left: calc(var(--p, 0) * 100%);
  transform: translateX(-50%);
}

.hud-rhythm { grid-column: 1 / -1; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  place-items: center;
  padding: 12px;
  background: rgba(4, 12, 8, 0.78);
}

.overlay.show { display: grid; }

.sheet {
  width: min(100%, 380px);
  max-height: 100%;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 22px;
  background: linear-gradient(180deg, #163528, #0c2118);
  border: 1px solid rgba(255, 195, 0, 0.58);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.scoreline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.scoreline b { font-size: 28px; color: var(--gold); }

.floater {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  pointer-events: none;
  text-shadow: 0 2px 6px #000;
  animation: rise 0.7s ease forwards;
}

.plinth {
  flex: 0 0 auto;
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  padding: 8px 6px 8px;
  background:
    radial-gradient(42px 12px at 50% 0, rgba(255, 195, 0, 0.95), rgba(255, 195, 0, 0) 72%),
    linear-gradient(180deg, #163528, #09160f);
  border-top: 1px solid rgba(255, 195, 0, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 224, 150, 0.28), 0 -10px 24px rgba(0, 0, 0, 0.22);
}

.nav-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #d9d0c2;
  min-width: 0;
  min-height: 52px;
  padding: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.nav-btn svg { width: 22px; height: 22px; display: block; }

.nav-btn small {
  font-size: 10px;
  letter-spacing: 0.03em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-btn.active { color: var(--gold); }

.nav-btn.active small { color: var(--gold); }

.nav-btn.home .gem {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #062015;
  background: linear-gradient(180deg, #49f091, #0f8d49);
  border: 1px solid #ffe08a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 14px rgba(0, 0, 0, 0.28);
}

.nav-btn.home small { color: #f6f1e6; }

.nav-btn.home.active small { color: #fff4c2; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

::selection { background: var(--gold); color: #1a1204; }

@keyframes pop {
  from { transform: scale(0.9); opacity: 0.45; }
  to { transform: none; opacity: 1; }
}

@keyframes rise {
  to { transform: translate(-50%, -22px); opacity: 0; }
}

@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.shake { animation: shake 0.28s linear; }

@media (max-width: 340px) {
  .level-grid { grid-template-columns: 1fr; }
  .level strong { min-height: 0; }
}

@media (min-width: 400px) {
  .goods-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-height: 680px) {
  .hint { -webkit-line-clamp: 1; min-height: 0; }
  .play { gap: 4px; padding: 6px 8px; }
  .hero-shot { height: 140px; }
}

@media (orientation: landscape) and (max-height: 540px) {
  .mast { padding: 4px 8px; }
  .mark { width: 34px; height: 38px; font-size: 11px; }
  .live, .icon-btn { height: 34px; min-width: 40px; }
  .plinth { padding: 4px 6px; }
  .nav-btn { min-height: 42px; }
  .nav-btn.home .gem { width: 36px; height: 36px; border-radius: 12px; }
  .hero-shot, .shot { height: 96px; }
  .pad { padding: 8px; gap: 8px; }
  .play {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "hud hud"
      "hint hint"
      "susan baskets"
      "spin baskets";
    gap: 4px;
    padding: 4px 8px 6px;
  }
  .baskets { overflow: auto; }
  .cell { padding: 2px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .gate-card, .floater, .shake { animation: none; }
}
