:root {
  color-scheme: light;
  --bg: #0f172a;
  --bg-soft: #16213e;
  --accent: #f97316;
  --accent-soft: #fb923c;
  --text: #f8fafc;
  --text-dim: #94a3b8;
  --card-bg: #1e293b;
  --ring-track: #334155;
  --success: #22c55e;
}

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

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen.active { display: flex; }

/* ---------- SETUP ---------- */

.setup-card {
  width: min(420px, 90vw);
  background: var(--card-bg);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.setup-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  color: var(--accent);
}

.subtitle {
  margin: 0 0 24px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}

.field {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.field label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input[type="number"],
.field input[type="text"] {
  background: var(--bg-soft);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 18px;
  width: 100%;
}

.field input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.btn-primary, .btn-secondary {
  border: none;
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: #1a1a1a;
  margin-top: 8px;
}

.btn-primary:active { background: var(--accent-soft); }

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid #334155;
}

/* ---------- GAME ---------- */

#screen-game {
  position: absolute;
  background: radial-gradient(circle at 50% 30%, var(--bg-soft), var(--bg) 70%);
  touch-action: none;
}

.icon-btn {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #334155;
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
}

.clock-wrap {
  position: relative;
  width: min(70vw, 300px);
  height: min(70vw, 300px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.clock-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg, .ring-progress {
  fill: none;
  stroke-width: 12;
}

.ring-bg { stroke: var(--ring-track); }

.ring-progress {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 879.6;
  stroke-dashoffset: 0;
  transition: stroke 0.2s;
}

.clock-value {
  font-size: min(20vw, 96px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.instruction {
  margin-top: 28px;
  color: var(--text-dim);
  font-size: 15px;
  text-align: center;
  padding: 0 24px;
}

#ripple-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.ripple {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid hsl(var(--hue, 25) 85% 55%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: rippleAnim 5000ms ease-out forwards;
}

.ripple::after {
  content: "";
  position: absolute;
  inset: -14px;
  border: 2px solid hsl(var(--hue, 25) 85% 72%);
  border-radius: 50%;
  opacity: 0;
  animation: rippleAnim 5000ms ease-out 800ms forwards;
}

@keyframes rippleAnim {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(18); opacity: 0; }
}

.result-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
}

.result-overlay.active { display: flex; }

.result-card {
  width: min(380px, 88vw);
  background: var(--card-bg);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.result-card h2 {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 22px;
}

.result-price {
  font-size: 56px;
  font-weight: 800;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.result-detail {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 24px;
  min-height: 20px;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
