/* public/css/game.css */

body.game-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  overflow: hidden;
  background: #0d1017;
}

.hidden { display: none !important; }

/* ============================================================ */
/*  AUTH SCREEN                                                  */
/* ============================================================ */

.auth-screen {
  position: fixed;
  inset: 0;
  background: #0d1017;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.auth-card {
  background: #14181f;
  border: 1px solid #1f242c;
  border-radius: 16px;
  padding: 40px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.auth-logo {
  font-size: 48px;
  margin-bottom: 16px;
  line-height: 1;
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 800;
  color: #e6e8eb;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.auth-sub {
  font-size: 14px;
  color: #8a94a6;
  line-height: 1.6;
  margin-bottom: 28px;
}

.auth-btn {
  width: 100%;
  padding: 15px 20px;
  background: #4ade80;
  color: #0d1017;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  margin-bottom: 16px;
}
.auth-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.auth-note {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 20px;
}

.auth-back {
  display: inline-block;
  font-size: 13px;
  color: #8a94a6;
  font-weight: 500;
  margin-top: 8px;
}
.auth-back:hover {
  color: #e6e8eb;
  opacity: 1;
}

/* ============================================================ */
/*  SIGNING OVERLAY                                              */
/* ============================================================ */

.signing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 16, 23, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.signing-overlay.hidden { display: none !important; }

.signing-card {
  background: #14181f;
  border: 1px solid #2a3140;
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.signing-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 18px;
  border: 3px solid #2a3140;
  border-top-color: #4ade80;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.signing-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: #e6e8eb;
  margin-bottom: 8px;
}

.signing-card p {
  font-size: 13px;
  color: #8a94a6;
  line-height: 1.6;
}

/* ============================================================ */
/*  SELECTION SCREEN                                             */
/* ============================================================ */

.selection-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #0d1017;
  z-index: 50;
  overflow-y: auto;
}
.selection-screen.hidden { display: none !important; }

.selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid #1f242c;
  gap: 16px;
  flex-wrap: wrap;
}
.selection-logo {
  font-weight: 700;
  font-size: 15px;
  color: #4ade80;
  text-decoration: none;
}
.selection-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.selection-wallet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #1a1f28;
  border: 1px solid #14532d;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #4ade80;
  font-family: monospace;
}
.selection-wallet-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.7);
}

.selection-balance {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.selection-balance .label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.selection-balance .value {
  font-size: 18px;
  font-weight: 700;
  color: #e6e8eb;
  font-family: monospace;
}

.selection-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 24px;
  text-align: center;
}
.selection-body h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
}
.selection-sub {
  font-size: 15px;
  color: #8a94a6;
  margin-bottom: 48px;
}

.pair-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
  gap: 16px;
  justify-content: center;
  width: 100%;
  max-width: 960px;
}

.pair-card {
  background: #14181f;
  border: 1px solid #1f242c;
  border-radius: 12px;
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.18s;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.pair-card:hover {
  border-color: #4ade80;
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(74, 222, 128, 0.08);
}

.pair-card .pair-name {
  font-size: 18px;
  font-weight: 800;
  color: #e6e8eb;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.pair-card .pair-label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.pair-card .pair-price {
  font-size: 22px;
  font-weight: 700;
  font-family: monospace;
  color: #4ade80;
  margin-bottom: 4px;
  transition: color 0.3s;
}
.pair-card .pair-price.up   { color: #4ade80; }
.pair-card .pair-price.down { color: #f87171; }

.pair-card .enter-icon {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1f28;
  border-radius: 50%;
  color: #4ade80;
  font-size: 14px;
  transition: all 0.18s;
}
.pair-card:hover .enter-icon {
  background: #4ade80;
  color: #0d1017;
}

/* ============================================================ */
/*  GAME SCREEN                                                  */
/* ============================================================ */

.game-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.game-screen.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #14181f;
  border-bottom: 1px solid #1f242c;
}
.brand { display: flex; align-items: center; gap: 12px; }

.change-market {
  background: #1a1f28;
  border: 1px solid #2a3140;
  color: #8a94a6;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.change-market:hover {
  background: #2a3140;
  color: #e6e8eb;
}

.brand .pair {
  font-size: 12px;
  font-weight: 700;
  color: #e6e8eb;
  padding: 4px 10px;
  background: #1f242c;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.follow-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 12px;
  background: #1a1f28;
  border: 1px solid #2a3140;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.follow-toggle:hover { background: #232a35; }
.follow-text {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #6b7280;
  transition: color 0.2s;
}
.follow-toggle.active .follow-text { color: #4ade80; }

.follow-toggle .switch {
  position: relative;
  width: 32px;
  height: 16px;
  background: #2a3140;
  border-radius: 10px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.follow-toggle.active .switch { background: #14532d; }

.follow-toggle .switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #6b7280;
  border-radius: 50%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.follow-toggle.active .switch-knob {
  left: 18px;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.7);
}

.stats { display: flex; gap: 32px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; }
.stat .label {
  font-size: 11px; color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.stat .value { font-size: 16px; font-weight: 600; color: #e6e8eb; font-family: monospace; }

.conn-status {
  position: fixed; top: 68px; right: 24px;
  padding: 6px 12px; font-size: 12px; border-radius: 6px;
  background: #1f242c; color: #8a94a6; z-index: 100;
  transition: opacity 0.3s;
}
.conn-status.ok      { background: #14532d; color: #4ade80; }
.conn-status.error   { background: #7f1d1d; color: #fca5a5; }
.conn-status.hidden  { opacity: 0; pointer-events: none; }

.chart-wrapper {
  flex: 1; position: relative; overflow: hidden;
}
#chart { width: 100%; height: 100%; }

.vline {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(251, 191, 36, 0.6);
  pointer-events: none;
  z-index: 5;
  transform: translateX(-0.5px);
}
.vline::before {
  content: 'REF';
  position: absolute;
  top: 8px; left: 4px;
  font-size: 10px;
  color: #fbbf24;
  font-weight: 700;
  letter-spacing: 1px;
}

.bet-panel {
  background: #14181f; border-top: 1px solid #1f242c;
  padding: 16px 24px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px 24px;
  grid-auto-rows: auto;
}

.bet-countdown { grid-column: 1 / -1; }
.countdown-bar {
  height: 4px;
  background: #1f242c;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.countdown-fill {
  height: 100%;
  background: #4ade80;
  width: 100%;
  transition: width 0.25s linear, background-color 0.3s;
}
.countdown-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #4ade80;
}
#countdown-time { font-family: monospace; font-size: 12px; }
.bet-countdown.warning .countdown-fill { background: #fbbf24; }
.bet-countdown.warning .countdown-text { color: #fbbf24; }
.bet-countdown.closed .countdown-fill { background: #6b7280; width: 0%; }
.bet-countdown.closed .countdown-text { color: #6b7280; }
.bet-countdown.closed #countdown-time { opacity: 0.5; }

.history-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.history-section { display: flex; flex-direction: column; gap: 6px; }
.history-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #6b7280;
  text-transform: uppercase;
}
.expand-btn {
  background: transparent;
  border: none;
  color: #8a94a6;
  font-size: 10px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
  transition: all 0.15s;
}
.expand-btn:hover { background: #2a3140; color: #e6e8eb; }
.history-chars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  min-height: 20px;
  line-height: 1;
}
.hc {
  display: inline-block;
  width: 14px;
  text-align: center;
  user-select: none;
  transition: opacity 0.15s;
}
.hc.win   { color: #4ade80; }
.hc.lose  { color: #f87171; }
.hc.draw  { color: #6b7280; }

.bet-controls { display: flex; flex-direction: column; gap: 12px; }
.amount-row { display: flex; align-items: center; gap: 12px; }
.amount-row label { font-size: 12px; color: #8a94a6; min-width: 90px; }
.amount-row input {
  background: #1a1f28; border: 1px solid #2a3140;
  color: #e6e8eb; padding: 8px 12px; border-radius: 6px;
  width: 120px; font-size: 14px; font-family: monospace;
}
.quick-amounts { display: flex; gap: 4px; }
.quick-amounts button {
  background: #1a1f28; border: 1px solid #2a3140;
  color: #8a94a6; padding: 6px 12px; border-radius: 4px;
  font-size: 12px; cursor: pointer; font-weight: 600;
  font-family: inherit;
}
.quick-amounts button:hover { background: #2a3140; color: #e6e8eb; }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn {
  padding: 14px; border: none; border-radius: 8px;
  font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
  display: flex; justify-content: center; align-items: center;
  gap: 10px; color: #0d1017;
  font-family: inherit;
}
.btn small { font-weight: 600; opacity: 0.8; }
.btn-long  { background: #4ade80; }
.btn-short { background: #f87171; }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; filter: grayscale(0.7); }

.bet-feedback { font-size: 13px; min-height: 18px; color: #8a94a6; }
.bet-feedback.error { color: #fca5a5; }
.bet-feedback.ok    { color: #4ade80; }

.toast-container {
  position: fixed; top: 80px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 15px; font-weight: 700;
  background: #1a1f28; color: #e6e8eb;
  border-left: 4px solid #8a94a6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease-out;
  min-width: 200px;
}
.toast.win  { border-left-color: #4ade80; color: #4ade80; }
.toast.lose { border-left-color: #f87171; color: #f87171; }
.toast .sub { display: block; font-size: 12px; font-weight: 500; color: #8a94a6; margin-top: 4px; }
.toast.fade { animation: toastOut 0.3s ease-in forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px); }
}