* {
  box-sizing: border-box;
}

:root {
  --bg-deep: #08131d;
  --bg-mid: #132536;
  --panel: rgba(12, 22, 31, 0.9);
  --panel-strong: rgba(18, 31, 44, 0.94);
  --line: rgba(153, 220, 224, 0.25);
  --text: #f2f7fb;
  --muted: #96aebb;
  --player: #59c2ff;
  --enemy: #ff6a70;
  --accent: #ffd166;
  --ready: #7ce5a1;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(59, 114, 146, 0.25), transparent 40%),
    linear-gradient(180deg, #0d1f2d 0%, #061018 100%);
  color: var(--text);
  font-family: Tahoma, Verdana, Segoe UI, sans-serif;
}

body.sudden-death .timer-display,
body.sudden-death .state-text {
  color: #ffe084;
  text-shadow: 0 0 18px rgba(255, 208, 110, 0.45);
}

button {
  font: inherit;
}

#app,
#gameShell,
#gameCanvas {
  width: 100%;
  height: 100%;
}

#app {
  position: relative;
}

#gameShell {
  position: relative;
}

#gameCanvas {
  display: block;
  cursor: crosshair;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background:
    linear-gradient(180deg, rgba(8, 19, 29, 0.58), rgba(8, 19, 29, 0.84)),
    radial-gradient(circle at top, rgba(77, 154, 176, 0.12), transparent 45%);
  backdrop-filter: blur(6px);
}

.hidden {
  display: none !important;
}

.panel {
  width: min(980px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(17, 31, 43, 0.96), rgba(10, 20, 28, 0.98));
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.menu-panel {
  padding: 34px;
}

.result-panel {
  width: min(460px, 100%);
  padding: 34px;
  text-align: center;
}

.branding h1,
.result-panel h2 {
  margin: 0;
  font-size: clamp(42px, 7vw, 68px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 12px;
}

.subtitle,
.result-text,
.menu-note {
  color: var(--muted);
}

.menu-status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.menu-status.error {
  color: #ff9ea3;
}

.subtitle {
  max-width: 620px;
  margin: 10px 0 0;
  line-height: 1.55;
}

.menu-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 28px;
}

.menu-section {
  padding: 20px;
  border: 1px solid rgba(153, 220, 224, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.menu-section h2 {
  margin: 0 0 16px;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.champion-select {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.champion-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  padding: 18px;
  border: 1px solid rgba(153, 220, 224, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(18, 30, 43, 0.95), rgba(11, 19, 26, 0.95));
  color: var(--text);
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.champion-card:hover,
.champion-card.selected {
  transform: translateY(-4px);
  border-color: rgba(255, 209, 102, 0.55);
  box-shadow: 0 18px 24px rgba(0, 0, 0, 0.24);
}

.champion-card strong {
  font-size: 24px;
  letter-spacing: 0.04em;
}

.champion-role {
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.champion-desc {
  color: var(--muted);
  line-height: 1.5;
}

.champion-icon {
  display: block;
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
}

.square-icon::before,
.circle-icon::before,
.triangle-icon::before {
  content: "";
  position: absolute;
  inset: 14px;
  margin: auto;
}

.square-icon::before {
  width: 34px;
  height: 34px;
  background: #3aa6ff;
}

.circle-icon::before {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ff8f54;
}

.triangle-icon::before {
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-bottom: 34px solid #ffc949;
  top: 11px;
}

.controls-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.controls-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.controls-list span {
  color: var(--accent);
}

.primary-button,
.secondary-button {
  min-width: 170px;
  padding: 14px 22px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, border-color 0.12s ease;
}

.primary-button {
  margin-top: 24px;
  background: linear-gradient(180deg, #ffd978, #dfaf31);
  color: #1b1b1b;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

#hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 18px 20px;
}

.top-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.health-card,
.score-card,
.cooldown-slot {
  border: 1px solid rgba(153, 220, 224, 0.18);
  border-radius: 18px;
  background: rgba(5, 13, 20, 0.7);
  backdrop-filter: blur(4px);
}

.health-card {
  padding: 14px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.card-title {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-subtitle {
  color: var(--text);
  font-weight: 700;
}

.health-bar {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.health-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  transition: width 0.16s linear;
}

.player-fill {
  background: linear-gradient(90deg, #2a9dff, #7ed5ff);
}

.enemy-fill {
  background: linear-gradient(90deg, #ff585f, #ff9b7d);
}

.health-text {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.score-card {
  padding: 14px 20px;
  text-align: center;
}

.score-text {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.round-text {
  margin-top: 6px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

.center-hud {
  position: absolute;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.timer-display {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.state-text {
  margin-top: 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

.bottom-hud {
  display: flex;
  justify-content: center;
}

.cooldowns {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 12px;
  width: min(860px, 100%);
}

.cooldown-slot {
  --cooldown-progress: 1;
  --cooldown-color: var(--ready);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.cooldown-slot.ready {
  border-color: rgba(124, 229, 161, 0.35);
}

.cooldown-wheel {
  position: relative;
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
}

.cooldown-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    var(--cooldown-color) calc(var(--cooldown-progress) * 1turn),
    rgba(255, 255, 255, 0.08) 0
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 0);
}

.cooldown-center {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px solid rgba(153, 220, 224, 0.16);
  background: rgba(8, 18, 28, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
}

.spell-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.spell-key {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.spell-name {
  display: block;
  font-weight: 700;
  line-height: 1.2;
}

.spell-cd {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.1;
  color: var(--muted);
}

.cooldown-slot.ready .spell-cd {
  color: var(--ready);
}

.cooldown-slot.ready .cooldown-center {
  border-color: rgba(124, 229, 161, 0.28);
}

.round-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  padding: 18px 26px;
  border-radius: 18px;
  border: 1px solid rgba(255, 209, 102, 0.35);
  background: rgba(7, 15, 23, 0.82);
  color: #fff4cf;
  font-size: clamp(22px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .menu-grid {
    grid-template-columns: 1fr;
  }

  .champion-select {
    grid-template-columns: 1fr;
  }

  .top-hud {
    grid-template-columns: 1fr;
  }

  .center-hud {
    top: 188px;
  }

  .cooldowns {
    grid-template-columns: 1fr;
  }

  .result-actions {
    flex-direction: column;
  }
}
