:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181b20;
  --panel-soft: #20242b;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --line: #343a45;
  --red: #ff5a65;
  --red-soft: rgba(255, 90, 101, 0.2);
  --blue: #57a6ff;
  --blue-soft: rgba(87, 166, 255, 0.2);
  --gold: #f1c95b;
  --green: #60d394;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  min-height: 40px;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

button:hover {
  border-color: #6b7280;
  background: #282d36;
}

button:active {
  transform: translateY(1px);
}

.app-shell {
  width: min(1280px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 28px;
  display: grid;
  grid-template-rows: auto auto auto minmax(320px, 1fr) auto;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 13px;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: 0;
}

.proof-note {
  margin: 8px 0 0;
  color: #8a8f98;
  font-size: 13px;
}

.proof-note code {
  font-size: 12px;
}

.run-controls {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.run-controls button {
  width: 76px;
}

.command-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.preset-button {
  padding: 0 10px;
  white-space: nowrap;
}

.preset-button.is-active {
  border-color: var(--gold);
  background: rgba(241, 201, 91, 0.14);
}

.live-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 190px;
  gap: 8px;
}

.live-command input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d0f13;
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

.live-command input:focus {
  border-color: var(--gold);
  outline: none;
}

.mock-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
  margin-top: 8px;
}

.mock-command input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d0f13;
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

.mock-command input:focus {
  border-color: var(--gold);
  outline: none;
}

.mock-note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.api-status {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  background: var(--panel);
  font-size: 14px;
}

.api-status.is-online {
  border-color: rgba(96, 211, 148, 0.65);
  color: var(--green);
}

.api-status.is-offline {
  border-color: rgba(255, 90, 101, 0.65);
  color: var(--red);
}

.battle-stage {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #13161b;
  overflow: hidden;
}

#battleCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
}

.status-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 0.8fr 1.6fr;
  gap: 8px;
}

.readout {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
}

.label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.readout strong {
  display: block;
  min-height: 21px;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.4;
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100vw - 20px, 720px);
    padding-top: 14px;
  }

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

  h1 {
    font-size: 28px;
  }

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

  .live-command {
    grid-template-columns: 1fr;
  }

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