:root {
  --orange: #FF8A3D;
  --orange-deep: #E85F14;
  --orange-soft: #FFB076;
  --gold: #FFC857;
  --mint: #38D6B0;
  --red: #FF5566;
  --ink: #1A101E;
  --ink-2: #24162B;
  --cream: #FFF6EC;
  --muted: #B9A9B7;
  --line: rgba(255, 255, 255, .12);
  --panel: rgba(31, 20, 38, .92);
  --panel-soft: rgba(255, 255, 255, .07);
  --shadow: 0 18px 44px rgba(0, 0, 0, .42);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #140D1A;
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  user-select: none;
  background:
    radial-gradient(120% 70% at 50% -10%, #4A2338 0%, #24121F 46%, #120B18 100%);
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(8, 4, 12, .55) 0%, rgba(8, 4, 12, 0) 17%, rgba(8, 4, 12, 0) 72%, rgba(8, 4, 12, .48) 100%),
    radial-gradient(120% 80% at 50% 55%, transparent 45%, rgba(6, 3, 10, .72) 100%);
}

.is-hidden { display: none !important; }

.mp-icon { width: 22px; height: 22px; flex: none; }

/* ---------------- HUD ---------------- */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 18px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hud-score {
  min-width: 108px;
  padding: 9px 14px 10px;
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(37, 22, 44, .88), rgba(22, 12, 29, .8));
  border: 1px solid rgba(255, 138, 61, .35);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
}

.hud-label {
  display: block;
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--orange-soft);
  margin-bottom: 1px;
}

.hud-score strong {
  display: block;
  font-size: 31px;
  line-height: .96;
  font-weight: 900;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 14px rgba(255, 138, 61, .4);
}

.hud-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.hud-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 246, 236, .92);
  background: rgba(26, 15, 33, .78);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums;
}

.hud-chip .mp-icon { width: 16px; height: 16px; color: var(--gold); }

.combo-badge {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: -4px;
  padding: 8px 16px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #FF6A2A, #FFB23E);
  color: #2B130E;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: .01em;
  box-shadow: 0 8px 28px rgba(255, 122, 38, .5), inset 0 1px 0 rgba(255, 255, 255, .45);
  animation: comboPop .34s cubic-bezier(.2, 1.5, .5, 1);
}

.combo-badge .mp-icon { width: 18px; height: 18px; color: #2B130E; }
.combo-badge em {
  font-style: normal;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(43, 19, 14, .16);
}

@keyframes comboPop {
  0% { transform: scale(.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.hud-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.speed-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 246, 236, .82);
  background: rgba(24, 13, 31, .68);
  border: 1px solid rgba(255, 255, 255, .1);
  font-variant-numeric: tabular-nums;
}

.speed-pill .mp-icon { width: 15px; height: 15px; color: var(--orange-soft); }

.control-hint {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 11px;
  color: rgba(255, 246, 236, .66);
  background: rgba(24, 13, 31, .58);
  border: 1px solid rgba(255, 255, 255, .08);
  transition: opacity .3s;
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 16px;
  border-radius: 15px;
  font-weight: 800;
  font-size: 15px;
  color: var(--cream);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  transition: transform .12s ease, filter .12s ease, background .2s;
}

.btn:active { transform: scale(.965); filter: brightness(.94); }

.btn .mp-icon { width: 20px; height: 20px; }

.btn-primary {
  color: #2C1308;
  background: linear-gradient(160deg, #FFB15C 0%, #FF8A3D 42%, #F4691E 100%);
  border: 1px solid rgba(255, 210, 158, .72);
  box-shadow: 0 10px 28px rgba(244, 105, 30, .38), inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -2px 0 rgba(149, 65, 14, .28);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .28);
}

.btn-primary .mp-icon { color: #2C1308; }

.btn-xl {
  width: 100%;
  min-height: 58px;
  border-radius: 18px;
  font-size: 19px;
  letter-spacing: .04em;
}

.btn-ghost {
  justify-content: flex-start;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .1);
  font-size: 14px;
}

.btn-ghost > .mp-icon:first-child { color: var(--orange-soft); }

.btn-ghost em {
  margin-left: auto;
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.btn-ghost .chev { width: 18px; height: 18px; margin-left: auto; color: var(--muted); }

.btn-revive {
  width: 100%;
  min-height: 54px;
  color: #2C1308;
  background: linear-gradient(155deg, #8CFFDC, #38D6B0 60%, #12A98A);
  border: 1px solid rgba(191, 255, 238, .8);
  box-shadow: 0 10px 26px rgba(38, 214, 176, .3), inset 0 1px 0 rgba(255, 255, 255, .55);
}

.btn-revive .mp-icon { color: #063B30; }

.btn-revive em {
  font-style: normal;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(6, 59, 48, .14);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.btn-revive:disabled,
.btn:disabled {
  opacity: .46;
  filter: grayscale(.35);
  transform: none;
  cursor: not-allowed;
}

/* ---------------- Start screen ---------------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(var(--safe-top) + 20px) 16px calc(var(--safe-bottom) + 18px);
  z-index: 5;
}

.start-screen {
  background:
    linear-gradient(to bottom, rgba(14, 8, 19, .1) 0%, rgba(14, 8, 19, .2) 34%, rgba(14, 8, 19, .88) 78%, #120B18 100%);
  overflow-y: auto;
}

.start-glow {
  position: absolute;
  left: 50%;
  top: 14%;
  width: min(76vw, 360px);
  height: min(76vw, 360px);
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 138, 61, .25), transparent 66%);
  filter: blur(14px);
  pointer-events: none;
}

.start-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 22px 20px 18px;
  border-radius: 28px;
  background:
    linear-gradient(165deg, rgba(44, 27, 52, .93), rgba(22, 13, 28, .97));
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .09);
  backdrop-filter: blur(18px);
  animation: riseIn .55s cubic-bezier(.2, .9, .3, 1) both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.logo-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #2C1308;
  background: linear-gradient(150deg, #FFC071, #FF8A3D 60%, #F4691E);
  box-shadow: 0 8px 20px rgba(244, 105, 30, .36), inset 0 1px 0 rgba(255, 255, 255, .5);
}

.logo-icon .mp-icon { width: 25px; height: 25px; }

.logo-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--orange-soft);
}

.game-title {
  margin: 0 0 8px;
  font-size: clamp(32px, 10.2vw, 44px);
  line-height: 1.02;
  letter-spacing: -.04em;
  font-weight: 900;
  color: #FFF8F0;
  text-shadow: 0 4px 0 rgba(123, 52, 17, .22), 0 12px 34px rgba(255, 138, 61, .2);
}

.game-sub {
  margin: 0 0 16px;
  max-width: 34ch;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.player-strip {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .08);
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  overflow: hidden;
  border-radius: 14px;
  color: #2C1308;
  font-weight: 900;
  font-size: 19px;
  background: linear-gradient(150deg, #FFD49B, #FF9B51 58%, #F4691E);
  border: 1px solid rgba(255, 226, 190, .7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.player-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-meta strong {
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-meta span {
  font-size: 11px;
  color: var(--muted);
}

.coin-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  flex: none;
  padding: 7px 11px;
  border-radius: 999px;
  color: #38200A;
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(150deg, #FFE18F, #FFC857 62%, #F0A72E);
  border: 1px solid rgba(255, 240, 187, .72);
  box-shadow: 0 5px 14px rgba(240, 167, 46, .26), inset 0 1px 0 rgba(255, 255, 255, .5);
  font-variant-numeric: tabular-nums;
}

.coin-pill .mp-icon { width: 16px; height: 16px; color: #6C4208; }

.coin-pill-dark {
  color: #FFE2A4;
  background: rgba(255, 200, 87, .1);
  border-color: rgba(255, 200, 87, .28);
  box-shadow: none;
}

.coin-pill-dark .mp-icon { color: var(--gold); }

.start-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 13px;
  font-size: 11px;
  color: rgba(255, 246, 236, .55);
}

.start-foot b { color: var(--orange-soft); }

.start-foot .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .3);
}

/* ---------------- Overlay sheets ---------------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: calc(var(--safe-top) + 12px) 12px calc(var(--safe-bottom) + 12px);
  background: rgba(9, 5, 13, .66);
  backdrop-filter: blur(9px);
  animation: overlayIn .22s ease both;
}

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

.sheet {
  width: 100%;
  max-width: 470px;
  max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 24px);
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px);
  overflow-y: auto;
  padding: 20px 16px calc(16px + var(--safe-bottom));
  border-radius: 28px;
  background:
    radial-gradient(110% 50% at 50% 0%, rgba(255, 138, 61, .13), transparent 60%),
    linear-gradient(165deg, #2B1A34 0%, #1D1124 58%, #170D1D 100%);
  border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .56), inset 0 1px 0 rgba(255, 255, 255, .09);
  scrollbar-width: none;
  animation: sheetUp .32s cubic-bezier(.2, .95, .3, 1) both;
}

.sheet::-webkit-scrollbar { display: none; }

@keyframes sheetUp {
  from { opacity: 0; transform: translateY(34px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-sheet { padding-top: 16px; }

.result-hero {
  position: relative;
  padding: 16px 16px 15px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(90% 130% at 12% -20%, rgba(255, 180, 101, .38), transparent 58%),
    linear-gradient(150deg, rgba(255, 138, 61, .21), rgba(79, 37, 62, .18));
  border: 1px solid rgba(255, 138, 61, .32);
}

.result-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  color: var(--orange-soft);
}

.result-kicker .mp-icon { width: 15px; height: 15px; }

.result-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 3px 0 9px;
}

.result-score span {
  font-size: clamp(52px, 16vw, 68px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  color: #FFF9F2;
  text-shadow: 0 8px 30px rgba(255, 138, 61, .35);
}

.result-score small {
  font-size: 14px;
  color: var(--orange-soft);
  font-weight: 800;
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.result-meta div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 11px;
  background: rgba(16, 9, 21, .42);
  border: 1px solid rgba(255, 255, 255, .07);
}

.result-meta span { font-size: 10px; color: var(--muted); }
.result-meta b {
  font-size: 14px;
  font-weight: 800;
  color: #FFF4E8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.banners {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}

.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.banner .mp-icon { width: 19px; height: 19px; }

.banner-gold {
  color: #4B2B07;
  background: linear-gradient(150deg, #FFE39A, #FFC857 70%, #F4AE35);
  border: 1px solid rgba(255, 246, 205, .7);
  box-shadow: 0 6px 18px rgba(244, 174, 53, .24);
}

.banner-title {
  color: #FFE6B3;
  background: linear-gradient(145deg, rgba(255, 138, 61, .2), rgba(255, 200, 87, .1));
  border: 1px solid rgba(255, 200, 87, .35);
}

.banner-title b { color: #FFD37A; }

.revive-box {
  margin-top: 11px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(56, 214, 176, .14), rgba(56, 214, 176, .05));
  border: 1px solid rgba(56, 214, 176, .34);
}

.revive-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.revive-copy strong { font-size: 13px; color: #A8FFE6; }
.revive-copy span { font-size: 10px; color: rgba(168, 255, 230, .66); text-align: right; }

.reward-zone { margin-top: 12px; }

.zone-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--muted);
}

.zone-title em { font-style: normal; font-weight: 600; letter-spacing: 0; color: rgba(255, 246, 236, .4); }

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

.btn-reward {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 70px;
  padding: 11px 12px;
  text-align: left;
  background: linear-gradient(150deg, rgba(255, 255, 255, .095), rgba(255, 255, 255, .045));
  border: 1px solid rgba(255, 255, 255, .12);
}

.btn-reward .mp-icon {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 17px;
  height: 17px;
  color: var(--orange-soft);
  opacity: .8;
}

.btn-reward { position: relative; }

.reward-title {
  font-size: 13px;
  font-weight: 800;
  color: #FFF4E8;
  padding-right: 18px;
}

.reward-desc {
  font-size: 11px;
  color: var(--orange-soft);
  font-weight: 700;
}

.btn-reward-gold {
  background: linear-gradient(150deg, rgba(255, 200, 87, .2), rgba(255, 138, 61, .08));
  border-color: rgba(255, 200, 87, .34);
}

.btn-reward-gold .reward-desc { color: var(--gold); }

.reward-done {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 700;
  color: #9FFFDF;
  background: rgba(56, 214, 176, .1);
  border: 1px solid rgba(56, 214, 176, .25);
}

.reward-done .mp-icon { width: 18px; height: 18px; color: var(--mint); }

.result-links {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.mini-board {
  margin-top: 13px;
  padding: 11px 12px;
  border-radius: 17px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .08);
}

.mini-board-head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--muted);
}

.mini-board-list { display: flex; flex-direction: column; gap: 5px; }

.mini-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px;
  border-radius: 9px;
  font-size: 12px;
}

.mini-row.is-me { background: rgba(255, 138, 61, .13); }
.mini-row .medal {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 900;
  color: #2F1B06;
  background: rgba(255, 255, 255, .12);
  color: var(--muted);
  flex: none;
}
.mini-row:nth-child(1) .medal { background: linear-gradient(150deg, #FFE39A, #FFC857); color: #5A3708; }
.mini-row:nth-child(2) .medal { background: linear-gradient(150deg, #E7EDF6, #B8C6D8); color: #38414E; }
.mini-row:nth-child(3) .medal { background: linear-gradient(150deg, #F2B98B, #C77A46); color: #40220D; }
.mini-row .m-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.mini-row .m-score { font-weight: 900; color: var(--orange-soft); font-variant-numeric: tabular-nums; }
.mini-row .m-title { font-size: 9px; padding: 2px 5px; border-radius: 5px; color: #FFDFA3; background: rgba(255, 200, 87, .12); border: 1px solid rgba(255, 200, 87, .25); }
.mini-empty { padding: 12px 4px; font-size: 11px; color: rgba(255, 246, 236, .4); text-align: center; }

.result-sheet > .btn-primary { margin-top: 13px; }

/* ---------------- Sheet head / board ---------------- */
.sheet-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.sheet-head p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.sheet-head > div:nth-child(2) { min-width: 0; flex: 1; }

.head-spacer { width: 40px; flex: none; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 13px;
  color: var(--cream);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  transition: transform .12s, background .2s;
}

.icon-btn:active { transform: scale(.94); background: rgba(255, 255, 255, .13); }

.tab-row {
  display: flex;
  gap: 5px;
  padding: 4px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid rgba(255, 255, 255, .07);
}

.tab {
  flex: 1;
  min-height: 36px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  transition: .2s;
}

.tab.is-active {
  color: #2C1308;
  background: linear-gradient(150deg, #FFB15C, #FF8A3D);
  box-shadow: 0 4px 14px rgba(244, 105, 30, .28), inset 0 1px 0 rgba(255, 255, 255, .4);
}

.board-list { display: flex; flex-direction: column; gap: 6px; }

.board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
}

.board-row.is-me {
  background: linear-gradient(145deg, rgba(255, 138, 61, .18), rgba(255, 138, 61, .06));
  border-color: rgba(255, 138, 61, .4);
}

.board-rank {
  width: 28px;
  flex: none;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.board-row:nth-child(1) .board-rank { color: #FFD37A; font-size: 17px; }
.board-row:nth-child(2) .board-rank { color: #DCE5F2; font-size: 17px; }
.board-row:nth-child(3) .board-rank { color: #F0B286; font-size: 17px; }

.board-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 900;
  color: #2C1308;
  background: linear-gradient(150deg, #FFD49B, #FF9B51 58%, #F4691E);
  border: 1px solid rgba(255, 226, 190, .42);
}

.board-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.board-name { display: flex; align-items: center; gap: 5px; min-width: 0; }
.board-name strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-main span { font-size: 10px; color: var(--muted); }
.board-score { text-align: right; flex: none; }
.board-score b { display: block; font-size: 15px; font-weight: 900; color: var(--orange-soft); font-variant-numeric: tabular-nums; }
.board-score span { font-size: 9px; color: rgba(255, 246, 236, .4); }

.title-tag {
  flex: none;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
  color: #FFDFA3;
  background: rgba(255, 200, 87, .12);
  border: 1px solid rgba(255, 200, 87, .26);
}

.my-rank-bar {
  position: sticky;
  bottom: 0;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  color: #FFE3C2;
  background: linear-gradient(150deg, rgba(255, 138, 61, .22), rgba(255, 138, 61, .1));
  border: 1px solid rgba(255, 138, 61, .32);
  backdrop-filter: blur(8px);
}

.board-empty {
  padding: 34px 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255, 246, 236, .46);
}

.board-empty .mp-icon { width: 34px; height: 34px; color: rgba(255, 138, 61, .5); display: block; margin: 0 auto 8px; }

/* ---------------- Shop ---------------- */
.skin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.skin-card {
  position: relative;
  padding: 9px;
  border-radius: 17px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .035));
  border: 1px solid rgba(255, 255, 255, .1);
  overflow: hidden;
}

.skin-card.is-equipped { border-color: rgba(255, 138, 61, .58); box-shadow: 0 0 0 1px rgba(255, 138, 61, .2), 0 8px 22px rgba(0, 0, 0, .22); }
.skin-card.is-locked { opacity: .94; }

.skin-visual {
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  margin-bottom: 8px;
  background:
    radial-gradient(70% 90% at 50% 78%, rgba(0, 0, 0, .38), transparent 70%),
    linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .16));
  overflow: hidden;
}

.skin-visual svg { width: 74px; height: 96px; display: block; filter: drop-shadow(0 8px 8px rgba(0, 0, 0, .35)); }

.skin-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 2px;
}

.skin-name strong { font-size: 13px; font-weight: 800; }
.skin-state { font-size: 9px; font-weight: 800; color: var(--orange-soft); }
.skin-state.owned { color: var(--mint); }
.skin-desc { min-height: 14px; font-size: 10px; color: var(--muted); margin-bottom: 7px; }

.skin-btn {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  color: #2C1308;
  background: linear-gradient(150deg, #FFB15C, #FF8A3D);
  border: 1px solid rgba(255, 210, 158, .5);
}

.skin-btn:active { transform: scale(.97); }
.skin-btn.equipped { color: #8CFFE3; background: rgba(56, 214, 176, .12); border-color: rgba(56, 214, 176, .3); }
.skin-btn.owned { color: #FFE6BD; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .13); }
.skin-btn:disabled { opacity: .5; }

.shop-note {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 11px;
  border-radius: 13px;
  font-size: 10px;
  line-height: 1.5;
  color: rgba(255, 246, 236, .56);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
}
.shop-note .mp-icon { width: 16px; height: 16px; color: var(--orange-soft); margin-top: 1px; }

/* ---------------- Ad ---------------- */
.ad-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 3, 8, .9);
  backdrop-filter: blur(12px);
}

.ad-card {
  width: 100%;
  max-width: 340px;
  padding: 20px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(165deg, #2B1A34, #170D1D);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: var(--shadow);
}

.ad-tag {
  display: inline-block;
  padding: 4px 10px;
  margin-bottom: 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  color: var(--orange-soft);
  background: rgba(255, 138, 61, .12);
  border: 1px solid rgba(255, 138, 61, .25);
}

.ad-art {
  position: relative;
  height: 108px;
  margin-bottom: 13px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #3A1E37, #1A0F22);
  border: 1px solid rgba(255, 255, 255, .08);
}

.ad-road {
  position: absolute;
  left: 50%;
  top: -20%;
  width: 62%;
  height: 145%;
  transform: translateX(-50%) perspective(80px) rotateX(20deg);
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .16) 0 14px, transparent 14px 44px);
  border-left: 4px solid rgba(255, 138, 61, .55);
  border-right: 4px solid rgba(255, 138, 61, .55);
  animation: adRoad .7s linear infinite;
}

@keyframes adRoad { to { background-position-y: 44px; } }

.ad-car {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 34px;
  height: 52px;
  transform: translateX(-50%);
  border-radius: 12px 12px 8px 8px;
  background: linear-gradient(160deg, #FFD49B, #FF8A3D 45%, #E85F14);
  box-shadow: 0 0 24px rgba(255, 138, 61, .5);
}

.ad-car::before {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 10px;
  height: 15px;
  border-radius: 5px;
  background: #2A1A31;
}

.ad-card h3 { margin: 0 0 3px; font-size: 16px; font-weight: 900; }
.ad-card p { margin: 0 0 14px; font-size: 11px; color: var(--muted); }

.ad-progress {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .1);
}

.ad-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FF8A3D, #FFC857);
  transition: width .2s linear;
}

.ad-count {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--orange-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------------- Toast / flash ---------------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 94px);
  z-index: 90;
  max-width: calc(100vw - 48px);
  padding: 10px 15px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #FFF5E9;
  background: rgba(27, 16, 34, .95);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .4);
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

.crash-flash {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: radial-gradient(circle at 50% 72%, rgba(255, 85, 102, .55), transparent 55%);
  opacity: 0;
  transition: opacity .18s;
}

.crash-flash.is-show { opacity: 1; }

/* ---------------- Responsive ---------------- */
@media (max-height: 660px) {
  .start-screen { justify-content: flex-start; }
  .start-card { margin-top: auto; margin-bottom: auto; }
}

@media (max-width: 360px) {
  .game-title { font-size: 30px; }
  .start-card { padding: 18px 15px 15px; border-radius: 24px; }
  .reward-title { font-size: 12px; }
  .btn-reward { min-height: 66px; padding: 10px; }
  .result-meta b { font-size: 13px; }
}

@media (max-height: 710px) {
  .start-card { padding: 16px 16px 13px; }
  .game-title { font-size: 32px; margin-bottom: 5px; }
  .game-sub { margin-bottom: 11px; font-size: 12px; }
  .player-strip { margin-bottom: 12px; padding: 8px 10px; }
  .btn-xl { min-height: 52px; font-size: 17px; }
  .start-foot { margin-top: 9px; }
  .skin-visual { height: 76px; }
  .skin-visual svg { width: 62px; height: 82px; }
}

@media (min-width: 700px) {
  .screen { align-items: center; }
  .start-card { margin-bottom: 5vh; }
  .overlay { align-items: center; }
  .sheet { max-height: 84vh; }
}

/* ---------------- Daily tasks entry ---------------- */
.start-task {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 58px;
  margin-bottom: 10px;
  padding: 9px 12px;
  text-align: left;
  border-radius: 17px;
  color: var(--cream);
  background: linear-gradient(150deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .035));
  border: 1px solid rgba(255, 255, 255, .11);
  transition: transform .12s, border-color .2s;
}

.start-task:active { transform: scale(.985); }
.start-task.has-claim { border-color: rgba(255, 200, 87, .45); box-shadow: 0 0 0 1px rgba(255, 200, 87, .1); }

.start-task-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  color: #4B2B07;
  background: linear-gradient(150deg, #FFE39A, #FFC857 65%, #F0A72E);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}

.start-task-icon .mp-icon { width: 21px; height: 21px; }

.start-task-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.start-task-copy strong { font-size: 14px; font-weight: 800; }
.start-task-copy span { font-size: 10px; color: var(--muted); }

.start-task-state { display: flex; align-items: center; gap: 3px; flex: none; color: var(--muted); }
.start-task-state em {
  font-style: normal;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: #FFDFA3;
  background: rgba(255, 200, 87, .12);
  border: 1px solid rgba(255, 200, 87, .26);
  font-variant-numeric: tabular-nums;
}
.start-task-state .mp-icon { width: 17px; height: 17px; }

/* ---------------- Daily tasks sheet ---------------- */
.tasks-sheet { padding-bottom: calc(20px + var(--safe-bottom)); }

.task-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 11px;
  color: var(--muted);
  background: linear-gradient(150deg, rgba(255, 138, 61, .12), rgba(255, 138, 61, .04));
  border: 1px solid rgba(255, 138, 61, .22);
}
.task-summary b { font-size: 15px; color: var(--orange-soft); font-variant-numeric: tabular-nums; }
.task-summary em { font-style: normal; color: rgba(255, 246, 236, .52); }

.task-list { display: flex; flex-direction: column; gap: 8px; }

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .08);
}

.task-row.is-done { background: linear-gradient(145deg, rgba(255, 200, 87, .11), rgba(255, 255, 255, .035)); border-color: rgba(255, 200, 87, .26); }
.task-row.is-claimed { opacity: .72; }

.task-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  color: var(--orange-soft);
  background: rgba(255, 138, 61, .12);
  border: 1px solid rgba(255, 138, 61, .22);
}
.task-icon .mp-icon { width: 21px; height: 21px; }
.task-row.is-done .task-icon { color: #4B2B07; background: linear-gradient(150deg, #FFE39A, #FFC857); border-color: rgba(255, 240, 187, .65); }

.task-main { flex: 1; min-width: 0; }
.task-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.task-head strong { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-head em { flex: none; font-style: normal; font-size: 10px; font-weight: 900; color: var(--gold); }

.task-bar {
  height: 6px;
  margin: 7px 0 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, .3);
}
.task-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FF8A3D, #FFC857);
  transition: width .35s ease;
}
.task-row.is-done .task-bar span { background: linear-gradient(90deg, #38D6B0, #8CFFDC); }

.task-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 9px; color: rgba(255, 246, 236, .45); }

.task-claim {
  flex: none;
  min-width: 64px;
  min-height: 40px;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 900;
  color: var(--muted);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
}
.task-claim.can-claim {
  color: #2C1308;
  background: linear-gradient(150deg, #FFE39A, #FFC857 65%, #F0A72E);
  border-color: rgba(255, 240, 187, .65);
  box-shadow: 0 5px 14px rgba(240, 167, 46, .24);
}
.task-claim:disabled { opacity: .55; }

.task-all {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 138, 61, .1), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 138, 61, .2);
}
.task-all.is-done { border-color: rgba(255, 200, 87, .38); background: linear-gradient(145deg, rgba(255, 200, 87, .14), rgba(255, 138, 61, .05)); }
.task-all-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  color: #FFDFA3;
  background: rgba(255, 200, 87, .12);
  border: 1px solid rgba(255, 200, 87, .26);
}
.task-all-icon .mp-icon { width: 21px; height: 21px; }
.task-all-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task-all-main strong { font-size: 13px; font-weight: 800; }
.task-all-main span { font-size: 9px; color: var(--muted); }
.task-claim-all { min-width: 64px; }

/* ---------------- Coin withdrawal ---------------- */
.wallet-card {
  position: relative;
  padding: 14px 16px;
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(100% 150% at 10% -20%, rgba(255, 200, 87, .34), transparent 60%),
    linear-gradient(150deg, rgba(255, 138, 61, .2), rgba(58, 31, 68, .4));
  border: 1px solid rgba(255, 200, 87, .3);
}
.wallet-top { display: flex; align-items: center; justify-content: space-between; color: var(--orange-soft); }
.wallet-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.wallet-top .mp-icon { width: 20px; height: 20px; color: var(--gold); }
.wallet-card > strong {
  display: block;
  margin: 3px 0 5px;
  font-size: 38px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  color: #FFF9F2;
  text-shadow: 0 6px 22px rgba(255, 138, 61, .3);
}
.wallet-rate { font-size: 10px; color: rgba(255, 246, 236, .55); }
.wallet-rate b { color: #FFDFA3; font-size: 12px; }

.field-label {
  margin: 15px 2px 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--muted);
}

.amount-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid rgba(255, 255, 255, .09);
}
.amount-step {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 13px;
  color: var(--cream);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .11);
}
.amount-step:active { transform: scale(.94); }
.amount-step:disabled { opacity: .36; }
.amount-step .mp-icon { width: 20px; height: 20px; }
.amount-value { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 3px; }
.amount-value small { font-size: 15px; font-weight: 800; color: var(--orange-soft); }
.amount-value strong { font-size: 38px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; color: #FFF9F2; }

.amount-quick { display: flex; gap: 7px; margin-top: 8px; }
.amount-quick button {
  flex: 1;
  min-height: 36px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .1);
}
.amount-quick button:disabled { opacity: .36; }
.amount-quick button.is-active {
  color: #2C1308;
  background: linear-gradient(150deg, #FFB15C, #FF8A3D);
  border-color: rgba(255, 210, 158, .5);
}

.text-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--cream);
  background: rgba(0, 0, 0, .24);
  border: 1px solid rgba(255, 255, 255, .12);
  outline: none;
  font: inherit;
  font-size: 14px;
}
.text-input:focus { border-color: rgba(255, 138, 61, .6); box-shadow: 0 0 0 3px rgba(255, 138, 61, .12); }
.text-input::placeholder { color: rgba(255, 246, 236, .3); }

.withdraw-cost {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 11px 2px;
  font-size: 11px;
  color: var(--muted);
}
.withdraw-cost b { font-size: 14px; color: #FFDFA3; font-variant-numeric: tabular-nums; }

.withdraw-msg {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 13px;
  font-size: 11px;
  line-height: 1.5;
  font-weight: 700;
}
.withdraw-msg.is-error { color: #FFD6DA; background: rgba(255, 85, 102, .13); border: 1px solid rgba(255, 85, 102, .3); }
.withdraw-msg.is-ok { color: #A8FFE6; background: rgba(56, 214, 176, .12); border: 1px solid rgba(56, 214, 176, .28); }
.withdraw-msg.is-info { color: #FFE6BD; background: rgba(255, 200, 87, .1); border: 1px solid rgba(255, 200, 87, .24); }

.withdraw-note {
  display: flex;
  gap: 7px;
  margin-top: 12px;
  padding: 10px 11px;
  border-radius: 13px;
  font-size: 9px;
  line-height: 1.55;
  color: rgba(255, 246, 236, .48);
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .07);
}
.withdraw-note .mp-icon { width: 15px; height: 15px; color: var(--orange-soft); margin-top: 1px; }

.task-claim.can-claim:active,
.amount-quick button:not(:disabled):active { transform: scale(.96); filter: brightness(.95); }
