:root {
  --bg: #090b0f;
  --panel: #10151d;
  --panel2: #161d28;
  --line: #263141;
  --text: #e8eef6;
  --muted: #8492a5;
  --a: #ff7a2f;
  --b: #35a3ff;
  --good: #5ee08b;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 420px at 50% -10%, #1a2636 0, transparent 60%),
    linear-gradient(180deg, #0b0e13, var(--bg));
  color: var(--text);
  font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, select, input { font: inherit; }

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  width: min(1440px, 100vw);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
}

.brand { display: grid; gap: 2px; }
.brand span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.brand strong { font-size: 24px; line-height: 1; }

.field { display: grid; gap: 7px; }
.field span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.versusFields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.sideA span { color: #ffad7d; }
.sideB span { color: #8dccff; }
.field select {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: #0b1017;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}
.field input { width: 100%; accent-color: var(--a); }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  background: #0b1017;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
}
.segmented button {
  height: 34px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.segmented button.on {
  color: var(--text);
  background: #243143;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.actions button {
  height: 38px;
  color: var(--text);
  background: #202b3a;
  border: 1px solid #344256;
  border-radius: 8px;
  cursor: pointer;
}
.actions button:hover { filter: brightness(1.12); }

.meter {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}
.meter > div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.meter b { color: var(--text); }
.meter i {
  position: relative;
  display: block;
  height: 16px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--b);
  border: 1px solid var(--line);
}
.meter em {
  display: block;
  height: 100%;
  width: 50%;
  background: var(--a);
  transition: width .18s ease;
}

.readout {
  display: grid;
  gap: 8px;
  margin-top: auto;
  color: var(--muted);
}
.readout div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.readout b {
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stageWrap {
  min-width: 0;
  min-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1118;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .4);
}

#game {
  width: 100%;
  height: 100%;
  min-height: 560px;
}
#game canvas { display: block; }

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .panel {
    order: 2;
  }
  .stageWrap {
    min-height: 64vh;
  }
  #game {
    min-height: 480px;
  }
}
