:root {
  --bg-1: #06101d;
  --bg-2: #0c2937;
  --bg-3: #382b17;
  --panel: rgba(9, 18, 31, 0.78);
  --panel-strong: rgba(8, 14, 24, 0.9);
  --line: rgba(103, 240, 255, 0.2);
  --line-warm: rgba(255, 179, 71, 0.3);
  --text-main: #f7fbff;
  --text-soft: #bfd6ea;
  --accent: #ffb347;
  --accent-2: #67f0ff;
  --accent-3: #ffe08b;
  --shadow: rgba(2, 8, 18, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text-main);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 700px at 14% 12%, rgba(103, 240, 255, 0.14), transparent 58%),
    radial-gradient(920px 560px at 86% 18%, rgba(255, 179, 71, 0.14), transparent 52%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2) 50%, var(--bg-3));
  position: relative;
  overflow-x: hidden;
}

.sky-lines,
.ambient-grid,
.ambient-orb {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.sky-lines {
  z-index: 0;
  background:
    linear-gradient(transparent 0, rgba(255, 255, 255, 0.03) 45%, transparent 100%),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 56px,
      rgba(255, 255, 255, 0.03) 57px,
      transparent 58px
    );
  opacity: 0.65;
}

.ambient-grid {
  z-index: 0;
  background-image:
    linear-gradient(rgba(103, 240, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 179, 71, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 30%, rgba(0, 0, 0, 0.7), transparent 76%);
}

.ambient-orb {
  z-index: 0;
  filter: blur(12px);
}

.orb-a {
  background: radial-gradient(circle at 18% 28%, rgba(103, 240, 255, 0.16), transparent 20%);
}

.orb-b {
  background: radial-gradient(circle at 82% 18%, rgba(255, 179, 71, 0.15), transparent 18%);
}

main,
section,
footer {
  position: relative;
  z-index: 1;
}

.game-shell {
  width: min(1240px, 95vw);
  margin: 20px auto 0;
}

.topbar {
  padding: 24px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(9, 16, 28, 0.92), rgba(10, 32, 46, 0.8));
  box-shadow: 0 26px 80px var(--shadow);
  backdrop-filter: blur(14px);
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.92fr);
  gap: 22px;
  align-items: start;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.title-wrap h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  line-height: 1;
}

.title-wrap h1 span {
  color: var(--accent);
}

.subtitle {
  margin: 0;
  max-width: 760px;
  color: var(--text-soft);
  line-height: 1.72;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 18px;
}

.quick-links a {
  color: #f5fbff;
  text-decoration: none;
  font-weight: 700;
}

.quick-links a:hover {
  color: var(--accent-2);
}

.quick-links .mini-link {
  color: #ffe4b0;
}

.hud {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hud-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(103, 240, 255, 0.14);
  background: rgba(7, 15, 30, 0.66);
  min-height: 78px;
}

.hud-item label {
  display: block;
  color: var(--text-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud-item strong {
  display: block;
  margin-top: 8px;
  font-size: 1.08rem;
  line-height: 1.35;
}

.hud-item-wide {
  grid-column: span 2;
}

.arena-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.76fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.view-panel,
.panel-block {
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(8, 15, 28, 0.9), rgba(8, 23, 39, 0.84));
  box-shadow: 0 18px 48px rgba(3, 10, 22, 0.3);
  backdrop-filter: blur(12px);
}

.view-panel {
  padding: 18px;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
}

.status-card {
  flex: 1;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.section-kicker {
  margin: 0;
  color: var(--accent-3);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-line {
  margin: 8px 0 0;
  color: #eef6ff;
  line-height: 1.6;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill-button,
.mini-btn,
.overlay-actions button,
.touch-pad button {
  font: inherit;
  cursor: pointer;
}

.pill-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  color: #08232b;
  background: linear-gradient(135deg, var(--accent-2), #9effcf);
  box-shadow: 0 14px 26px rgba(103, 240, 255, 0.18);
}

.pill-button.secondary,
.overlay-actions .secondary,
.mini-btn {
  color: #eef8ff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

.pill-button.ghost {
  color: #ffeac6;
  background: rgba(255, 179, 71, 0.08);
  border: 1px solid rgba(255, 179, 71, 0.18);
  box-shadow: none;
}

.pill-button:hover,
.mini-btn:hover,
.overlay-actions button:hover,
.touch-pad button:hover {
  transform: translateY(-1px);
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.meta-chip {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-chip label {
  display: block;
  color: var(--text-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-chip strong {
  display: block;
  margin-top: 7px;
  font-size: 0.98rem;
}

.board-frame {
  margin-top: 16px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(4, 10, 19, 0.88), rgba(5, 17, 29, 0.92));
  border: 1px solid rgba(103, 240, 255, 0.16);
}

.canvas-wrap {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: linear-gradient(180deg, #14293b, #050a12 72%);
}

.canvas-tip {
  margin: 14px 0 0;
  color: var(--text-soft);
  line-height: 1.6;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  margin-right: 6px;
  padding: 5px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #f7fbff;
  font-size: 0.86rem;
  font-weight: 700;
}

.touch-controls {
  display: none;
  gap: 12px;
  margin-top: 14px;
}

.touch-pad {
  display: grid;
  gap: 10px;
  flex: 1;
}

.touch-pad button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #f5fbff;
  font-weight: 800;
  padding: 14px 12px;
}

.touch-pad .accent-action {
  color: #08242c;
  background: linear-gradient(135deg, var(--accent), #ffe08b);
  border-color: rgba(255, 224, 139, 0.4);
}

.sidebar {
  display: grid;
  gap: 16px;
}

.panel-block {
  padding: 18px;
}

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

.section-head h2,
.panel-block h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-head span {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.objective-line,
.panel-block p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.65;
}

.meter + .meter {
  margin-top: 16px;
}

.meter {
  margin-top: 16px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.meter-track {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.meter-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 120ms linear;
}

.progress-track .meter-fill {
  background: linear-gradient(90deg, var(--accent-2), #9effcf);
}

.safety-track .meter-fill {
  background: linear-gradient(90deg, var(--accent), #ffe08b);
}

.inline-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

select {
  flex: 1;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #f7fbff;
  padding: 12px 14px;
  font: inherit;
}

.mini-btn {
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
}

.hint {
  margin-top: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.stat-card {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-card span {
  display: block;
  color: var(--text-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 8, 15, 0.72);
  backdrop-filter: blur(14px);
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.overlay .panel {
  width: min(560px, 100%);
  padding: 28px;
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(8, 15, 27, 0.96), rgba(13, 32, 44, 0.92));
  border: 1px solid rgba(103, 240, 255, 0.18);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

.overlay-tag {
  margin: 0;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 800;
}

.overlay h2 {
  margin: 10px 0 12px;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.overlay p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.overlay p + p {
  margin-top: 10px;
}

.overlay-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.overlay-actions button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
}

.overlay-actions .hidden {
  display: none;
}

@media (max-width: 1080px) {
  .topbar,
  .arena-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .game-shell {
    width: min(100%, 96vw);
  }

  .topbar,
  .view-panel,
  .panel-block {
    border-radius: 22px;
  }

  .board-toolbar,
  .meta-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions .pill-button {
    width: 100%;
  }

  .meta-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .touch-controls {
    display: flex;
  }
}

@media (max-width: 560px) {
  .topbar,
  .view-panel,
  .panel-block,
  .overlay .panel {
    padding: 16px;
  }

  .quick-links,
  .overlay-actions,
  .inline-controls {
    display: grid;
  }

  .hud,
  .meta-row,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .hud-item-wide {
    grid-column: auto;
  }
}
