:root {
  --bg-main: #07090e;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-border: rgba(99, 102, 241, 0.2);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  user-select: none;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.18) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.12) 0%, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 75px;
  overflow-x: hidden;
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 16px;
}

/* Header */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.brand-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}
.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.balance-container {
  display: flex;
  align-items: center;
  gap: 6px;
}
.balance-pill {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 6px 12px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
}
.btn-top-deposit {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
  transition: transform 0.1s ease;
}
.btn-top-deposit:active {
  transform: scale(0.95);
}

/* 3D KUB SECTION */
.cube-section {
  position: relative;
  height: 135px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 700px;
  margin-bottom: 4px;
}
.cube-viewport {
  width: 74px;
  height: 74px;
  transform-style: preserve-3d;
  animation: rotateCube 18s infinite linear;
  cursor: grab;
}
@keyframes rotateCube {
  0% { transform: rotateX(-20deg) rotateY(0deg); }
  100% { transform: rotateX(-20deg) rotateY(360deg); }
}
.cube-face {
  position: absolute;
  width: 74px;
  height: 74px;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid var(--accent-indigo);
  box-shadow: inset 0 0 14px rgba(99, 102, 241, 0.35), 0 0 12px rgba(6, 182, 212, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}
.cube-face .face-icon {
  font-size: 20px;
  margin-bottom: 2px;
}
.cube-face .face-text {
  font-size: 10px;
  color: var(--accent-cyan);
  text-shadow: 0 0 6px var(--accent-cyan);
}
.cube-face.front  { transform: translateZ(37px); }
.cube-face.back   { transform: rotateY(180deg) translateZ(37px); }
.cube-face.right  { transform: rotateY(90deg) translateZ(37px); }
.cube-face.left   { transform: rotateY(-90deg) translateZ(37px); }
.cube-face.top    { transform: rotateX(90deg) translateZ(37px); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(37px); }

.cube-halo {
  position: absolute;
  width: 90px;
  height: 14px;
  bottom: 16px;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.6) 0%, transparent 70%);
  filter: blur(6px);
}
.cube-status-caption {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* Room Switcher Tabs */
.rooms-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.room-tab {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.room-tab.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.15));
  border-color: var(--accent-indigo);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}
.room-tab .tab-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.tab-name {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}
.tab-price {
  font-size: 11px;
  color: var(--text-muted);
}
.tab-payout {
  font-size: 11px;
  font-weight: 700;
  color: #34d399;
}

/* Queue Live Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(12px);
}
.card-header-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cycle-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Progress Bar */
.progress-container {
  margin-bottom: 12px;
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: 9999px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* Queue Info Grid */
.queue-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}
.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.stat-val {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

/* Action Button */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  color: #fff;
  border: none;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
  transition: transform 0.1s ease, filter 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:active {
  transform: scale(0.98);
  filter: brightness(1.15);
}

/* Turbo Loop Switch */
.reinvest-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}
.reinvest-text strong {
  display: block;
  font-size: 12px;
  color: #e9d5ff;
}
.reinvest-text span {
  font-size: 10px;
  color: #c084fc;
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* Ticket List in TMA */
.ticket-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ticket-num {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.ticket-room {
  font-size: 10px;
  color: var(--text-muted);
}
.ticket-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}
.badge-waiting { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-paid { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-reinvested { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #07090e;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.2s ease;
}
.nav-item.active {
  color: var(--accent-cyan);
}
.nav-icon {
  font-size: 18px;
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-indigo);
  color: #fff;
  padding: 10px 18px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
}

/* Modal Sheet */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-sheet {
  background: #0f172a;
  border: 1px solid var(--accent-indigo);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 18px 40px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}
.modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.deposit-methods-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.method-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}
.method-card.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-indigo);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}
.method-icon {
  font-size: 20px;
  margin-bottom: 4px;
}
.method-title {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.method-sub {
  font-size: 9px;
  color: var(--text-muted);
}
.wallet-box-wrap {
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 14px;
  text-align: center;
}
.wallet-addr-text {
  font-family: monospace;
  font-size: 11px;
  color: var(--accent-cyan);
  word-break: break-all;
  background: rgba(6, 182, 212, 0.08);
  padding: 8px;
  border-radius: 6px;
  margin: 8px 0;
}
.btn-copy-addr {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.tx-input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  margin-bottom: 10px;
  outline: none;
}
.tx-input:focus {
  border-color: var(--accent-indigo);
}
.qr-preview {
  width: 130px;
  height: 130px;
  background: #fff;
  padding: 6px;
  border-radius: 8px;
  margin: 0 auto 10px;
  display: block;
}
