:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --surface: #151922;
  --surface-strong: #1d2430;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f7f7fb;
  --muted: #a8b0c2;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --yellow: #facc15;
  --green: #34d399;
  --danger: #fb7185;
  font-family: "Outfit", "Noto Sans KR", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at 15% 12%, rgba(34, 211, 238, 0.2), transparent 28rem),
    radial-gradient(circle at 85% 22%, rgba(244, 114, 182, 0.18), transparent 24rem),
    linear-gradient(180deg, #111522, var(--bg) 32rem);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  margin: 0 auto;
  max-width: 1080px;
  padding: 18px;
}

.topbar {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: auto 1fr auto;
  margin-bottom: 18px;
}

.back-link,
.icon-button,
.primary-button,
.secondary-button,
.preset-btn,
.entrant-tools button {
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.back-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  padding: 10px 14px;
  text-decoration: none;
}

.icon-button {
  aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font-size: 1.25rem;
  width: 44px;
}

.eyebrow {
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.45rem, 3vw, 2.4rem);
  line-height: 1.05;
  margin-bottom: 0;
}

h2 {
  font-size: clamp(1.6rem, 4vw, 3.4rem);
  letter-spacing: 0;
  line-height: 1.08;
}

.setup-panel,
.arena-panel,
.result-panel {
  background: rgba(15, 18, 26, 0.78);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  padding: clamp(18px, 4vw, 34px);
}

.setup-copy {
  max-width: 720px;
}

.setup-copy p:last-child {
  color: var(--muted);
  line-height: 1.7;
}

.controls-grid,
.entrant-grid,
.match-grid {
  display: grid;
  gap: 12px;
}

.controls-grid {
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(160px, 1fr));
  margin: 24px 0 16px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 7px;
}

input,
select {
  background: #0f131d;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  padding: 13px 14px;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14);
}

.preset-row,
.primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-btn,
.secondary-button,
.entrant-tools button {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 11px 14px;
}

.entrant-tools {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-weight: 900;
  justify-content: space-between;
  margin: 24px 0 10px;
}

.entrant-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.entrant-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.entrant-card span {
  color: var(--cyan);
  display: block;
  font-size: 0.72rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.primary-actions {
  margin-top: 20px;
}

.primary-button,
.secondary-button {
  min-height: 46px;
}

.primary-button {
  background: linear-gradient(135deg, var(--cyan), var(--pink));
  border-radius: 14px;
  color: #061018;
  font-weight: 900;
  padding: 13px 18px;
}

.primary-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  opacity: 0.55;
}

.back-link:hover,
.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.preset-btn:hover,
.entrant-tools button:hover,
.fighter-card:hover {
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

.round-header {
  margin-bottom: 18px;
}

.round-header h2 {
  margin-bottom: 14px;
}

.progress-track {
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

#progress-bar {
  background: linear-gradient(90deg, var(--cyan), var(--pink), var(--yellow));
  height: 100%;
  transition: width 320ms ease;
  width: 0;
}

.match-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fighter-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  min-height: 260px;
  padding: 18px;
  text-align: left;
}

.fighter-card .avatar {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  display: flex;
  font-size: 3.8rem;
  height: 112px;
  justify-content: center;
  margin-bottom: 18px;
}

.fighter-card h3 {
  font-size: clamp(1.3rem, 3vw, 2rem);
  margin-bottom: 8px;
}

.fighter-card p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.fighter-card.winner {
  border-color: rgba(250, 204, 21, 0.65);
  box-shadow: 0 0 40px rgba(250, 204, 21, 0.14);
}

.judge-panel,
.bracket-panel {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-top: 16px;
  padding: 16px;
}

.judge-panel {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.judge-label {
  color: var(--yellow);
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
  margin-bottom: 6px;
}

#judge-text {
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

.bracket-panel h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

#history-list {
  color: var(--muted);
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.winner-card {
  background:
    linear-gradient(160deg, rgba(34, 211, 238, 0.16), rgba(244, 114, 182, 0.16)),
    var(--surface-strong);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  overflow: hidden;
  padding: clamp(22px, 5vw, 42px);
  position: relative;
  text-align: center;
}

.winner-card::before {
  color: rgba(255, 255, 255, 0.05);
  content: "WINNER";
  font-size: clamp(4rem, 14vw, 9rem);
  font-weight: 900;
  left: 50%;
  letter-spacing: 0;
  position: absolute;
  top: 18px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.winner-card > * {
  position: relative;
}

.winner-avatar {
  font-size: 5.4rem;
  margin: 18px 0;
}

.winner-card h2 {
  margin-bottom: 12px;
}

.winner-card p {
  color: var(--muted);
  line-height: 1.7;
  margin-left: auto;
  margin-right: auto;
  max-width: 720px;
}

.winner-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.winner-stats span {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-weight: 800;
  padding: 9px 12px;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .back-link {
    display: none;
  }

  .controls-grid,
  .entrant-grid,
  .match-grid {
    grid-template-columns: 1fr;
  }

  .fighter-card {
    min-height: 220px;
  }

  .judge-panel {
    align-items: stretch;
    flex-direction: column;
  }
}
