:root {
  --bg: #0b0b10;
  --panel: #14141d;
  --panel2: #1b1b27;
  --line: #2a2a3a;
  --text: #e6e6f0;
  --muted: #8b8ba0;
  --accent: #ffd34f;
  --green: #8fdc6a;
  --red: #e0483f;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, sans-serif; }

#app { display: flex; flex-direction: column; height: 100vh; }

#topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 16px; background: linear-gradient(90deg, #16131f, #1d1a2b);
  border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: 3px; font-size: 20px; color: var(--accent); }
.brand .tag { display: block; font-size: 11px; letter-spacing: 1px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.hint { font-size: 12px; color: var(--muted); text-align: right; }

main { flex: 1; display: flex; min-height: 0; }

#stage { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  background: #07070b; padding: 8px; overflow: hidden; }
#viewWrap { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
#game { max-width: 100%; max-height: 100%; background: #0b0b10; border: 1px solid var(--line); border-radius: 6px;
  image-rendering: pixelated; cursor: crosshair; }
.three-layer { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: crosshair; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#modeBadge { position: absolute; top: 14px; right: 14px; z-index: 5; font-size: 12px; color: var(--muted);
  background: rgba(10,10,16,0.8); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }

#logpanel { position: absolute; left: 16px; bottom: 16px; width: 330px; max-height: 210px;
  background: rgba(10, 10, 16, 0.86); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; display: flex; flex-direction: column; backdrop-filter: blur(3px); }
.panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 6px; }
#log { overflow-y: auto; font-size: 12.5px; line-height: 1.45; display: flex; flex-direction: column; gap: 3px; }
.log-line { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }
.muted { color: var(--muted); }
.theme { color: var(--accent); font-weight: 600; }
.quest { color: #7fd0ff; }
.joke { color: #b9ffb0; font-style: italic; }
.boss { color: #ff8f6a; font-weight: 600; }
.win { color: var(--green); font-weight: 700; }
.dead { color: var(--red); font-weight: 700; }
.loot_common { color: #c8c8c8; }
.loot_rare { color: #4fa3ff; }
.loot_epic { color: #b061ff; }
.loot_absurd { color: var(--accent); font-weight: 600; }

#side { width: 300px; background: var(--panel); border-left: 1px solid var(--line);
  padding: 14px; overflow-y: auto; }
.hud-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13px; }
.bar { flex: 1; height: 12px; background: #26263a; border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; transition: width .15s; }
.hud-line { font-size: 13px; color: var(--text); margin: 4px 0; }
#quest .quest-title { color: var(--accent); font-weight: 700; font-size: 15px; }
#quest .quest-text { font-size: 13px; margin: 4px 0 8px; }
.quest-meta { font-size: 12px; color: var(--muted); }

.legend { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; }
.dot.player { background: #78d0ff; }
.dot.boss { background: var(--red); }
.dot.relic { background: var(--accent); }
.dot.loot { background: #b061ff; }

/* Экран сотворения мира Демиургом */
#creator { position: absolute; inset: 0; z-index: 20; display: none; align-items: center;
  justify-content: center; background: rgba(6,6,11,0.93); backdrop-filter: blur(3px); }
.creator-box { max-width: 620px; padding: 28px 34px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel); text-align: center; }
.creator-title { font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
.creator-status { font-size: 14px; color: var(--muted); margin-top: 10px; }
.creator-lore { font-size: 14px; line-height: 1.5; color: var(--text); margin: 10px 0; }
.creator-seed { font-size: 13px; color: var(--muted); margin-top: 12px; }
.quest-world { font-size: 15px; font-weight: 700; color: #8fd6ff; margin-bottom: 6px; }
.quest-lore { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; line-height: 1.45; }
.hud-line.warn { color: #b6e05a; }

@media (max-width: 900px) {
  main { flex-direction: column; }
  #side { width: auto; border-left: none; border-top: 1px solid var(--line); }
  #logpanel { position: static; width: auto; margin: 8px; }
  .hint { display: none; }
}
