:root {
  --bg: #eceef2;
  --ink: #17171a;
  --muted: #62666f;
  --panel: #fbfbfd;
  --panel-strong: #ffffff;
  --line: #d7dbe3;
  --accent: #36b7a7;
  --accent-dark: #127f75;
  --danger: #e55757;
  --warning: #e6aa38;
  --violet: #6877df;
  --shadow: 0 20px 60px rgba(23, 23, 26, 0.14);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 10%, rgba(54, 183, 167, 0.16), transparent 26rem),
    radial-gradient(circle at 88% 86%, rgba(229, 87, 87, 0.12), transparent 22rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
canvas {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3vw, 3.25rem);
  line-height: 0.95;
  letter-spacing: 0;
}

#objective {
  max-width: 920px;
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 1.45;
}

.primary-button,
.command-button,
.module-button {
  min-height: 46px;
  border-radius: 8px;
  padding: 12px 14px;
  color: #ffffff;
  background: var(--ink);
  box-shadow: 0 8px 18px rgba(23, 23, 26, 0.12);
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.primary-button:hover,
.command-button:hover,
.module-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(23, 23, 26, 0.16);
}

.primary-button:active,
.command-button:active,
.module-button:active {
  transform: translateY(0);
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: stretch;
}

.stage-panel {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121216;
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  min-height: 380px;
  border-radius: 6px;
  background: #111115;
}

.command-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.status-card,
.progress-block,
.panel-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(23, 23, 26, 0.07);
}

.status-card {
  min-height: 94px;
  padding: 12px;
}

.status-card span,
.progress-row span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-card strong {
  display: block;
  margin-top: 5px;
  font-size: 1.65rem;
  line-height: 1;
}

.meter {
  width: 100%;
  height: 9px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e7ee;
}

.meter.wide {
  height: 12px;
  margin-top: 10px;
}

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

.hull-fill {
  background: linear-gradient(90deg, var(--danger), #f08b65);
}

.shield-fill {
  background: linear-gradient(90deg, var(--accent), #6ed8ff);
}

.progress-fill {
  background: linear-gradient(90deg, var(--violet), var(--accent), var(--warning));
}

.progress-block {
  padding: 13px;
}

.progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.progress-row strong {
  font-size: 1.35rem;
}

.panel-section {
  padding: 14px;
}

.panel-section h2 {
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.selected-section {
  min-height: 112px;
  background: var(--panel-strong);
}

#selectedInfo {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

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

.module-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #24242a;
}

.module-button span {
  display: inline-flex;
  min-width: 30px;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--ink);
  background: #ffffff;
  font-size: 0.84rem;
  font-weight: 800;
}

.command-button {
  background: var(--accent-dark);
}

.message {
  min-height: 42px;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 1100px) {
  .play-layout {
    grid-template-columns: 1fr;
  }

  .command-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selected-section,
  .panel-section:last-child {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .command-panel,
  .status-grid,
  .button-grid {
    grid-template-columns: 1fr;
  }

  canvas {
    min-height: 300px;
  }
}
