﻿
/* Disable pinch-zoom across the whole app */
html, body { touch-action: pan-y; }
* { -webkit-touch-callout: none; }
input, textarea { touch-action: manipulation; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
/* No text cursor on PC */
body { user-select: none; -webkit-user-select: none; cursor: default; }
input, textarea, [contenteditable] { user-select: text; -webkit-user-select: text; cursor: text; }
/* Winora — design tokens & base styles */

@font-face {
  font-family: 'SFPro';
  src: url('/ach/fonts/SFProText-Semibold.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colors — dark theme (default) */
  --bg: #0A0A0B;
  --modal-backdrop: rgba(8, 10, 15, 0.85);
  --surface-1: #131418;
  --surface-2: #1C1E23;
  --surface-3: #262930;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text: #FFFFFF;
  --text-secondary: rgba(255,255,255,0.62);
  --text-tertiary: rgba(255,255,255,0.38);

  /* Accent */
  --accent: #C5F82A;
  --accent-press: #B0E021;
  --accent-ink: #0A0A0B;
  --gram: #0098EA;

  /* Semantic */
  --win: #6BE7A8;
  --lose: #FF5C5C;
  --warn: #FFB547;

  /* Card faces */
  --card-face: #FAFAF7;
  --card-face-ink: #0A0A0B;
  --card-back: #16171B;

  /* Shape */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 9999px;

  /* Type */
  --font-sans: 'SFPro', -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: 'SFPro', "SF Mono", "Menlo", "Consolas", monospace;
  --font-display: 'SFPro', -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --font-num: 'SFPro', -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --font-num-weight: 600;
}

[data-theme="light"] {
  --modal-backdrop: rgba(240, 242, 245, 0.85);
  /* Polished light palette with clear visual hierarchy */
  --bg: #F0F2F5;
  --surface-1: #FFFFFF;
  --surface-2: #F5F6FA;
  --surface-3: #E8EBF0;
  --border: rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.14);
  --text: #1A1D26;
  --text-secondary: rgba(26,29,38,0.60);
  --text-tertiary: rgba(26,29,38,0.38);

  /* Accent — vibrant green */
  --accent: #4CB050;
  --accent-press: #3E9A42;
  --accent-ink: #FFFFFF;
  --gram: #0077B8;

  /* Semantic */
  --win: #1A9E52;
  --lose: #DC3545;
  --warn: #D9820A;

  /* Cards */
  --card-face: #FFFFFF;
  --card-face-ink: #1A1D26;
  --card-back: #2A2F3A;

  color-scheme: light;
}

/* Light theme — depth & polish */
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .btn-primary { box-shadow: 0 2px 10px rgba(76,176,80,0.30); }
[data-theme="light"] .tabbar {
  background: transparent;
  border-top: none;
}
[data-theme="light"] .tabbar-home-circle {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
  color: #999;
}
[data-theme="light"] .tabbar-home-active .tabbar-home-circle {
  background: rgba(59,154,232,0.1);
  border-color: rgba(59,154,232,0.3);
  color: #3B9AE8;
}
[data-theme="light"] .tabbar-pill {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .tabbar-pill .tabbar-item {
  color: rgba(0,0,0,0.3);
}
[data-theme="light"] .tabbar-pill .tabbar-item svg { opacity: 0.5; }
[data-theme="light"] .tabbar-pill-active {
  color: #3B9AE8 !important;
}
[data-theme="light"] .tabbar-pill-active svg { opacity: 1 !important; }
[data-theme="light"] .tabbar-avatar-circle {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .tabbar-avatar-active .tabbar-avatar-circle {
  border-color: rgba(59,154,232,0.4);
  box-shadow: 0 0 0 2px rgba(59,154,232,0.2);
}
[data-theme="light"] input, [data-theme="light"] textarea {
  color: var(--text);
  background: var(--surface-1);
  border: 1.5px solid var(--border-strong);
}
[data-theme="light"] input.modal-amount-input, [data-theme="light"] textarea.modal-amount-input {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
[data-theme="light"] input:focus, [data-theme="light"] textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76,176,80,0.12);
}
[data-theme="light"] input.modal-amount-input:focus, [data-theme="light"] textarea.modal-amount-input:focus {
  border: none !important;
  box-shadow: none !important;
}
[data-theme="light"] button[style*="var(--surface-2)"] {
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
[data-theme="light"] .card-surface, [data-theme="light"] [class*="surface-1"] {
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);
}
[data-theme="light"] .screen { scrollbar-color: rgba(0,0,0,0.12) transparent; }
[data-theme="light"] [style*="modal"] {
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
}
[data-theme="dark"] .screen.wheel-screen {
  background: radial-gradient(ellipse 80% 60% at 50% 30%, #1A1F2A 0%, var(--bg) 70%);
}

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

html, body {
  margin: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

/* Mono numerals */
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; font-family: var(--font-num); font-weight: var(--font-num-weight, 700); letter-spacing: -0.02em; }

/* PC adaptation — stretch full width in Telegram desktop */
@media (min-width: 500px) {
  .tg-header { padding: 0 24px; }
  .section-header { padding: 0 24px; }
}

/* Hide scrollbars but allow scroll */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }

/* === The phone-app surface === */
.app {
  position: absolute;
  inset: 0;
  padding-top: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* On desktop — no Telegram header, no top padding */
@media (min-width: 600px) {
  .app { padding-top: 0; }
}

.app-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 100px;
}

/* === Telegram-ish header (top safe area uses iOS status bar) === */
.tg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 8px;
  position: sticky;
  top: 0;
  z-index: 5;
  transition: background 0.25s ease, backdrop-filter 0.25s ease, box-shadow 0.25s ease;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.tg-header--scrolled {
  background: rgba(19, 20, 24, 0.82);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: 0 1px 0 var(--border);
}
[data-theme="light"] .tg-header--scrolled {
  background: rgba(255, 255, 255, 0.82);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}

.tg-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 17px;
  color: var(--accent);
  font-weight: 400;
}

.tg-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.tg-action {
  font-size: 17px;
  color: var(--accent);
  font-weight: 400;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.2px;
  border-radius: var(--r-pill);
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:active { background: var(--accent-press); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-lg { height: 56px; padding: 0 28px; font-size: 17px; }
.btn-md { height: 44px; padding: 0 22px; font-size: 14px; }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }

/* === Card (UI surface) === */
.card {
  background: var(--surface-1);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

.list {
  background: var(--surface-1);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 0 16px;
  position: relative;
}
.list-row + .list-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 56px;
  right: 0;
  height: 1px;
  background: var(--border);
}
.list-row-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.list-row-title { flex: 1; font-size: 16px; letter-spacing: -0.2px; }
.list-row-detail { color: var(--text-secondary); font-size: 15px; }

/* === Section header (Telegram style) === */
.section-header {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 16px 16px 6px;
  letter-spacing: 0.2px;
  text-align: center;
}

/* === Pill / chip === */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.chip-accent { background: rgba(197,248,42,0.14); color: var(--accent); }
.chip-gram { background: rgba(0,152,234,0.14); color: var(--gram); }

/* === Tab bar === */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  pointer-events: none;
  padding: 16px 16px 8px;
  background: transparent;
  border-radius: 0;
  border-top: none;
}
.tabbar-row {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
}
.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  padding: 0;
  position: relative;
}
.tabbar-home-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: grid;
  place-items: center;
  color: #8a8a8a;
}
.tabbar-home-active .tabbar-home-circle {
  background: rgba(59,154,232,0.18);
  border-color: rgba(59,154,232,0.4);
  color: #3B9AE8;
}
.tabbar-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 30px;
  padding: 16px 8px;
  height: 64px;
  box-sizing: border-box;
}
.tabbar-pill .tabbar-item {
  flex: 1;
  color: rgba(255,255,255,0.35);
}
.tabbar-pill .tabbar-item svg { opacity: 0.55; }
.tabbar-pill-active {
  color: #fff !important;
}
.tabbar-pill-active svg { opacity: 1 !important; }
.tabbar-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}
.tabbar-avatar-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-sizing: border-box;
}
.tabbar-avatar-circle > * {
  border-radius: 50%;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
}
.tabbar-avatar-active .tabbar-avatar-circle {
  border-color: rgba(59,154,232,0.4);
  box-shadow: 0 0 0 2px rgba(59,154,232,0.25);
}
.tabbar-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  padding: 0 3px;
  background: var(--lose);
  color: white;
  font-size: 8px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.tabbar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
}
  top: -2px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  padding: 0 3px;
  background: var(--lose);
  color: white;
  font-size: 8px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.tabbar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
}

/* === Animations === */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes flipIn {
  0% { transform: rotateY(180deg) translateY(-200px) translateX(40px); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: rotateY(0deg) translateY(0) translateX(0); opacity: 1; }
}
/* Deal from deck — cards fly in from center */
@keyframes deckPulse {
  0%, 100% { filter: brightness(1) drop-shadow(0 0 0px transparent); }
  50% { filter: brightness(1.15) drop-shadow(0 0 12px rgba(197,248,42,0.25)); }
}
@keyframes dealFromBottom {
  0% { transform: translateY(280px) scale(0.5) rotate(15deg); opacity: 0; }
  25% { opacity: 0.7; }
  100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes dealFromTop {
  0% { transform: translateY(-260px) scale(0.5) rotate(-15deg); opacity: 0; }
  25% { opacity: 0.7; }
  100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes dealFromRight {
  0% { transform: translateX(180px) translateY(0) scale(0.35) rotate(12deg); opacity: 0; }
  30% { opacity: 0.8; }
  100% { transform: translateX(0) translateY(0) scale(1) rotate(0deg); opacity: 1; }
}
/* Cards fly from deck (right-center) to dealer (top) */
@keyframes dealDeckToDealer {
  0% { transform: translateX(120px) translateY(140px) scale(0.35) rotate(10deg); opacity: 0; }
  25% { opacity: 0.7; }
  100% { transform: translateX(0) translateY(0) scale(1) rotate(0deg); opacity: 1; }
}
/* Cards fly from deck (right-center) to player (bottom) */
@keyframes dealDeckToPlayer {
  0% { transform: translateX(120px) translateY(-120px) scale(0.35) rotate(-8deg); opacity: 0; }
  25% { opacity: 0.7; }
  100% { transform: translateX(0) translateY(0) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes dealFromLeft {
  0% { transform: translateX(-140px) translateY(80px) scale(0.4) rotate(-18deg); opacity: 0; }
  25% { opacity: 0.7; }
  100% { transform: translateX(0) translateY(0) scale(1) rotate(0deg); opacity: 1; }
}
/* Flip a card face-up (baccarat) */
@keyframes cardFlip {
  0% { transform: rotateY(90deg) scale(0.8); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}
/* Deal card into baccarat hand — fly from deck on right */
@keyframes dealDeckBacPlayer {
  0% { transform: translateX(160px) translateY(80px) scale(0.35) rotate(10deg); opacity: 0; }
  25% { opacity: 0.7; }
  100% { transform: translateX(0) translateY(0) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes dealDeckBacBanker {
  0% { transform: translateX(100px) translateY(80px) scale(0.35) rotate(10deg); opacity: 0; }
  25% { opacity: 0.7; }
  100% { transform: translateX(0) translateY(0) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes sliceIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes wheelIdle {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes slideIn {
  from { transform: translateX(8%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes sliceIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 0.9; transform: scale(1); }
}

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

@keyframes playerRowIn {
  0% { opacity: 0; transform: translateX(-12px) scale(0.95); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes betPop {
  0% { opacity: 0; transform: scale(0.7) translateY(4px); }
  50% { opacity: 1; transform: scale(1.15) translateY(-1px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* === Logo (placeholder lockup) === */
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
}
.wordmark .dot {
  display: inline-block;
  width: 0.18em;
  height: 0.18em;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 0.08em;
  vertical-align: 0.18em;
}

/* === Numbers display === */
.balance-num {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

/* Screen page — instantly visible (no fade-in to avoid flicker on re-renders) */
.screen {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
}

/* iPhone-specific banner fix */
@supports (-webkit-touch-callout: none) {
  .game-card-btn {
    width: calc(100% - 10px) !important;
    margin: 0 auto;
  }
}

/* ── Responsive / PC adaptation ────────────────────────────────── */

/* On non-Telegram (PC/desktop preview) — limit app width, center everything */
.app {
  width: 100%;
  margin: 0 auto;
}

/* Prevent text overflow in top bars everywhere */
.tg-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

/* Chip never overflows */
.chip {
  max-width: 140px;
  overflow: hidden;
}

/* tabular numbers in chips don't wrap */
.chip .tabular, .chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  max-width: 90px;
  vertical-align: middle;
}

/* Responsive font sizes for very small screens (< 360px) */
@media (max-width: 360px) {
  .btn-lg { height: 50px; font-size: 15px; }
  .btn-md { height: 40px; font-size: 13px; }
  .tabbar-label { font-size: 9px; }
  .tabbar-home-circle { width: 48px; height: 48px; }
  .tabbar-avatar-circle { width: 48px; height: 48px; }
  .tabbar-pill { padding: 10px 6px; height: 48px; }
  .tg-title { font-size: 15px; }
}

/* Safe area insets for iPhone notch / Dynamic Island */
@supports (padding-top: env(safe-area-inset-top)) {
  .tg-header {
    padding-top: max(6px, env(safe-area-inset-top));
  }
  .tabbar {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .app {
    padding-top: 0;
  }
}

/* ─── PC / wide screen adaptation ─────────────────────────── */
.desktop-close { display: none; }
@media (min-width: 600px) {
  body { background: #0A0A0B; overflow: hidden; }
  #root { width: 100%; height: 100vh; }
  .app { position: fixed !important; left: 50% !important; top: 0 !important; right: auto !important; bottom: auto !important; transform: translateX(-50%); max-width: 430px; width: 100%; height: 100%; }
  .tabbar { max-width: 430px; left: 50%; transform: translateX(-50%); padding: 16px 20px 10px; }
  .tabbar-pill { padding: 16px 12px; height: 60px; gap: 6px; border-radius: 26px; }
  .tabbar-label { font-size: 11px; }
  .tabbar-home-circle { width: 60px; height: 60px; }
  .tabbar-avatar-circle { width: 60px; height: 60px; }
  .screen { padding-left: 16px; padding-right: 16px; }
  .section-header { padding-left: 16px; padding-right: 16px; }
  .desktop-close { display: flex !important; }
}
@media (min-width: 900px) {
  .tabbar { max-width: 430px; left: 50%; transform: translateX(-50%); }
}
