:root {
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-soft: #f6f9f7;
  --text: #0d2119;
  --text-soft: #4f6a5e;
  --muted: #8b9d94;
  --line: #e4ebe6;
  --green: #10a066;
  --green-bright: #1ec884;
  --green-dark: #067a4c;
  --green-soft: #e2f7ed;
  --lime: #cdf45c;
  --red: #e5485c;
  --red-soft: #fdecee;
  --amber: #b9761a;
  --amber-soft: #fff6e6;
  --purple: #7659e8;
  --grad-win: linear-gradient(135deg, #14b877 0%, #0a8d5c 100%);
  --grad-roll: linear-gradient(135deg, #1ad084 0%, #0a8f5c 55%, #06734a 100%);
  --shadow-sm: 0 2px 8px rgba(13, 33, 25, 0.05);
  --shadow: 0 8px 24px rgba(13, 33, 25, 0.07);
  --shadow-lg: 0 22px 48px rgba(13, 33, 25, 0.13);
  --radius: 26px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  color-scheme: light;
  background: #dfe5e1;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(16, 160, 102, 0.28);
  outline-offset: 2px;
}

/* ---------- App shell ---------- */

.app-frame {
  position: relative;
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 320px at 50% -80px, rgba(30, 200, 132, 0.16), transparent 70%),
    linear-gradient(180deg, #f2f7f4 0%, #edf1ee 55%, #eef2ef 100%);
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: calc(66px + env(safe-area-inset-top));
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 18px 13px;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid rgba(210, 222, 215, 0.6);
  background: rgba(243, 248, 245, 0.82);
  backdrop-filter: blur(20px) saturate(140%);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(13, 33, 25, 0.06);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(13, 33, 25, 0.1);
}

.brand-logo img { width: 34px; height: 34px; object-fit: contain; }

.brand-name {
  font-size: 19px;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.wallet-shortcut {
  display: flex;
  height: 40px;
  gap: 8px;
  align-items: center;
  padding: 0 13px 0 8px;
  border: 1px solid rgba(13, 33, 25, 0.07);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.14s ease;
}

.wallet-shortcut:active { transform: scale(0.96); }
.wallet-shortcut strong { font-family: var(--mono); font-size: 12.5px; }

.wallet-shortcut-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 9px;
  background: var(--green-soft);
}

.wallet-shortcut .lucide { width: 15px; height: 15px; fill: none; stroke: var(--green-dark); }

.app-main { min-height: 60vh; }

.view {
  padding: 18px 16px 24px;
  animation: view-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading { margin: 6px 4px 20px; }

.eyebrow,
.section-heading > div > span {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.page-heading h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.05em;
  line-height: 1.05;
}

.page-heading p:last-child {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.card,
.transaction-item,
.quest-item,
.settings-row {
  border: 1px solid rgba(13, 33, 25, 0.06);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card { border-radius: var(--radius); }

/* ---------- Dice board ---------- */

.dice-card {
  overflow: hidden;
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
}

/* The stage is the outer game panel: a dark cabinet that frames the arena. */
.dice-stage {
  position: relative;
  min-height: 232px;
  overflow: hidden;
  padding: 12px 14px 16px;
  background:
    radial-gradient(120% 62% at 50% 8%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, #e8f8f0 0%, #dff2ea 48%, #e9f3ef 100%);
  transition: background 0.4s ease;
}

.dice-stage::before {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(16, 160, 102, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 160, 102, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  content: "";
  -webkit-mask-image: radial-gradient(circle at 50% 32%, #000 0%, transparent 74%);
  mask-image: radial-gradient(circle at 50% 32%, #000 0%, transparent 74%);
}

.stage-glow {
  position: absolute;
  top: -30%;
  left: 50%;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 200, 132, 0.3) 0%, transparent 66%);
  filter: blur(8px);
  transform: translateX(-50%);
  transition: background 0.4s ease;
  pointer-events: none;
}

.dice-stage[data-state="win"] .stage-glow { background: radial-gradient(circle, rgba(30, 200, 132, 0.5) 0%, transparent 66%); }
.dice-stage[data-state="loss"] .stage-glow { background: radial-gradient(circle, rgba(229, 72, 92, 0.3) 0%, transparent 66%); }

.dice-stage.is-rolling .stage-glow { animation: pulse-glow 0.55s ease-in-out infinite alternate; }

@keyframes pulse-glow {
  from { opacity: 0.55; transform: translateX(-50%) scale(0.94); }
  to { opacity: 1; transform: translateX(-50%) scale(1.06); }
}

.burst {
  position: absolute;
  top: 46%;
  left: 50%;
  width: 8px;
  height: 8px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.burst i {
  position: absolute;
  width: 4px;
  height: 4px;
  margin: -2px;
  border-radius: 50%;
  background: var(--lime);
  opacity: 0;
}

.dice-stage[data-state="win"] .burst i { animation: burst-out 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.dice-stage[data-state="win"] .burst i:nth-child(2) { animation-delay: 0.04s; }
.dice-stage[data-state="win"] .burst i:nth-child(3) { animation-delay: 0.08s; }
.dice-stage[data-state="win"] .burst i:nth-child(4) { animation-delay: 0.02s; }
.dice-stage[data-state="win"] .burst i:nth-child(5) { animation-delay: 0.06s; }
.dice-stage[data-state="win"] .burst i:nth-child(6) { animation-delay: 0.1s; }
.dice-stage[data-state="win"] .burst i:nth-child(7) { animation-delay: 0.03s; }
.dice-stage[data-state="win"] .burst i:nth-child(8) { animation-delay: 0.07s; }

.burst i:nth-child(1) { --bx: 0px;   --by: -74px; }
.burst i:nth-child(2) { --bx: 52px;  --by: -52px; }
.burst i:nth-child(3) { --bx: 74px;  --by: 0px; }
.burst i:nth-child(4) { --bx: 52px;  --by: 52px; }
.burst i:nth-child(5) { --bx: 0px;   --by: 74px; }
.burst i:nth-child(6) { --bx: -52px; --by: 52px; }
.burst i:nth-child(7) { --bx: -74px; --by: 0px; }
.burst i:nth-child(8) { --bx: -52px; --by: -52px; }

@keyframes burst-out {
  0% { opacity: 0; transform: translate(0, 0) scale(0.2); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(1); }
}

.dice-topline {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.live-chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--green-dark);
}

.live-chip span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-bright);
  box-shadow: 0 0 0 4px rgba(30, 200, 132, 0.16);
  animation: live-blink 1.8s ease-in-out infinite;
}

@keyframes live-blink {
  50% { box-shadow: 0 0 0 7px rgba(30, 200, 132, 0.05); }
}

/* ---------- Spin wheel ----------
   The play area is a spinning prize wheel, like an arcade bonus game. The
   disc is split into alternating green/red slices and spins while the
   server decides, then settles so the pointer lands on the colour that
   came out. The colour rule is unchanged: green below 50, red from 50. */

.game-arena {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 200px;
  margin: 2px 0 4px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid #dfe9e2;
  background: linear-gradient(180deg, #ffffff 0%, #f2f9f5 100%);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.game-arena[data-guess="red"] { border-color: #f0cdd4; }

.game-arena[data-result="green"],
.game-arena[data-state="win"] {
  border-color: #b9e8d1;
  box-shadow: 0 0 22px rgba(30, 200, 132, 0.22), var(--shadow-sm);
}

.game-arena[data-result="red"],
.game-arena[data-state="loss"] {
  border-color: #f2c9ce;
  box-shadow: 0 0 22px rgba(229, 72, 92, 0.22), var(--shadow-sm);
}

.wheel-wrap {
  position: relative;
  width: 188px;
  height: 188px;
  margin: 12px auto 10px;
}

/* The disc: twelve alternating slices, green at 0/120/240 degrees. */
.wheel-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    #2fd694 0deg 30deg, #a32738 30deg 60deg, #17a877 60deg 90deg,
    #c74358 90deg 120deg, #2fd694 120deg 150deg, #c74358 150deg 180deg,
    #17a877 180deg 210deg, #a32738 210deg 240deg, #2fd694 240deg 270deg,
    #a32738 270deg 300deg, #17a877 300deg 330deg, #c74358 330deg 360deg
  );
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.55),
    inset 0 0 0 6px rgba(13, 33, 25, 0.08),
    0 12px 26px rgba(13, 33, 25, 0.2);
  transition: transform 1.9s cubic-bezier(0.16, 0.84, 0.26, 1);
  will-change: transform;
}

/* Hairline separators between slices plus a dark rim for depth. */
.wheel-disc::before {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(6, 16, 12, 0.5) 0deg 0.7deg, transparent 0.7deg 30deg);
  content: "";
}

.wheel-disc::after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 46%, rgba(13, 33, 25, 0.05) 72%, rgba(13, 33, 25, 0.3) 100%);
  content: "";
}

/* While spinning, the disc rotates via inline transforms from app.js so the
   landing angle can be retargeted mid-flight when the server answers. */

/* Ten chasing bulbs around the rim light up like a real cabinet wheel. */
.wheel-lights {
  position: absolute;
  inset: -7px;
  pointer-events: none;
}

.wheel-lights {
  --bulb-r: 97px;
}

.wheel-lights i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px;
  border-radius: 50%;
  background: #f3c96b;
  box-shadow: 0 0 6px rgba(233, 178, 74, 0.6);
  animation: bulb-blink 1.2s ease-in-out infinite;
  transform: rotate(var(--a, 0deg)) translateY(calc(var(--bulb-r, 97px) * -1));
}

.wheel-lights i:nth-child(1) { --a: 0deg; }
.wheel-lights i:nth-child(2) { --a: 36deg; }
.wheel-lights i:nth-child(3) { --a: 72deg; }
.wheel-lights i:nth-child(4) { --a: 108deg; }
.wheel-lights i:nth-child(5) { --a: 144deg; }
.wheel-lights i:nth-child(6) { --a: 180deg; }
.wheel-lights i:nth-child(7) { --a: 216deg; }
.wheel-lights i:nth-child(8) { --a: 252deg; }
.wheel-lights i:nth-child(9) { --a: 288deg; }
.wheel-lights i:nth-child(10) { --a: 324deg; }

.wheel-lights i:nth-child(odd) { animation-delay: 0.6s; }

.game-arena.is-rolling .wheel-lights i { animation-duration: 0.3s; animation-delay: 0s; }

@keyframes bulb-blink {
  0%, 100% { opacity: 0.35; box-shadow: 0 0 2px rgba(233, 178, 74, 0.3); }
  50% { opacity: 0.95; box-shadow: 0 0 8px rgba(233, 178, 74, 0.85); }
}

/* The centre of the wheel is a round SPIN button; it doubles as the status
   label (MENANG!/KALAH!) and glows red when the round is lost. */
.wheel-hub {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  width: 86px;
  height: 86px;
  margin: -43px;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, #2edc94 0%, #12b473 55%, #0a8d5c 100%);
  box-shadow:
    0 0 0 5px #ffffff,
    0 0 0 6px rgba(13, 33, 25, 0.08),
    0 10px 22px rgba(10, 141, 92, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #fff;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.wheel-hub span {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 4px rgba(6, 58, 38, 0.4);
}

.wheel-hub small {
  color: rgba(255, 255, 255, 0.85);
  font-size: 6.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.wheel-hub:active { transform: scale(0.95); }
.wheel-hub:disabled { cursor: wait; filter: saturate(0.75) brightness(0.97); }

/* Lost round: the button and its ring go red. */
.game-arena[data-state="loss"] .wheel-hub {
  background: linear-gradient(160deg, #f2637a 0%, #d13a52 55%, #a32738 100%);
  box-shadow:
    0 0 0 5px #ffffff,
    0 0 0 6px rgba(13, 33, 25, 0.08),
    0 10px 22px rgba(163, 39, 56, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Won round: a lime halo around the button. */
.game-arena[data-state="win"] .wheel-hub {
  box-shadow:
    0 0 0 5px #ffffff,
    0 0 0 6px rgba(168, 230, 58, 0.65),
    0 0 26px rgba(168, 230, 58, 0.5),
    0 10px 22px rgba(10, 141, 92, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* A lime pointer at the top marks the winning slice. */
.wheel-pointer {
  position: absolute;
  z-index: 4;
  top: -4px;
  left: 50%;
  width: 0;
  height: 0;
  margin-left: -10px;
  border-top: 17px solid #cdf45c;
  border-right: 10px solid transparent;
  border-left: 10px solid transparent;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
}

/* ---------- Controls ---------- */

/* The controls sit on the light game card, matching the rest of the app. */
form {
  padding: 12px 14px 16px;
}

.control-group { margin-top: 12px; }

.control-label,
.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.control-label output {
  color: var(--green-dark);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 800;
}


.color-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.color-card {
  display: grid;
  gap: 3px;
  justify-items: center;
  padding: 15px 10px 13px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: #f6f9f7;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.color-swatch {
  width: 30px;
  height: 30px;
  margin-bottom: 3px;
  border-radius: 50%;
}

.color-card[data-guess="green"] .color-swatch {
  background: linear-gradient(160deg, #2fd694, #0a8d5c);
  box-shadow: 0 4px 10px rgba(10, 141, 92, 0.35);
}

.color-card[data-guess="red"] .color-swatch {
  background: linear-gradient(160deg, #f2637a, #a32738);
  box-shadow: 0 4px 10px rgba(163, 39, 56, 0.35);
}
.color-card strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.1em;
  transition: color 0.18s ease;
}

.color-card.is-active[data-guess="green"] {
  border-color: var(--green);
  background: linear-gradient(180deg, #e9faf1, #f5fcf8);
  box-shadow: 0 8px 20px rgba(10, 141, 92, 0.22);
  transform: translateY(-2px);
}

.color-card.is-active[data-guess="red"] {
  border-color: #d13a52;
  background: linear-gradient(180deg, #fdeef1, #fef7f8);
  box-shadow: 0 8px 20px rgba(209, 58, 82, 0.22);
  transform: translateY(-2px);
}

.color-card.is-active[data-guess="green"] strong { color: var(--green-dark); }
.color-card.is-active[data-guess="red"] strong { color: #c22b45; }

.bet-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bet-input-wrap {
  flex: 1 1 120px;
  min-width: 96px;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.bet-input-wrap:focus-within {
  border-color: var(--green-bright);
  background: #fff;
}

.bet-input-wrap input {
  border: 0; outline: 0; background: none;
  flex: 1; min-width: 0;
  font-family: var(--mono);
  font-size: 15px; font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.bet-input-wrap input::-webkit-outer-spin-button,
.bet-input-wrap input::-webkit-inner-spin-button { appearance: none; }

.bet-shortcuts {
  display: flex;
  gap: 5px;
}

.bet-shortcuts button {
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 8.5px;
  font-weight: 750;
  transition: all 0.15s ease;
}

.bet-shortcuts button:active { transform: scale(0.94); }
.bet-shortcuts button:hover { border-color: var(--green-bright); background: var(--green-soft); color: var(--green-dark); }
.bet-shortcuts button.is-active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
  box-shadow: 0 2px 8px rgba(10, 141, 92, 0.18);
}

.multiplier-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-top: 7px;
}

.multiplier-row button {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.multiplier-row button:active { transform: scale(0.94); }
.multiplier-row button:hover { border-color: var(--green-bright); background: var(--green-soft); color: var(--green-dark); }
.multiplier-row button.is-active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
  box-shadow: 0 2px 8px rgba(10, 141, 92, 0.18);
}

/* The round SPIN button lives in the wheel centre (see .wheel-hub); the old
   full-width roll button is gone. The error line keeps its reserved space. */
.rtp-note {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
}

[data-theme="dark"] .rtp-note { color: #5f7d6f; }

.form-error { min-height: 17px; margin: 9px 0 0; color: var(--red); font-size: 10.5px; font-weight: 600; text-align: center; }

/* ---------- Lists ---------- */

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 4px 10px;
}

.history-label {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.history-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-bright);
  animation: live-blink 1.8s ease-in-out infinite;
}

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.icon-button .lucide { width: 13px; height: 13px; stroke: var(--text-soft); }
.icon-button:active { transform: scale(0.92); }
.icon-button:hover { border-color: rgba(16, 160, 102, 0.4); }

.recent-list,
.transaction-list,
.quest-list,
.settings-list { display: grid; gap: 9px; }

.recent-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 54px;
  padding: 9px 14px;
  border: 1px solid rgba(13, 33, 25, 0.06);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.recent-item:active { transform: scale(0.985); }

.recent-color {
  width: 10px;
  height: 34px;
  border-radius: 6px;
}

.recent-color[data-color="green"] { background: linear-gradient(180deg, #2fd694, #0a8d5c); box-shadow: 0 3px 8px rgba(10, 141, 92, 0.3); }
.recent-color[data-color="red"] { background: linear-gradient(180deg, #f2637a, #a32738); box-shadow: 0 3px 8px rgba(163, 39, 56, 0.3); }

.recent-item[data-won="true"] { border-color: #c9ecd9; background: linear-gradient(180deg, #f4fcf8, #ffffff); }
.recent-item[data-won="false"] { border-color: #f6d9dd; background: linear-gradient(180deg, #fef6f7, #ffffff); }

.transaction-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 11px 14px;
  border-radius: 18px;
}

.recent-main,
.transaction-main { min-width: 0; }
.recent-main strong,
.transaction-main strong { display: block; font-size: 11.5px; }
.recent-main span,
.transaction-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 9.5px; }

.recent-item .recent-main strong { font-family: var(--mono); font-size: 14px; letter-spacing: -0.02em; }

.recent-value,
.transaction-value { text-align: right; }
.recent-value strong,
.transaction-value strong { display: block; font-family: var(--mono); font-size: 12px; }
.recent-value span,
.transaction-value span { display: block; margin-top: 4px; font-size: 8.5px; font-weight: 800; letter-spacing: 0.06em; }

.text-win { color: var(--green-dark); }
.text-loss { color: var(--red); }

.empty-state {
  margin: 0;
  padding: 26px 0;
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
}

/* ---------- Wallet ---------- */

.wallet-hero {
  position: relative;
  overflow: hidden;
  padding: 22px 22px 24px;
  border: 1px solid #dfe9e2;
  border-radius: 24px;
  background:
    radial-gradient(110% 90% at 100% 0%, rgba(211, 178, 106, 0.14) 0%, transparent 52%),
    radial-gradient(70% 120% at -10% 110%, rgba(30, 200, 132, 0.1) 0%, transparent 50%),
    linear-gradient(165deg, #ffffff 0%, #f2f9f5 60%, #eef6f1 100%);
  box-shadow: var(--shadow);
  color: var(--text);
}

.wallet-hero .hero-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.wallet-hero > strong { font-weight: 750; }

.wallet-hero-foot {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(13, 33, 25, 0.08);
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.14em;
}

.wallet-hero-foot b { color: #5c8a2e; font-family: var(--mono); font-weight: 700; }

.wallet-hero::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13, 33, 25, 0.02), transparent 38%);
  content: "";
  pointer-events: none;
}

.wallet-hero::after {
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(13, 33, 25, 0.05);
  border-radius: 50%;
  content: "";
}

.wallet-hero-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.wallet-hero > strong { display: block; margin-top: 18px; font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: -0.04em; }
.wallet-hero > small { color: var(--muted); font-size: 10px; letter-spacing: 0.06em; }

.demo-chip {
  padding: 4px 8px;
  border: 1px solid rgba(92, 138, 46, 0.35);
  border-radius: 7px;
  background: rgba(168, 230, 58, 0.14);
  color: #5c8a2e;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 12px;
}

.quick-actions button {
  display: flex;
  min-height: 94px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(13, 33, 25, 0.06);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.quick-actions { grid-template-columns: repeat(4, 1fr); gap: 7px; }

.quick-actions button:not(:disabled) { cursor: pointer; }
.quick-actions button:not(:disabled):hover { border-color: rgba(16, 160, 102, 0.35); }
.quick-actions button:not(:disabled):active { transform: scale(0.97); }

.quick-action.is-active {
  border-color: var(--green);
  background: linear-gradient(180deg, #e9faf1, #f6fcf8);
  box-shadow: 0 6px 16px rgba(10, 141, 92, 0.18);
}

.quick-action.is-active .action-icon { background: var(--green); color: #fff; }

/* Live-only actions (Transfer / Staking) sit locked while demo mode is on. */
.quick-action:disabled { opacity: 0.55; filter: grayscale(0.35); box-shadow: none; }
.quick-action:disabled .action-icon { background: var(--surface-soft); color: var(--muted); }

/* ---------- Login / Register ---------- */

.auth-card {
  margin: 4vh auto 0;
  width: min(400px, 100%);
  padding: 26px 22px 22px;
  border: 1px solid rgba(13, 33, 25, 0.08);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand { text-align: center; }
.auth-brand img { border-radius: 12px; }
.auth-brand h2 { margin: 10px 0 4px; font-size: 17px; letter-spacing: -0.01em; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.5; }

.auth-pass { position: relative; }
.pass-eye {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
}
.pass-eye .lucide { width: 15px; height: 15px; }
.pass-eye i[data-lucide="eye-off"],
.pass-eye svg[data-lucide="eye-off"] { display: none; }
.pass-eye.is-on i[data-lucide="eye-off"],
.pass-eye.is-on svg[data-lucide="eye-off"] { display: block; }
.pass-eye.is-on i[data-lucide="eye"],
.pass-eye.is-on svg[data-lucide="eye"] { display: none; }

.auth-switch { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: 10.5px; }
.auth-switch a { color: var(--green-dark); font-weight: 700; text-decoration: none; }
.auth-switch a:active { opacity: 0.7; }

/* Guest mode: hide the whole shell until the visitor signs in. */
body.is-guest .app-bar,
body.is-guest .bottom-nav { display: none; }
body.is-guest .app-main { min-height: 80vh; }

.settings-icon.logout { background: var(--red-soft); color: var(--red); }

/* Chip mode (hero wallet & kartu profil) berubah saat mode LIVE aktif. */
.demo-chip.is-live,
.verified-chip.is-live {
  border-color: rgba(20, 184, 119, 0.5);
  background: linear-gradient(135deg, #14b877, #0a8d5c);
  color: #fff;
}
.auth-dot { margin: 0 6px; opacity: 0.55; }

/* Wallet sub-pages (deposit / withdraw / transfer / staking) are full views
   reached from the quick actions on the wallet tab. */
.wallet-page {
  padding: 18px;
  border: 1px solid rgba(13, 33, 25, 0.06);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

#viewWallet .wallet-metrics { margin-top: 12px; }

.page-head { display: flex; gap: 10px; align-items: center; }

.page-back {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  cursor: pointer;
}

.page-back .lucide { width: 16px; height: 16px; stroke: var(--text-soft); }
.page-back:active { transform: scale(0.94); }

.wallet-page h2 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.wallet-page .page-sub { margin: 10px 0 0; color: var(--muted); font-size: 9.5px; }

.qr-box {
  display: grid;
  width: 190px;
  margin: 14px auto 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  place-items: center;
}

.qr-box img { width: 100%; height: auto; }

.address-box {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed #cbd8d0;
  border-radius: 12px;
  background: var(--surface-soft);
}

.address-box code {
  flex: 1;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.copy-button .lucide { width: 12px; height: 12px; }

.page-note { margin: 8px 0 0; color: var(--muted); font-size: 8.5px; }

.fee-row {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 9.5px;
}

.stake-terms {
  margin: 12px 0 0;
  padding: 13px 15px;
  border: 1px solid #f0dfb9;
  border-radius: 14px;
  background: var(--amber-soft);
  color: #6d5a35;
  font-size: 9.5px;
  line-height: 1.7;
}

.stake-terms strong { color: var(--amber); }

.page-field { margin-top: 13px; }
.page-amount { width: 100%; }

.page-chips { display: flex; gap: 6px; margin-top: 8px; }

.page-chips button {
  flex: 1;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.page-chips button:active { transform: scale(0.95); }
.page-chips button:hover { border-color: var(--green-bright); color: var(--green-dark); }

.page-submit {
  width: 100%;
  height: 42px;
  margin-top: 14px;
  border: 0;
  border-radius: 13px;
  background: var(--grad-roll);
  box-shadow: 0 10px 24px rgba(10, 141, 92, 0.32);
  color: #fff;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.page-submit:active { transform: translateY(1px); }
.page-submit:disabled { opacity: 0.6; cursor: wait; }

.page-submit.secondary {
  margin-top: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--text-soft);
}

.stake-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 14px;
}

.stake-stats div {
  padding: 11px 6px;
  border: 1px solid rgba(13, 33, 25, 0.06);
  border-radius: 13px;
  background: var(--surface-soft);
  text-align: center;
}

.stake-stats span { display: block; color: var(--muted); font-size: 7.5px; font-weight: 800; letter-spacing: 0.1em; }
.stake-stats strong { display: block; margin-top: 5px; font-family: var(--mono); font-size: 11.5px; }
.quick-actions strong { font-size: 10.5px; }
.quick-actions small { margin-top: 3px; color: var(--muted); font-size: 8.5px; }

.action-icon { display: grid; width: 30px; height: 30px; place-items: center; margin-bottom: 8px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); }
.action-icon .lucide { width: 15px; height: 15px; stroke: currentColor; }

.wallet-metrics,
.account-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 12px;
  margin-bottom: 12px;
}

.wallet-metrics div,
.account-stats div {
  padding: 14px 8px;
  border: 1px solid rgba(13, 33, 25, 0.06);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.wallet-metrics span,
.account-stats span { display: block; color: var(--muted); font-size: 8.5px; }
.wallet-metrics strong,
.account-stats strong { display: block; overflow: hidden; margin-top: 6px; font-family: var(--mono); font-size: 12.5px; text-overflow: ellipsis; }

.transaction-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--green-soft); color: var(--green-dark); }
.transaction-icon .lucide { width: 18px; height: 18px; stroke: currentColor; }

/* ---------- Reward ---------- */

.daily-card {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
}

.daily-tag { color: var(--purple); font-size: 8.5px; font-weight: 900; letter-spacing: 0.1em; }
.daily-copy h2 { margin: 5px 0 4px; font-size: 21px; letter-spacing: -0.03em; }
.daily-copy p { max-width: 230px; margin: 0; color: var(--muted); font-size: 9.5px; line-height: 1.5; }

.claim-button {
  min-width: 80px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #cdf45c, #a8e63a);
  color: #0d2119;
  cursor: pointer;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 18px rgba(168, 230, 58, 0.4);
}

.claim-button:disabled { background: #eaeeeb; color: var(--muted); cursor: not-allowed; box-shadow: none; }

.weekly-card,
.mitra-card { margin-top: 12px; padding: 18px; border-radius: 22px; }

.weekly-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.weekly-top h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -0.02em; }

.weekly-sub { margin: 8px 0 0; color: var(--muted); font-size: 9.5px; }

.tier-list { display: grid; gap: 7px; margin-top: 12px; }

.tier {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  font-size: 10px;
}

.tier span { color: var(--muted); }
.tier strong { font-family: var(--mono); }

.tier.is-reached { border-color: #b6e4cd; background: #f2fbf7; }
.tier.is-reached span { color: var(--green-dark); }
.tier.is-reached strong { color: var(--green-dark); }

.progress-track { overflow: hidden; height: 8px; border-radius: 99px; background: #e6ede8; }
.progress-fill { width: 0%; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #1ad084, #0a8d5c); transition: width 0.4s ease; }
.progress-fill.mitra { background: linear-gradient(90deg, #8f6ff0, #6a48d8); }

.weekly-progress,
.mitra-progress { margin-top: 12px; }

.weekly-progress small,
.mitra-progress small { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; }
.weekly-progress b,
.mitra-progress b { color: var(--text); }

.mitra-code {
  padding: 6px 10px;
  border: 1px dashed rgba(118, 89, 232, 0.4);
  border-radius: 9px;
  background: #f6f3ff;
  color: var(--purple);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.mitra-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.mitra-actions .page-submit { margin-top: 0; }

.quest-progress { color: var(--purple); font-family: var(--mono); font-size: 11.5px; font-weight: 800; }
.quest-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 72px; padding: 13px 14px; border-radius: 18px; }
.quest-number { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; background: #f2eefd; color: var(--purple); font-family: var(--mono); font-size: 9.5px; }
.quest-item strong { display: block; font-size: 11.5px; }
.quest-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 9.5px; }
.quest-reward { padding: 5px 9px; border-radius: 9px; background: var(--green-soft); color: var(--green-dark); font-family: var(--mono); font-size: 9.5px; font-weight: 800; }
.quest-item.is-complete { border-color: #b6e4cd; background: #f3fbf7; }
.quest-item.is-complete .quest-number { background: var(--green-soft); color: var(--green-dark); }

.reward-notice { margin-top: 16px; padding: 15px; border: 1px solid #f0dfb9; border-radius: 17px; background: var(--amber-soft); }
.reward-notice strong { color: var(--amber); font-size: 10.5px; }
.reward-notice p { margin: 5px 0 0; color: #8a744b; font-size: 9.5px; line-height: 1.5; }

/* ---------- Account ---------- */

.profile-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(13, 33, 25, 0.06);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.profile-avatar {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(150deg, #123a2a, #0a1f17);
  box-shadow: 0 8px 18px rgba(10, 31, 23, 0.28);
  color: #fff;
  font-size: 16px;
  font-weight: 850;
}

.profile-copy strong { display: block; font-size: 13.5px; }
.profile-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 9.5px; }
.verified-chip { padding: 6px 9px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); font-size: 8.5px; font-weight: 900; letter-spacing: 0.08em; }

.settings-list { margin-top: 12px; }
.settings-list + .settings-list { margin-top: 10px; }
.settings-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 68px; padding: 12px 14px; border-radius: 18px; }
button.settings-row { cursor: pointer; text-align: left; }
button.settings-row:active { transform: scale(0.985); }
.row-chevron { width: 15px; height: 15px; stroke: var(--muted); }
.mode-value { padding: 5px 9px; border-radius: 9px; background: var(--green-soft); color: var(--green-dark); font-size: 9px; font-weight: 900; letter-spacing: 0.08em; }

/* Demo/live mode page. */
.mode-options { display: grid; gap: 9px; margin-top: 14px; }
.mode-option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 15px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.mode-option strong { display: block; font-size: 12.5px; letter-spacing: 0.06em; }
.mode-option small { display: block; margin-top: 3px; color: var(--muted); font-size: 9.5px; }
.mode-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #cbd8d0; background: #fff; }
.mode-dot.live { border-color: #d13a52; }
.mode-option.is-active { border-color: var(--green); background: #f2fbf7; box-shadow: 0 6px 16px rgba(10, 141, 92, 0.15); }
.mode-option.is-active .mode-dot { border-color: var(--green-dark); background: var(--green-bright); box-shadow: inset 0 0 0 3px #fff; }
.mode-check { width: 16px; height: 16px; stroke: var(--green-dark); opacity: 0; transition: opacity 0.18s ease; }
.mode-option.is-active .mode-check { opacity: 1; }

.mode-note {
  margin-top: 12px;
  padding: 13px 15px;
  border: 1px solid #f0dfb9;
  border-radius: 14px;
  background: var(--amber-soft);
}

.mode-note strong { color: var(--amber); font-size: 10.5px; }
.mode-note p { margin: 5px 0 0; color: #8a744b; font-size: 9.5px; line-height: 1.5; }

/* Legal pages (terms / privacy) and partnership info list. */
.legal-list {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.legal-list li {
  padding: 12px 14px;
  border: 1px solid rgba(13, 33, 25, 0.06);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.6;
}

.legal-list strong { color: var(--text); }

#viewPartnership .stake-stats { margin-top: 14px; }
#viewPartnership .mitra-actions { margin-top: 13px; }
.settings-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 13px; background: var(--green-soft); color: var(--green-dark); }
.settings-icon .lucide { width: 18px; height: 18px; stroke: currentColor; }
.settings-row strong { display: block; font-size: 10.5px; }
.settings-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 8.5px; }
.settings-value { color: var(--muted); font-size: 9.5px; }
.status-dot { color: var(--green-dark); font-size: 9.5px; font-weight: 800; }
.status-dot::before { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--green-bright); content: ""; }

.reset-button {
  width: 100%;
  height: 48px;
  margin-top: 16px;
  border: 1px solid #f2c9ce;
  border-radius: 15px;
  background: var(--red-soft);
  color: var(--red);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 750;
}

.version { margin: 15px 0 0; color: var(--muted); font-size: 8.5px; text-align: center; }

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: min(100%, 520px);
  height: calc(74px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(4, 1fr);
  margin: 0 auto;
  padding: 8px 9px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(210, 222, 215, 0.85);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 -10px 34px rgba(13, 33, 25, 0.08);
  backdrop-filter: blur(22px) saturate(150%);
}

.nav-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 15px;
  background: none;
  color: #9aaba2;
  cursor: pointer;
  font-size: 9.5px;
  font-weight: 700;
  transition: color 0.18s ease, background 0.18s ease;
}

.nav-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.nav-item .lucide { width: 22px; height: 22px; }
.nav-item.is-active { background: var(--green-soft); color: var(--green-dark); }

/* ---------- Toast ---------- */

.toast-region {
  position: fixed;
  z-index: 60;
  right: 12px;
  top: calc(74px + env(safe-area-inset-top));
  left: 12px;
  display: grid;
  width: min(calc(100% - 24px), 496px);
  gap: 8px;
  margin: 0 auto;
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  border: 1px solid rgba(13, 33, 25, 0.08);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(13, 33, 25, 0.16);
  color: var(--text-soft);
  font-size: 10.5px;
  animation: toast-in 0.22s ease;
}

.toast.error { border-color: #f2c9ce; color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

@media (min-width: 560px) {
  .app-frame { box-shadow: 0 0 60px rgba(13, 33, 25, 0.1); }
}

@media (max-width: 360px) {
  .app-frame { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .view { padding-right: 12px; padding-left: 12px; }
  .game-arena { min-height: 184px; }
  .wheel-wrap { width: 168px; height: 168px; }
  .wheel-lights { --bulb-r: 87px; }
  .wheel-hub { width: 78px; height: 78px; margin: -39px; }
  .bottom-nav { height: calc(70px + env(safe-area-inset-bottom)); }
  .color-pick { gap: 8px; }
  .color-card { padding: 12px 6px 11px; }
  .color-card strong { font-size: 11.5px; }
  .color-swatch { width: 26px; height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Theme switch ---------- */

.theme-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 99px;
  background: #d6e2db;
  transition: background 0.2s ease;
}

.theme-switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(13, 33, 25, 0.25);
  content: "";
  transition: transform 0.2s ease;
}

.theme-switch.is-on { background: var(--green); }
.theme-switch.is-on::after { transform: translateX(18px); }

/* ---------- Dark theme ----------
   Toggled by the switch on the Account page; the choice persists in
   localStorage and re-colours every surface through the palette variables. */

[data-theme="dark"] {
  color-scheme: dark;
  background: #040605;
  --bg: #050807;
  --surface: #0d1712;
  --surface-soft: #0a1210;
  --text: #e8f5ee;
  --text-soft: #a7c3b6;
  --muted: #6f8d80;
  --line: #1a2b23;
  --green-dark: #57d9a3;
  --green-soft: rgba(30, 200, 132, 0.14);
  --red-soft: rgba(229, 72, 92, 0.16);
  --amber-soft: rgba(233, 178, 74, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 22px 48px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .app-frame {
  background:
    radial-gradient(900px 320px at 50% -80px, rgba(30, 200, 132, 0.09), transparent 70%),
    linear-gradient(180deg, #071009 0%, #050a08 55%, #040605 100%);
}

[data-theme="dark"] .app-bar { background: rgba(4, 7, 5, 0.85); border-bottom-color: rgba(30, 50, 42, 0.6); }
[data-theme="dark"] .brand-logo { background: #14251e; border-color: rgba(255, 255, 255, 0.07); }
[data-theme="dark"] .wallet-shortcut { background: #14251e; }
[data-theme="dark"] .bottom-nav { background: rgba(4, 7, 5, 0.92); border-top-color: rgba(30, 50, 42, 0.85); box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.5); }
[data-theme="dark"] .nav-item { color: #5f7d70; }
[data-theme="dark"] .color-card { background: var(--surface-soft); }

/* Selected colour card glows instead of turning light. */
[data-theme="dark"] .color-card.is-active[data-guess="green"] {
  border-color: var(--green-bright);
  background: rgba(30, 200, 132, 0.16);
  box-shadow: 0 8px 20px rgba(10, 141, 92, 0.35);
}

[data-theme="dark"] .color-card.is-active[data-guess="red"] {
  border-color: #f2637a;
  background: rgba(229, 72, 92, 0.16);
  box-shadow: 0 8px 20px rgba(209, 58, 82, 0.35);
}

[data-theme="dark"] .color-card.is-active[data-guess="green"] strong { color: #6fe6ac; }
[data-theme="dark"] .color-card.is-active[data-guess="red"] strong { color: #ff9fb0; }

[data-theme="dark"] .bet-input-wrap { background: rgba(0, 0, 0, 0.4); }
[data-theme="dark"] .bet-input-wrap:focus-within { background: #040605; }

/* The games cabinet goes black; no white ring may survive around the wheel. */
[data-theme="dark"] .dice-stage {
  background:
    radial-gradient(120% 62% at 50% 8%, rgba(46, 220, 148, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, #081209 0%, #060d0a 48%, #040605 100%);
}

[data-theme="dark"] .game-arena { background: linear-gradient(180deg, #0a1710 0%, #071009 55%, #050807 100%); border-color: #1f332a; }

[data-theme="dark"] .wheel-disc {
  box-shadow:
    inset 0 0 0 5px rgba(5, 8, 7, 0.9),
    inset 0 0 0 6px rgba(255, 255, 255, 0.14),
    0 14px 34px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .wheel-hub {
  background: radial-gradient(circle at 50% 30%, #12241c, #081209 72%);
  box-shadow:
    0 0 0 5px #0d1712,
    0 0 0 6px rgba(255, 255, 255, 0.12),
    0 10px 22px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .wheel-pointer { border-top-color: #cdf45c; }

[data-theme="dark"] .recent-item[data-won="true"] { border-color: #1d3a2d; background: linear-gradient(180deg, #10241b, #112019); }
[data-theme="dark"] .recent-item[data-won="false"] { border-color: #3a2327; background: linear-gradient(180deg, #241317, #1c1215); }
[data-theme="dark"] .toast { background: #0d1712; }

/* Amber info blocks and reward surfaces follow the dark palette too. */
[data-theme="dark"] .stake-terms,
[data-theme="dark"] .reward-notice,
[data-theme="dark"] .mode-note { border-color: rgba(233, 178, 74, 0.25); color: #d9c08a; }

[data-theme="dark"] .stake-terms strong,
[data-theme="dark"] .reward-notice strong,
[data-theme="dark"] .mode-note strong { color: #e9b24a; }

[data-theme="dark"] .stake-terms p,
[data-theme="dark"] .reward-notice p,
[data-theme="dark"] .mode-note p { color: #b39a67; }

[data-theme="dark"] .tier.is-reached { border-color: #1d3a2d; background: rgba(30, 200, 132, 0.1); }
[data-theme="dark"] .tier.is-reached span,
[data-theme="dark"] .tier.is-reached strong { color: #57d9a3; }

[data-theme="dark"] .claim-button:disabled { background: #1a2b23; color: var(--muted); }
[data-theme="dark"] .mitra-code { border-color: rgba(118, 89, 232, 0.45); background: rgba(118, 89, 232, 0.14); color: #b9a5f5; }
[data-theme="dark"] .qr-box { background: #fff; }
[data-theme="dark"] .progress-track { background: #1c2a24; }
[data-theme="dark"] .address-box { border-color: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .mode-option { background: var(--surface-soft); }
[data-theme="dark"] .mode-dot { background: #0d1712; border-color: #2a443a; }
[data-theme="dark"] .mode-option.is-active { background: rgba(30, 200, 132, 0.12); border-color: var(--green); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
[data-theme="dark"] .mode-option.is-active .mode-dot { background: var(--green-bright); border-color: var(--green); box-shadow: inset 0 0 0 3px #0d1712; }
[data-theme="dark"] .mode-check { stroke: var(--green-bright); }
[data-theme="dark"] .theme-switch { background: #2a443a; }
[data-theme="dark"] .theme-switch::after { background: #e8f5ee; }

[data-theme="dark"] .wallet-hero {
  border-color: rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(110% 90% at 100% 0%, rgba(211, 178, 106, 0.16) 0%, transparent 52%),
    radial-gradient(70% 120% at -10% 110%, rgba(30, 200, 132, 0.12) 0%, transparent 50%),
    linear-gradient(165deg, #16261f 0%, #0d1813 55%, #0a130f 100%);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #fff;
}

[data-theme="dark"] .wallet-hero .hero-label,
[data-theme="dark"] .wallet-hero-top,
[data-theme="dark"] .wallet-hero > small { color: rgba(255, 255, 255, 0.45); }
[data-theme="dark"] .wallet-hero-foot { border-top-color: rgba(255, 255, 255, 0.07); color: rgba(255, 255, 255, 0.4); }
[data-theme="dark"] .wallet-hero-foot b { color: #d8f39a; }
[data-theme="dark"] .demo-chip { border-color: rgba(205, 244, 92, 0.35); background: rgba(205, 244, 92, 0.08); color: #d8f39a; }
[data-theme="dark"] .demo-chip.is-live,
[data-theme="dark"] .verified-chip.is-live { border-color: rgba(20, 184, 119, 0.5); background: linear-gradient(135deg, #14b877, #0a8d5c); color: #fff; }
