:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: rgba(8, 15, 28, 0.62);
  --panel-strong: rgba(10, 20, 35, 0.82);
  --line: rgba(160, 220, 255, 0.22);
  --text: #eef8ff;
  --muted: #8aa6bc;
  --cyan: #26e2ff;
  --violet: #9f7cff;
  --gold: #ffd166;
  --green: #65ffba;
  --red: #ff6b82;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(circle at 22% 18%, rgba(38, 226, 255, 0.18), transparent 28%),
    radial-gradient(circle at 82% 16%, rgba(255, 209, 102, 0.1), transparent 24%),
    linear-gradient(135deg, #03050a 0%, #07131d 52%, #0b0718 100%);
  color: var(--text);
}

button {
  font: inherit;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.glass {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(10, 18, 32, 0.76), rgba(12, 20, 38, 0.48));
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) saturate(145%);
}

.topbar {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  padding: 14px 18px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.15rem, 2.4vw, 2rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.score-shell {
  min-width: 110px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 8px;
  background: rgba(255, 209, 102, 0.08);
  text-align: right;
}

.score-shell span,
.metric-label span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.score-shell strong {
  display: block;
  color: var(--gold);
  font-size: 1.55rem;
}

.hud {
  position: fixed;
  top: 114px;
  left: 18px;
  z-index: 8;
  width: min(430px, calc(100vw - 36px));
  max-height: calc(100vh - 202px);
  overflow: hidden auto;
  padding: 16px;
  border-radius: 8px;
}

.hud-head,
.choice-head,
.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.level-pill {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(38, 226, 255, 0.1);
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
}

.metrics {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.metric-card {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.metric-label strong {
  font-size: 1rem;
}

.meter {
  height: 9px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.meter i {
  display: block;
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green), var(--gold));
  box-shadow: 0 0 18px rgba(38, 226, 255, 0.55);
  transition: width 0.6s ease;
}

.progress-block {
  padding: 12px;
  border-radius: 8px;
  background: rgba(3, 8, 15, 0.42);
}

#chartCanvas {
  width: 100%;
  height: 132px;
  margin-top: 10px;
  display: block;
}

.mentor-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(159, 124, 255, 0.24);
  border-radius: 8px;
  background: rgba(159, 124, 255, 0.08);
}

.mentor-panel p:last-child {
  margin: 0;
  color: #dbeaff;
  line-height: 1.5;
}

.choice-dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9;
  width: min(560px, calc(100vw - 36px));
  padding: 16px;
  border-radius: 8px;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.choice-btn {
  min-height: 88px;
  padding: 14px;
  border: 1px solid rgba(38, 226, 255, 0.22);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(38, 226, 255, 0.13), rgba(255, 255, 255, 0.05));
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.choice-btn:hover,
.choice-btn:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 209, 102, 0.5);
  background: linear-gradient(145deg, rgba(255, 209, 102, 0.15), rgba(38, 226, 255, 0.1));
  outline: none;
}

.choice-btn strong {
  display: block;
  margin-bottom: 7px;
  font-size: 0.96rem;
}

.choice-btn span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold);
  cursor: pointer;
}

.abilities {
  position: fixed;
  right: 18px;
  top: 114px;
  z-index: 8;
  width: min(300px, calc(100vw - 36px));
  padding: 14px;
  border-radius: 8px;
}

.ability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ability {
  padding: 8px 10px;
  border: 1px solid rgba(101, 255, 186, 0.2);
  border-radius: 8px;
  background: rgba(101, 255, 186, 0.08);
  color: #d7ffef;
  font-size: 0.76rem;
  font-weight: 800;
}

.ability.locked {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  color: #738495;
}

.event-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 15;
  max-width: min(520px, calc(100vw - 36px));
  padding: 14px 18px;
  border: 1px solid rgba(255, 209, 102, 0.34);
  border-radius: 8px;
  background: rgba(8, 14, 25, 0.86);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.36);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
}

.transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(38, 226, 255, 0.18), rgba(2, 5, 10, 0.96));
  opacity: 0;
  pointer-events: none;
}

.transition-overlay > div {
  width: min(520px, calc(100vw - 36px));
  text-align: center;
}

.transition-overlay h2 {
  font-size: clamp(1.8rem, 7vw, 4.8rem);
}

@media (max-width: 860px) {
  body,
  #app {
    overflow: hidden auto;
  }

  .topbar,
  .hud,
  .abilities,
  .choice-dock {
    position: relative;
    inset: auto;
    width: calc(100% - 24px);
    margin: 12px;
  }

  .topbar {
    margin-top: 12px;
  }

  .hud {
    max-height: none;
  }

  .abilities {
    top: auto;
    right: auto;
  }

  .choice-dock {
    right: auto;
    bottom: auto;
    margin-bottom: 24px;
  }

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

  #game-canvas {
    min-height: 100vh;
  }
}
