:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f0d13;
  color: #f2edf7;
  --surface: #17131d;
  --surface-2: #211a29;
  --surface-3: #2a2233;
  --border: #3b3047;
  --muted: #a79daf;
  --accent: #a8e063;
  --accent-strong: #c9ff80;
  --danger: #ef6f78;
  --gold: #e9c46a;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 20%, rgba(115, 79, 143, 0.16), transparent 30rem),
    linear-gradient(180deg, #120f17, #0b090e 65%);
}

button { font: inherit; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

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

.topbar { padding: 28px 0 18px; }
.topbar h1 { margin: 0; font-size: clamp(1.25rem, 2vw, 1.7rem); }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: .76rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.footer { padding: 18px 0 28px; color: var(--muted); font-size: .82rem; }

.game {
  min-height: 650px;
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  background: rgba(23, 19, 29, .94);
  box-shadow: var(--shadow);
}

.screen { min-height: 650px; display: grid; }
.screen--center { place-items: center; padding: 48px 24px; text-align: center; }

.panel {
  border: 1px solid var(--border);
  background: rgba(33, 26, 41, .88);
  border-radius: 18px;
  padding: 22px;
}

.hero { max-width: 720px; }
.hero h2 { font-size: clamp(2rem, 6vw, 4.7rem); line-height: .95; margin: 10px 0 18px; letter-spacing: -.04em; }
.hero p { color: var(--muted); font-size: 1.05rem; line-height: 1.7; }

.magic-circle {
  width: 170px;
  height: 170px;
  margin: 0 auto 24px;
  border: 2px solid #796191;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 0 50px rgba(168, 224, 99, .12), inset 0 0 40px rgba(121, 97, 145, .18);
}

.magic-circle::before,
.magic-circle::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid #564568;
  transform: rotate(45deg);
}
.magic-circle::after { transform: rotate(15deg); }
.egg { font-size: 4.4rem; filter: drop-shadow(0 8px 12px rgba(0,0,0,.35)); z-index: 1; }

.button {
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #15200d;
  font-weight: 850;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.06); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button--ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.button--secondary { background: var(--surface-3); color: #fff; border: 1px solid #4a3c59; }
.button--danger { background: var(--danger); color: #23080b; }

.pill-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0 26px; }
.pill { padding: 7px 10px; background: var(--surface-3); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; font-size: .8rem; }

.layout { display: grid; grid-template-columns: 280px 1fr; min-height: 650px; }
.sidebar { border-right: 1px solid var(--border); background: #131017; padding: 22px; }
.stage { padding: 28px; display: flex; flex-direction: column; gap: 22px; }

.statline { display: flex; justify-content: space-between; gap: 10px; margin: 8px 0; color: var(--muted); font-size: .9rem; }
.statline strong { color: #fff; }
.progress { height: 8px; border-radius: 999px; overflow: hidden; background: #0b090d; border: 1px solid #302638; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.progress--enemy > span { background: var(--danger); }

.section-title { margin: 0 0 12px; font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mutation-list, .equipment-list { display: grid; gap: 8px; }
.tag { padding: 9px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; }
.empty { color: #776e7e; font-style: italic; }

.room-grid, .choice-grid, .monster-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.monster-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-button {
  text-align: left;
  width: 100%;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  color: #fff;
  cursor: pointer;
}
.card-button:hover { border-color: #6e5884; background: #261e2e; }
.card-button h3 { margin: 0 0 8px; }
.card-button p { margin: 0; color: var(--muted); line-height: 1.5; }
.card-button .reward { margin-top: 14px; color: var(--accent); font-size: .84rem; font-weight: 700; }

.room-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.room-heading h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.room-heading p { margin: 7px 0 0; color: var(--muted); }

.combatants { display: grid; grid-template-columns: 1fr 70px 1fr; gap: 20px; align-items: center; }
.combatant { min-height: 240px; display: flex; flex-direction: column; justify-content: space-between; }
.combatant__portrait { font-size: 4.5rem; text-align: center; padding: 18px; }
.enemy-party { gap: 14px; }
.enemy-list { display: grid; gap: 10px; }
.enemy-unit { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.02); }
.enemy-unit__portrait { font-size: 2rem; text-align: center; }
.enemy-unit__body { min-width: 0; }
.enemy-unit--defeated { opacity: .45; }
.vs { text-align: center; font-weight: 900; color: #665a6f; font-size: 1.2rem; }
.combat-log { max-height: 175px; overflow: auto; background: #0e0b11; border: 1px solid #2f2638; border-radius: 12px; padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; line-height: 1.55; color: #bfb4c8; }
.combat-log p { margin: 0 0 5px; }

.notice { border-left: 3px solid var(--gold); background: rgba(233, 196, 106, .08); padding: 13px 15px; color: #e7d9ae; border-radius: 8px; }
.story { color: #b5a9bf; font-style: italic; max-width: 630px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 780px) {
  .shell { width: min(100% - 18px, 1120px); }
  .topbar { align-items: flex-start; }
  .topbar .button { padding: 9px 11px; font-size: .78rem; }
  .game, .screen { min-height: 720px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .stage { padding: 20px; }
  .monster-grid, .room-grid, .choice-grid { grid-template-columns: 1fr; }
  .combatants { grid-template-columns: 1fr; }
  .vs { display: none; }
  .combatant { min-height: 200px; }
  .footer { align-items: flex-start; flex-direction: column; }
}

.tactics-panel { display: grid; gap: 14px; padding: 16px 18px; }
.tactics-panel .story { margin: 4px 0 0; }
.behavior-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.button--selected { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

.companion-tag { display: grid; gap: 4px; }
.companion-tag__meta { color: var(--muted); font-size: .75rem; }
.companion-choice { min-height: 235px; }
.companion-choice__icon { font-size: 2.6rem; margin-bottom: 8px; }
.companion-stats { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.companion-stats span { padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: .78rem; background: rgba(255,255,255,.025); }
.player-party { gap: 14px; }
.player-primary { display: grid; grid-template-columns: 86px 1fr; gap: 14px; align-items: center; }
.player-primary .combatant__portrait { font-size: 3.4rem; padding: 8px; }
.player-primary h3 { margin: 0 0 8px; }
.companion-combat-list { display: grid; gap: 10px; }
.progress--companion > span { background: var(--gold); }
.companion-unit { background: rgba(233, 196, 106, .035); }

@media (max-width: 520px) {
  .player-primary { grid-template-columns: 1fr; text-align: center; }
  .companion-stats { justify-content: center; }
}
