/* Chrono Wheel Layout Stylesheet - Matching Hand-drawn Specifications */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Space+Grotesk:wght@600;700&display=swap');

.cw-sketch-app {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #f8fafc;
  background: radial-gradient(circle at 50% 15%, #073b22 0%, #031e11 55%, #010d07 100%);
  border: 2px solid rgba(245, 158, 11, 0.4);
  border-radius: 24px;
  padding: 24px 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(16, 185, 129, 0.12);
  max-width: 780px;
  margin: 20px auto;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.cw-sketch-app * {
  box-sizing: border-box;
}

/* 1. TOP HEADER: Balance (Left) & Active Bet (Right) */
.cw-top-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.25);
}

.cw-stat-box {
  display: flex;
  flex-direction: column;
}

.cw-stat-box.left {
  align-items: flex-start;
}

.cw-stat-box.right {
  align-items: flex-end;
}

.cw-stat-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6ee7b7;
  margin-bottom: 4px;
}

.cw-stat-value {
  font-size: 26px;
  font-weight: 900;
  font-family: 'Space Grotesk', monospace;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cw-stat-value.gold {
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}

.cw-stat-value.emerald {
  color: #34d399;
  text-shadow: 0 0 12px rgba(52, 211, 153, 0.4);
}

.cw-btn-faucet-sm {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #a7f3d0;
  border-radius: 9999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.2s;
}
.cw-btn-faucet-sm:hover {
  background: #10b981;
  color: #022c22;
}

/* 2. CENTER WHEEL CIRCLE: Spin 0-9 Single Digit */
.cw-wheel-center-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  position: relative;
}

.cw-circle-wheel-wrapper {
  position: relative;
  width: 270px;
  height: 270px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cw-wheel-pointer-top {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 22px solid #fbbf24;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.9));
  z-index: 10;
}

.cw-canvas-wheel {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #064e3b, 0 0 0 8px #f59e0b, 0 15px 35px rgba(0,0,0,0.85);
  display: block;
}

.cw-wheel-inner-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: radial-gradient(circle, #052e18 40%, #02180c 100%);
  border: 3px solid #fbbf24;
  box-shadow: 0 4px 18px rgba(0,0,0,0.9), inset 0 0 10px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 5;
}

.cw-badge-spin {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fbbf24;
  line-height: 1.1;
}

.cw-badge-range {
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
}

.cw-badge-digit {
  font-size: 9px;
  font-weight: 700;
  color: #a7f3d0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cw-badge-winner-num {
  font-size: 34px;
  font-weight: 900;
  color: #fef08a;
  line-height: 1;
  text-shadow: 0 0 10px rgba(254, 240, 138, 0.8);
}

/* 3. TIME COUNTDOWN (90 Sec / 1:30 min) */
.cw-countdown-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(2, 22, 12, 0.8);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 9999px;
  padding: 10px 24px;
  margin: 0 auto 26px auto;
  width: fit-content;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.cw-countdown-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6ee7b7;
}

.cw-countdown-timer {
  font-size: 24px;
  font-weight: 900;
  font-family: 'Space Grotesk', monospace;
  color: #34d399;
  text-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
}

.cw-countdown-sub {
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
}

/* 4. 0-9 BET ENTRY PAD */
.cw-bet-entry-pad {
  border: 2px solid rgba(245, 158, 11, 0.6);
  border-radius: 18px;
  background: rgba(2, 20, 11, 0.85);
  padding: 16px;
  margin-bottom: 22px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 8px 25px rgba(0,0,0,0.6);
}

.cw-pad-header {
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fef08a;
  margin-bottom: 14px;
  border-bottom: 1px dashed rgba(245, 158, 11, 0.35);
  padding-bottom: 8px;
}

.cw-pad-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.cw-pad-card {
  position: relative;
  height: 80px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 5px 14px rgba(0,0,0,0.6);
}

.cw-pad-card:hover {
  transform: translateY(-3px);
  border-color: #fbbf24;
  box-shadow: 0 8px 20px rgba(0,0,0,0.8), 0 0 14px rgba(245, 158, 11, 0.4);
}

.cw-pad-card.selected {
  border-color: #fef08a;
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.7), 0 10px 24px rgba(0,0,0,0.9);
}

.cw-pad-card.winner {
  animation: cw-winner-flash 1s infinite alternate;
  border-color: #fef08a;
}

@keyframes cw-winner-flash {
  from { box-shadow: 0 0 15px #f59e0b; }
  to { box-shadow: 0 0 30px #fef08a, 0 0 45px #f59e0b; }
}

.cw-pad-card-green {
  background: linear-gradient(135deg, #065f46 0%, #047857 50%, #022c22 100%);
}
.cw-pad-card-red {
  background: linear-gradient(135deg, #991b1b 0%, #b91c1c 50%, #450a0a 100%);
}
.cw-pad-card-black {
  background: linear-gradient(135deg, #27272a 0%, #18181b 50%, #09090b 100%);
}

.cw-card-digit {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

.cw-card-bet-badge {
  font-size: 10px;
  font-weight: 800;
  color: #fbbf24;
  margin-top: 3px;
}

.cw-card-bet-badge.active {
  background: rgba(245, 158, 11, 0.35);
  border: 1px solid #fef08a;
  border-radius: 9999px;
  padding: 1px 7px;
  color: #ffffff;
}

/* 5. 3 BETTING OPTIONS: 10 - 100 - 1000 */
.cw-chips-options-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.cw-chip-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  border: 3px dashed rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 15px rgba(0,0,0,0.6), inset 0 0 6px rgba(0,0,0,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.cw-chip-btn:hover {
  transform: translateY(-3px) scale(1.06);
}

.cw-chip-btn.active {
  transform: scale(1.14);
  box-shadow: 0 0 0 3px #fbbf24, 0 12px 25px rgba(0,0,0,0.9);
}

.cw-chip-10   { background: radial-gradient(circle, #38bdf8 35%, #0284c7 100%); color: #fff; }
.cw-chip-100  { background: radial-gradient(circle, #f87171 35%, #dc2626 100%); color: #fff; }
.cw-chip-1000 { background: radial-gradient(circle, #fbbf24 35%, #d97706 100%); color: #000; border-color: #fff; }

/* 6. CLEAR & PLACE BET BUTTONS */
.cw-actions-sketch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.cw-btn-sketch {
  flex: 1;
  padding: 14px 24px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cw-btn-clear-sketch {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}
.cw-btn-clear-sketch:hover {
  background: rgba(220, 38, 38, 0.25);
  border-color: #ef4444;
  color: #ffffff;
}

.cw-btn-place-sketch {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: #fef08a;
  color: #000;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}
.cw-btn-place-sketch:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.6);
}
.cw-btn-place-sketch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 7. OPTIONAL: WIN AND LOSE HISTORY */
.cw-history-sketch-box {
  background: rgba(2, 16, 9, 0.9);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 16px;
  padding: 14px 18px;
}

.cw-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cw-history-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a7f3d0;
}

.cw-history-list {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.cw-history-item {
  min-width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  flex-shrink: 0;
}

.cw-history-item.win {
  border-color: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.cw-history-item .rnd-lbl {
  font-size: 8px;
  opacity: 0.75;
}

/* Toast Notification */
.cw-toast-msg {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: #064e3b;
  border: 1px solid #34d399;
  color: #ecfdf5;
  padding: 10px 22px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0,0,0,0.7);
  z-index: 200;
  animation: cw-toast-in 0.25s ease;
}

.cw-toast-msg.error {
  background: #7f1d1d;
  border-color: #f87171;
  color: #fee2e2;
}

@keyframes cw-toast-in {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@media (max-width: 640px) {
  .cw-sketch-app { padding: 16px 14px; }
  .cw-stat-value { font-size: 20px; }
  .cw-circle-wheel-wrapper { width: 220px; height: 220px; }
  .cw-canvas-wheel { width: 210px; height: 210px; }
  .cw-wheel-inner-badge { width: 88px; height: 88px; }
  .cw-badge-range { font-size: 15px; }
  .cw-pad-grid { gap: 6px; }
  .cw-pad-card { height: 68px; }
  .cw-card-digit { font-size: 24px; }
  .cw-chip-btn { width: 52px; height: 52px; font-size: 13px; }
  .cw-actions-sketch-row { gap: 10px; }
  .cw-btn-sketch { padding: 12px 14px; font-size: 14px; }
}
