/* Full-screen Hundreder. Original charcoal, silver and warm gold palette. */
:root {
  color-scheme: dark;
  --bg: #0a0a0b;
  --surface: #141416;
  --raised: #1c1c1f;
  --stroke: #ffffff12;
  --text: #ededf0;
  --muted: #919199;
  --faint: #55555d;
  --gold: #d9b25c;
  --gold-light: #edcf8c;
  --display: "Unbounded", system-ui, sans-serif;
  --ui: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
}
body {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% 38%, #ffffff04, transparent 65%), var(--bg);
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  transition:
    background 0.16s,
    border-color 0.16s,
    color 0.16s,
    opacity 0.16s;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
button:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
button,
input {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
[hidden] {
  display: none !important;
}
.svg-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.app {
  height: 100dvh;
  width: 100%;
  padding: 0 24px 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.game-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 12px;
}
.stage {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 16px 26px 0;
  overflow: hidden;
}
.glow-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, #fff03, transparent 70%);
}
.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 18px;
  gap: 20px;
}
.stage-wordmark {
  font-size: 9px;
  letter-spacing: 1.7px;
  color: var(--faint);
}
.round-state {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}
.round-state > i {
  height: 4px;
  width: 4px;
  background: #92929c;
  border-radius: 50%;
}
.revealing .round-state > i {
  background: var(--gold);
  animation: status-pulse 0.8s ease infinite;
}
.numbers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 40px;
  width: 100%;
  align-items: center;
  flex: 1;
  min-height: 0;
  padding: 10px 4vw 0;
}
.num-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 10px;
}
.num-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 2.5px;
}
.num {
  display: block;
  position: relative;
  font-family: var(--display);
  font-size: clamp(76px, 18vh, 220px);
  font-weight: 600;
  letter-spacing: -0.065em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  min-width: 1.6em;
  will-change: transform;
}
.num.player {
  color: #9a9aa4;
}
.num.casino {
  color: #f2f2f5;
}
.num.is-masked {
  color: transparent !important;
}
.num.is-masked::after {
  content: "—";
  position: absolute;
  inset: 0;
  color: #414147;
  font-family: var(--ui);
  font-weight: 400;
  letter-spacing: 0;
}
.focus-row {
  flex: 0 0 100px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 8px;
}
.distance-label {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.7px;
}
.focus {
  display: flex;
  align-items: center;
  gap: 14px;
}
.focus-label {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--muted);
}
.focus-value {
  font-family: var(--display);
  font-size: clamp(48px, 7.5vh, 92px);
  font-weight: 600;
  letter-spacing: -1.5px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.focus-value.bump {
  animation: focus-bump 0.25s ease-out;
}
.focus[class*="leap-"] .focus-value {
  animation: result-rise 0.55s ease-out;
}
.picker-area {
  flex: 0 0 auto;
  width: 100%;
  margin: 0 auto;
  max-width: none;
}
.picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 56px;
  font-size: 8px;
  letter-spacing: 1.5px;
  color: #74747e;
}
.picker-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pick-step {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid #ffffff13;
  border-radius: 10px;
  color: #bcbcc5;
  background: #ffffff03;
  font-size: 20px;
}
.pick-step:hover:not(:disabled) {
  background: #ffffff0a;
  border-color: #ffffff2b;
}
.ruler-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 105px;
  overflow: hidden;
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 9%,
    #000 91%,
    transparent
  );
}
.ruler {
  display: block;
  width: 100%;
  height: 105px;
  touch-action: pan-y;
  cursor: grab;
}
.indicator {
  position: absolute;
  left: 50%;
  top: 13px;
  bottom: 7px;
  width: 2px;
  border-radius: 2px;
  background: #d0d0d8;
  transform: translateX(-50%);
  pointer-events: none;
}
.indicator::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -3px;
  transform: translateX(-50%);
  width: 8px;
  height: 5px;
  background: #d0d0d8;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7%;
  pointer-events: none;
}
.fade-left {
  left: 0;
  background: linear-gradient(90deg, var(--bg), transparent);
}
.fade-right {
  right: 0;
  background: linear-gradient(-90deg, var(--bg), transparent);
}
.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 33px;
  margin-bottom: 0;
}
.mini-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--muted);
}
.mult-block,
.win-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
}
.mult,
.win-amount {
  font: 600 12px var(--display);
  font-variant-numeric: tabular-nums;
}
.win-banner {
  justify-content: flex-end;
}
.win-text {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.5px;
}
.win-banner.visible .win-amount {
  color: var(--gold);
}
.win-banner.win-small .win-amount {
  color: #bebec8;
}
.picker-hint {
  font-size: 9px;
  color: #686874;
  letter-spacing: 0.3px;
  margin: 0;
}
.num.impact {
  animation: number-land 0.45s ease-out;
}
.stage.flash-win::after,
.stage.flash-jackpot::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid #d9b25c30;
  animation: flash-fade 0.8s ease-out forwards;
}
.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}
.confetti {
  position: absolute;
  width: 5px;
  height: 8px;
  border-radius: 2px;
}
.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.95fr) minmax(0, 1fr);
  gap: 30px;
  align-items: center;
  flex: 0 0 108px;
  background: #ffffff09;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 15px 22px;
}
.bet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.bet-display {
  font-size: 10px;
  color: #bebec6;
  font-variant-numeric: tabular-nums;
}
.custom-row {
  height: 45px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #ffffff18;
  border-radius: 8px;
  background: #09090a;
  padding: 3px;
}
.step-btn {
  width: 38px;
  align-self: stretch;
  flex-shrink: 0;
  border: 0;
  border-radius: 5px;
  background: #ffffff06;
  color: #aaaab4;
  font-size: 20px;
}
.step-btn:hover:not(:disabled) {
  background: #ffffff13;
  color: var(--text);
}
.input-currency {
  font-size: 14px;
  color: #666670;
  margin-left: 5px;
}
.custom-input {
  width: 100%;
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: 500 17px var(--ui);
  text-align: center;
  color: var(--text);
  padding: 3px;
  appearance: textfield;
  -moz-appearance: textfield;
}
.custom-input::-webkit-inner-spin-button,
.custom-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.quick-section > .mini-label {
  display: block;
  margin-bottom: 8px;
}
.chip-row {
  display: flex;
  gap: 7px;
}
.chip {
  flex: 1;
  min-width: 0;
  min-height: 45px;
  border: 1px solid #ffffff10;
  border-radius: 7px;
  color: #91919c;
  background: #ffffff06;
  font-size: 11px;
  font-weight: 500;
  padding: 5px;
}
.chip:hover:not(:disabled) {
  background: #ffffff09;
  border-color: #ffffff28;
  color: #dddde4;
}
.chip.active {
  color: var(--gold);
  border-color: #d9b25c50;
  background: #d9b25c0b;
}
.play-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
}
.play {
  width: 100%;
  min-height: 48px;
  letter-spacing: 1.8px;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid #e0bd72;
  border-radius: 9px;
  background: linear-gradient(130deg, #e1c482, #cfa44f);
  color: #19150c;
  box-shadow: 0 3px 14px #d9b25c12;
}
.play:hover:not(:disabled) {
  background: linear-gradient(130deg, #eed59b, #dfbb6b);
}
.play:active:not(:disabled) {
  transform: translateY(1px);
}
.keyboard-note {
  font-size: 8px;
  color: #7c7c85;
  margin: 0;
  min-height: 10px;
  text-align: center;
}
.error-banner {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 24px;
  max-width: min(90vw, 480px);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  background: #2b2225;
  border: 1px solid #966672;
  color: #ffe1e4;
  padding: 15px 21px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 12px 40px #0008;
}
.error-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
dialog {
  width: min(580px, calc(100vw - 32px));
  max-height: 85dvh;
  border: 1px solid #ffffff25;
  border-radius: 16px;
  padding: 24px;
  background: #141416;
  color: var(--text);
  box-shadow: 0 30px 90px #0008;
}
dialog::backdrop {
  background: #000b;
  backdrop-filter: blur(8px);
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.7px;
  color: var(--muted);
}
.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--stroke);
  border-radius: 7px;
  background: #1e1e22;
  color: #c1c1cb;
  font-size: 24px;
}
.icon-button:hover {
  background: #303035;
}
dialog h2 {
  font-family: var(--ui);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.7px;
  margin: 12px 0 25px;
}
.help-steps {
  list-style: none;
  counter-reset: steps;
  padding: 0;
  display: grid;
  gap: 20px;
}
.help-steps li {
  counter-increment: steps;
  position: relative;
  padding-left: 39px;
}
.help-steps li::before {
  content: counter(steps, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 2px;
  font: 14px var(--ui);
  color: var(--gold);
}
.help-steps strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.help-steps span {
  display: block;
  font-size: 11px;
  color: #a6a6b0;
  line-height: 1.8;
}
.payout-reference {
  margin-top: 25px;
}
.payout-reference h3 {
  font-size: 11px;
  font-weight: 500;
  color: #ccc;
}
.dialog-note {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
  margin: 20px 0 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
th {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  padding: 12px 10px;
  background: #ffffff03;
  border-top: 1px solid #ffffff0b;
  border-bottom: 1px solid #ffffff0b;
}
td {
  font-size: 11px;
  padding: 12px 10px;
  border-bottom: 1px solid #ffffff08;
  color: #bfbfc9;
}
th:last-child,
td:last-child {
  text-align: right;
}
@keyframes focus-bump {
  50% {
    transform: translateY(-2px);
  }
}
@keyframes result-rise {
  0% {
    transform: translateY(6px);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes number-land {
  30% {
    transform: scale(1.045);
  }
}
@keyframes flash-fade {
  to {
    opacity: 0;
  }
}
@keyframes status-pulse {
  50% {
    opacity: 0.35;
  }
}
@keyframes balance-credited {
  40% {
    color: #f5dc99;
    text-shadow: 0 0 14px #d9b25c77;
  }
}
@media (min-width: 1600px) {
  .app {
    padding-left: 36px;
    padding-right: 36px;
  }
  .num {
    font-size: clamp(160px, 24vh, 300px);
  }
  .stage {
    padding-left: 45px;
    padding-right: 45px;
  }
  .controls {
    gap: 48px;
    flex-basis: 120px;
    padding: 20px 32px;
  }
  .focus-value {
    font-size: clamp(68px, 8vh, 110px);
  }
  .ruler-wrap,
  .ruler {
    height: 120px;
  }
  .focus-row {
    flex-basis: 120px;
  }
  .numbers {
    padding-left: 7vw;
    padding-right: 7vw;
  }
}
@media (max-width: 1100px) {
  .app {
    padding-left: 16px;
    padding-right: 16px;
  }
  .controls {
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 0.95fr) minmax(0, 1fr);
    padding: 14px 16px;
  }
  .stage {
    padding-left: 15px;
    padding-right: 15px;
  }
  .num {
    font-size: clamp(80px, 18vh, 180px);
  }
  .numbers {
    padding-left: 0;
    padding-right: 0;
  }
  .picker-hint {
    font-size: 8px;
  }
  .focus-value {
    font-size: 52px;
  }
  .num-label {
    font-size: 10px;
  }
}
@media (max-width: 820px) {
  .controls {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.95fr) minmax(0, 1fr);
    gap: 16px;
  }
  .num {
    font-size: clamp(75px, 16vw, 150px);
  }
}
@media (max-width: 600px) {
  .app {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    padding: 0 12px calc(9px + env(safe-area-inset-bottom));
  }
  .game-shell {
    gap: 10px;
  }
  .stage {
    padding: 15px 2px 0;
    min-height: 390px;
    flex: 1;
  }
  .stage-top {
    flex-basis: 14px;
  }
  .stage-wordmark {
    font-size: 7px;
    letter-spacing: 1px;
  }
  .round-state {
    font-size: 8px;
  }
  .numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 14px;
    padding-top: 18px;
    flex: 1;
    min-height: 145px;
  }
  .num {
    font-size: clamp(52px, 18vw, 108px);
    letter-spacing: -0.09em;
    line-height: 1.2;
  }
  .num-label {
    font-size: 8px;
    letter-spacing: 1.2px;
  }
  .num-block {
    gap: 7px;
  }
  .focus-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-basis: 92px;
    margin: 0 0 12px;
  }
  .distance-label {
    position: static;
    transform: none;
    font-size: 8px;
    height: 11px;
  }
  .focus {
    gap: 10px;
  }
  .focus-label {
    font-size: 11px;
    letter-spacing: 1.2px;
  }
  .focus-value {
    font-size: clamp(34px, 9.5vw, 52px);
  }
  .picker-heading {
    margin: 0 43px;
    font-size: 6px;
    letter-spacing: 0.8px;
  }
  .picker-controls {
    gap: 4px;
  }
  .pick-step {
    width: 40px;
    height: 44px;
    font-size: 18px;
  }
  .ruler-wrap,
  .ruler {
    height: 82px;
  }
  .result-row {
    min-height: 31px;
    gap: 8px;
  }
  .mini-label {
    font-size: 8px;
  }
  .mult-block,
  .win-banner {
    min-width: 0;
    gap: 6px;
  }
  .mult,
  .win-amount {
    font-size: 10px;
  }
  .win-text {
    font-size: 7px;
  }
  .picker-hint {
    display: none;
  }
  .controls {
    grid-template-columns: 1fr 1fr;
    gap: 14px 14px;
    flex: 0 0 auto;
    padding: 14px;
    border-radius: 12px;
  }
  .bet-section {
    grid-column: 1;
    grid-row: 1;
  }
  .play-section {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-top: 0;
    align-self: end;
    gap: 0;
  }
  .play {
    min-height: 46px;
    font-size: 12px;
  }
  .keyboard-note {
    display: none;
  }
  .quick-section {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }
  .quick-section > .mini-label {
    display: none;
  }
  .chip {
    min-height: 40px;
    font-size: 10px;
  }
  .custom-row {
    height: 46px;
  }
  .step-btn {
    width: 33px;
  }
  .custom-input {
    font-size: 15px;
  }
  .input-currency {
    font-size: 11px;
    margin-left: 0;
  }
  dialog {
    padding: 20px;
  }
  .help-steps span {
    font-size: 11px;
  }
}
@media (max-height: 620px) and (min-width: 601px) {
  .app {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  .stage {
    min-height: 375px;
  }
  .num {
    font-size: 105px;
  }
  .controls {
    flex-basis: 96px;
  }
  .focus-row {
    flex-basis: 78px;
  }
  .ruler-wrap,
  .ruler {
    height: 82px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .confetti-layer {
    display: none;
  }
}
@media (max-width: 600px) {
  .controls {
    gap: 12px;
  }
  .play-section {
    width: 100%;
    max-width: 360px;
    justify-self: center;
  }
  .quick-section {
    min-width: 0;
  }
  .quick-section .chip-row {
    gap: 4px;
  }
  .quick-section .chip {
    font-size: 9px;
    padding: 3px;
    min-height: 46px;
  }
}

/* -- Top bar ----------------------------------------------------------------
   MoneyBall V8 / Crocodile layout (wordmark, rounds strip, wallet with +,
   menu) in Hundreder's charcoal, silver and gold. */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
  min-height: 66px;
  padding: 0 5px;
  border-bottom: 1px solid var(--stroke);
}
.brand {
  display: flex;
  align-items: center;
  flex: none;
}
.logo {
  font: 800 18px var(--display);
  letter-spacing: 0.14em;
  white-space: nowrap;
  background: linear-gradient(90deg, #9696a0, #fff 50%, #9696a0);
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
}

/* Previous rounds, newest first. */
.rounds {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 30px;
  margin-left: 8px;
  color: var(--faint);
}
.rounds-icon {
  width: 17px;
  height: 17px;
}
.rounds-list {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: -8px -8px -8px -6px;
  padding: 8px 8px 8px 6px;
  overflow: hidden;
  list-style: none;
}
.rounds.overflow .rounds-list {
  -webkit-mask: linear-gradient(90deg, #000 calc(100% - 52px), transparent calc(100% - 8px));
  mask: linear-gradient(90deg, #000 calc(100% - 52px), transparent calc(100% - 8px));
}
.rounds-empty {
  display: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.rounds.empty .rounds-empty {
  display: block;
}
.rounds.empty .rounds-list {
  display: none;
}
.round-chip {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 58px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid #ffffff14;
  border-radius: 999px;
  background: var(--surface);
  color: #b7b7c1;
  font: 600 12px var(--ui);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.round-times {
  margin-left: 0.06em;
  font-size: 0.86em;
  opacity: 0.75;
}
.round-chip.won {
  border-color: #d9b25c33;
  color: #d8cdb2;
}
.round-chip.won.tier-1 {
  border-color: #d9b25c66;
  background: #d9b25c12;
  color: var(--gold-light);
}
.round-chip.won.tier-2 {
  border-color: var(--gold);
  background: linear-gradient(180deg, #d9b25c2e, #d9b25c14);
  box-shadow: 0 0 12px #d9b25c33;
  color: #f6e3b4;
}
.round-chip.won.tier-3 {
  border-color: var(--gold-light);
  background: linear-gradient(180deg, #edcf8c, #b88f3a);
  box-shadow: 0 0 14px #d9b25c66;
  color: var(--bg);
}
.round-chip.lost {
  color: #8a8a93;
}
.round-chip.is-new {
  animation: chip-pop 0.46s cubic-bezier(0.3, 0.7, 0.4, 1.4);
}
@keyframes chip-pop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  60% {
    transform: scale(1.14);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

/* Wallet, top-up and menu. */
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.wallet {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
}
.wallet .icon {
  width: 22px;
  height: 22px;
}
.balance {
  font: 600 18px var(--display);
  letter-spacing: -0.7px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.balance.credited {
  animation: balance-credited 0.6s ease-out;
}
.add-button,
.menu-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 8px;
}
.add-button {
  border: 1px solid #edcf8c80;
  background: linear-gradient(#e6c472, #c29a45);
  box-shadow: 0 0 14px #d9b25c33, inset 0 1px 0 #ffffff55;
  color: var(--bg);
}
.add-button .icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.4;
}
.add-button:hover:not(:disabled) {
  background: linear-gradient(#f0d488, #cfa652);
}
.add-button:disabled {
  opacity: 0.35;
  box-shadow: none;
}
.menu-toggle {
  margin-left: 6px;
  border: 1px solid transparent;
  background: none;
  color: #e3e3e8;
}
.menu-toggle:hover {
  background: #ffffff0a;
  border-color: #ffffff17;
}
.menu-toggle[aria-expanded="true"] {
  border-color: #d9b25c80;
  background: #d9b25c14;
  box-shadow: 0 0 14px #d9b25c33;
  color: var(--gold-light);
}
.menu-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.menu-icon .bar {
  transform-box: view-box;
  transform-origin: 12px 12px;
  transition:
    transform 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.2),
    opacity 0.2s;
}
.menu-toggle[aria-expanded="true"] .bar-top {
  transform: translateY(5px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .bar-mid {
  opacity: 0;
  transform: scaleX(0.2);
}
.menu-toggle[aria-expanded="true"] .bar-bottom {
  transform: translateY(-5px) rotate(-45deg);
}

.menu {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  width: 256px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 72px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #ffffff1c;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 100% 0, #d9b25c17, transparent 62%),
    #111113;
  box-shadow:
    0 24px 60px -12px #000000e6,
    0 0 0 1px #00000073;
  transform-origin: top right;
}
.menu::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #edcf8cb3, transparent);
  pointer-events: none;
}
.menu.is-open {
  animation: menu-pop 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes menu-pop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
  }
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: #d6d6dd;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}
.menu-item .icon {
  width: 19px;
  height: 19px;
  color: var(--muted);
  transition: color 0.15s;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: #ffffff0a;
  color: #fff;
}
.menu-item:focus-visible {
  outline-offset: -2px;
}
.menu-item:hover .icon,
.menu-item:focus-visible .icon,
.menu-item[aria-pressed="true"] .icon {
  color: var(--gold);
}
.menu-label {
  flex: 1;
  white-space: nowrap;
}
.menu-tag {
  flex: none;
  padding: 4px 8px;
  border: 1px solid #d9b25c59;
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
}
.menu-tag strong {
  color: var(--gold);
  font-weight: 700;
}
.menu-rule {
  display: block;
  height: 1px;
  margin: 5px 10px;
  background: var(--stroke);
}
.switch {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border: 1px solid #ffffff24;
  border-radius: 999px;
  background: #0a0a0b;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.switch > span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6f6f78;
  transition:
    transform 0.24s cubic-bezier(0.3, 0.7, 0.4, 1.35),
    background 0.2s;
}
.menu-item[aria-pressed="true"] .switch {
  border-color: var(--gold);
  background: #a8843a;
}
.menu-item[aria-pressed="true"] .switch > span {
  transform: translateX(14px);
  background: #fff;
}
.sound-off {
  display: none;
}
.sound-toggle[aria-pressed="false"] .sound-waves {
  display: none;
}
.sound-toggle[aria-pressed="false"] .sound-off {
  display: inline;
}
.menu-volume {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 8px 43px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
#sound-volume {
  flex: 1;
  min-width: 0;
  height: 22px;
  margin: 0;
  accent-color: var(--gold);
  cursor: pointer;
}
#sound-value {
  width: 30px;
  text-align: right;
}

/* Tablets: rounds take their own row under the brand and wallet. */
@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 8px 2px;
  }
  .rounds {
    order: 1;
    flex: 1 0 100%;
    height: 26px;
    margin-left: 0;
    gap: 8px;
  }
  .round-chip {
    min-width: 52px;
    height: 24px;
    padding: 0 9px;
    font-size: 11px;
  }
}
@media (max-width: 600px) {
  .topbar {
    gap: 8px;
    padding: 6px 0;
  }
  .logo {
    font-size: 14px;
    letter-spacing: 0.1em;
  }
  .topbar-tools {
    gap: 6px;
  }
  .wallet {
    gap: 6px;
  }
  .wallet .icon {
    width: 18px;
    height: 18px;
  }
  .balance {
    font-size: 15px;
  }
  .add-button,
  .menu-toggle {
    width: 34px;
    height: 34px;
  }
  .menu-toggle {
    margin-left: 2px;
  }
  .add-button .icon {
    width: 17px;
    height: 17px;
  }
  .menu {
    width: 240px;
  }
}
@media (max-width: 360px) {
  .logo {
    font-size: 12px;
  }
  .wallet .icon {
    display: none;
  }
}
@media (max-height: 620px) and (min-width: 901px) {
  .topbar {
    min-height: 48px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .round-chip.is-new,
  .menu.is-open {
    animation: none;
  }
}
