:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --gold: #f0c14b;
  --text: #f5f0e8;
  --muted: #8b9bb4;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 20% 0%, #2a1f4d 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, #1a3a4a 0%, transparent 45%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
}

.wrap {
  width: min(460px, 100%);
  text-align: center;
}

.menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.menu-btn {
  border: 1px solid #3d4f6f;
  background: #151c28;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.menu-btn.is-on {
  color: #1a1205;
  background: linear-gradient(180deg, #ffd76a, var(--gold));
  border-color: transparent;
}

.panel[hidden] {
  display: none;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
}

.sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 0.9rem;
}

.machine {
  background: var(--panel);
  border: 2px solid #3d4f6f;
  border-radius: 20px;
  padding: 20px 16px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.reels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
  background: #0a0e14;
  border-radius: 12px;
  padding: 12px;
  overflow: hidden;
}

.reel {
  height: 88px;
  border-radius: 8px;
  background: linear-gradient(180deg, #243044, #151c28);
  display: grid;
  place-items: center;
  font-size: 2rem;
  border: 1px solid #3a4a63;
}

.reel.spinning {
  animation: blurSpin 0.12s linear infinite;
}

@keyframes blurSpin {
  0% { filter: blur(0); transform: translateY(0); }
  50% { filter: blur(2px); transform: translateY(4px); }
  100% { filter: blur(0); transform: translateY(0); }
}

.result {
  min-height: 72px;
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(240, 193, 75, 0.08);
  border: 1px dashed rgba(240, 193, 75, 0.35);
  font-size: 1rem;
  line-height: 1.45;
}

.result .code {
  display: block;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 6px;
}

.result.warn {
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.08);
}

button#spin {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1205;
  background: linear-gradient(180deg, #ffd76a, var(--gold));
  cursor: pointer;
}

button#spin:disabled,
button#tesla-reload:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.machine.tesla {
  text-align: left;
}

.verdict {
  text-align: center;
  border-radius: 12px;
  padding: 14px 12px;
  margin-bottom: 12px;
  background: rgba(139, 155, 180, 0.12);
}

.verdict .label {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
}

.verdict .price {
  display: block;
  margin-top: 4px;
  font-size: 1.4rem;
  font-weight: 700;
}

.verdict .chg {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
}

.verdict.up {
  background: rgba(61, 220, 151, 0.12);
  color: #b6f5d8;
}

.verdict.down {
  background: rgba(255, 107, 107, 0.12);
  color: #ffc1c1;
}

.verdict.flat {
  background: rgba(240, 193, 75, 0.12);
  color: #ffe7a3;
}

#tesla-chart {
  width: 100%;
  height: 180px;
  display: block;
  background: #0a0e14;
  border-radius: 12px;
  margin-bottom: 12px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.stats div {
  background: #121926;
  border-radius: 10px;
  padding: 8px 10px;
}

.stats dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.stats dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.reasons {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.45;
}

button#tesla-reload {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1205;
  background: linear-gradient(180deg, #ffd76a, var(--gold));
  cursor: pointer;
}

.hint {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--muted);
}
