* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: #fafafa;
  color: #1a1a1a;
  -webkit-user-select: none;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 20px 28px;
  min-height: 100vh;
  overflow: hidden;
}

.back-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  background: rgba(255,255,255,0.92);
  color: #111;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  text-decoration: none;
  font-family: inherit;
  border: 1px solid #e5e5e5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

header {
  text-align: center;
  margin-bottom: 22px;
}
.title {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 22px;
  width: 100%;
  max-width: 520px;
}
.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.team-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 140px;
  padding: 11px 12px;
  border: 1.5px solid #e5e5e5;
  background: #fff;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  text-align: center;
  letter-spacing: -0.02em;
  outline: none;
  transition: border-color 150ms ease, background 150ms ease;
}
.team-input:focus {
  border-color: #1a1a1a;
  background: #fff;
}
.team-input::placeholder {
  color: #c8c8c8;
  font-weight: 600;
}
.score {
  font-size: 60px;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  min-width: 60px;
  text-align: center;
  color: #1a1a1a;
  transition: color 200ms ease;
}
.score.pending { color: #d4d4d4; }
.score.set { color: #1a1a1a; }
.score.pop { animation: pop 450ms ease; }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.vs {
  font-size: 18px;
  font-weight: 900;
  color: #c8c8c8;
  letter-spacing: 0.06em;
  align-self: center;
  padding-top: 80px;
}

.wheel-container {
  width: min(calc(100vw - 40px), calc(100vh - 420px), 400px);
  aspect-ratio: 1 / 1;
  margin-bottom: 22px;
  position: relative;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
#spin-btn {
  padding: 18px 36px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 120ms ease;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  max-width: calc(100vw - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#spin-btn:hover { background: #000; }
#spin-btn:active { transform: scale(0.97); }
#spin-btn:disabled {
  background: #d4d4d4;
  cursor: not-allowed;
  box-shadow: none;
}

#result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  opacity: 0;
  transition: opacity 300ms ease;
}
#result-overlay.show { opacity: 1; }
#result-overlay.hidden { display: none; }

.result-card {
  background: #fff;
  border-radius: 24px;
  padding: 32px 26px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 18px 44px rgba(0,0,0,0.18);
}
.result-label {
  font-size: 13px;
  color: #888;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.result-teams {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.r-team {
  font-size: 15px;
  font-weight: 700;
  color: #555;
  letter-spacing: -0.01em;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.r-vs {
  font-size: 11px;
  font-weight: 800;
  color: #c8c8c8;
  letter-spacing: 0.06em;
}
.result-score {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1.05;
  margin: 6px 0 10px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 14px;
}
.r-num.winner { color: #cd2e3a; }
.r-num.loser { color: #c8c8c8; }
.r-colon { color: #d4d4d4; font-weight: 800; }
.result-winner {
  font-size: 16px;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}
#restart-btn {
  width: 100%;
  padding: 14px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all 120ms ease;
}
#restart-btn:hover { background: #000; }
#restart-btn:active { transform: scale(0.98); }
