:root {
  --bg: #0b0910; --panel: rgba(28, 24, 38, .88); --line: #3a334d; --text: #ece8f5; --muted: #a39cb6;
  --accent: #e8a03c; --hp: #c9463f; --xp: #5aa9e6;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, sans-serif; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 18px; } h2 { font-size: 16px; }
h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 14px; }
[hidden] { display: none !important; }

/* The 3D view fills the window; everything else floats on top. */
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#floats { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

header { position: fixed; inset: 0 0 auto 0; height: 46px; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
#gold { color: var(--accent); font-weight: 600; }
#gold, #potions, #depth { font-variant-numeric: tabular-nums; }

aside { position: fixed; top: 58px; bottom: 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
#left { left: 12px; width: 270px; }
#right { right: 12px; width: 260px; }
#log { position: fixed; left: 294px; right: 284px; bottom: 12px; height: 168px; overflow-y: auto; font-size: 13px; }
#combat { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); width: 300px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  backdrop-filter: blur(6px); }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .small { font-size: 12px; }

button, select, input:not([type=checkbox]) { font: inherit; color: var(--text); background: #2d2740;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; }
button { cursor: pointer; } button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: none; color: var(--muted); }
#guild input:not([type=checkbox]), #guild select, #guild button { width: 100%; margin-top: 6px; text-align: left; }
#guild label { display: block; margin-top: 6px; }
#guild .preview { margin: 8px 0 2px; }
#minimap { display: block; width: 100%; image-rendering: pixelated; border-radius: 4px; }

.bar { position: relative; height: 16px; background: #120f18; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--hp); transition: width .15s linear; }
.bar span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 16px; }
.bar.xp { height: 4px; } .bar.xp i { background: var(--xp); }

.hero { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hero:first-child { padding-top: 0; } .hero:last-child { border: 0; padding-bottom: 0; }
.hero.down { opacity: .45; }
.hero .lv { color: var(--accent); font-size: 12px; }
.hero .x { padding: 0 6px; background: none; border: 0; color: var(--muted); }
.hero .stats { margin-top: 5px; font-variant-numeric: tabular-nums; }
.portrait { font-size: 30px; line-height: 1; }

.foe + .foe { margin-top: 8px; }
.foe.down { opacity: .35; text-decoration: line-through; }
.foe small { color: var(--muted); }
.foe.boss > span { color: #ff7ad9; font-weight: 700; }
.hero .special { white-space: pre-line; }
dialog#chooser { color: var(--text); width: min(460px, 92vw); max-height: 86vh; overflow-y: auto; }
dialog#chooser::backdrop { background: rgba(0, 0, 0, .55); }
dialog#chooser p { margin: 4px 0 0; }
.choices { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.choices button { text-align: left; display: flex; flex-direction: column; }
.choices button.offclass b { font-weight: 400; }
dialog#chooser > button { margin-top: 12px; }
.hero .pick { width: 100%; margin-top: 6px; border-color: var(--accent); color: var(--accent); }
#sound { position: relative; }
#sound-menu { position: absolute; top: 40px; right: 0; width: 290px; z-index: 5; display: flex; flex-direction: column; gap: 8px; }
#sound-menu input[type=range] { display: block; width: 100%; accent-color: var(--accent); }
#sound-menu p { margin: 0; line-height: 1.6; }
#sound-menu h3 { margin-top: 4px; }
#guild .shops button { font-size: 12px; }

#log div { padding: 1px 0; }
#log div.sub { color: var(--muted); padding-left: 22px; }

/* Floating combat text */
.float { position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: 17px;
  text-shadow: 0 1px 3px #000, 0 0 2px #000; animation: rise 1s ease-out forwards; white-space: nowrap; }
.float.hit { color: #ffd76a; } .float.bad { color: #ff6a5e; } .float.good { color: #7be08a; }
.float.miss { color: #c9c4d6; font-size: 13px; }
@keyframes rise { to { transform: translate(-50%, -260%); opacity: 0; } }

@media (max-width: 900px) {
  #right { display: none; }
  #left { width: 220px; }
  #log { left: 244px; right: 12px; }
}
