:root {
  color-scheme: dark;
  --bg: #101211;
  --panel: #181b19;
  --panel-2: #202520;
  --line: #394038;
  --text: #edf1ea;
  --muted: #aab4a8;
  --accent: #e6b85c;
  --accent-2: #74b9b0;
  --danger: #e16d5f;
  --ok: #83c879;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(16, 18, 17, 0.78), rgba(16, 18, 17, 0.94)),
    radial-gradient(circle at 20% 10%, rgba(116, 185, 176, 0.18), transparent 26rem),
    radial-gradient(circle at 80% 0%, rgba(230, 184, 92, 0.12), transparent 22rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #242a25;
  color: var(--text);
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #19150b;
  font-weight: 700;
}

button.danger {
  border-color: var(--danger);
  color: #ffd7d1;
}

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

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111411;
  color: var(--text);
  padding: 0 12px;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 44px);
  line-height: 1.05;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  gap: 16px;
  margin-top: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 25, 0.94);
  overflow: hidden;
}

.panel h2 {
  margin: 0;
  padding: 14px 16px;
  font-size: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(32, 37, 32, 0.78);
}

.panel-body {
  padding: 14px 16px;
}

.stack {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat {
  padding: 10px;
  border: 1px solid rgba(57, 64, 56, 0.8);
  border-radius: 6px;
  background: #141714;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  margin-top: 4px;
}

.node-list,
.equipment-list,
.log-list {
  display: grid;
  gap: 8px;
}

.node,
.equipment-item,
.unit {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #141714;
}

.node.done {
  border-color: rgba(131, 200, 121, 0.55);
}

.node-title,
.unit-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(116, 185, 176, 0.14);
  color: #bdece5;
  font-size: 12px;
  white-space: nowrap;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #0d0f0d;
  margin-top: 8px;
}

.bar > i {
  display: block;
  height: 100%;
  width: var(--value);
  background: var(--ok);
}

.bar.spirit > i {
  background: var(--accent-2);
}

.bar.enemy > i {
  background: var(--danger);
}

.statuses {
  min-height: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.status {
  font-size: 12px;
  color: #ffe6a8;
}

.error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(225, 109, 95, 0.72);
  border-radius: 6px;
  background: rgba(225, 109, 95, 0.12);
  color: #ffd7d1;
}

.battle-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.log-list {
  max-height: 260px;
  overflow: auto;
}

.log-list p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.start {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.start-box {
  width: min(520px, 100%);
}

.start-box h1 {
  margin: 0 0 8px;
  font-size: clamp(32px, 8vw, 56px);
}

.start-box p {
  color: var(--muted);
  line-height: 1.7;
}

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

  .battle-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 20px, 1280px);
    padding: 14px 0;
  }

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

  .actions,
  .stat-grid {
    grid-template-columns: 1fr;
  }
}
