* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: radial-gradient(1100px 720px at 50% 36%, #232839 0%, #171a26 55%, #101219 100%);
  color: #e9e4d8;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ---------- header ---------- */
header {
  text-align: center;
  padding: 28px 16px 6px;
}
.over {
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #8d93a8;
}
h1 {
  margin: 6px 0 2px;
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #f3e9d6;
  text-shadow: 0 2px 24px rgba(245, 180, 85, 0.12);
}
.sub {
  font-style: italic;
  color: #b9c0d4;
  font-size: clamp(0.9rem, 2.2vw, 1.05rem);
}

/* ---------- stage ---------- */
.stage {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
}
#machine {
  display: block;
  width: min(880px, 94vw);
  height: auto;
  touch-action: manipulation;
}
@media (max-height: 760px) {
  #machine { width: min(680px, 90vw); }
}
@media (max-height: 620px) {
  #machine { width: min(520px, 86vw); }
}

#switch { cursor: pointer; }
#switch:hover .knob { fill: #ff6f66; }
#switch-hit:focus { outline: none; }
#switch-hit:focus-visible {
  stroke: #f5b455;
  stroke-width: 2;
  stroke-dasharray: 4 7;
  opacity: 0.9;
}
svg text { font-family: inherit; }

#status {
  min-height: 1.6em;
  margin-top: 4px;
  font-style: italic;
  color: #f5b455;
  opacity: 0.92;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  transition: opacity 0.3s;
}

/* ---------- footer ---------- */
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 22px 18px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}
#score {
  font-size: 0.85rem;
  color: #8d93a8;
  letter-spacing: 0.06em;
  min-width: 10em;
}
#chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.chip {
  font: inherit;
  font-size: 0.85rem;
  color: #cfd5e8;
  background: rgba(29, 34, 48, 0.8);
  border: 1px solid #3a4157;
  border-radius: 999px;
  padding: 0.45em 0.95em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip:hover { border-color: #6b7390; }
.chip.on {
  border-color: #f5b455;
  color: #f5b455;
  background: rgba(245, 180, 85, 0.08);
}
