:root {
  --bg: #0b0710;
  --panel: #140d1c;
  --panel-2: #1c1327;
  --line: #2f2240;
  --text: #f2e6d0;
  --muted: #a8977f;
  --gold: #e0b040;
  --red: #c4242f;
  --green: #8fd16a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(80% 60% at 70% 0%, rgba(196, 36, 47, 0.12), transparent 60%),
    radial-gradient(60% 50% at 0% 100%, rgba(224, 176, 64, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  margin: 0 2px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  color: var(--text);
}

.muted { color: var(--muted); }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 16px;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.logo {
  font-weight: 900;
  font-size: 24px;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(224, 176, 64, 0.35);
}
.tag { color: var(--muted); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}
button.primary {
  background: linear-gradient(180deg, #d63a3f, #9c1a24);
  border-color: #e35a5f;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 24px rgba(196, 36, 47, 0.35);
}
button.primary:hover { filter: brightness(1.12); }
button.primary kbd { background: rgba(0, 0, 0, 0.25); border-color: rgba(255, 255, 255, 0.25); }
button.ghost { background: transparent; padding: 6px 12px; font-size: 13px; }
button.ghost:hover { border-color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px;
  align-items: start;
}

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(224, 176, 64, 0.06);
  background: #000;
}
#game { width: 100%; height: 100%; display: block; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 24px;
  text-align: center;
  background: radial-gradient(70% 70% at 50% 50%, rgba(10, 6, 16, 0.75), rgba(10, 6, 16, 0.92));
}
.overlay[hidden] { display: none; }
/* Paused with the menu hidden: the frozen fight shows through untouched. */
#pause.clean { background: none; }
#pause.clean > * { visibility: hidden; }
.pause-tip { font-size: 13px; margin-top: 6px; }
.overlay h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  line-height: 0.95;
  font-size: clamp(34px, 5.6vw, 70px);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(224, 176, 64, 0.4), 0 4px 0 #6b1218;
}
.overlay h2 { margin: 0; font-size: clamp(32px, 5vw, 56px); font-weight: 900; letter-spacing: 0.1em; }
.overlay h2.win { color: var(--gold); text-shadow: 0 0 24px rgba(224, 176, 64, 0.5); }
.overlay h2.lose { color: var(--green); text-shadow: 0 0 24px rgba(143, 209, 106, 0.4); }
.subtitle {
  margin: -4px 0 2px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #c084fc;
}
.lede { margin: 0; max-width: 560px; color: var(--text); line-height: 1.5; font-size: 15px; }
.tour {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 4px 0;
  padding: 0;
  flex-wrap: wrap;
  justify-content: center;
}
.tour li {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 92px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.tour .where { font-weight: 700; letter-spacing: 0.04em; }
.tour .who { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.8; }
.tour li.here { border: 1px solid var(--gold); color: var(--gold); background: rgba(224, 176, 64, 0.08); }
.tour li.boss { border-color: rgba(255, 139, 209, 0.45); color: #ff8bd1; }
.memory-line { margin: 0; font-size: 12px; color: #c084fc; }
.memory-line[hidden] { display: none; }
button.link { padding: 0 2px; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; }
button.link:hover { color: var(--text); }
.next-stop { margin: 0; color: var(--muted); font-size: 13px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.ai-line {
  margin: 4px 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.ai-line[data-state="ready"] { color: var(--green); border-color: rgba(143, 209, 106, 0.4); }
.ai-line[data-state="offline"] { color: #ffb36b; border-color: rgba(255, 179, 107, 0.4); }

.summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: min(560px, 100%);
  margin: 6px 0;
}
.summary > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  text-align: left;
}
.summary .wide { flex-direction: column; }
.summary .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.summary .v { font-weight: 700; }

/* ---- Aswang Mind panel ---- */
.panel {
  background: linear-gradient(180deg, var(--panel), #0f0916);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 12px;
}
.panel.pulse { animation: pulse 0.9s ease-out; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(224, 176, 64, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(224, 176, 64, 0); }
}
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel-title { font-weight: 900; letter-spacing: 0.16em; font-size: 15px; }
.panel-sub { color: var(--muted); font-size: 11px; margin-top: -6px; }
#ai-status {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
#ai-status[data-state="ready"] { color: var(--green); border-color: rgba(143, 209, 106, 0.5); }
#ai-status[data-state="thinking"] { color: var(--gold); border-color: rgba(224, 176, 64, 0.5); animation: blink 0.8s steps(2) infinite; }
#ai-status[data-state="offline"], #ai-status[data-state="error"] { color: #ffb36b; border-color: rgba(255, 179, 107, 0.5); }
@keyframes blink { 50% { opacity: 0.45; } }

.next { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
#ai-next { height: 100%; width: 0; background: var(--gold); transition: width 0.2s linear; }

.panel section h3 {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.step {
  display: inline-grid;
  place-items: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 10px;
  color: var(--text);
}
.panel section p { margin: 0; line-height: 1.45; font-size: 14px; min-height: 2.9em; }

#ai-intent {
  display: inline-block;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: #d9ec9c;
}
#ai-intent[data-intent="AGGRESSIVE"] { color: #ff4d4d; }
#ai-intent[data-intent="DEFENSIVE"] { color: #5fa8ff; }
#ai-intent[data-intent="COUNTER"] { color: #ffd23f; }
#ai-intent[data-intent="ZONE"] { color: #7dff9a; }
#ai-intent[data-intent="BAIT"] { color: #ff8bd1; }
#ai-intent[data-intent="PRESSURE"] { color: #ff8a3d; }
#ai-intent[data-intent="RETREAT"] { color: #b9a3ff; }
#ai-focus { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; min-height: 22px; }
.chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(224, 176, 64, 0.12);
  border: 1px solid rgba(224, 176, 64, 0.35);
  color: var(--gold);
}

#ai-note {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 179, 107, 0.08);
  border: 1px solid rgba(255, 179, 107, 0.3);
  color: #ffcf9e;
  font-size: 12px;
  line-height: 1.4;
}

.stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }

#ai-log { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 11.5px; line-height: 1.7; }
#ai-log li:first-child { color: var(--gold); }
#ai-log-empty { margin: 0; font-size: 12px; }

details { font-size: 12px; color: var(--muted); }
details summary { cursor: pointer; }
details pre {
  margin: 8px 0 0;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border-radius: 6px;
  background: #07040b;
  color: #cbbda6;
  font-size: 10.5px;
  line-height: 1.35;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  max-width: 1320px;
  margin: 14px auto 0;
  padding: 0 16px;
  font-size: 13px;
}

.foot {
  max-width: 1320px;
  margin: 18px auto 24px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .overlay .lede { font-size: 13px; }
}
