/* Visual port of site/: the live controls and application state remain unchanged. */
:root {
  --color-bg: #050403;
  --color-bg-elevated: #15120b;
  --color-surface-0: #0b0a06;
  --color-surface-1: #111008;
  --color-surface-2: #221b0d;
  --color-surface-3: #302719;
  --color-border: #3e3522;
  --color-border-strong: #665539;
  --color-border-gold: #b3955955;
  --text-primary: #f3efdf;
  --text-secondary: #c7c2b4;
  --text-muted: #aaa698;
  --text-accent: #f6cd66;
  --text-heading-gold: #f3d985;
  --text-on-gold: #211603;
  --gold-400: #f6cd66;
  --gold-500: #d99b26;
  --font-display: var(--font-body);
  --radius-md: 12px;
  --radius-lg: 16px;
  --gradient-gold: linear-gradient(180deg, #ffe9a2 0%, #f8cf65 40%, #d99b26 100%);
  --gradient-gold-pressed: linear-gradient(180deg, #e8ca80, #d99b26);
  --background-tabbar: #080704f5;
  --background-active: #38290f;
  --background-secondary: #171106;
  --control-fill: #100c06;
  --control-fill-hover: #241a0a;
  --control-fill-selected: #38290f;
  --control-fill-disabled: #0b0804;
  --background-featured: linear-gradient(120deg, #1d1b1066, #080704e6 55%);
  --design-border: #78613b;
  --design-gold-edge: #ffdf91;
  --design-panel-gradient: linear-gradient(135deg, #31250f44, #0d0b05dd 65%);
  --design-shell: 420px;
  --design-gold-shadow: inset 0 1px 2px #fff2bd, 0 4px 18px #d49a2d24;
  --shadow-gold-btn: var(--design-gold-shadow);
  --glow-gold: inset 0 1px 1px #f4d58920, 0 5px 15px #0005;
  font-size: 14px;
}

/* Keep WebView rubber-banding off the document and its fixed navigation. */
html { height: 100%; overflow: hidden; overscroll-behavior-y: none; background: var(--color-bg); }
body { height: 100%; overflow: hidden; overscroll-behavior-y: none; background: transparent; }
body::before {
  max-width: 480px;
  margin-inline: auto;
  background: linear-gradient(#05040314, #05040350), url('/static/art/background.png') center top / cover no-repeat;
}
h1, h2, h3 { font-family: var(--font-body); letter-spacing: 0; }
h2 { font-size: 25px; line-height: 1.25; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, a, summary { touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold-200);
  outline-offset: 3px;
}
.icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  vertical-align: middle;
}
.muted { font-size: 12px; line-height: 1.65; }
.app {
  position: fixed;
  inset: 0;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: none;
  width: 100%;
  max-width: var(--design-shell);
  margin-inline: auto;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.home-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  --footer-safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--pvp-safe-bottom, 0px));
  --footer-clearance: calc(71px + var(--footer-safe-bottom));
}
/* Only the content scrolls; the footer is not part of this scroll surface. */
.home-view > main {
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: none;
  padding-bottom: calc(var(--footer-height, var(--footer-clearance)) + 12px);
}

.balance-card {
  margin-bottom: 16px;
  padding: 9px 10px;
  border-color: var(--design-border);
  border-radius: 15px;
  background: var(--background-featured);
  box-shadow: var(--glow-gold);
}
.balance-summary { gap: 8px; }
.balance-controls { gap: 8px; }
.avatar-trigger { min-width: 44px; min-height: 44px; }
.balance-card .avatar { width: 34px; height: 34px; font-size: 17px; background: linear-gradient(135deg, #69643d, #2d2918); color: var(--gold-100); border: 1px solid var(--color-border-gold); }
.balance-trigger { flex: 0 1 auto; width: fit-content; max-width: 100%; margin-inline-start: auto; min-height: 44px; padding: 0; gap: 4px; }
.balance-trigger .balance { font-size: clamp(18px, 5.5vw, 24px); line-height: 1.3; font-weight: 800; color: #f0e7b1; }
.balance-trigger .currency { font-size: 14px; color: var(--text-primary); }
.balance-trigger .dropdown-chevron { width: 14px; height: 14px; }
.balance-card .balance-topup { flex-basis: 44px; width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 27px; border-radius: 10px; }
.dropdown.avatar-dropdown { position: static; }
.dropdown-menu { z-index: 50; background: var(--color-bg-elevated); border-color: var(--design-border); box-shadow: 0 12px 32px #000b; }
.avatar-dropdown .avatar-menu { width: min(240px, calc(100vw - 56px)); inset-inline-start: 0; inset-inline-end: auto; }
.dropdown-heading { font-size: 12px; }
.dropdown-option { min-height: 56px; }
.avatar-menu .dropdown-option { min-height: 44px; }
.coin-badge { background: var(--background-active); }
.account-status { margin-bottom: 10px; }
.panel { margin: 20px 0; padding: 0; border: 0; border-radius: 0; min-height: 0; background: transparent; box-shadow: none; }
.section-heading { gap: 12px; margin-bottom: 16px; }
.section-heading > h2 { min-width: 0; }
.section-heading > button { flex-shrink: 0; }
.promo-banner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 110px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #977746;
  border-radius: 15px;
  background: var(--color-bg) center / cover no-repeat;
  box-shadow: inset 0 0 16px #d5a6400b;
}
.promo-banner strong { width: 62%; font-size: 22px; line-height: 1.2; font-weight: 800; color: #f6dc91; text-shadow: 0 2px 6px #000; }
.promo-banner > span { font-size: 12px; color: #dbbc71; letter-spacing: .08em; }
.gift-banner { background-image: linear-gradient(90deg, #07060355, transparent), url('/static/art/gift.png'); }
.compact-banner { min-height: 100px; }
.compact-banner strong { font-size: 18px; line-height: 1.4; }
.commission-section > p { margin-bottom: 12px; font-size: 13px; }
.commissions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.commissions > div { padding: 16px 4px; border: 1px solid #8b6b37; border-radius: 13px; background: linear-gradient(135deg, #79521a20, #130d05); text-align: center; box-shadow: inset 0 1px 1px #eac88218; }
.commissions span { font-size: 12px; color: var(--text-secondary); }
.commissions strong { display: block; margin-top: 6px; color: var(--text-heading-gold); font-size: 27px; line-height: 1.2; }
.referral-banner { background-image: linear-gradient(90deg, #07060366, transparent), url('/static/art/referrals.png'); }
.game-title { margin-bottom: 12px; font-size: 16px; color: var(--text-primary); text-align: start; }
.game-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 12px;
  border: 1px solid #655333;
  border-radius: 15px;
  background: linear-gradient(140deg, #211a0b38, #0706039c);
}
.game-prize { padding: 0 0 4px; margin: 0; border: 0; background: transparent; text-align: center; }
.game-prize .muted { color: var(--text-secondary); font-size: 12px; }
.game-prize output { font-family: var(--font-body); font-size: 32px; line-height: 1.3; font-weight: 800; color: #f3d687; text-shadow: 0 2px 12px #c68a2140; }
.game-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.game-field { gap: 9px; min-width: 0; }
.game-field label { font-size: 12px; color: var(--text-secondary); }
.game-row .ton-input { min-width: 0; min-height: 49px; padding: 0 10px; border: 1px solid #5c5039; border-radius: 10px; background: #060603; box-shadow: inset 0 1px 6px #0009; }
.ton-input input { min-width: 0; min-height: 46px; padding: 0; background: transparent; border: 0; box-shadow: none; font-size: 22px; font-weight: 600; }
.ton-input span { font-size: 12px; }
.game-adjustments { gap: 6px; }
.game-adjustments button { min-height: 44px; padding: 6px 3px; border: 1px solid #6d5b3c; border-radius: 9px; background: linear-gradient(#1b170d88, #050403); color: var(--text-secondary); font-size: 12px; box-shadow: inset 0 1px 1px #fff1; }
.payment-check, .wallet-actions .primary, .balance-topup.primary, .payment-actions .primary {
  border: 1px solid var(--design-gold-edge);
  border-radius: 12px;
  background: var(--gradient-gold) border-box no-repeat;
  color: var(--text-on-gold);
  box-shadow: var(--design-gold-shadow);
  font-weight: 800;
}
.payment-close { min-height: 44px; padding: 10px 13px; border: 1px solid #675538; border-radius: 10px; background: linear-gradient(#19150b80, #080704); color: var(--text-primary); font-size: 12px; font-weight: 600; box-shadow: none; }
.game-play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  margin: 0;
  padding: 12px;
  font-size: 22px;
  box-shadow: 0 0 25px #e4aa3848, inset 0 1px 3px #fff6d8;
}
.game-play::before { content: ''; width: 28px; height: 28px; flex: 0 0 auto; background: currentColor; mask: url('/static/dice.svg') center / contain no-repeat; }
:is(#panel-game, #axm-game-section)[data-game-state="playing"] .game-play[aria-busy="true"]::before { mask: none; background: transparent; }
.asset-workspace { padding: 16px; border-color: var(--design-border); background: var(--color-surface-0); }
.asset-workspace > h2 { font-size: 16px; }
.asset-workspace h3 { color: var(--text-heading-gold); font-size: 15px; }

.game-history { margin: 18px 0 0; padding: 14px 12px; border: 1px solid #4a3b22; border-radius: 15px; background: linear-gradient(135deg, #2b220d55, #080704); }
.game-history h2 { font-size: 16px; color: #e7d3a0; }
.game-history-table { font-size: 12px; }
.game-history-table th { font-size: 11px; color: var(--text-muted); font-weight: 500; padding: 8px 3px; }
.game-history-table td { padding: 10px 3px; border-color: #30291a; }
.game-history-table td:last-child { min-width: 88px; }
.game-history-table th:last-child, .game-history-table td:last-child { text-align: end; }
.game-history-scroll { border: 0; }
.payment-field { gap: 8px; }
.payment-field label { font-size: 13px; color: var(--text-secondary); }
.payment-field input, .payment-field select, .asset-workspace input, .asset-workspace select {
  min-height: 46px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 11px;
  border: 1px solid var(--color-border-strong);
  border-radius: 11px;
  background: #090804;
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
}
.payment-field [aria-invalid="true"], .asset-workspace [aria-invalid="true"] { border-color: var(--danger-text); }
.payment-error { font-size: 12px; }
.payment-result { font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.footer {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  width: 100%;
  max-width: var(--design-shell);
  z-index: 30;
  margin: 0 auto;
  padding: 7px max(6px, env(safe-area-inset-right, 0px)) max(7px, var(--footer-safe-bottom)) max(6px, env(safe-area-inset-left, 0px));
  border: 1px solid #453923;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--background-tabbar);
  box-shadow: 0 -4px 20px #0008;
  backdrop-filter: blur(16px);
}
.footer .tabs { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.footer .tabs button { min-height: 56px; min-width: 0; padding: 6px 2px; gap: 5px; border-radius: 12px; color: #c7c0ac; font-size: 10px; font-weight: 500; line-height: 1.3; background: transparent; box-shadow: none; }
.footer .tabs button[aria-selected="true"] { color: #f6d478; background: linear-gradient(140deg, #70511e66, #241b09aa); box-shadow: inset 0 1px 1px #ddaf4c24; }
.footer .tab-icon { width: 21px; height: 21px; stroke-width: 1.5; }
.footer [aria-selected="true"] .tab-icon { filter: drop-shadow(0 0 4px #f6cc5540); }
.tournament-tab-icon { position: relative; display: inline-flex; width: 21px; height: 21px; }
.tournament-active-indicator {
  position: absolute;
  top: -3px;
  inset-inline-end: -4px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--color-bg);
  border-radius: 50%;
  background: var(--gold-400);
}

.auth-state { max-width: var(--design-shell); margin-inline: auto; padding: 20px 22px 32px; gap: 14px; background: var(--color-bg); }
.welcome-art { width: calc(100% + 44px); max-height: 58dvh; overflow: hidden; margin: -20px -22px 0; }
.welcome-art img { display: block; width: 100%; max-height: 58dvh; object-fit: contain; mask-image: linear-gradient(#000 88%, transparent); }
.welcome-tagline { color: var(--text-heading-gold) !important; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.auth-state #status { font-size: 13px; }

/* Opaque selection surfaces keep native and custom controls on the same theme. */
::selection { background: var(--gold-400); color: var(--text-on-gold); }
select, .payment-field select, .asset-workspace select, .currency-payment-page select {
  appearance: none;
  background-color: var(--control-fill);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-accent) 50%), linear-gradient(135deg, var(--text-accent) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-inline-end: 36px;
  color: var(--text-primary);
}
select option, select optgroup { background: var(--control-fill); color: var(--text-primary); }
select option:checked { background: var(--gold-400); color: var(--text-on-gold); }
select option:hover, select option:focus { background: var(--control-fill-hover); color: var(--text-primary); }
.dropdown-option { background: var(--control-fill); }
.dropdown-option:hover:not(:disabled), .dropdown-option:focus-visible { background: var(--control-fill-hover); }
.dropdown-option[aria-checked="true"], .dropdown-option[aria-selected="true"] {
  background: var(--control-fill-selected);
  color: var(--text-accent);
  border-color: var(--design-border);
}
.tabs button { background: var(--control-fill); }
.tabs button:hover:not(:disabled) { background: var(--control-fill-hover); }
.tabs button[aria-selected="true"], .footer .tabs button[aria-selected="true"] {
  background: var(--control-fill-selected);
  color: var(--text-accent);
}
.game-adjustments button:not(:disabled) { background: var(--control-fill); }
.game-adjustments button:hover:not(:disabled), .game-adjustments button:active:not(:disabled) { background: var(--control-fill-hover); }
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  vertical-align: middle;
  border: 1px solid var(--color-border-strong);
  border-radius: 5px;
  background: var(--control-fill);
  accent-color: var(--gold-400);
  cursor: pointer;
}
input[type="radio"] { border-radius: var(--radius-round); }
input[type="checkbox"]:checked, input[type="checkbox"]:indeterminate, input[type="radio"]:checked {
  background: var(--gold-400);
  border-color: var(--gold-400);
}
input[type="checkbox"]:checked::before {
  content: "";
  width: 10px;
  height: 6px;
  margin-top: -3px;
  border: solid var(--text-on-gold);
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}
input[type="checkbox"]:indeterminate::before { content: ""; width: 10px; height: 2px; background: var(--text-on-gold); }
input[type="radio"]:checked::before { content: ""; width: 8px; height: 8px; border-radius: var(--radius-round); background: var(--text-on-gold); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled, select:disabled, .dropdown-option:disabled {
  background: var(--control-fill-disabled);
  border-color: var(--color-border);
  color: var(--text-muted);
  cursor: not-allowed;
}
input[type="checkbox"]:disabled::before, input[type="radio"]:disabled::before { border-color: var(--text-muted); }
input[type="radio"]:disabled:checked::before, input[type="checkbox"]:disabled:indeterminate::before { background: var(--text-muted); }
input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--control-fill) inset;
  -webkit-text-fill-color: var(--text-primary);
  caret-color: var(--gold-400);
}

@media (min-width: 700px) {
  .app { border-inline: 1px solid #40311b; box-shadow: 0 0 100px #a56a0a0b; }
  body::before { max-width: var(--design-shell); }
}
@media (max-width: 360px) {
  .app { padding-inline: max(12px, env(safe-area-inset-left)); }

  .balance-card { padding: 8px; }
  .balance-summary, .balance-controls { gap: 6px; }
  .balance-trigger .balance { font-size: 18px; }
  .balance-trigger .currency { font-size: 12px; }
  .promo-banner { min-height: 100px; padding: 15px; }
  .promo-banner strong { font-size: 19px; }
  .compact-banner strong { font-size: 16px; }
  .game-content { padding: 14px 10px; }
  .game-row { gap: 8px; }
  .game-adjustments button { font-size: 11px; }
  .game-prize output { font-size: 28px; }
  .footer .tabs button { padding-inline: 1px; }
}
@media (hover: hover) {
  .payment-check:hover:not(:disabled), .primary:hover:not(:disabled) { filter: brightness(1.05); }
  .payment-close:hover:not(:disabled) { border-color: var(--design-border); background-color: var(--color-surface-2); }
}
@media (forced-colors: active) {
  input[type="checkbox"], input[type="radio"] { appearance: auto; }
  input[type="checkbox"]::before, input[type="radio"]::before { content: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
