:root {
  --bg: #0b0d12;
  --panel: #171b24;
  --panel-2: #1f2532;
  --border: #3a4356;
  --gold: #e8c46a;
  --text: #e8e6df;
  --muted: #9aa3b5;
  --hp: #c8423b;
  --mp: #3b7fc8;
  --exp: #6fbf5a;
  --danger: #c8423b;
  --good: #6fbf5a;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #141a26 0%, #07090d 70%);
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 16px;
}

#ui > .ui-panel-layer { pointer-events: auto; }

#boot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 40%, #1a2232 0%, #07090d 75%);
  z-index: 100;
  transition: opacity 0.5s ease;
}

#boot.hidden { opacity: 0; pointer-events: none; }

.boot-title {
  font-size: 54px;
  letter-spacing: 10px;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(232, 196, 106, 0.35);
  font-weight: bold;
}

.boot-sub { color: var(--muted); letter-spacing: 2px; }

.boot-bar {
  width: 320px;
  height: 8px;
  background: #1c2230;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

#boot-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8a6d2f, var(--gold));
  transition: width 0.3s ease;
}

.panel {
  background: rgba(18, 22, 30, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}

.btn {
  font: inherit;
  color: var(--text);
  background: linear-gradient(180deg, #2a3240, #1c2330);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn:hover { border-color: var(--gold); background: linear-gradient(180deg, #333d4e, #222a38); }
.btn:active { transform: translateY(1px); }
.btn.primary { border-color: var(--gold); color: #1a1608; background: linear-gradient(180deg, #f0d589, #c9a244); font-weight: bold; }
.btn.primary:hover { background: linear-gradient(180deg, #ffe6a1, #dcb553); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.bar {
  position: relative;
  background: #0d1017;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.bar > i { display: block; height: 100%; transition: width 0.2s ease; }
.bar > span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  text-shadow: 0 1px 2px #000;
}
.bar.hp > i { background: linear-gradient(180deg, #e35a52, #a32d27); }
.bar.mp > i { background: linear-gradient(180deg, #5aa0e3, #2c62a3); }
.bar.exp > i { background: linear-gradient(180deg, #82d46a, #4b8f3a); }

.scrollable { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3a4356 transparent; }
.scrollable::-webkit-scrollbar { width: 8px; }
.scrollable::-webkit-scrollbar-thumb { background: #3a4356; border-radius: 4px; }
.scrollable::-webkit-scrollbar-track { background: transparent; }

/* ================================================================
   Overlay layers
   ================================================================ */
.ui-hud-layer, .ui-screen-layer, .ui-panel-layer, .ui-toast-layer {
  position: absolute;
  inset: 0;
}
.ui-hud-layer { z-index: 5; pointer-events: none; }
.ui-screen-layer { z-index: 20; }
.ui-panel-layer { z-index: 30; }
.ui-toast-layer { z-index: 60; pointer-events: none; }
.ui-hud-layer.is-hidden, .hud.is-hidden { display: none !important; }

.hud {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 22px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  font: inherit;
  font-size: 12px;
  font-weight: bold;
  color: #f2e6c4;
  background: linear-gradient(180deg, #2b3241, #1a1f2a);
  border: 1px solid #4a5468;
  border-bottom-color: #2a303c;
  border-radius: 5px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .5);
  letter-spacing: .5px;
}

/* ---------------- HUD ---------------- */
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.hud-hero { display: flex; gap: 12px; padding: 10px 14px 10px 10px; min-width: 320px; background: linear-gradient(135deg, rgba(16,20,28,.94), rgba(24,29,40,.88)); }
.hud-portrait {
  width: 64px; height: 64px; flex: 0 0 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0d1017;
  box-shadow: inset 0 0 0 1px rgba(232,196,106,.08);
}
.hud-portrait canvas, .hud-portrait .portrait-img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.portrait-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--gold); font-weight: bold; background: radial-gradient(circle at 50% 30%, #2a3141, #12161e); }
.hud-hero-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.hud-name-row { display: flex; align-items: baseline; gap: 10px; }
.hud-name { font-size: 18px; font-weight: bold; letter-spacing: .4px; color: #f4edda; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-lvl { font-size: 11px; color: var(--gold); letter-spacing: 1px; text-transform: uppercase; }
.hud-lvl-num { font-size: 14px; }
.hud-sub { font-size: 11px; color: var(--muted); letter-spacing: .6px; min-height: 14px; }
.hud-bars { display: flex; flex-direction: column; gap: 3px; }
.hud-bar {
  position: relative; height: 12px;
  background: #0a0d13;
  border: 1px solid #2e3646;
  border-radius: 4px;
  overflow: hidden;
}
.hud-bar i { display: block; height: 100%; width: 0; transition: width .25s ease; }
.hud-bar span { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 6px; font-size: 9px; line-height: 1; color: #fff; text-shadow: 0 1px 2px #000; letter-spacing: .3px; }
.hud-bar.hp i { background: linear-gradient(180deg, #e05048, #8f221d); }
.hud-bar.mp i { background: linear-gradient(180deg, #4b95e0, #22528f); }
.hud-bar.exp i { background: linear-gradient(180deg, #86d86d, #427f31); }

.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; max-width: 320px; }
.hud-location, .hud-gold { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 12px; background: rgba(14,18,25,.88); }
.hud-loc-icon, .hud-gold-icon { color: var(--gold); font-size: 13px; }
.hud-loc-name { letter-spacing: .5px; color: #e9e2d1; }
.hud-gold-num { color: #f0d075; }
.hud-gold-label { color: var(--muted); font-size: 11px; }
.hud-quest { padding: 10px 12px; min-width: 230px; max-width: 320px; background: rgba(14,18,25,.88); }
.hud-quest.is-empty { opacity: .55; }
.hud-quest-head { display: flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold); margin-bottom: 5px; }
.hud-quest-mark { font-size: 12px; }
.hud-quest-name { font-size: 13px; font-weight: bold; color: #f2ecdc; line-height: 1.25; }
.hud-quest-obj { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.hud-help-toggle {
  width: 26px; height: 26px; padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(14,18,25,.9);
  color: var(--muted);
  font-weight: bold;
  cursor: pointer;
}
.hud-help-toggle:hover { color: var(--gold); border-color: var(--gold); }
.hud-controls { position: absolute; right: 22px; top: 96px; width: 224px; padding: 12px 14px; background: rgba(12,15,21,.95); font-size: 12px; }
.hud-controls.is-hidden { display: none; }
.hud-controls-title { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.hud-controls-list { display: flex; flex-direction: column; gap: 6px; }
.hud-control-row { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.hud-control-row kbd { min-width: 70px; }
.hud-bottom { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hud-hint { min-height: 20px; padding: 4px 12px; border-radius: 20px; background: rgba(8,10,14,.72); color: #d8d2c2; font-size: 12px; letter-spacing: .3px; text-shadow: 0 1px 2px #000; transition: opacity .3s; }
.hud-hint:empty { opacity: 0; }
.hud-skills { display: flex; gap: 10px; }
.hud-slot {
  position: relative;
  width: 58px; height: 58px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(12,15,21,.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.hud-slot-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.hud-slot-icon canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.hud-skill-glyph { font-size: 24px; line-height: 1; }
.hud-slot-key { position: absolute; top: -7px; left: -5px; min-width: 18px; height: 18px; padding: 0 4px; font-size: 10px; }
.hud-slot-name { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--muted); white-space: nowrap; max-width: 70px; overflow: hidden; text-overflow: ellipsis; }
.hud-slot-cd { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(5,7,10,.78); border-radius: 9px; color: #fff; font-weight: bold; font-size: 16px; }
.hud-slot.is-cooling .hud-slot-cd { display: flex; }
.hud-quicks { display: flex; gap: 8px; }
.hud-quick-slot {
  position: relative;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(12,15,21,.92);
  border: 1px solid rgba(232,201,122,.35);
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.hud-quick-slot:hover { border-color: var(--gold); transform: translateY(-2px); }
.hud-quick-slot.is-empty { opacity: .45; }
.hud-quick-icon { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.hud-quick-icon canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.hud-quick-count { position: absolute; right: -4px; bottom: -4px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: #2a2012; border: 1px solid rgba(232,201,122,.55); color: #f2dfaa; font-size: 10px; line-height: 14px; text-align: center; }
.hud-quick-key { position: absolute; top: -7px; left: -5px; min-width: 16px; height: 16px; padding: 0 3px; font-size: 9px; }
.hud-quick-name { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); font-size: 8px; color: var(--muted); white-space: nowrap; max-width: 62px; overflow: hidden; text-overflow: ellipsis; }
.hud-screens, .ui-screen-layer { pointer-events: none; }

/* ---------------- Screens ---------------- */
.ui-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: auto;
}
.ui-screen.is-visible { opacity: 1; transform: none; }
.screen-error { padding: 20px; color: #f0a0a0; }

.screen-menu {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(58,47,88,.45), transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(24,52,64,.4), transparent 55%),
    linear-gradient(160deg, #0a0c12 0%, #101522 52%, #080a0f 100%);
}
.menu-bg { position: absolute; inset: 0; overflow: hidden; }
.menu-glow {
  position: absolute; width: 640px; height: 640px; left: -140px; top: -160px;
  background: radial-gradient(circle, rgba(232,196,106,.10), transparent 62%);
  filter: blur(6px);
}
.menu-particles { position: absolute; inset: 0; background-image: radial-gradient(rgba(232,196,106,.22) 1px, transparent 1px); background-size: 92px 92px; opacity: .5; }
.menu-content {
  position: relative;
  width: min(720px, 80vw);
  padding: 46px 54px;
  border: 1px solid rgba(232,196,106,.16);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(15,18,26,.86), rgba(10,12,18,.7));
  box-shadow: 0 30px 90px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.04);
  backdrop-filter: blur(2px);
}
.menu-eyebrow { font-size: 11px; letter-spacing: 5px; text-transform: uppercase; color: var(--gold); opacity: .85; margin-bottom: 12px; }
.game-title { margin: 0; font-size: clamp(42px, 6vw, 74px); line-height: .98; letter-spacing: 10px; font-weight: bold; color: #f5efdf; text-shadow: 0 4px 26px rgba(0,0,0,.8), 0 0 40px rgba(232,196,106,.18); }
.game-title .title-line { display: block; }
.game-title .title-gold { color: var(--gold); text-shadow: 0 0 34px rgba(232,196,106,.35); }
.title-rule { width: 100%; height: 1px; margin: 22px 0 18px; background: linear-gradient(90deg, transparent, rgba(232,196,106,.65), transparent); }
.menu-tagline { font-size: 15px; line-height: 1.55; color: #c9c4b6; max-width: 520px; margin: 0 0 26px; font-style: italic; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; width: 300px; }
.menu-buttons .btn { padding: 13px 20px; font-size: 15px; letter-spacing: 1.4px; text-transform: uppercase; text-align: center; }
.menu-save-note { margin-top: 14px; font-size: 11px; color: var(--muted); letter-spacing: .6px; }
.menu-footer { margin-top: 32px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.06); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: rgba(154,163,181,.65); }

.screen-create {
  background: linear-gradient(180deg, rgba(7,9,13,.97), rgba(12,16,24,.97));
  align-items: stretch;
  padding: 22px;
}
.create-shell { width: min(1180px, 96vw); margin: auto; display: flex; flex-direction: column; gap: 16px; max-height: 100%; }
.create-header { display: flex; align-items: flex-end; gap: 18px; padding: 0 4px 12px; border-bottom: 1px solid rgba(232,196,106,.15); }
.create-eyebrow { font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: var(--gold); opacity: .75; }
.create-title { margin: 0; font-size: 30px; letter-spacing: 2px; color: #f3ecda; }
.create-header .create-back { margin-left: auto; }
.create-body { display: grid; grid-template-columns: 1.05fr 1.15fr .82fr .9fr; gap: 16px; min-height: 0; }
.create-pane { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.pane-title { margin: 0; font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--gold); }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; overflow-y: auto; padding: 2px; }
.choice-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 11px;
  text-align: left;
  color: var(--text);
  background: linear-gradient(170deg, #1a1f2b, #131720);
  border: 1px solid #30394a;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
  font: inherit;
}
.choice-card:hover { border-color: #58657c; transform: translateY(-1px); }
.choice-card.is-selected { border-color: var(--gold); background: linear-gradient(170deg, #2a2717, #1a1a14); box-shadow: 0 0 0 1px rgba(232,196,106,.35), 0 8px 24px rgba(0,0,0,.4); }
.choice-head { display: flex; align-items: center; gap: 9px; }
.choice-portrait { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 7px; overflow: hidden; background: #0c0f15; border: 1px solid #343d4e; }
.choice-portrait canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.choice-name { font-size: 13px; font-weight: bold; letter-spacing: .5px; }
.choice-desc { font-size: 11px; line-height: 1.4; color: var(--muted); }
.mod-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mod-chip { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: rgba(107,127,166,.16); color: #aebbd4; }
.choice-perks { display: flex; flex-direction: column; gap: 3px; }
.perk { font-size: 10px; color: #cbbf98; }
.class-stats { display: flex; flex-wrap: wrap; gap: 4px; font-size: 10px; color: #9aa6bb; margin-top: auto; }
.class-stats span { padding: 1px 5px; background: rgba(255,255,255,.04); border-radius: 3px; }
.create-name { justify-content: flex-start; }
.create-name-input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  color: #f4ecda;
  background: #0e1118;
  border: 1px solid #3a4356;
  border-radius: 8px;
  outline: none;
}
.create-name-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,196,106,.12); }
.name-input-wrap { position: relative; }
.name-counter { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--muted); }
.name-hint { font-size: 10px; line-height: 1.45; color: var(--muted); }
.name-error { font-size: 11px; color: #e07a72; min-height: 14px; }
.create-summary { font-size: 11px; color: var(--muted); line-height: 1.5; }
.create-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.07); }
.create-footer .create-start { min-width: 220px; padding: 12px 20px; }

.screen-story { background: radial-gradient(ellipse at 50% 40%, #131a28, #05070a 75%); }
.story-shell { width: min(1000px, 90vw); display: grid; grid-template-columns: 300px 1fr; gap: 30px; align-items: center; }
.story-art { position: relative; width: 100%; aspect-ratio: 1; border-radius: 14px; overflow: hidden; border: 1px solid rgba(232,196,106,.28); background: #0a0d13; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.story-art canvas, .story-portrait canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.story-art-glow { position: absolute; inset: 0; box-shadow: inset 0 0 60px rgba(232,196,106,.14); }
.story-pane { display: flex; flex-direction: column; gap: 14px; max-height: 74vh; overflow-y: auto; padding-right: 8px; }
.story-title { margin: 0; font-size: 15px; letter-spacing: 3px; text-transform: uppercase; color: var(--gold); }
.story-text { font-size: 18px; line-height: 1.7; color: #ded8c9; margin: 0; }
.story-text p { margin: 0 0 14px; }
.story-text p:last-child { margin-bottom: 0; }
.story-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 6px; }
.story-dots { display: flex; gap: 6px; }
.story-dot { width: 7px; height: 7px; border-radius: 50%; background: #3a4356; }
.story-dot.is-active { background: var(--gold); }
.story-counter { font-size: 10px; letter-spacing: 1.5px; color: var(--muted); }
.story-hint { font-size: 10px; color: var(--muted); }
.story-next { min-width: 180px; }

.screen-gameover, .screen-victory { background: radial-gradient(ellipse at 50% 40%, rgba(40,12,12,.94), #05060a 76%); }
.screen-victory { background: radial-gradient(ellipse at 50% 40%, rgba(44,36,14,.92), #05060a 76%); }
.gameover-shell, .ending-shell { width: min(640px, 90vw); padding: 34px 38px; text-align: center; background: linear-gradient(170deg, rgba(22,17,17,.96), rgba(10,11,15,.96)); border: 1px solid #4a2d2d; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.ending-shell { border-color: rgba(232,196,106,.3); }
.gameover-shell h2, .ending-title { margin: 8px 0 12px; font-size: 34px; letter-spacing: 4px; color: #e4a09a; }
.ending-title { color: var(--gold); }
.ending-eyebrow { font-size: 10px; letter-spacing: 4px; text-transform: uppercase; color: var(--muted); }
.ending-subtitle { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.ending-text { max-height: 38vh; overflow-y: auto; margin: 16px 0; text-align: left; font-size: 14px; line-height: 1.7; color: #d8d2c4; padding: 0 6px; }
.ending-text p { margin: 0 0 12px; }
.ending-stats { display: flex; justify-content: center; gap: 26px; margin: 14px 0 18px; font-size: 12px; color: var(--muted); }
.ending-hint { font-size: 10px; letter-spacing: 2px; color: var(--muted); margin-top: 16px; }
.gameover-cool { opacity: .8; }
.ending-actions .btn { min-width: 200px; }

.credits-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; background: #05070a; }
.credits-scroll { flex: 1; overflow-y: auto; padding: 10vh 0; text-align: center; }
.credits-line { font-size: 14px; letter-spacing: 2px; color: #c9c2b2; padding: 8px 0; }
.credits-gap { height: 34px; }
.credits-back { margin: 10px auto 18px; }

/* ---------------- Panel skeleton ---------------- */
.ui-panel-layer { display: flex; align-items: center; justify-content: center; padding: 24px; }
.ui-panel-layer:empty { display: none; }
.ui-backdrop { position: absolute; inset: 0; background: rgba(3,5,8,.66); backdrop-filter: blur(3px); }
.panel-window {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(960px, 92vw);
  max-height: 88vh;
  padding: 22px 26px;
  background: linear-gradient(165deg, #1a1f2a, #10141c 70%);
  border: 1px solid #3c465a;
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0,0,0,.72), inset 0 1px 0 rgba(255,255,255,.05);
  animation: panel-in .18s ease-out;
}
@keyframes panel-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.panel-dialogue { width: min(880px, 92vw); }
.panel-shop { width: min(900px, 92vw); }
.panel-trainer { width: min(820px, 92vw); }
.panel-inventory { width: min(1060px, 94vw); }
.panel-skills { width: min(900px, 92vw); }
.panel-quests { width: min(900px, 92vw); }
.panel-map { width: min(1020px, 94vw); }
.panel-pause { width: min(620px, 92vw); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.panel-head-text { min-width: 0; }
.panel-title { margin: 0; font-size: 22px; letter-spacing: 1.5px; color: #f3ebd8; }
.panel-sub { margin-top: 4px; font-size: 11px; letter-spacing: 1px; color: var(--muted); }
.panel-head-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.panel-close { width: 32px; height: 32px; border-radius: 8px; border: 1px solid #3a4356; background: #171c26; color: var(--muted); font-size: 14px; cursor: pointer; }
.panel-close:hover { color: #fff; border-color: #66748c; }
.panel-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 12px; }
.panel-inset { background: rgba(8,11,16,.55); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 14px; }
.panel-error { padding: 24px; color: #e08a84; text-align: center; }
.panel-alias { display: contents; }
.gold-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 20px; background: rgba(232,196,106,.1); border: 1px solid rgba(232,196,106,.32); font-size: 12px; color: #f0d075; }
.gold-chip-icon { font-size: 12px; }
.mini-bar { height: 8px; background: #0a0d13; border: 1px solid #2c3444; border-radius: 4px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a6d2f, var(--gold)); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 20px; text-align: center; color: var(--muted); }
.empty-glyph { font-size: 30px; color: rgba(232,196,106,.5); }
.empty-text { font-size: 14px; color: #c9c3b4; }
.empty-sub { font-size: 11px; }
.muted-note { font-size: 11px; color: var(--muted); }
.rule-gem { color: var(--gold); }
.rarity-tag { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; border: 1px solid currentColor; }
.rarity-common { color: #b9c1cf; }
.rarity-uncommon { color: #7fce84; }
.rarity-rare { color: #6fa8e8; }
.rarity-epic { color: #c08be8; }
.rarity-legendary { color: #f0c064; }
.tag-good { font-size: 9px; padding: 1px 6px; border-radius: 4px; background: rgba(111,191,90,.16); color: #8fd47a; letter-spacing: .5px; }
.tag-main { font-size: 9px; padding: 1px 6px; border-radius: 4px; background: rgba(232,196,106,.15); color: var(--gold); letter-spacing: .5px; }
.btn.small { padding: 6px 11px; font-size: 12px; }
.btn.ghost { background: transparent; border-color: #3a4356; color: var(--muted); }
.btn.ghost:hover { color: #eee; border-color: #66748c; }
.btn.danger { border-color: #6a3434; color: #e3a09a; background: linear-gradient(180deg, #2a1b1b, #1c1414); }
.btn.danger.is-confirm { background: #7a2e2a; color: #fff; border-color: #b0554e; }

/* ---------------- Dialogue ---------------- */
.dialogue-box { display: flex; flex-direction: column; gap: 14px; }
.dialogue-main { display: flex; gap: 18px; align-items: flex-start; }
.dialogue-portrait { width: 110px; height: 110px; flex: 0 0 110px; border-radius: 10px; overflow: hidden; border: 1px solid #3c465a; background: #0a0d13; }
.dialogue-portrait canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.dialogue-body { flex: 1; min-width: 0; }
.dialogue-name { font-size: 16px; font-weight: bold; color: var(--gold); letter-spacing: 1px; margin-bottom: 6px; }
.dialogue-text { font-size: 15px; line-height: 1.65; color: #e4dece; min-height: 66px; }
.dialogue-options { display: flex; flex-direction: column; gap: 6px; }
.dialogue-option { display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 12px; border-radius: 8px; border: 1px solid #333c4e; background: #161b25; color: #ddd7c8; font: inherit; font-size: 13px; cursor: pointer; }
.dialogue-option:hover { border-color: var(--gold); background: #22201a; color: #fff; }
.dialogue-option-mark { color: var(--gold); font-size: 10px; }
.dialogue-hint { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); text-align: right; }

/* ---------------- Shop ---------------- */
.shop-panel { display: flex; flex-direction: column; }
.shop-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1 1 auto; min-height: 120px; max-height: 54vh; padding-right: 4px; }
.shop-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; background: rgba(255,255,255,.025); }
.shop-row:hover { border-color: #3c465a; background: rgba(255,255,255,.05); }
.shop-row-info { min-width: 0; }
.shop-row-top { display: flex; align-items: center; gap: 8px; }
.shop-row-name { font-size: 13px; font-weight: bold; color: #e9e2d1; }
.shop-row-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.shop-row-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 3px; font-size: 10px; color: #98a4ba; }
.shop-row-stats { display: flex; gap: 8px; flex-wrap: wrap; font-size: 10px; color: #b9a877; margin-top: 2px; }
.shop-price { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #f0d075; }
.shop-price-icon { font-size: 11px; }
.shop-row-buy { grid-column: 3; }
.shop-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.item-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 7px; background: #0c0f15; border: 1px solid #333c4e; overflow: hidden; }
.item-icon canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.icon-glyph { font-size: 18px; }
.tab-bar { display: flex; gap: 4px; padding: 4px; border-radius: 9px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.06); margin-bottom: 12px; align-self: flex-start; }
.tab-bar .btn { border: none; background: transparent; color: var(--muted); padding: 6px 16px; font-size: 12px; }
.tab-bar .btn.is-active { background: #2a3140; color: #f2e8d4; }

/* ---------------- Trainer ---------------- */
.trainer-panel { display: flex; flex-direction: column; }
.trainer-list { display: flex; flex-direction: column; gap: 7px; overflow-y: auto; }
.trainer-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 11px 13px; border-radius: 9px; border: 1px solid #2f3849; background: rgba(255,255,255,.025); }
.trainer-row.is-learned { opacity: .62; }
.trainer-row-top { display: flex; align-items: center; gap: 9px; }
.trainer-name { font-size: 14px; font-weight: bold; color: #eee6d3; }
.trainer-desc { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.trainer-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 5px; font-size: 10px; color: #a9b4c8; }
.trainer-meta span { padding: 1px 6px; background: rgba(255,255,255,.04); border-radius: 3px; }
.trainer-action { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.trainer-info { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding: 10px 12px; border-radius: 9px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.05); font-size: 12px; color: var(--muted); }

/* ---------------- Inventory ---------------- */
.inventory-panel { display: flex; flex-direction: column; min-height: 0; }
.inventory-body { display: grid; grid-template-columns: 1.35fr .9fr; gap: 16px; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.inventory-left { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: hidden; }
.inventory-right { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.inventory-equip { display: flex; gap: 12px; }
.equip-slot { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 9px; border: 1px dashed #3a4356; background: rgba(0,0,0,.18); }
.equip-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.equip-row { display: flex; align-items: center; gap: 9px; }
.equip-name { font-size: 12px; color: #e7dfcd; }
.equip-meta { font-size: 10px; color: #a9b4c8; }
.equip-empty-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 7px; border: 1px dashed #333c4e; color: #4c566b; }
.inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 7px; align-content: start; overflow-y: auto; padding: 2px; flex: 1 1 auto; min-height: 0; }
.inv-cell { position: relative; width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid #333c4e; background: linear-gradient(160deg, #191e28, #11151d); cursor: pointer; overflow: hidden; }
.inv-cell:hover { border-color: #6b788f; }
.inv-cell.is-selected { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(232,196,106,.4); }
.inv-cell canvas { width: 82%; height: 82%; image-rendering: pixelated; }
.inv-count { position: absolute; right: 3px; bottom: 2px; min-width: 15px; padding: 0 3px; border-radius: 4px; background: rgba(5,7,10,.85); font-size: 9px; color: #e9e2d1; text-align: center; }
.inventory-details { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.inv-detail-head { display: flex; gap: 12px; align-items: center; }
.inv-detail-title { font-size: 16px; font-weight: bold; color: #f2ead8; }
.inv-detail-type { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.inv-detail-desc { font-size: 12px; line-height: 1.55; color: #c4c8d2; }
.inv-detail-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.inv-detail-stats span { font-size: 11px; padding: 3px 7px; border-radius: 5px; background: rgba(111,191,90,.1); color: #a7df97; border: 1px solid rgba(111,191,90,.18); }
.inv-detail-meta { font-size: 11px; color: var(--muted); line-height: 1.5; }
.inv-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.inventory-hero { margin-top: auto; }
.hero-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hero-stat { padding: 8px 4px; border-radius: 7px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.05); text-align: center; min-width: 0; }
.stat-k { display: block; font-size: 9px; letter-spacing: 1.5px; color: var(--muted); }
.stat-v { display: block; margin-top: 3px; font-size: 15px; font-weight: bold; color: var(--gold); }
.inventory-note { font-size: 10px; color: var(--muted); }
.equipment-mini { display: flex; gap: 14px; font-size: 11px; color: #a9b4c8; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-cell { padding: 8px; border-radius: 7px; background: rgba(0,0,0,.2); text-align: center; }
.stat-cell .stat-k { font-size: 9px; }

/* ---------------- Skills ---------------- */
.skills-panel { display: flex; flex-direction: column; }
.skills-hint { font-size: 11px; color: var(--muted); margin-bottom: 10px; line-height: 1.4; }
.skill-slot-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.skill-slot-card { display: flex; flex-direction: column; gap: 6px; padding: 11px; border-radius: 9px; border: 1px solid #333c4e; background: linear-gradient(165deg, #1a1f2a, #12161e); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.skill-slot-card.is-active { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(232,196,106,.3); }
.skill-slot-card.is-empty { opacity: .7; border-style: dashed; }
.skill-slot-key { align-self: flex-start; }
.skill-slot-name { font-size: 12px; font-weight: bold; color: #e9e2d1; }
.skill-slot-meta { font-size: 10px; color: var(--muted); }
.skill-assign-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 4px 0 8px; }
.skills-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.skill-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 8px; border: 1px solid transparent; background: rgba(255,255,255,.025); }
.skill-row.is-assigned { border-color: rgba(232,196,106,.4); background: rgba(232,196,106,.05); }
.skill-row-top { display: flex; align-items: center; gap: 8px; }
.skill-row-name { font-size: 13px; font-weight: bold; color: #e9e2d1; }
.skill-row-desc { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.skill-row-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 10px; color: #a9b4c8; }
.skill-badge { font-size: 9px; letter-spacing: 1px; padding: 2px 6px; border-radius: 4px; background: rgba(232,196,106,.15); color: var(--gold); text-transform: uppercase; }
.skill-icon { width: 42px; height: 42px; border-radius: 7px; border: 1px solid #333c4e; background: #0c0f15; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.skill-icon canvas { width: 100%; height: 100%; image-rendering: pixelated; }

/* ---------------- Quests ---------------- */
.quests-panel { display: flex; flex-direction: column; }
.quest-list { display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }
.quest-card { padding: 12px 14px; border-radius: 9px; border: 1px solid #2f3849; background: rgba(255,255,255,.025); }
.quest-card.is-completed { opacity: .6; }
.quest-head { display: flex; align-items: flex-start; gap: 10px; }
.quest-title-wrap { flex: 1; min-width: 0; }
.quest-name { font-size: 14px; font-weight: bold; color: #eee6d3; }
.quest-desc { font-size: 11px; line-height: 1.5; color: var(--muted); margin-top: 3px; }
.quest-badges { display: flex; gap: 5px; flex-shrink: 0; }
.quest-objectives { display: flex; flex-direction: column; gap: 4px; margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,.06); }
.quest-objective { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #b9bfcb; }
.quest-obj-mark { color: var(--gold); font-size: 9px; }
.quest-obj-desc { flex: 1; }
.quest-obj-count { color: #8fd47a; font-size: 10px; }
.quest-objective.is-done .quest-obj-desc { text-decoration: line-through; color: #6c7a8f; }
.quest-reward { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 10px; color: #cbbf98; }
.quest-reward-label { color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }

/* ---------------- Map ---------------- */
.map-panel { display: flex; flex-direction: column; }
.map-wrap { position: relative; border-radius: 11px; overflow: hidden; border: 1px solid #333c4e; background: radial-gradient(ellipse at 50% 45%, #1b2331, #0b0e14 75%); }
.map-canvas { position: relative; width: 100%; aspect-ratio: 2 / 1; }
.map-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-lines line { stroke: #3f4c62; stroke-width: .4; vector-effect: non-scaling-stroke; }
.map-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; padding: 6px; }
.map-node-icon { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid #3c465a; background: radial-gradient(circle at 40% 30%, #2a3242, #121720); font-size: 20px; color: #9aa6bb; transition: all .15s; }
.map-node.is-current .map-node-icon { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 0 4px rgba(232,196,106,.1), 0 0 26px rgba(232,196,106,.25); }
.map-node.is-unvisited .map-node-icon { opacity: .45; }
.map-node.is-locked .map-node-icon { opacity: .35; border-style: dashed; }
.map-node:hover .map-node-icon { border-color: #7e8ba2; color: #dfe6f2; }
.map-node-name { font-size: 10px; letter-spacing: .5px; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.map-node-ring { display: none; }
.map-node-status { font-size: 9px; color: var(--gold); }
.map-legend, .map-exits { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 10px; color: var(--muted); }
.map-info { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.05); }
.map-info-icon { font-size: 20px; color: var(--gold); }
.map-info-head { flex: 1; }
.map-info-name { font-size: 13px; font-weight: bold; color: #e9e2d1; }
.map-info-desc { font-size: 10px; color: var(--muted); margin-top: 2px; }
.map-panel .legend-item { display: flex; align-items: center; gap: 5px; }
.map-exits-label { letter-spacing: 1px; text-transform: uppercase; }

/* ---------------- Pause ---------------- */
.pause-panel { text-align: center; }
.pause-title { margin: 0 0 4px; font-size: 26px; letter-spacing: 4px; color: var(--gold); }
.pause-eyebrow { font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); }
.pause-hero { margin: 16px 0; padding: 12px; border-radius: 9px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.05); font-size: 12px; color: #c9c3b4; }
.pause-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.pause-buttons .btn { padding: 10px 12px; }
.pause-hint { margin-top: 12px; font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.pause-quit { grid-column: 1 / -1; }

/* ---------------- Toasts ---------------- */
.ui-toast-layer { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding: 18px; }
.toast { display: flex; align-items: flex-start; gap: 10px; min-width: 240px; max-width: 360px; padding: 11px 14px; border-radius: 9px; border: 1px solid #3c465a; background: rgba(14,18,25,.96); box-shadow: 0 12px 30px rgba(0,0,0,.5); opacity: 0; transform: translateX(16px); transition: opacity .25s, transform .25s; }
.toast.is-in { opacity: 1; transform: none; }
.toast.is-out { opacity: 0; transform: translateX(16px); }
.toast-icon { font-size: 16px; color: var(--gold); line-height: 1.2; }
.toast-body { min-width: 0; }
.toast-title { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin-bottom: 2px; }
.toast-text { font-size: 12px; line-height: 1.45; color: #e0dacb; }
.toast.kind-level { border-color: rgba(232,196,106,.45); }
.toast.kind-level .toast-icon { color: #f0d075; }

/* ---------------- Responsive ---------------- */
@media (max-height: 760px) {
  .menu-content { padding: 30px 42px; }
  .game-title { font-size: 54px; }
  .create-shell { gap: 10px; }
  .create-body { grid-template-columns: 1fr 1fr; }
  .create-name { grid-column: auto; }
  .panel-window { max-height: 92vh; padding: 16px 20px; }
  .dialogue-portrait { width: 84px; height: 84px; flex-basis: 84px; }
  .dialogue-text { font-size: 14px; min-height: 52px; }
}
@media (max-width: 1000px) {
  .create-body { grid-template-columns: 1fr; overflow-y: auto; }
  .create-name { grid-column: auto; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .inventory-body { grid-template-columns: 1fr; overflow-y: auto; }
  .story-shell { grid-template-columns: 1fr; }
  .story-art { max-width: 220px; margin: 0 auto; }
}

/* ---------------- Minimap ---------------- */
.hud-minimap {
  width: 192px;
  padding: 8px 8px 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: linear-gradient(180deg, rgba(16,20,30,.94), rgba(10,13,20,.9));
}
.hud-minimap-title {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
}
.hud-minimap-canvas {
  width: 176px;
  height: 120px;
  display: block;
  image-rendering: pixelated;
  border: 1px solid rgba(232,196,106,.25);
  border-radius: 4px;
  background: #080b12;
}

/* ---------------- Inventory compare ---------------- */
.inv-compare {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(10,14,22,.55);
  border: 1px solid rgba(120,140,180,.16);
}
.inv-compare-head {
  font-size: 10px;
  letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 5px;
}
.inv-compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  font-size: 12px;
}
.inv-compare-stat { color: #cfc9bb; }
.inv-compare-val { font-variant-numeric: tabular-nums; font-weight: 700; }
.inv-compare-val.is-up { color: #7ecb72; }
.inv-compare-val.is-down { color: #d9675f; }
.inv-compare-same { font-size: 11px; color: var(--muted); font-style: italic; }

/* ---------------- Pause settings ---------------- */
.pause-settings {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(9,12,18,.55);
  border: 1px solid rgba(120,140,180,.14);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.pause-settings-title {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}
.pause-setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pause-setting-label { font-size: 11px; color: var(--muted); min-width: 84px; }
.pause-setting-val {
  min-width: 42px;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #e8e6df;
}
.pause-range {
  flex: 1;
  accent-color: var(--gold);
  height: 4px;
  cursor: pointer;
}
.pause-toggle { flex: 1; justify-content: center; }

.pause-saves { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.pause-save-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pause-save-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 9px 10px;
  background: rgba(10,13,18,.72);
  border: 1px solid var(--border);
  border-radius: 9px;
  min-height: 92px;
}
.pause-save-card.has-save { border-color: rgba(232,201,122,.35); }
.pause-save-label { font-size: 10px; letter-spacing: .8px; text-transform: uppercase; color: var(--gold); }
.pause-save-name { font-size: 12px; color: #eae6da; font-weight: 600; }
.pause-save-meta { font-size: 10px; color: var(--muted); }
.pause-save-empty { font-size: 11px; color: rgba(200,196,184,.45); font-style: italic; padding: 8px 0; }
.pause-save-btns { display: flex; gap: 4px; margin-top: auto; flex-wrap: wrap; }
.pause-save-btns .btn { padding: 3px 7px; font-size: 10px; }

.bestiary-panel { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.bestiary-progress { font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; }
.bestiary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
  max-height: 56vh;
}
.bestiary-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 11px 12px;
  background: rgba(11,14,20,.8);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.bestiary-card.is-seen { border-color: rgba(232,201,122,.28); }
.bestiary-card.is-locked { opacity: .62; }
.bestiary-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.bestiary-name { font-weight: 600; color: #efe9d8; font-size: 14px; }
.bestiary-level { font-size: 10px; color: var(--muted); white-space: nowrap; }
.bestiary-boss { align-self: flex-start; }
.bestiary-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.bestiary-stat { display: flex; flex-direction: column; font-size: 9px; color: var(--muted); }
.bestiary-stat b { font-size: 12px; color: #e6e0d0; }
.bestiary-desc { font-size: 11px; color: #c9c3b4; line-height: 1.35; }
.bestiary-kills { font-size: 10px; color: var(--gold); }
.bestiary-loot { display: flex; flex-wrap: wrap; gap: 4px; font-size: 10px; color: var(--muted); }
.bestiary-loot-label { color: var(--gold); }
.bestiary-loot-item { padding: 1px 5px; border: 1px solid var(--border); border-radius: 6px; }
.bestiary-locked { font-size: 11px; color: rgba(200,196,184,.5); font-style: italic; }

.inv-filters { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.inv-filter {
  padding: 4px 9px;
  font-size: 10px;
  color: var(--muted);
  background: rgba(12,15,21,.8);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
}
.inv-filter:hover { color: #efe9d8; border-color: rgba(232,201,122,.4); }
.inv-filter.is-active { color: #1b1509; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.inv-quick-assign { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.inv-quick-label { font-size: 10px; color: var(--muted); }
.inv-quick-btn { min-width: 28px; justify-content: center; }

.difficulty-grid { grid-template-columns: 1fr; }
.difficulty-card { padding: 9px 10px; }
.difficulty-card .choice-name { font-size: 13px; }
.difficulty-card .class-stats { margin-top: 2px; }

.pause-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.pause-stat { padding: 6px 8px; background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.05); border-radius: 7px; min-width: 0; }
.pause-stat-label { display: block; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pause-stat-value { display: block; margin-top: 2px; font-size: 13px; color: #efe9d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.achievements-panel { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.achievements-progress { font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; }
.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 9px; overflow-y: auto; padding-right: 4px; max-height: 56vh; }
.achievement-card { display: flex; gap: 10px; padding: 10px 12px; background: rgba(11,14,20,.8); border: 1px solid var(--border); border-radius: 10px; opacity: .68; }
.achievement-card.is-unlocked { opacity: 1; border-color: rgba(232,201,122,.34); background: linear-gradient(135deg, rgba(232,201,122,.08), rgba(11,14,20,.85)); }
.achievement-icon { width: 34px; height: 34px; flex: 0 0 34px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: rgba(0,0,0,.3); border: 1px solid rgba(232,201,122,.18); font-size: 18px; color: var(--gold); }
.achievement-body { flex: 1 1 auto; min-width: 0; }
.achievement-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.achievement-name { font-size: 13px; font-weight: 600; color: #efe9d8; }
.achievement-state { font-size: 10px; color: var(--muted); white-space: nowrap; }
.achievement-card.is-unlocked .achievement-state { color: var(--gold); }
.achievement-desc { margin-top: 3px; font-size: 11px; color: #c9c3b4; line-height: 1.3; }
.achievement-bar { margin-top: 7px; height: 4px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.achievement-fill { height: 100%; background: var(--gold); border-radius: 3px; }
.achievement-card:not(.is-unlocked) .achievement-fill { background: rgba(232,201,122,.45); }
@media (max-height: 700px) {
  .hud-minimap { display: none; }
}
@media (max-height: 800px) {
  .pause-settings { padding: 9px 11px; gap: 6px; margin-top: 9px; }
  .pause-btn { padding-top: 7px; padding-bottom: 7px; }
}

/* ---------------- Network screens ---------------- */
.screen-auth, .screen-characters { background: radial-gradient(ellipse at 30% 20%, rgba(38,48,74,.55), transparent 55%), linear-gradient(160deg, #080a10, #101622 55%, #07090e); align-items: stretch; padding: 22px; }
.net-bg { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(232,196,106,.16) 1px, transparent 1px); background-size: 108px 108px; opacity: .35; }
.net-shell { position: relative; width: min(1060px, 96vw); margin: auto; display: flex; flex-direction: column; gap: 16px; max-height: 100%; }
.net-header { display: flex; align-items: flex-end; gap: 20px; padding: 0 4px 14px; border-bottom: 1px solid rgba(232,196,106,.16); }
.net-brand { font-size: 11px; letter-spacing: 5px; color: var(--gold); opacity: .8; white-space: nowrap; }
.net-head-text { flex: 1 1 auto; }
.net-title { margin: 0; font-size: 30px; letter-spacing: 2px; color: #f3ecda; }
.net-subtitle { margin-top: 2px; font-size: 12px; color: var(--muted); }
.net-back, .net-logout { margin-left: auto; }
.net-card { width: min(470px, 92vw); margin: 10px auto 0; padding: 22px; border: 1px solid rgba(232,196,106,.16); border-radius: 16px; background: linear-gradient(165deg, rgba(20,25,36,.92), rgba(11,14,20,.88)); box-shadow: 0 26px 70px rgba(0,0,0,.55); display: flex; flex-direction: column; gap: 12px; }
.net-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 9px; background: rgba(0,0,0,.26); border: 1px solid rgba(255,255,255,.05); }
.net-tab { flex: 1 1 0; padding: 8px 10px; font: inherit; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); background: transparent; border: 0; border-radius: 6px; cursor: pointer; }
.net-tab.is-active { color: #1b1509; background: var(--gold); font-weight: 600; }
.net-form { display: flex; flex-direction: column; gap: 10px; }
.net-field { display: flex; flex-direction: column; gap: 5px; }
.net-label { font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); }
.net-input { width: 100%; padding: 10px 12px; font: inherit; font-size: 13px; color: var(--text); background: rgba(6,8,12,.72); border: 1px solid #333c4d; border-radius: 8px; outline: none; transition: border-color .15s, box-shadow .15s; }
.net-input:focus { border-color: rgba(232,196,106,.65); box-shadow: 0 0 0 2px rgba(232,196,106,.12); }
.net-error { display: none; padding: 8px 10px; border-radius: 7px; background: rgba(200,66,59,.14); border: 1px solid rgba(200,66,59,.4); color: #f0b3ad; font-size: 12px; }
.net-error.is-visible { display: block; }
.net-submit { width: 100%; margin-top: 2px; padding: 12px; font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase; }
.net-note { font-size: 11px; line-height: 1.45; color: var(--muted); border-top: 1px solid rgba(255,255,255,.06); padding-top: 10px; }
.net-server { display: flex; flex-direction: column; gap: 5px; border-top: 1px solid rgba(255,255,255,.06); padding-top: 10px; }
.net-server-row { display: flex; gap: 6px; align-items: center; }
.net-server-row .net-input { flex: 1 1 auto; }
.net-server-row .btn { padding: 9px 10px; font-size: 11px; white-space: nowrap; }
.net-server-status { min-height: 14px; font-size: 10px; color: var(--muted); }
.net-server-status.is-ok { color: #8fd07a; }

.net-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.net-slot { display: flex; flex-direction: column; align-items: center; gap: 7px; min-height: 250px; padding: 14px 10px; border: 1px solid #30394a; border-radius: 12px; background: linear-gradient(170deg, #1a1f2b, #10141d); text-align: center; }
.net-slot.is-empty { border-style: dashed; opacity: .85; }
.net-slot-index { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.net-slot-plus { width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px dashed rgba(232,196,106,.4); color: var(--gold); font-size: 26px; }
.net-slot-portrait { width: 64px; height: 64px; border-radius: 9px; overflow: hidden; background: #0b0e14; border: 1px solid #343d4e; }
.net-portrait { width: 64px; height: 64px; image-rendering: pixelated; display: block; }
.net-slot-name { font-size: 14px; font-weight: 600; color: #f1ead9; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.net-slot-meta, .net-slot-level { font-size: 11px; color: var(--muted); line-height: 1.35; }
.net-slot-actions { display: flex; flex-direction: column; gap: 5px; width: 100%; margin-top: auto; }
.net-slot-actions .btn { width: 100%; padding: 7px 8px; font-size: 11px; }
.net-slot-empty-text { font-size: 11px; color: var(--muted); }
.net-loading { min-height: 16px; font-size: 12px; color: var(--muted); text-align: center; }
.net-auth .net-card { margin-top: 4px; }

@media (max-width: 1040px) { .net-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .net-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); } .net-header { flex-wrap: wrap; } }

/* ---------------- Chat ---------------- */
.chat-widget { position: absolute; left: 18px; bottom: 18px; width: 380px; z-index: 60; display: none; flex-direction: column; background: rgba(8,11,16,.88); border: 1px solid rgba(232,196,106,.18); border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.55); overflow: hidden; pointer-events: auto; backdrop-filter: blur(3px); }
.chat-widget.is-visible { display: flex; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); border-bottom: 1px solid rgba(255,255,255,.06); cursor: pointer; }
.chat-unread { display: none; min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--gold); color: #1b1509; font-size: 9px; line-height: 15px; text-align: center; letter-spacing: 0; }
.chat-unread.is-visible { display: inline-block; }
.chat-log { display: flex; flex-direction: column; gap: 3px; padding: 6px 10px; max-height: 92px; overflow: hidden; }
.chat-widget.is-open .chat-log { max-height: 190px; overflow-y: auto; }
.chat-line { font-size: 12px; line-height: 1.35; color: #d8d3c6; word-wrap: break-word; }
.chat-line.chat-empty { color: rgba(154,163,181,.7); font-style: italic; }
.chat-line.chat-system { color: #b9a06d; font-style: italic; }
.chat-line.chat-trade .chat-from { color: #d9b36a; }
.chat-line.chat-party .chat-from { color: #7fb7e8; }
.chat-line.chat-guild .chat-from { color: #9fd98f; }
.chat-line.chat-whisper .chat-from { color: #cf9fe8; }
.chat-from { color: var(--muted); margin-right: 4px; }
.chat-text { color: #e8e3d6; }
.chat-form { display: none; gap: 5px; padding: 7px 8px; border-top: 1px solid rgba(255,255,255,.06); background: rgba(5,7,10,.5); }
.chat-widget.is-open .chat-form { display: flex; }
.chat-channel, .chat-target, .chat-input { font: inherit; font-size: 12px; color: var(--text); background: rgba(6,8,12,.8); border: 1px solid #333c4d; border-radius: 6px; padding: 6px 8px; outline: none; }
.chat-channel { flex: 0 0 92px; }
.chat-target { flex: 0 0 76px; }
.chat-input { flex: 1 1 auto; min-width: 0; }
.chat-channel:focus, .chat-target:focus, .chat-input:focus { border-color: rgba(232,196,106,.6); }

/* ---------------- M3: группа и ролл добычи ---------------- */
.panel-party { width: min(640px, calc(100vw - 48px)); }
.party-panel { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.party-size { font-size: 12px; color: var(--gold); border: 1px solid rgba(232,196,106,.35); border-radius: 20px; padding: 3px 10px; letter-spacing: 1px; }
.party-invite { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: rgba(232,196,106,.08); border: 1px solid rgba(232,196,106,.35); border-radius: 8px; }
.party-invite-text { font-size: 13px; color: #f0e5c9; }
.party-list { display: flex; flex-direction: column; gap: 7px; max-height: 300px; overflow-y: auto; }
.party-member { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: rgba(9,12,18,.72); border: 1px solid #2a3242; border-radius: 8px; }
.party-member.is-leader { border-color: rgba(232,196,106,.4); }
.party-member.is-self { background: rgba(232,196,106,.06); }
.party-icon { flex: 0 0 auto; }
.party-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.party-member-head { display: flex; align-items: baseline; gap: 8px; }
.party-name { font-size: 14px; color: #f1e9d4; }
.party-level { font-size: 11px; color: var(--muted); }
.party-crown { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: #1b1509; background: var(--gold); border-radius: 3px; padding: 1px 5px; }
.party-class { font-size: 11px; color: #9aa3b5; }
.party-hp { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--muted); }
.party-hp .mini-bar { flex: 1 1 auto; height: 6px; }
.party-kick { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 1px solid #4a2f2f; background: rgba(80,24,24,.5); color: #e8a0a0; cursor: pointer; }
.party-invite-form { display: flex; gap: 8px; }
.party-invite-form .input { flex: 1 1 auto; }
.party-actions { display: flex; gap: 8px; justify-content: flex-end; }
.party-actions .btn-danger { background: rgba(120,30,30,.5); border-color: #6a3030; color: #f0b4b4; }

.ui-loot-layer { position: absolute; top: 84px; right: 18px; z-index: 130; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.loot-roll-card { width: 336px; padding: 11px 12px 12px; background: rgba(10,13,19,.96); border: 1px solid rgba(232,196,106,.5); border-radius: 10px; box-shadow: 0 16px 44px rgba(0,0,0,.65); pointer-events: auto; opacity: 0; transform: translateX(18px); transition: opacity .2s, transform .2s; }
.loot-roll-card.is-in { opacity: 1; transform: none; }
.loot-roll-card.is-out { opacity: 0; transform: translateX(18px); }
.loot-roll-card.is-voted { opacity: .75; }
.loot-roll-title { font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.loot-roll-body { display: flex; align-items: center; gap: 10px; }
.loot-roll-info { min-width: 0; }
.loot-roll-item { font-size: 14px; color: #f3ead3; }
.loot-roll-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.loot-roll-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.loot-roll-actions .btn { padding: 5px 9px; font-size: 11px; }
.loot-roll-timer { margin-left: auto; font-size: 11px; color: var(--muted); }

/* ---------------- M4: аукцион ---------------- */
.panel-auction { width: min(880px, calc(100vw - 48px)); }
.auction-panel { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.auction-gold { font-size: 12px; color: var(--gold); border: 1px solid rgba(232,196,106,.35); border-radius: 20px; padding: 3px 10px; font-variant-numeric: tabular-nums; }
.auction-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr); gap: 14px; min-height: 0; }
.auction-lots { display: flex; flex-direction: column; gap: 7px; max-height: 380px; overflow-y: auto; padding-right: 4px; }
.auction-col-title { font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold); margin-bottom: 2px; }
.auction-lot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(9,12,18,.72); border: 1px solid #2a3242; border-radius: 8px; }
.auction-lot.is-own { border-color: rgba(232,196,106,.28); background: rgba(232,196,106,.05); }
.auction-icon { flex: 0 0 auto; }
.auction-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.auction-name { font-size: 13px; color: #f1e9d4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auction-seller { font-size: 10px; color: var(--muted); }
.auction-price { font-size: 12px; color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.auction-lot .btn { padding: 5px 9px; font-size: 11px; white-space: nowrap; }
.auction-side { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: rgba(9,12,18,.5); border: 1px solid #232b3a; border-radius: 9px; align-self: start; }
.auction-form { display: flex; flex-direction: column; gap: 6px; }
.auction-form .input { width: 100%; }
.auction-form .btn { margin-top: 4px; }
.auction-label { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.auction-select { appearance: none; }
.auction-panel .panel-foot { margin-top: 2px; }
@media (max-width: 760px) {
  .auction-body { grid-template-columns: 1fr; }
  .auction-lots { max-height: 240px; }
}

.talent-panel { display: flex; flex-direction: column; gap: 10px; }
.talent-panel .talent-points {
  padding: 4px 10px; border-radius: 999px; background: rgba(240, 197, 105, 0.14);
  color: #f5d78a; font-size: 13px; font-weight: 700;
}
.talent-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.talent-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid rgba(240, 197, 105, 0.18); border-radius: 10px;
  background: linear-gradient(135deg, rgba(40, 34, 28, 0.9), rgba(24, 21, 18, 0.9));
}
.talent-row.is-max { border-color: rgba(240, 197, 105, 0.5); }
.talent-icon {
  width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center;
  border-radius: 10px; background: rgba(240, 197, 105, 0.1); color: #f0c569; font-size: 22px;
}
.talent-info { flex: 1 1 auto; min-width: 0; }
.talent-head { display: flex; align-items: center; gap: 10px; }
.talent-name { color: #f5e4b8; font-size: 15px; }
.talent-ranks { display: inline-flex; gap: 3px; }
.talent-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.13); }
.talent-dot.is-on { background: #f0c569; box-shadow: 0 0 6px rgba(240,197,105,0.55); }
.talent-desc { margin-top: 3px; color: #b9ab8c; font-size: 12px; line-height: 1.35; }
.talent-learn { flex: 0 0 auto; }
.talent-learn:disabled { opacity: 0.4; cursor: default; }
