/* ==========================================================================
   LIGHT UP THADINGYUT — styles
   tokens → base → atmosphere → screens → components → title → HUD/game
   → stages 1–6 → results/board → claim → overlays → motion
   ========================================================================== */

:root {
  --night-0: #04051a;
  --night-1: #080b26;
  --night-2: #0f1440;
  --night-3: #1a1f5c;

  --gold-50: #fff8e6;
  --gold-100: #ffeec4;
  --gold-200: #ffdc8f;
  --gold-300: #f5c060;
  --gold-400: #e5a03c;
  --gold-500: #b8762a;
  --gold-700: #6e4415;
  --amber: #ff9f43;
  --ember: #ff6b35;
  --rose: #ff6f8e;
  --jade: #3fd8a9;
  --azure: #7ab4ff;

  --text: #f6ecd8;
  --text-2: rgba(246, 236, 216, .74);
  --text-3: rgba(246, 236, 216, .5);
  --line: rgba(245, 192, 96, .2);
  --line-2: rgba(245, 192, 96, .42);
  --glass: linear-gradient(180deg, rgba(34, 38, 100, .62), rgba(12, 14, 48, .74));

  --r: 18px;
  --f-ui: 'Outfit', 'Noto Sans Myanmar', 'Myanmar Text', 'Pyidaungsu', system-ui, sans-serif;
  --f-display: var(--f-ui);
  --f-my: var(--f-ui);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --app-w: 480px;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  min-height: 100%;
  height: 100dvh;
  overflow: hidden;
  color: var(--text);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.45;
  background:
    radial-gradient(120% 55% at 50% 108%, rgba(120, 52, 60, .55) 0%, rgba(80, 30, 60, 0) 60%),
    radial-gradient(70% 40% at 82% 2%, rgba(38, 50, 140, .55) 0%, rgba(38, 50, 140, 0) 70%),
    linear-gradient(180deg, #04061a 0%, #0a0f33 42%, #16143f 76%, #2a1638 100%);
  background-color: var(--night-1);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
[lang="my"] { font-family: var(--f-my); }

/* ------------------------------------------------------------ atmosphere */
#bg, #fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#bg { z-index: 0; }
#fx { z-index: 60; }

/* --------------------------------------------------------------- layout */
#app {
  position: relative; z-index: 2;
  max-width: var(--app-w); height: 100%;
  margin: 0 auto;
}
@media (min-width: 700px) {
  :root { --app-w: 520px; }
}

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden;
  transform: translateY(10px);
  transition: opacity .38s ease, transform .38s ease, visibility 0s linear .38s;
}
.screen.active {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .38s ease, transform .38s ease, visibility 0s;
}
.screen.gone { display: none; }
.screen.scroll {
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen.scroll::-webkit-scrollbar { display: none; }

.page {
  width: 100%;
  padding: calc(18px + var(--safe-t)) 16px calc(28px + var(--safe-b));
  display: flex; flex-direction: column; gap: 16px;
}

/* ----------------------------------------------------------- components */
.kicker {
  font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold-300);
}

.card {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 236, 190, .06);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.card.ornate::before { /* diamond jewel at the top edge */
  content: ''; position: absolute; top: -6px; left: 50%;
  width: 10px; height: 10px; margin-left: -5px; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--gold-100), var(--gold-400));
  box-shadow: 0 0 12px rgba(255, 200, 110, .8);
}
.card.ornate::after { /* thin gold fade along the top edge */
  content: ''; position: absolute; top: -1px; left: 12%; right: 12%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-300), transparent);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.card-head h2 { font-family: var(--f-display); font-weight: 400; font-size: 18px; color: var(--gold-100); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 22px;
  border-radius: 999px; border: 0;
  font-weight: 800; font-size: 16px; letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
  transition: transform .12s ease, filter .2s ease, box-shadow .2s ease, opacity .2s;
  touch-action: manipulation;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.97); }
.btn:disabled { cursor: default; opacity: .45; filter: grayscale(.4); }
.btn-primary {
  color: #2b1405;
  background: linear-gradient(180deg, #ffe7a6 0%, #f8c35c 48%, #e39a33 100%);
  box-shadow: 0 10px 28px -8px rgba(255, 170, 70, .65), inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(140, 70, 10, .35);
}
.btn-primary:not(:disabled):hover { filter: brightness(1.06); }
.btn-ghost {
  color: var(--gold-100);
  background: rgba(255, 220, 150, .06);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.btn-text {
  color: var(--text-2); background: none; min-height: 44px;
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
:focus-visible { outline: 2px solid var(--gold-200); outline-offset: 3px; }

.icon-btn {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 13px; border: 1px solid var(--line);
  background: rgba(10, 12, 40, .55);
  color: var(--gold-100);
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.icon-btn svg { width: 20px; height: 20px; }
.mute-btn { position: absolute; z-index: 40; top: calc(12px + var(--safe-t)); right: 14px; }
.mute-btn .i-off { display: none; }
.mute-btn.muted .i-on { display: none; }
.mute-btn.muted .i-off { display: block; }
.mute-btn.muted { color: var(--text-3); }

.link-btn {
  background: none; border: 0; padding: 8px 2px; cursor: pointer;
  color: var(--gold-200); font-weight: 700; font-size: 13px; letter-spacing: .04em;
}
.link-btn.center { align-self: center; }

.back-btn {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: rgba(10, 12, 40, .5);
  color: var(--gold-100); cursor: pointer;
}
.back-btn svg { width: 20px; height: 20px; }
.page-head { display: flex; align-items: center; gap: 12px; padding-right: 52px; }
.page-head h2 { font-family: var(--f-display); font-weight: 400; font-size: 22px; color: var(--gold-100); }
.board-sub { font-size: 12px; color: var(--text-3); }
/* sponsor logo slot (BR-03): hidden unless a brand theme turns it on */
.brand-slot { display: none; align-items: center; gap: 8px; justify-content: center; margin-bottom: 4px; }
.brand-by { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }

/* board rows */
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.row {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 12px;
  border-radius: 12px;
  font-size: 15px;
  background: rgba(255, 255, 255, .025);
}
.r-rank { font-weight: 800; color: var(--text-3); font-variant-numeric: tabular-nums; }
.r-rank::before { content: '#'; opacity: .55; font-weight: 600; }
.r-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.r-name em {
  font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  margin-left: 8px; padding: 2px 7px; border-radius: 999px;
  color: #2b1405; background: var(--gold-300); vertical-align: 2px;
}
.r-score { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--gold-100); }
.row.top1 .r-rank { color: #ffd66b; } .row.top2 .r-rank { color: #e5e0d4; } .row.top3 .r-rank { color: #e0a06a; }
.row.top1 { background: linear-gradient(90deg, rgba(255, 200, 90, .14), rgba(255, 255, 255, .02)); }
.row.you {
  background: linear-gradient(90deg, rgba(255, 190, 90, .26), rgba(255, 150, 60, .1));
  box-shadow: inset 0 0 0 1px rgba(255, 210, 130, .55), 0 0 24px -6px rgba(255, 170, 70, .55);
}
.row.you .r-rank { color: var(--gold-100); }
.row.skeleton { background: rgba(255, 255, 255, .04); animation: shimmer 1.2s ease-in-out infinite; }
.row.empty { grid-template-columns: 1fr; color: var(--text-3); font-size: 13px; }
.board-list.compact .row { min-height: 36px; font-size: 14px; }
.board-gap { text-align: center; color: var(--text-3); margin: 4px 0; letter-spacing: .3em; }

/* fields */
.field-label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; }
.field input {
  width: 100%; height: 54px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--line-2);
  background: rgba(6, 8, 30, .6);
  color: var(--text); font: 600 17px var(--f-ui);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: rgba(246, 236, 216, .3); font-weight: 500; }
.field input:focus { border-color: var(--gold-300); box-shadow: 0 0 0 4px rgba(245, 192, 96, .16); }
.field.invalid input { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(255, 111, 142, .14); }
.field.nudge { animation: nudge .35s ease; }
.field-error { min-height: 0; font-size: 13px; font-weight: 600; color: #ff9fb4; margin-top: 6px; }
.field-error:empty { display: none; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* toast */
#toast {
  position: fixed; z-index: 80; left: 50%; bottom: calc(24px + var(--safe-b));
  transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 18px; border-radius: 999px;
  background: rgba(20, 20, 50, .92); border: 1px solid var(--line-2);
  font-size: 14px; font-weight: 700; color: var(--gold-100);
  transition: opacity .25s, transform .25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* -------------------------------------------------------------- lantern */
.lantern {
  --w: 60px;
  --l-core: #5b4d60; --l-hi: #40354c; --l-mid: #2a2340; --l-lo: #17132a; --l-rib: rgba(255, 255, 255, .07);
  --glow: rgba(255, 190, 90, .55);
  position: absolute;
  width: var(--w); height: calc(var(--w) * 1.3);
  margin: calc(var(--w) * -.65) 0 0 calc(var(--w) * -.5);
  padding: 0; border: 0; background: none; appearance: none; -webkit-appearance: none;
  cursor: pointer; touch-action: none; outline: none;
  z-index: 2;
}
span.lantern { position: relative; margin: 0; display: inline-block; cursor: default; }
.lantern::before { content: ''; position: absolute; inset: -14px -12px; border-radius: 50%; } /* forgiving hit area */

/* Burnt-out decoy: clearly a lantern, clearly dead — cold ash tones and a
   faint blue-grey rim so it reads against the night sky without looking lit. */
.lantern.burnt { --l-core: #8a8496; --l-hi: #625c70; --l-mid: #3d3850; --l-lo: #1f1b2c; --l-rib: rgba(20, 16, 30, .45); }

/* lantern life-cycle */
.lantern.caught { animation: caught .38s ease-out forwards; pointer-events: none; }
.lantern.fade { animation: fadeOut .35s ease forwards; pointer-events: none; }
.lantern.release { animation: release 1.3s var(--rise-delay, 0ms) cubic-bezier(.5, 0, .7, .4) forwards; }

/* ----------------------------------------------------------------- title */
.screen-title { align-items: stretch; }

.title-wrap {
  position: relative;
  width: 100%;
  padding: calc(70px + var(--safe-t)) 18px calc(26px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px;
}
.title { display: flex; flex-direction: column; align-items: center; line-height: .95; font-weight: 400; }

.start-form {
  width: 100%; max-width: 380px; margin-top: 14px;
  display: flex; flex-direction: column; align-items: stretch; text-align: left;
}
.btn-play { margin-top: 16px; min-height: 60px; font-size: 18px; letter-spacing: .18em; animation: breathe 2.8s ease-in-out infinite; }
.welcome { margin-top: 12px; font-size: 13px; color: var(--text-2); text-align: center; }
.welcome b { color: var(--gold-100); }
.board-preview { width: 100%; max-width: 380px; margin-top: 16px; text-align: left; }

/* ------------------------------------------------------------------ HUD */
.screen-game { padding-top: var(--safe-t); }
.hud { position: relative; z-index: 6; padding: 12px 14px 6px; }
.hud-row { display: flex; align-items: center; gap: 10px; padding-right: 52px; }
.hud-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hud-stage-num { font-size: 10.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-300); }
.hud-stage-name { font-family: var(--f-display); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-score { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.hud-score-label { font-size: 10px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--text-3); }
.hud-score-val { font-size: 24px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--gold-100); text-shadow: 0 0 16px rgba(255, 180, 80, .35); }
.hud-score.bump .hud-score-val { animation: bump .3s ease; }
.hud-score.drop .hud-score-val { animation: dropScore .4s ease; }

.hud-sub { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.hud-progress { display: flex; gap: 6px; }
.hud-progress i {
  width: 11px; height: 14px; border-radius: 45% / 50%;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 220, 150, .12);
  transition: background .4s, box-shadow .4s;
}
.hud-progress i.current { border-color: var(--gold-300); animation: pulseDot 1.2s ease-in-out infinite; }
.hud-progress i.done { background: radial-gradient(ellipse at 50% 40%, #fff5d0, #ffb347 60%, #c4581e); border-color: transparent; box-shadow: 0 0 10px rgba(255, 170, 70, .7); }

.hud-combo {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 220, 150, .1);
  opacity: .5; transition: opacity .3s, background .3s, border-color .3s;
}
.hud-combo.active { opacity: 1; }
.hud-combo-val { font-weight: 800; font-size: 15px; min-width: 24px; font-variant-numeric: tabular-nums; color: var(--gold-100); }
.hud-combo-track { width: 54px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.hud-combo-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--gold-200)); transform-origin: left; transform: scaleX(0); transition: transform .18s ease; }
.hud-combo[data-mult="3"], .hud-combo[data-mult="4"] { background: rgba(255, 150, 60, .14); border-color: rgba(255, 180, 90, .45); }
.hud-combo[data-mult="5"] { background: linear-gradient(90deg, rgba(255, 150, 60, .35), rgba(255, 210, 120, .22)); border-color: var(--gold-200); box-shadow: 0 0 18px rgba(255, 170, 70, .5); }
.hud-combo.pulse { animation: bump .35s ease; }
.hud-combo.broke { animation: nudge .35s ease; }

.hud-timer { height: 3px; margin-top: 10px; border-radius: 3px; background: rgba(255, 255, 255, .07); overflow: hidden; opacity: 0; transition: opacity .2s; }
.hud-timer.on { opacity: 1; }
.hud-timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--ember), var(--gold-200)); transform-origin: left; }
.hud-timer.low i { background: linear-gradient(90deg, #ff4f6b, var(--ember)); }

.stage-area {
  position: relative; flex: 1; min-height: 0;
  margin: 2px 10px calc(10px + var(--safe-b));
  touch-action: none;
  border-radius: 22px;
}
.stage-area.shake { animation: shake .34s ease; }

#float-layer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.float {
  position: fixed; transform: translate(-50%, -50%);
  font-weight: 800; font-size: 19px; white-space: nowrap;
  color: var(--gold-100);
  text-shadow: 0 0 12px rgba(255, 170, 70, .7), 0 2px 0 rgba(60, 20, 0, .6);
  animation: floatUp .9s cubic-bezier(.2, .8, .3, 1) forwards;
}
.float.hot { color: #fff1c4; font-size: 22px; }
.float.bonus { font-size: 18px; color: var(--gold-200); letter-spacing: .04em; animation-duration: 1.4s; }
.float.miss { color: rgba(220, 215, 235, .8); font-size: 15px; text-shadow: none; }
.float.bad { color: #ff8da4; text-shadow: 0 0 10px rgba(255, 80, 110, .5); }
.float.perfect {
  font-size: 24px; letter-spacing: .06em;
  background: linear-gradient(180deg, #ffffff, #ffe08a 55%, #ffb347);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 10px rgba(255, 200, 100, .9));
  animation: floatPerfect 1s cubic-bezier(.2, .8, .3, 1) forwards;
}
.float.great { font-size: 21px; color: #ffe3a3; }
.float.good { font-size: 18px; color: #ffc68a; }

.combo-pop {
  position: absolute; z-index: 8; left: 50%; top: 42%;
  display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%, -50%) scale(.5); opacity: 0; pointer-events: none;
}
.combo-pop b {
  font-family: var(--f-display); font-weight: 400; font-size: 76px; line-height: 1;
  background: linear-gradient(180deg, #fff8e0, #ffc75a 60%, #f07b2a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 160, 60, .7));
}
.combo-pop span { font-size: 12px; font-weight: 800; letter-spacing: .4em; text-transform: uppercase; color: var(--gold-200); }
.combo-pop.show { animation: comboPop .75s cubic-bezier(.2, 1.3, .4, 1) forwards; }

/* ------------------------------------------------------------- overlays */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 20px;
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.overlay.show { opacity: 1; visibility: visible; transition: opacity .25s ease, visibility 0s; }

.overlay.intro { background: radial-gradient(ellipse at 50% 45%, rgba(8, 10, 34, .55), rgba(4, 5, 20, .88)); cursor: pointer; }
.intro-card {
  position: relative; width: min(340px, 100%);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  transform: translateY(12px) scale(.96); transition: transform .35s cubic-bezier(.2, 1.2, .4, 1);
}
.overlay.show .intro-card { transform: none; }
.intro-my {
  position: absolute; left: 50%; top: -48px; transform: translateX(-50%);
  font-family: var(--f-my); font-size: 150px; line-height: 1; color: rgba(245, 192, 96, .09);
  pointer-events: none;
}
.intro-title { font-family: var(--f-display); font-weight: 400; font-size: 34px; color: var(--gold-50); text-shadow: 0 0 24px rgba(255, 170, 70, .45); }
.intro-title-my { font-size: 14px; color: var(--gold-200); opacity: .85; line-height: 1.9; }
.intro-demo { height: 84px; display: grid; place-items: center; margin: 8px 0 2px; }
.intro-text { font-size: 16px; font-weight: 600; color: var(--text); max-width: 290px; }

.overlay.clear { pointer-events: none; }
.clear-card { text-align: center; transform: scale(.85); transition: transform .4s cubic-bezier(.2, 1.4, .4, 1); }
.overlay.show .clear-card { transform: none; }
.clear-kicker { font-size: 12px; font-weight: 800; letter-spacing: .36em; text-transform: uppercase; color: var(--gold-300); }
.clear-title { font-family: var(--f-display); font-size: 22px; color: var(--text-2); margin-top: 4px; }
.clear-points {
  font-weight: 800; font-size: 52px; line-height: 1.1; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff8e0, #ffc75a 60%, #f07b2a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 160, 60, .55));
}

.overlay.pause { z-index: 30; background: rgba(4, 5, 20, .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pause-card { width: min(320px, 100%); display: flex; flex-direction: column; gap: 10px; text-align: center; padding: 26px 20px 16px; }
.pause-card h2 { font-family: var(--f-display); font-weight: 400; font-size: 30px; color: var(--gold-100); }
.pause-card p { color: var(--text-2); font-size: 14px; margin-bottom: 8px; }

/* pause freezes every CSS animation in the game layer */
body.is-paused #screen-game *, body.is-paused #screen-game *::before, body.is-paused #screen-game *::after,
body.is-paused #float-layer * { animation-play-state: paused !important; }
body.is-paused #pause-overlay, body.is-paused #pause-overlay * { animation-play-state: running !important; }

/* intro demos */
.demo { display: flex; align-items: center; justify-content: center; gap: 14px; }
.demo-row span.lantern { margin-top: 6px; }
.demo-tap {
  position: absolute; width: 22px; height: 22px; margin: 18px 0 0 -118px; border-radius: 50%;
  border: 2px solid rgba(255, 240, 200, .9); animation: tapHint 1.2s ease-out infinite;
}
.demo-row { position: relative; }
.demo-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 10px; }
.demo-item i { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.demo-item.ok i { color: var(--gold-200); }
.demo-item.no i { color: #ff9fb4; }
.demo-meter { position: relative; width: 190px; height: 16px; border-radius: 10px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line); }
.demo-grid { display: grid; grid-template-columns: repeat(2, 26px); gap: 14px; }
.demo-grid i { width: 26px; height: 30px; border-radius: 45% / 50%; opacity: .35; }
.demo-grid .on { animation: demoFlash 1.6s ease-in-out infinite; }
.demo-mults { gap: 6px; }
.demo-mults b { font-size: 15px; padding: 5px 9px; border-radius: 10px; background: rgba(255, 255, 255, .06); color: var(--text-2); }
.demo-mults b:nth-child(3), .demo-mults b:nth-child(4) { color: var(--gold-200); background: rgba(255, 150, 60, .14); }
.demo-mults b.hot { color: #2b1405; background: linear-gradient(180deg, #ffe7a6, #f0a53c); box-shadow: 0 0 16px rgba(255, 170, 70, .6); }
.demo-orb { position: relative; width: 84px; height: 84px; }

/* ============================================================ STAGES */

/* 3 — Perfect Flame */
.btn-stop {
  width: 124px; height: 124px; border-radius: 50%; border: 0; cursor: pointer;
  font-weight: 800; font-size: 20px; letter-spacing: .2em; text-transform: uppercase; color: #2b1405;
  background: radial-gradient(circle at 50% 35%, #fff4d0, #f8c35c 55%, #d9822c);
  box-shadow: 0 0 0 6px rgba(255, 200, 110, .14), 0 0 0 14px rgba(255, 200, 110, .06), 0 16px 40px -10px rgba(255, 160, 60, .7), inset 0 -4px 0 rgba(120, 60, 10, .3);
  touch-action: none;
}
.btn-stop:active { transform: scale(.95); }

/* 4 — Memory */

/* 5 — Rush */
.stage-rush::before {
  content: ''; position: absolute; inset: -10px; border-radius: 30px; pointer-events: none;
  box-shadow: inset 0 0 0 0 rgba(255, 150, 60, 0);
  transition: box-shadow .4s ease;
}

/* 6 — Pagoda */

.sky-lantern {
  position: absolute; bottom: 4%; width: 12px; height: 16px; border-radius: 30% 30% 45% 45%;
  background: linear-gradient(180deg, #ffe7a6, #f08a2a);
  box-shadow: 0 0 14px 4px rgba(255, 170, 70, .55);
  opacity: 0;
  animation: skyRise 3.2s ease-in forwards;
}

/* ============================================================ RESULTS */
.results-page { padding-bottom: 20px; }
.badge-best {
  margin-top: 4px; padding: 5px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
  color: #2b1405; background: linear-gradient(180deg, #ffe7a6, #f0a53c);
  box-shadow: 0 0 20px rgba(255, 170, 70, .55);
  animation: bump .5s ease .9s both;
}

.rank-card { text-align: center; padding-top: 20px; }
.rank-num {
  font-family: var(--f-display); font-size: clamp(70px, 22vw, 96px); line-height: 1; color: var(--gold-50);
  text-shadow: 0 0 30px rgba(255, 170, 70, .55); margin: 4px 0 2px; font-variant-numeric: tabular-nums;
}
.rank-num .hash { font-size: .5em; vertical-align: .55em; color: var(--gold-300); margin-right: 2px; }
.rank-card.first .rank-num { animation: titleGlow 2s ease-in-out infinite; }
.rank-of { font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.neighbors { text-align: left; }
.chase {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 150, 60, .1); border: 1px dashed rgba(255, 190, 100, .45);
  font-size: 14px; color: var(--text); text-align: left;
}
.chase svg { width: 16px; height: 16px; flex: none; color: var(--gold-200); animation: rise 1.4s ease-in-out infinite; }
.chase b { color: var(--gold-100); }
.best-line { margin-top: 10px; font-size: 12px; color: var(--text-3); }
.best-line b { color: var(--text-2); }
.best-line .climb { color: var(--jade); }
.best-line .warn { color: #ff9fb4; }

.breakdown summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--gold-100); list-style: none; display: flex; justify-content: space-between; }
.breakdown summary::-webkit-details-marker { display: none; }
.breakdown summary::after { content: '+'; color: var(--gold-300); font-weight: 800; }
.breakdown[open] summary::after { content: '–'; }
.breakdown ul { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.breakdown li { display: grid; grid-template-columns: 1fr 70px 56px; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.breakdown li small { color: var(--text-3); margin-left: 4px; }
.breakdown em { font-style: normal; font-weight: 800; text-align: right; color: var(--gold-100); font-variant-numeric: tabular-nums; }
.bd-bar { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bd-bar b { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--gold-200)); transform-origin: left; }
.bd-total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 800; }
.bd-total span { color: var(--gold-100); }

.res-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px;
  margin-top: auto;
  padding: 28px 16px calc(14px + var(--safe-b));
  background: linear-gradient(180deg, rgba(8, 10, 30, 0), rgba(8, 10, 30, .94) 38%, rgba(8, 10, 30, .98));
}
.res-actions .btn { padding: 0 14px; font-size: 15px; letter-spacing: .06em; white-space: nowrap; }

/* ============================================================ CLAIM */
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--gold-400); }
.check.invalid span { color: #ff9fb4; }

/* ============================================================ MOTION */
@keyframes sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes ignite { 0% { filter: brightness(2.4) saturate(1.2); } 100% { filter: brightness(1); } }
@keyframes goldPulse { from { opacity: .75; } to { opacity: 1; } }
@keyframes smoke { 0% { transform: translate(0, 0) scale(.6); opacity: .8; } 100% { transform: translate(4px, -26px) scale(1.6); opacity: 0; } }
@keyframes life { 0% { transform: scale(1.12); opacity: .95; } 100% { transform: scale(.72); opacity: .15; border-color: rgba(255, 120, 80, .8); } }
@keyframes caught { 0% { transform: scale(1); opacity: 1; filter: brightness(1.6); } 100% { transform: scale(1.5); opacity: 0; filter: brightness(2); } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes release { 0% { transform: none; opacity: 1; } 100% { transform: translateY(-75vh) scale(.55); opacity: 0; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes dropScore { 0% { transform: none; color: #ff8da4; } 30% { transform: translateY(3px); } 100% { transform: none; } }
@keyframes pulseDot { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 192, 96, .5); } 50% { box-shadow: 0 0 0 4px rgba(245, 192, 96, 0); } }
@keyframes floatUp { 0% { transform: translate(-50%, -30%) scale(.7); opacity: 0; } 18% { transform: translate(-50%, -60%) scale(1.1); opacity: 1; } 100% { transform: translate(-50%, -170%) scale(1); opacity: 0; } }
@keyframes floatPerfect { 0% { transform: translate(-50%, -30%) scale(.4); opacity: 0; } 22% { transform: translate(-50%, -70%) scale(1.25); opacity: 1; } 60% { transform: translate(-50%, -110%) scale(1.05); opacity: 1; } 100% { transform: translate(-50%, -170%) scale(1); opacity: 0; } }
@keyframes comboPop { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 30% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; } 70% { transform: translate(-50%, -50%) scale(1); opacity: .95; } 100% { transform: translate(-50%, -70%) scale(.96); opacity: 0; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 10px 28px -8px rgba(255, 170, 70, .6), inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(140, 70, 10, .35); } 50% { box-shadow: 0 10px 40px -4px rgba(255, 170, 70, .9), inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(140, 70, 10, .35); } }
@keyframes titleGlow { 0%, 100% { filter: drop-shadow(0 0 16px rgba(255, 170, 70, .4)) drop-shadow(0 2px 0 rgba(90, 40, 0, .6)); } 50% { filter: drop-shadow(0 0 28px rgba(255, 170, 70, .7)) drop-shadow(0 2px 0 rgba(90, 40, 0, .6)); } }
@keyframes shimmer { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes tapHint { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes demoFlash { 0%, 60%, 100% { opacity: .3; box-shadow: none; } 20%, 40% { opacity: 1; box-shadow: 0 0 16px currentColor; } }
@keyframes skyRise { 0% { opacity: 0; transform: translate(0, 0) scale(.8); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--drift, 0), -420px) scale(.5); } }
@keyframes rise { 0%, 100% { transform: translateY(1px); } 50% { transform: translateY(-2px); } }

/* ------------------------------------------------ small / short screens */
@media (max-height: 700px) {
  .title-wrap { padding-top: calc(52px + var(--safe-t)); gap: 8px; }
  .btn-stop { width: 104px; height: 104px; }
}
@media (max-width: 360px) {
  .hud-combo-track { width: 36px; }
  .hud-stage-name { font-size: 16px; }
}
@media (min-width: 700px) {
  .title-wrap { padding-top: calc(90px + var(--safe-t)); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-play { animation: none !important; }
  .screen { transition-duration: .01s; }
}

/* ---- Sky Lantern edition: start form additions ---- */
.field-label-2 { margin-top: 14px; }
.check-start { margin-top: 12px; font-size: 13px; }

/* ======================= SKY LANTERN GAME ======================= */
.lc { position: absolute; inset: 0; overflow: hidden; border-radius: 22px; }
.lc-field { position: absolute; inset: 0; }
.sky {
  position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none; cursor: pointer;
  touch-action: none; z-index: 2;
}
.sky::before { content: ''; position: absolute; inset: -14px -12px; border-radius: 40%; } /* forgiving hit area */
.sky-art { position: relative; display: block; width: 100%; height: 100%; pointer-events: none; }
.sky-img { object-fit: contain; }
.sky-glow {
  position: absolute; left: 50%; top: 62%; width: 210%; height: 170%; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 190, 90, .45), rgba(255, 150, 60, .12) 50%, transparent 75%);
}
.sky-special .sky-glow { background: radial-gradient(closest-side, rgba(255, 220, 120, .7), rgba(255, 170, 60, .2) 50%, transparent 75%); animation: goldPulse .7s ease-in-out infinite alternate; }
.sky-golden .sky-glow { width: 260%; height: 220%; background: radial-gradient(closest-side, rgba(255, 250, 210, .95), rgba(255, 210, 90, .3) 50%, transparent 75%); animation: goldPulse .35s ease-in-out infinite alternate; }
.sky-time .sky-glow { background: radial-gradient(closest-side, rgba(120, 220, 255, .65), rgba(40, 160, 255, .2) 50%, transparent 75%); }
.sky-giant .sky-glow { width: 200%; height: 170%; background: radial-gradient(closest-side, rgba(255, 220, 140, .75), rgba(255, 160, 60, .2) 55%, transparent 78%); animation: goldPulse .5s ease-in-out infinite alternate; }
.sky.caught { animation: caught .4s ease-out forwards; pointer-events: none; }
.sky.fade, .sky.gone { animation: fadeOut .35s ease forwards; pointer-events: none; }
.sky.thump .sky-art { animation: bump .18s ease; }
.giant-ring { position: absolute; left: 12%; right: 12%; bottom: -14px; height: 7px; border-radius: 6px; background: rgba(0, 0, 0, .35); overflow: hidden; }
.giant-ring i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--gold-100)); transform-origin: left; transform: scaleX(0); transition: transform .1s; }
.giant-count {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); pointer-events: none;
  font: 800 34px/1 var(--f-ui); color: #fff; text-shadow: 0 0 14px rgba(120, 50, 0, .9), 0 2px 0 rgba(90, 40, 0, .8);
}

.lc-clock {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 4;
  font: 800 15px var(--f-ui); font-variant-numeric: tabular-nums; letter-spacing: .04em; color: var(--gold-100);
  padding: 3px 12px; border-radius: 999px; background: rgba(6, 8, 30, .55); border: 1px solid var(--line);
}
.lc-clock.low { color: #ff9fb4; border-color: rgba(255, 111, 142, .6); animation: pulseDot 1s ease-in-out infinite; }
.lc-wind {
  position: absolute; top: 40px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: rgba(122, 180, 255, .16); border: 1px solid rgba(122, 180, 255, .45); color: #cfe3ff;
  font: 700 12px var(--f-ui); letter-spacing: .14em; text-transform: uppercase;
}
.lc-wind svg { width: 18px; height: 18px; animation: windBlow .8s ease-in-out infinite alternate; }
.lc-wind.left svg { transform: scaleX(-1); }
.lc-wind[hidden] { display: none; }

.lc-banner {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; padding: 20px; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(6, 8, 30, .7), rgba(6, 8, 30, 0) 70%);
}
.lc-banner.show { animation: bannerIn .45s cubic-bezier(.2, 1.3, .4, 1) forwards; }
.lc-banner.quick { background: none; justify-content: flex-start; padding-top: 18%; }
.lb-kicker { font: 800 13px var(--f-ui); letter-spacing: .4em; text-transform: uppercase; color: var(--gold-200); padding-left: .4em; }
.lb-num {
  font-family: var(--f-display); font-weight: 400; font-size: 112px; line-height: .95;
  background: linear-gradient(180deg, #fff8e0, #ffc75a 60%, #f07b2a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 160, 60, .7));
}
.lb-score { font-size: 84px; font-family: var(--f-ui); font-weight: 800; }
.lb-name { font-family: var(--f-display); font-size: 26px; color: var(--gold-50); }
.lb-intro { max-width: 280px; font-size: 15px; font-weight: 600; color: var(--text); margin-top: 4px; }
.lb-mini { font: 800 28px var(--f-ui); color: #fff; text-shadow: 0 0 18px rgba(255, 180, 80, .9); }
.lc-banner.quick span { font: 700 14px var(--f-ui); color: var(--gold-100); letter-spacing: .1em; text-transform: uppercase; }

.demo-sky { gap: 26px; }
.demo-sky .sky-art { width: 46px; height: 60px; }
.demo-sky .demo-item:last-child .sky-art { width: 50px; height: 65px; }
.demo-item i.hot { color: var(--gold-100); }

@keyframes bannerIn { 0% { opacity: 0; transform: scale(.85); } 100% { opacity: 1; transform: none; } }
@keyframes windBlow { from { transform: translateX(-2px); } to { transform: translateX(3px); } }
.sky-giant { z-index: 5; }

/* ======================= END SCREEN: score card + sharing ======================= */
.share-hero { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 6px; }
.share-frame {
  position: relative; width: min(100%, 360px); aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 50px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(245, 192, 96, .35), 0 0 40px -10px rgba(255, 170, 70, .45);
  background: #0a0d2c; animation: cardIn .6s .1s cubic-bezier(.2, 1.2, .4, 1) both;
}
.share-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.share-skel { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 14px; animation: shimmer 1.2s ease-in-out infinite; }
.share-skel[hidden], .share-img[hidden] { display: none; }
.share-actions { display: grid; grid-template-columns: 1.55fr 1fr; gap: 10px; width: min(100%, 360px); }
.share-actions .btn { padding: 0 12px; white-space: nowrap; }
.btn-fb {
  color: #fff; background: #1877f2; text-transform: none; letter-spacing: 0; font-size: 15px;
  box-shadow: 0 10px 24px -10px rgba(24, 119, 242, .8);
}
.btn-fb svg { width: 20px; height: 20px; }
.share-actions .btn-ghost { text-transform: none; letter-spacing: 0; font-size: 15px; }
.save-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(4, 5, 20, .9); }
.save-overlay[hidden] { display: none; }
.save-box { width: min(100%, 380px); display: flex; flex-direction: column; gap: 12px; text-align: center; color: var(--text); }
.save-box img { width: 100%; border-radius: 14px; -webkit-touch-callout: default; user-select: auto; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }
.sky-giant.leaving { opacity: .75; transition: opacity .8s; }
.r-games { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); line-height: 1.1; }

/* level banner that waits for a tap */
.lc-banner.wait { pointer-events: auto; cursor: pointer; }

/* Terms & Conditions */
.check-start span[lang="my"] { font-size: 14px; line-height: 1.7; color: var(--text); }
.tc-link { display: block; text-align: left; margin: 4px 0 0 34px; padding: 4px 0; font-size: 13px; line-height: 1.7; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.tc-overlay { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgba(4, 5, 20, .88); }
.tc-overlay[hidden] { display: none; }
.tc-box { width: min(100%, 440px); max-height: min(86vh, 640px); display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 18px; background: #12163f; border: 1px solid var(--line-2); color: var(--text); }
.tc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tc-head h2 { font-size: 18px; line-height: 1.6; color: var(--gold-100); }
.tc-body { overflow-y: auto; font-size: 14px; line-height: 1.65; color: var(--text-2); padding-right: 4px; -webkit-user-select: text; user-select: text; }
.tc-body ol { padding-left: 20px; margin: 8px 0 0; display: grid; gap: 8px; }
#consent-error { font-family: var(--f-my); line-height: 1.7; }
