/* SIMULATION MODE shell — parchment-on-obsidian, ember accents.
   Deliberately distinct from v1's green CRT console (style.css is NOT imported). */

:root {
  --obsidian: #0b0908;
  --obsidian-2: #16110d;
  --obsidian-3: #1f1812;
  --parch: #e9d8ab;
  --parch-dim: #b09a6e;
  --parch-faint: #7e6c4c;
  --ember: #ff7a2f;
  --ember-deep: #c43e1c;
  --gold: #d4a82e;
  --gold-soft: #c9a227;
  --blood: #a32116;
  --blood-dark: #5e120c;
  --line: #58432a;
  --line-bright: #8a6a33;
  --feed: #e0a653;
  --serif: "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  background: var(--obsidian);
  color: var(--parch);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app, .screen { position: fixed; inset: 0; }

.screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(196, 62, 28, 0.10), transparent 55%),
    radial-gradient(ellipse at 50% -30%, rgba(212, 168, 46, 0.05), transparent 60%),
    var(--obsidian);
}
.hidden { display: none !important; }

code { font-family: Consolas, monospace; color: var(--gold); font-size: 0.9em; }

/* ------------------------------------------------------------ ornate frame */
.ornate {
  position: relative;
  border: 1px solid var(--line);
  outline: 1px solid rgba(138, 106, 51, 0.35);
  outline-offset: 3px;
  background:
    linear-gradient(rgba(255, 160, 60, 0.03), rgba(0, 0, 0, 0.25)),
    var(--obsidian-2);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.8),
    0 12px 50px rgba(0, 0, 0, 0.7),
    inset 0 0 60px rgba(0, 0, 0, 0.55);
}
.ornate::before, .ornate::after {
  content: "\25C6";
  position: absolute;
  color: var(--line-bright);
  font-size: 11px;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255, 140, 50, 0.4);
}
.ornate::before { top: -9px; left: 50%; transform: translateX(-50%); }
.ornate::after { bottom: -9px; left: 50%; transform: translateX(-50%); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-block;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--parch);
  background: linear-gradient(#241b12, #120d09);
  border: 1px solid var(--line-bright);
  padding: 10px 22px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s;
  text-transform: uppercase;
}
.btn:hover {
  border-color: var(--ember);
  color: #fff;
  box-shadow: 0 0 18px rgba(255, 122, 47, 0.25), inset 0 0 12px rgba(255, 122, 47, 0.12);
}
.btn-ember {
  background: linear-gradient(#5b2410, #2c0f06);
  border-color: var(--ember-deep);
  color: #ffd9b0;
}
.btn-gold {
  background: linear-gradient(#574311, #2b2008);
  border-color: var(--gold);
  color: #ffe9a8;
}
.btn.big { font-size: 17px; padding: 13px 34px; }
.btn-x {
  padding: 4px 10px;
  font-size: 13px;
  letter-spacing: 0;
}
.btn-row { display: flex; gap: 14px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.btn-col { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; min-width: 240px; }

.hint-line {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--parch-faint);
  text-align: center;
}

/* ----------------------------------------------------------------- panels */
.panel { padding: 34px 44px; max-width: 620px; text-align: center; }
.panel-kicker {
  font-size: 11px;
  letter-spacing: 0.45em;
  color: var(--ember);
  margin-bottom: 12px;
}
.panel-kicker.err { color: var(--blood); }
.panel-title { font-size: 26px; letter-spacing: 0.06em; margin-bottom: 12px; font-weight: normal; }
.panel-text { color: var(--parch-dim); line-height: 1.55; font-size: 15px; }

/* ----------------------------------------------------------------- splash */
.splash { text-align: center; }
.splash-rune {
  font-size: 30px;
  color: var(--ember);
  text-shadow: 0 0 24px rgba(255, 122, 47, 0.8);
  animation: pulse 1.6s ease-in-out infinite;
}
.splash-title {
  margin-top: 14px;
  font-size: 34px;
  font-weight: normal;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--parch);
}
.splash-sub { margin-top: 10px; color: var(--parch-faint); letter-spacing: 0.2em; font-size: 13px; }
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ------------------------------------------------------------ WORLD FORGE */
.forge-wrap { width: min(760px, 92vw); text-align: center; }
.forge-title {
  font-size: 42px;
  font-weight: normal;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--parch);
  text-shadow: 0 0 30px rgba(255, 122, 47, 0.35);
  animation: forgeGlow 2.4s ease-in-out infinite;
}
@keyframes forgeGlow {
  0%, 100% { text-shadow: 0 0 18px rgba(255, 122, 47, 0.25); }
  50% { text-shadow: 0 0 44px rgba(255, 122, 47, 0.6), 0 0 10px rgba(255, 200, 120, 0.4); }
}
.forge-sub { margin: 10px 0 22px; color: var(--parch-faint); letter-spacing: 0.22em; font-size: 12px; }
.forge-frame {
  display: grid;
  grid-template-columns: 220px 1fr;
  text-align: left;
  min-height: 320px;
}
#forge-stages {
  list-style: none;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
}
#forge-stages li {
  padding: 7px 4px;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--parch-faint);
  transition: color 0.3s;
}
#forge-stages li::before { content: "\25C7  "; color: var(--line-bright); }
#forge-stages li.on { color: var(--ember); }
#forge-stages li.on::before { content: "\25C6  "; color: var(--ember); animation: pulse 1s infinite; }
#forge-stages li.done { color: var(--parch-dim); }
#forge-stages li.done::before { content: "\25C6  "; color: var(--gold-soft); animation: none; }
#forge-stages .stage-detail { display: block; font-size: 10px; color: var(--parch-faint); letter-spacing: 0.05em; padding-left: 18px; }
#forge-feed {
  padding: 18px 20px;
  height: 320px;
  overflow-y: auto;
  font-family: Consolas, "Lucida Console", monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--feed);
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 0 8px rgba(224, 166, 83, 0.25);
}
.forge-status { margin-top: 16px; font-size: 13px; letter-spacing: 0.2em; color: var(--parch-dim); min-height: 18px; }
.forge-status.done { color: var(--gold); text-shadow: 0 0 14px rgba(212, 168, 46, 0.5); }

/* ------------------------------------------------------------------ stage */
#stage { position: absolute; inset: 0; background: #000; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* -------------------------------------------------------------------- HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-plate {
  background: linear-gradient(rgba(22, 17, 13, 0.92), rgba(11, 9, 8, 0.92));
  border: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), inset 0 0 18px rgba(0, 0, 0, 0.5);
  padding: 10px 16px;
}
.hud-plate.small { padding: 5px 12px; font-size: 12px; letter-spacing: 0.16em; color: var(--parch-dim); }

#hud-zone { position: absolute; top: 14px; left: 14px; max-width: 360px; transition: opacity 0.4s; }
#hud.boss-active #hud-zone { opacity: 0.12; }
#zone-name { font-size: 17px; letter-spacing: 0.12em; color: var(--parch); }
#zone-objective { margin-top: 3px; font-size: 11.5px; color: var(--parch-dim); line-height: 1.4; }
#zone-progress { margin-top: 3px; font-size: 10px; letter-spacing: 0.3em; color: var(--parch-faint); }

#hud-right { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#minimap {
  border: 1px solid var(--line);
  background: rgba(11, 9, 8, 0.85);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}
#hud-lore .lore-glyph { color: var(--gold); margin-right: 6px; }
#lore-count { color: var(--parch); }

#hud-bottom {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 18px;
}

/* HP globe (Diablo-style) */
#hp-globe {
  width: 96px; height: 96px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line-bright);
  background: radial-gradient(circle at 35% 28%, #2c0e0e, #140606 72%);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.8), inset 0 0 24px rgba(0, 0, 0, 0.8);
}
#hp-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 100%;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 120, 100, 0.55), transparent 55%),
    linear-gradient(#d6402c, #6e120a);
  transition: height 0.18s ease-out;
  box-shadow: inset 0 3px 8px rgba(255, 160, 140, 0.35);
}
.hp-gloss {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.28), transparent 42%);
  pointer-events: none;
}
#hp-text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 16px; color: #ffe9d8;
  text-shadow: 0 1px 3px #000, 0 0 8px rgba(0, 0, 0, 0.8);
}

/* ability bar */
#ability-bar { display: flex; gap: 10px; padding-bottom: 6px; }
.ab-slot {
  width: 56px; height: 56px;
  position: relative;
  border: 1px solid var(--line-bright);
  background: linear-gradient(#221a11, #0f0b08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7), inset 0 0 14px rgba(0, 0, 0, 0.6);
}
.ab-glyph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 24px;
  color: var(--parch);
  text-shadow: 0 0 10px rgba(255, 150, 60, 0.45);
}
.ab-slot[data-fx="fire"] .ab-glyph { color: #ffb36b; }
.ab-slot[data-fx="bolt"] .ab-glyph { color: #ffe27a; }
.ab-slot[data-fx="arc"] .ab-glyph { color: #ffd2a8; }
.ab-slot[data-fx="wave"] .ab-glyph { color: #b9c8ff; }
.ab-cd { position: absolute; inset: 0; pointer-events: none; }
.ab-key {
  position: absolute; bottom: 1px; right: 4px;
  font-size: 9px; letter-spacing: 0.08em;
  color: var(--parch-faint);
}
.ab-slot.ready { border-color: var(--ember-deep); }

#hud-shards { margin-bottom: 6px; }
#hud-shards .shard-glyph { color: #9fd8d2; margin-right: 5px; }

#hud-keys {
  position: absolute; bottom: 4px; right: 12px;
  font-size: 10px; letter-spacing: 0.12em;
  color: rgba(126, 108, 76, 0.66);
}
/* keyboard hints are noise on touch — hide while the virtual sticks are up */
#stage:has(.g3dc-root.g3dc-on) #hud-keys { display: none; }

/* boss bar */
#boss-bar {
  position: absolute;
  top: 18px; left: 50%; transform: translateX(-50%);
  width: min(560px, 60vw);
  text-align: center;
}
#boss-name {
  font-size: 16px; letter-spacing: 0.3em;
  color: #ffb9a0;
  text-shadow: 0 0 14px rgba(195, 40, 20, 0.8), 0 1px 2px #000;
  margin-bottom: 5px;
}
.boss-track {
  height: 14px;
  border: 1px solid var(--line-bright);
  background: rgba(10, 6, 5, 0.9);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7), inset 0 0 10px #000;
}
#boss-fill {
  height: 100%; width: 100%;
  background: linear-gradient(#e0512f, #7a140b);
  box-shadow: 0 0 14px rgba(224, 81, 47, 0.6);
  transition: width 0.12s linear;
}
#boss-phases { margin-top: 4px; font-size: 11px; letter-spacing: 0.5em; color: var(--parch-faint); }
#boss-phases .pip.on { color: var(--ember); text-shadow: 0 0 8px rgba(255, 122, 47, 0.8); }
#boss-phases .pip.spent { color: #4a3320; }

/* ------------------------------------------------------------------ toasts */
#toasts {
  position: absolute;
  top: 86px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  width: min(640px, 80vw);
}
.toast {
  padding: 8px 22px;
  background: rgba(16, 11, 8, 0.92);
  border: 1px solid var(--line);
  color: var(--parch);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-align: center;
  animation: toastIn 0.25s ease-out;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
}
.toast.taunt { border-color: var(--ember-deep); color: #ffc7a3; font-style: italic; }
.toast.deathline { border-color: var(--gold-soft); color: #ffe9a8; font-style: italic; }
.toast.notice { color: var(--parch-dim); }
.toast.fade { opacity: 0; transition: opacity 0.6s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }

/* ------------------------------------------------------------ zone banner */
#zone-banner {
  position: absolute;
  top: 22%; left: 0; right: 0;
  text-align: center;
  pointer-events: none;
  animation: bannerIn 0.7s ease-out;
}
#zb-name {
  font-size: 40px;
  letter-spacing: 0.3em; text-indent: 0.3em;
  color: var(--parch);
  text-shadow: 0 0 34px rgba(255, 122, 47, 0.45), 0 2px 6px #000;
}
#zb-line {
  margin: 12px auto 0; max-width: 560px;
  font-style: italic; font-size: 15px;
  color: var(--parch-dim);
  text-shadow: 0 1px 3px #000;
}
#zone-banner.out { opacity: 0; transition: opacity 0.9s; }
@keyframes bannerIn { from { opacity: 0; letter-spacing: 0.6em; } to { opacity: 1; } }

/* ------------------------------------------------------------- boss banner */
#banner-boss {
  position: absolute;
  top: 26%; left: 0; right: 0;
  text-align: center;
  pointer-events: none;
  animation: bannerIn 0.5s ease-out;
}
.bb-kicker { font-size: 11px; letter-spacing: 0.5em; color: var(--blood); margin-bottom: 8px; }
#bb-name {
  font-size: 44px;
  letter-spacing: 0.22em; text-indent: 0.22em;
  color: #ffb9a0;
  text-shadow: 0 0 40px rgba(195, 40, 20, 0.9), 0 2px 8px #000;
}
#bb-desc { margin-top: 8px; font-size: 14px; color: var(--parch-dim); text-shadow: 0 1px 3px #000; }
#bb-intro { margin: 10px auto 0; max-width: 580px; font-style: italic; font-size: 15px; color: #e8c39a; text-shadow: 0 1px 3px #000; }
#banner-boss.out { opacity: 0; transition: opacity 0.8s; }

/* ---------------------------------------------------------------- overlays */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 3, 2, 0.55);
  backdrop-filter: blur(1px);
  z-index: 30;
}
.overlay.bottom { align-items: flex-end; padding-bottom: 4vh; }
.overlay.dark { background: rgba(4, 2, 2, 0.82); }

/* lore popup */
.lore-panel { max-width: 540px; padding: 30px 40px 22px; text-align: center; border-color: var(--gold-soft); }
.lore-panel .panel-kicker { color: var(--gold); }
#lore-title { font-size: 21px; font-weight: normal; letter-spacing: 0.08em; margin-bottom: 14px; color: #f3e3b5; }
#lore-text {
  font-style: italic; font-size: 16px; line-height: 1.65;
  color: var(--parch);
  quotes: "\201C" "\201D";
}
#lore-text::before { content: open-quote; color: var(--gold); }
#lore-text::after { content: close-quote; color: var(--gold); }
.lore-ref { margin-top: 12px; font-size: 12px; letter-spacing: 0.2em; color: var(--parch-faint); }
.lore-badge {
  margin-top: 10px; display: inline-block;
  padding: 3px 14px;
  border: 1px solid var(--gold-soft);
  font-size: 11px; letter-spacing: 0.25em;
  color: var(--gold);
}

/* narration card */
.card-panel { max-width: 560px; padding: 32px 42px 22px; text-align: center; }
#card-title { font-size: 24px; font-weight: normal; letter-spacing: 0.1em; margin-bottom: 12px; }
#card-text { font-size: 15.5px; line-height: 1.6; color: var(--parch-dim); }
.card-extra { margin-top: 14px; font-style: italic; font-size: 14.5px; color: #e8c39a; }

/* dialogue */
.dlg-panel { width: min(680px, 94vw); padding: 18px 22px 12px; pointer-events: auto; }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
#dlg-name { font-size: 19px; letter-spacing: 0.14em; color: #f3e3b5; }
#dlg-role { font-size: 11px; letter-spacing: 0.2em; color: var(--ember); margin-top: 2px; }
#dlg-log {
  max-height: 230px; min-height: 90px;
  overflow-y: auto;
  padding: 12px 4px;
  display: flex; flex-direction: column; gap: 9px;
}
.msg { max-width: 86%; font-size: 14.5px; line-height: 1.5; padding: 7px 12px; }
.msg.npc {
  align-self: flex-start;
  background: rgba(40, 28, 16, 0.6);
  border-left: 2px solid var(--ember-deep);
  color: var(--parch);
}
.msg.player {
  align-self: flex-end;
  background: rgba(22, 20, 26, 0.7);
  border-right: 2px solid var(--line-bright);
  color: var(--parch-dim);
}
.msg.streaming::after { content: "\258C"; color: var(--ember); animation: pulse 0.8s infinite; }
#dlg-suggest { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 10px; }
#dlg-suggest button {
  font-family: var(--serif);
  font-size: 12.5px;
  color: var(--parch-dim);
  background: rgba(30, 22, 14, 0.8);
  border: 1px solid var(--line);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
#dlg-suggest button:hover:not(:disabled) { color: #fff; border-color: var(--ember); }
#dlg-suggest button:disabled { opacity: 0.4; cursor: default; }
#dlg-form { display: flex; gap: 8px; }
#dlg-input {
  flex: 1;
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--parch);
  background: rgba(8, 6, 5, 0.9);
  border: 1px solid var(--line);
  padding: 9px 12px;
  outline: none;
}
#dlg-input:focus { border-color: var(--line-bright); box-shadow: 0 0 12px rgba(255, 122, 47, 0.12); }
#dlg-input:disabled, #dlg-send:disabled { opacity: 0.45; }
.dlg-panel .hint-line { margin-top: 8px; }

/* death */
.death-panel { text-align: center; max-width: 640px; padding: 20px; }
.death-title {
  font-size: 54px;
  letter-spacing: 0.26em; text-indent: 0.26em;
  color: #c9311d;
  text-shadow: 0 0 50px rgba(163, 33, 22, 0.9), 0 2px 10px #000;
  animation: bannerIn 0.8s ease-out;
}
.death-line {
  margin: 22px auto 28px; max-width: 520px;
  font-style: italic; font-size: 17px; line-height: 1.6;
  color: var(--parch-dim);
  min-height: 48px;
}
.death-line.pending { color: var(--parch-faint); }

/* victory */
.victory-panel { text-align: center; max-width: 700px; padding: 20px; }
.victory-rune {
  font-size: 34px; color: var(--gold);
  text-shadow: 0 0 30px rgba(212, 168, 46, 0.9);
  animation: pulse 1.8s infinite;
}
.victory-title {
  margin-top: 8px;
  font-size: 60px;
  letter-spacing: 0.3em; text-indent: 0.3em;
  color: #ffe9a8;
  text-shadow: 0 0 60px rgba(212, 168, 46, 0.75), 0 0 18px rgba(255, 235, 170, 0.5), 0 2px 10px #000;
  animation: bannerIn 0.9s ease-out;
}
.victory-world { margin-top: 6px; font-size: 14px; letter-spacing: 0.4em; color: var(--gold-soft); }
.victory-text {
  margin: 24px auto 6px; max-width: 560px;
  font-size: 16px; line-height: 1.7; font-style: italic;
  color: var(--parch);
}

/* pause + continue + error panels */
.pause-panel, .continue-panel, .error-panel { text-align: center; }
.pause-panel { padding: 28px 50px; }
.error-panel .panel-text { color: #cf8d7a; }

/* scrollbars (webkit) */
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--obsidian); }
::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--obsidian); }
::-webkit-scrollbar-thumb:hover { background: var(--line-bright); }
