@font-face {
  font-family: CinzelLoop;
  src: url("cinzel.ttf") format("truetype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: PadaukLoop;
  src: url("padauk.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: PadaukLoop;
  src: url("padaukbold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --crimson: #B11226;
  --crimson-deep: #7A0C1A;
  --gold: #E6B422;
  --gold-dim: #B48C1A;
  --ink: #12080A;
  --ink-lift: #1C0C10;
  --cream: #F6E7C2;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

html, body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  font-family: PadaukLoop, "Myanmar Text", sans-serif;
}

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

button, h1, h2, h3, strong {
  font-family: inherit;
}

h1, .latin, .mast-name strong, .pct, .mesa-cell b, .fan-tile span, .flip-tile b, .chip b, .loop-hud b, .score-list b {
  font-family: CinzelLoop, PadaukLoop, serif;
}

h2, h3 {
  font-family: PadaukLoop, "Myanmar Text", sans-serif;
}

button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.ink-frame {
  width: min(100%, 440px);
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--ink);
  box-shadow: 0 0 0 1px rgba(230, 180, 34, 0.18);
}

@media (min-width: 720px) {
  body {
    background:
      linear-gradient(118deg, rgba(177, 18, 38, 0.35), transparent 42%),
      var(--ink) url("goldslash.webp") center / cover no-repeat;
  }
  .ink-frame {
    min-height: min(100dvh, 920px);
    margin-top: max(12px, var(--safe-t));
    border-radius: 28px;
  }
}

.wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.loop-wash {
  background-image: url("loopback.webp");
  filter: saturate(1.05);
}

.slash-wash {
  background-image: url("goldslash.webp");
  opacity: 0.55;
}

.loop-wash.dim {
  filter: brightness(0.28) saturate(1.05);
}

.slash-wash {
  filter: brightness(0.42) saturate(1.1);
}

#onboard .scene.is-on {
  background: linear-gradient(180deg, rgba(18, 8, 10, 0.72), rgba(18, 8, 10, 0.2) 42%, rgba(18, 8, 10, 0.62));
  border-radius: 22px;
  padding: 12px 10px 16px;
}

.slash-cut {
  position: absolute;
  inset: -20%;
  background: linear-gradient(128deg, transparent 42%, rgba(230, 180, 34, 0.22) 50%, transparent 58%);
  pointer-events: none;
  transform: rotate(-8deg);
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(18px + var(--safe-t)) 20px calc(22px + var(--safe-b));
}

.veil.is-on {
  animation: veilIn 0.5s ease both;
}

@keyframes veilIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.splash-core, .scene {
  position: relative;
  width: min(100%, 380px);
  text-align: center;
}

.splash-mark {
  width: 118px;
  height: 118px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(18, 8, 10, 0.55));
  animation: markPulse 1.5s ease both;
}

@keyframes markPulse {
  0% { transform: scale(0.82) rotate(-8deg); opacity: 0; }
  55% { transform: scale(1.06) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.kicker {
  margin: 0 0 6px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--gold);
  font-family: CinzelLoop, serif;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.7rem);
  font-weight: 700;
  color: var(--gold);
}

h2 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.45;
  text-shadow: 0 2px 10px var(--ink);
}

h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  line-height: 1.45;
}

.splash-line, .lead {
  margin: 0 0 16px;
  line-height: 1.65;
  color: rgba(246, 231, 194, 0.92);
  text-shadow: 0 2px 10px var(--ink);
}

.splash-bar {
  display: block;
  width: 168px;
  height: 4px;
  margin: 18px auto 0;
  border-radius: 99px;
  background: rgba(177, 18, 38, 0.45);
  overflow: hidden;
}

.splash-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--crimson), var(--gold));
  animation: splashFill 1.5s linear forwards;
}

@keyframes splashFill {
  to { width: 100%; }
}

.crimson-track {
  position: absolute;
  top: calc(10px + var(--safe-t));
  left: 18px;
  right: 18px;
  height: 7px;
  border-radius: 99px;
  background: rgba(18, 8, 10, 0.55);
  border: 1px solid rgba(230, 180, 34, 0.28);
  overflow: hidden;
  z-index: 2;
}

.crimson-track i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--crimson-deep), var(--crimson), var(--gold));
  box-shadow: 0 0 12px var(--crimson);
  transition: width 0.2s linear;
}

.onboard-tag {
  margin-top: 28px;
}

.scene {
  display: none;
  flex-direction: column;
  align-items: center;
}

.scene.is-on {
  display: flex;
  animation: sceneFan 0.7s ease both;
}

@keyframes sceneFan {
  from { opacity: 0; transform: rotate(-8deg) translateY(16px); }
  to { opacity: 1; transform: rotate(0deg) translateY(0); }
}

.cta, .ghost {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cta {
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  color: var(--ink);
  box-shadow: 0 8px 0 var(--crimson-deep), 0 12px 24px rgba(18, 8, 10, 0.35);
}

.cta:disabled {
  opacity: 0.38;
  box-shadow: none;
  cursor: default;
}

.ghost {
  margin-top: 8px;
  color: var(--gold);
  border: 1px solid rgba(230, 180, 34, 0.35);
}

.fold-rig {
  position: relative;
  width: min(86vw, 280px);
  height: 250px;
  margin: 8px auto 18px;
}

.glyph {
  position: absolute;
  top: 38px;
  font-style: normal;
  font-size: 92px;
  line-height: 1;
  color: var(--gold);
  font-family: CinzelLoop, serif;
  font-weight: 700;
  text-shadow: 0 8px 0 var(--crimson-deep);
  transition: transform 1s ease;
}

.glyph.a { left: 8px; }
.glyph.b { left: 92px; }
.glyph.c { left: 168px; }

.fold-rig.is-fold .glyph.a { transform: translate(78px, 8px) rotate(-8deg) scale(0.72); opacity: 0.2; }
.fold-rig.is-fold .glyph.b { transform: translate(0, -6px) scale(1.05); }
.fold-rig.is-fold .glyph.c { transform: translate(-78px, 10px) rotate(8deg) scale(0.72); opacity: 0.2; }

.fold-shot {
  position: absolute;
  inset: 18px 10px 40px;
  width: calc(100% - 20px);
  object-fit: contain;
  opacity: 0;
  transform: rotate(-8deg) scale(0.7);
  transition: opacity 1.2s ease, transform 1.4s ease;
}

.fold-rig.is-fold .fold-shot {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.loop-draw {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.loop-draw path {
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 720;
  stroke-dashoffset: 720;
}

.fold-rig.is-loop path {
  animation: drawLoop 1.2s ease forwards;
}

@keyframes drawLoop {
  to { stroke-dashoffset: 0; }
}

.flip-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 20px;
  perspective: 900px;
  width: 100%;
}

.flip-tile {
  width: min(138px, 44vw);
  height: 168px;
  flex: 1 1 38%;
  max-width: 148px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s ease;
}

.flip-tile.is-over {
  transform: rotateY(180deg) rotate(-8deg);
}

.flip-tile .face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background:
    linear-gradient(160deg, rgba(230, 180, 34, 0.16), transparent 42%),
    var(--ink-lift);
  border: 1px solid rgba(230, 180, 34, 0.4);
  box-shadow: 8px 10px 0 rgba(177, 18, 38, 0.35);
}

.flip-tile .front img {
  width: 78px;
  height: 78px;
  object-fit: contain;
}

.flip-tile .back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, var(--crimson), var(--crimson-deep));
}

.flip-tile b {
  font-family: CinzelLoop, serif;
  color: var(--gold);
}

.ask-fan {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin: 4px 0 14px;
}

.ask-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
}

.ask-grid button {
  min-height: 52px;
  padding: 10px 8px;
  border-radius: 14px;
  background: var(--ink-lift);
  border: 1px solid rgba(230, 180, 34, 0.28);
  transform: rotate(-8deg);
  font-weight: 700;
}

.ask-grid button:nth-child(2n) {
  transform: rotate(8deg);
}

.ask-grid button.is-yes {
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  color: var(--ink);
}

.ask-grid button.is-no {
  animation: noShake 0.4s ease;
}

@keyframes noShake {
  25% { transform: translateX(-6px) rotate(-8deg); }
  50% { transform: translateX(6px) rotate(8deg); }
  100% { transform: translateX(0); }
}

.ask-hint {
  color: var(--gold);
  font-weight: 700;
}

.seal-mark {
  width: 140px;
  margin-top: 12px;
  filter: drop-shadow(0 0 18px rgba(230, 180, 34, 0.35));
}

#app {
  position: relative;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding:
    calc(10px + var(--safe-t)) 12px
    calc(118px + var(--safe-b));
}

.mast {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mast-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mast-name img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.mast-name small {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-family: CinzelLoop, serif;
}

.mast-name strong {
  font-size: 1.15rem;
  color: var(--gold);
}

.chip {
  min-width: 64px;
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(177, 18, 38, 0.72);
  border: 1px solid rgba(230, 180, 34, 0.4);
  text-align: right;
  transform: rotate(-8deg);
}

.chip span {
  display: block;
  font-size: 0.65rem;
  color: var(--gold);
}

.chip b {
  font-family: CinzelLoop, serif;
  font-size: 1.1rem;
}

#stage {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.pane {
  display: none;
  animation: sceneFan 0.45s ease both;
}

.pane.is-on {
  display: block;
}

.mesa-fan {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(104px, auto));
  gap: 12px 6px;
  margin-top: 8px;
  padding: 10px 8px 18px;
  overflow: visible;
}

.mesa-cell {
  position: relative;
  min-height: 108px;
  min-width: 0;
  padding: 10px 4px 12px;
  border-radius: 18px;
  background:
    linear-gradient(155deg, rgba(230, 180, 34, 0.14), transparent 46%),
    var(--ink-lift);
  border: 1px solid rgba(230, 180, 34, 0.32);
  box-shadow: 6px 8px 0 rgba(177, 18, 38, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mesa-cell img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.mesa-cell b {
  font-family: CinzelLoop, serif;
  font-size: 0.78rem;
  color: var(--gold);
}

.mesa-cell:nth-child(1) { transform: rotate(-8deg) translateY(-6px); }
.mesa-cell:nth-child(2) { transform: rotate(0deg) translateY(-14px); }
.mesa-cell:nth-child(3) { transform: rotate(8deg) translateY(-2px); }
.mesa-cell:nth-child(4) { transform: rotate(-8deg) translateY(8px); }
.mesa-cell:nth-child(5) { transform: rotate(0deg) translateY(2px); }
.mesa-cell:nth-child(6) { transform: rotate(8deg) translateY(10px); }

.mesa-cell.is-hot {
  outline: 2px solid var(--gold);
}

.loop-hud, .loop-hud.mini {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  margin-bottom: 8px;
  font-size: 0.82rem;
}

.loop-hud b {
  color: var(--gold);
  font-family: CinzelLoop, serif;
}

.loop-stage {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 30%, rgba(177, 18, 38, 0.45), transparent 55%),
    rgba(18, 8, 10, 0.72);
  border: 1px solid rgba(230, 180, 34, 0.3);
  overflow: hidden;
  touch-action: manipulation;
}

.loop-stage.mini {
  height: 210px;
  margin-bottom: 8px;
}

.loop-stage svg {
  width: 100%;
  height: 100%;
}

.loop-stage .rail {
  fill: none;
  stroke: var(--crimson);
  stroke-width: 8;
  stroke-linecap: round;
}

.loop-stage .rail-gold {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.2;
  stroke-dasharray: 6 10;
  opacity: 0.85;
}

.loop-stage .mark {
  fill: var(--gold);
  stroke: var(--crimson);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px var(--gold));
}

.loop-stage .mark.is-hot {
  fill: #fff3b0;
}

.loop-stage .rider {
  font-family: CinzelLoop, serif;
  font-size: 28px;
  font-weight: 700;
  fill: var(--gold);
  paint-order: stroke;
  stroke: var(--ink);
  stroke-width: 4;
}

.quiz-step {
  color: var(--gold);
  font-family: CinzelLoop, serif;
  margin: 0 0 8px;
}

.pct {
  display: block;
  font-size: 3.2rem;
  color: var(--gold);
  margin: 8px 0;
}

.hold-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0;
}

.hold-nine {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 32%, rgba(230, 180, 34, 0.28), transparent 42%),
    var(--crimson);
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 8px rgba(177, 18, 38, 0.35);
  transform: rotate(-8deg);
  touch-action: none;
}

.hold-nine:disabled {
  opacity: 0.55;
  cursor: default;
}

.hold-nine b {
  font-family: CinzelLoop, serif;
  font-size: 78px;
  color: var(--gold);
  position: relative;
  z-index: 1;
}

.hold-ring {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) var(--hold, 0%), transparent 0);
  mask: radial-gradient(circle, transparent 58%, #000 60%);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%);
}

.hold-msg {
  margin: 14px 0 0;
  color: var(--gold);
}

.stamps {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0;
  margin: 8px 0 0;
}

.stamps li {
  width: 28px;
  height: 36px;
  clip-path: polygon(50% 0, 100% 26%, 100% 74%, 50% 100%, 0 74%, 0 26%);
  background: rgba(246, 231, 194, 0.12);
  border: 1px solid rgba(230, 180, 34, 0.25);
}

.stamps li.on {
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  box-shadow: 0 0 10px rgba(230, 180, 34, 0.45);
}

.score-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.score-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--ink-lift);
  border: 1px solid rgba(230, 180, 34, 0.22);
  transform: rotate(-8deg);
}

.score-list li:nth-child(2n) {
  transform: rotate(8deg);
}

.score-list b {
  color: var(--gold);
  font-family: CinzelLoop, serif;
}

.nine-hero {
  position: relative;
  height: 220px;
  margin: 8px 0 12px;
}

.nine-hero img {
  width: 100%;
  height: 200px;
  object-fit: contain;
}

.nine-mark {
  position: absolute !important;
  width: 72px !important;
  height: 72px !important;
  right: 18px;
  bottom: 0;
}

.sheet {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(18, 8, 10, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 12px calc(128px + var(--safe-b));
}

.sheet-card {
  width: min(100%, 380px);
  max-height: min(68dvh, 520px);
  overflow: auto;
  padding: 18px 16px 14px;
  border-radius: 22px 22px 8px 8px;
  background:
    linear-gradient(160deg, rgba(177, 18, 38, 0.4), transparent 40%),
    var(--ink-lift);
  border: 1px solid rgba(230, 180, 34, 0.4);
  transform: rotate(-8deg);
  text-align: center;
}

.sheet-card img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.sheet-card ol {
  text-align: left;
  margin: 0 0 14px;
  padding-left: 20px;
  line-height: 1.5;
}

.fan-nav {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(8px + var(--safe-b));
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 54px);
  gap: 8px 6px;
  padding: 6px 4px 2px;
}

.fan-tile {
  position: relative;
  border-radius: 14px;
  background: var(--ink-lift);
  border: 1px solid rgba(230, 180, 34, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}

.fan-tile img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.fan-tile span {
  font-family: CinzelLoop, serif;
  font-size: 0.72rem;
  color: var(--cream);
}

.fan-tile .gold-nine {
  position: absolute;
  top: -1px;
  right: 3px;
  font-style: normal;
  font-family: CinzelLoop, serif;
  font-size: 0.7rem;
  color: var(--gold);
  opacity: 0;
}

.fan-tile.is-on {
  background: linear-gradient(180deg, var(--crimson), var(--crimson-deep));
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(230, 180, 34, 0.35);
}

.fan-tile.is-on .gold-nine {
  opacity: 1;
}

.fan-tile:nth-child(1) { transform: rotate(-8deg) translateY(-4px); }
.fan-tile:nth-child(2) { transform: rotate(0deg) translateY(-10px); }
.fan-tile:nth-child(3) { transform: rotate(8deg) translateY(-2px); }
.fan-tile:nth-child(4) { transform: rotate(-8deg) translateY(4px); }
.fan-tile:nth-child(5) { transform: rotate(0deg) translateY(0); }
.fan-tile:nth-child(6) { transform: rotate(8deg) translateY(6px); }

@media (max-height: 700px) {
  .fold-rig { height: 200px; }
  .loop-stage { height: 230px; }
  .mesa-cell { min-height: 96px; }
  .glyph { font-size: 72px; }
}

@media (max-width: 400px) {
  .fan-tile span { font-size: 0.6rem; }
  .flip-tile { width: min(120px, 42vw); height: 150px; }
  .mesa-cell img { width: 40px; height: 40px; }
  .mesa-cell b { font-size: 0.64rem; }
  .mesa-cell:nth-child(1) { transform: rotate(-8deg) translateY(-4px); }
  .mesa-cell:nth-child(2) { transform: rotate(0deg) translateY(-10px); }
  .mesa-cell:nth-child(3) { transform: rotate(8deg) translateY(0); }
  .mesa-cell:nth-child(4) { transform: rotate(-8deg) translateY(6px); }
  .mesa-cell:nth-child(5) { transform: rotate(0deg) translateY(2px); }
  .mesa-cell:nth-child(6) { transform: rotate(8deg) translateY(8px); }
  .mast-name small { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
