:root {
  --gold: #ffd100;
  --gold-dim: #b8952a;
  --panel: rgba(12, 10, 18, 0.82);
  --panel-edge: #6b5424;
  --text: #f2ead8;
  --muted: #a89f8a;
  --hp: #2fbf3a;
  --hp-dark: #145a19;
  --mana: #2a6fe0;
  --mana-dark: #0f2c63;
  --serif: 'Cinzel', Georgia, 'Times New Roman', serif;
  --sans: 'Alegreya Sans', 'Trebuchet MS', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0a0a10;
  color: var(--text);
  font-family: var(--sans);
  user-select: none;
  -webkit-user-select: none;
}
#game canvas { display: block; }
body.hover-enemy #game canvas { cursor: crosshair; }
body.hover-npc #game canvas { cursor: help; }
body.targeting #game canvas { cursor: cell; }
body.dead #game canvas { filter: grayscale(1) brightness(0.8); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.btn {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--gold);
  background: linear-gradient(#5a1a12, #2e0a06);
  border: 1px solid #a0782a;
  border-radius: 4px;
  padding: 8px 18px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.25), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.btn:hover { filter: brightness(1.25); }
.btn.primary { background: linear-gradient(#8a2a14, #4a0e06); }
.btn.big { font-size: 18px; padding: 12px 28px; width: 100%; }

.panel {
  position: absolute;
  background: var(--panel);
  border: 2px solid var(--panel-edge);
  border-radius: 8px;
  box-shadow: 0 0 0 1px #000, 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

/* ---------------------------------------------------------------- Loading and login */
#loading, #login {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
#loading { background: radial-gradient(circle at 50% 40%, #2a1e40, #06050a); }
#loading .msg { margin-top: 18px; color: var(--muted); font-size: 18px; }
.logo {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 64px;
  letter-spacing: 0.06em;
  background: linear-gradient(#fff4c0, #ffcf4a 45%, #b0701a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #2a1402) drop-shadow(0 0 24px rgba(255, 170, 60, 0.35));
}
#login { background: radial-gradient(ellipse at 50% 60%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 70%); }
.login-card {
  width: min(380px, calc(100vw - 32px));
  padding: 28px 28px 20px;
  text-align: center;
  background: rgba(10, 8, 16, 0.78);
  border: 2px solid var(--panel-edge);
  border-radius: 10px;
  box-shadow: 0 0 0 1px #000, 0 20px 60px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.login-card .logo { font-size: 40px; letter-spacing: 0.03em; }
.logo-sub { font-family: var(--serif); color: var(--gold-dim); letter-spacing: 0.5em; margin: -6px 0 10px; font-size: 13px; }
.login-desc { color: var(--muted); margin-bottom: 18px; font-size: 16px; }
.login-card label { display: block; text-align: left; font-family: var(--serif); color: var(--gold); font-size: 12px; letter-spacing: 0.1em; margin: 12px 0 6px; }
#name {
  width: 100%;
  padding: 10px 12px;
  font-size: 18px;
  font-family: var(--sans);
  color: var(--text);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid #5a4a2a;
  border-radius: 4px;
  outline: none;
}
#name:focus { border-color: var(--gold); }
#swatches { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 20px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #222; cursor: pointer; box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.4); }
.swatch.on { border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 209, 0, 0.7), inset 0 -4px 8px rgba(0, 0, 0, 0.4); }
#watch-intro { width: 100%; margin-top: 10px; }
.login-foot { margin-top: 14px; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- HUD layout */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud .panel, #hud button, #hud input, #action-bar, #death, #banner { pointer-events: auto; }

.unit-frame {
  position: absolute;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 0;
}
#player-frame { left: 14px; }
#party-frames { position: absolute; left: 20px; top: 96px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.pmember { display: flex; align-items: center; }
.pm-portrait { position: relative; width: 40px; height: 40px; flex: none; z-index: 2; }
.pm-portrait canvas { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #3a8cff; box-shadow: 0 0 0 1px #000, 0 2px 6px rgba(0, 0, 0, 0.6); display: block; }
.pm-lvl { position: absolute; bottom: -4px; left: -4px; width: 18px; height: 18px; border-radius: 50%; background: #1a1410; border: 1px solid #3a8cff; font: 700 10px var(--serif); color: #cfe0ff; display: flex; align-items: center; justify-content: center; }
.pm-body { width: 140px; margin-left: -8px; padding: 4px 8px 4px 14px; background: rgba(10, 12, 20, 0.72); border: 1px solid rgba(58, 140, 255, 0.45); border-radius: 0 5px 5px 0; }
.pm-name { font: 700 12px var(--serif); color: #9fc4ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; text-shadow: 0 1px 2px #000; }
.pm-lead { color: #ffd100; }
.pm-hp { height: 10px; }
.pm-hp .txt { font-size: 9px; }
.pmember.far { opacity: 0.55; }
.pmember.dead .pm-portrait canvas { filter: grayscale(1); }
.plate.party .pname { color: #6ab4ff !important; }
#target-frame { left: 330px; }
.portrait-wrap { position: relative; width: 64px; height: 64px; flex: none; z-index: 2; }
.portrait-wrap canvas, .t-portrait {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #8a6a2a;
  box-shadow: 0 0 0 1px #000, 0 3px 8px rgba(0, 0, 0, 0.6);
  display: block;
}
.t-portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 30px;
  color: #ffd9c0;
  background: radial-gradient(circle at 50% 35%, #6a2a1a, #1a0806);
}
#target-frame.friendly .t-portrait { background: radial-gradient(circle at 50% 35%, #2a4a6a, #081420); color: #d0e8ff; }
#target-frame.elite .t-portrait { border-color: var(--gold); box-shadow: 0 0 0 1px #000, 0 0 14px rgba(255, 209, 0, 0.8); }
#target-frame.dead .t-portrait { filter: grayscale(1); }
.lvl-badge {
  position: absolute;
  bottom: -4px;
  left: -4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1a1410;
  border: 2px solid #8a6a2a;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 12px;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}
#target-frame .lvl-badge { left: auto; right: -4px; }
.uf-body {
  width: 200px;
  padding: 5px 8px 6px 14px;
  margin-left: -10px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 0 6px 6px 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
#target-frame .uf-body { margin-left: 0; margin-right: -10px; padding: 5px 14px 6px 8px; border-radius: 6px 0 0 6px; }
.uf-name { font-family: var(--serif); font-weight: 700; font-size: 13px; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; text-shadow: 0 1px 2px #000; }
#player-frame.combat .uf-name { color: #ff6a50; }
.bar {
  position: relative;
  height: 15px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #000;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.bar .fill { position: absolute; inset: 0 auto 0 0; transition: width 0.15s linear; }
.bar.hp .fill { background: linear-gradient(#5fe066, var(--hp) 45%, var(--hp-dark)); }
.bar.mana { height: 12px; }
.bar.mana .fill { background: linear-gradient(#6aa8ff, var(--mana) 45%, var(--mana-dark)); }
#target-frame .bar.hp .fill { background: linear-gradient(#ff7a6a, #d0281a 45%, #6a0c06); }
#target-frame.friendly .bar.hp .fill { background: linear-gradient(#5fe066, var(--hp) 45%, var(--hp-dark)); }
.bar .absorb { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(45deg, rgba(220, 245, 255, 0.55) 0 4px, rgba(160, 220, 255, 0.3) 4px 8px); transition: width 0.15s linear; }
.bar .txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.auras { position: absolute; top: 72px; left: 70px; display: flex; gap: 4px; flex-wrap: wrap; width: 240px; }
#target-frame .auras { left: 0; }
.aura {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  border: 1px solid #000;
  background-size: cover;
  position: relative;
  box-shadow: 0 0 0 1px #6b5424;
  pointer-events: auto;
}
.aura.debuff { box-shadow: 0 0 0 1px #c02020; }
.aura span { position: absolute; bottom: -12px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; color: #ffe; text-shadow: 0 1px 2px #000; }

/* ---------------------------------------------------------------- Minimap and tracker */
#minimap-wrap { position: absolute; top: 10px; right: 14px; text-align: center; }
#zone-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 13px;
  color: var(--gold);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 3px 12px;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px #000;
  display: inline-block;
}
#minimap { display: block; border-radius: 50%; border: 3px solid #8a6a2a; box-shadow: 0 0 0 2px #000, 0 6px 16px rgba(0, 0, 0, 0.6); background: #000; }
#realm { font-size: 11px; color: var(--muted); margin-top: 4px; text-shadow: 0 1px 2px #000; }
#quest-tracker { position: absolute; top: 236px; right: 16px; width: 250px; text-align: right; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.qt-head { font-family: var(--serif); font-weight: 700; color: var(--gold); font-size: 14px; margin-bottom: 4px; }
.qt-q { margin-bottom: 10px; }
.qt-title { color: #ffd100; font-weight: 700; font-size: 15px; }
.qt-title span { color: #40ff40; font-weight: 500; }
.qt-q.complete .qt-title { color: #7aff5a; }
.qt-line { color: #eee; font-size: 14px; }
.qt-line.done { color: #888; }
.qt-hint { color: #bfb49a; font-size: 12px; font-style: italic; }

/* ---------------------------------------------------------------- Messages */
#error-text, #msg-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-weight: 700;
  text-shadow: 0 2px 3px #000, 0 0 6px #000;
  white-space: nowrap;
  opacity: 0;
}
#error-text { top: 18%; color: #ff2a2a; font-size: 18px; }
#msg-text { top: 22%; color: var(--gold); font-size: 22px; }
.fade { animation: fadeMsg 2.2s ease-out forwards; }
@keyframes fadeMsg { 0% { opacity: 1; } 65% { opacity: 1; } 100% { opacity: 0; } }
#hint { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); color: #ffe0a0; font-size: 16px; text-shadow: 0 1px 3px #000; background: rgba(0, 0, 0, 0.45); padding: 4px 12px; border-radius: 4px; }

#zone-text { position: absolute; top: 14%; width: 100%; text-align: center; opacity: 0; }
#zone-text .big { font-family: var(--serif); font-weight: 900; font-size: 48px; color: #ffd24a; text-shadow: 0 3px 0 #3a1a02, 0 0 20px rgba(0, 0, 0, 0.8); }
#zone-text .small { font-family: var(--serif); font-size: 20px; color: #f0e0b0; text-shadow: 0 2px 4px #000; }
#zone-text.show { animation: zoneIn 4.5s ease-in-out forwards; }
@keyframes zoneIn { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; } }

#levelup { position: absolute; top: 30%; width: 100%; text-align: center; opacity: 0; }
#levelup .lv { font-family: var(--serif); font-weight: 900; font-size: 56px; color: #fff2a0; text-shadow: 0 0 20px #ffb000, 0 3px 0 #5a3000; }
#levelup .learn { font-size: 20px; color: #ffe; text-shadow: 0 2px 4px #000; margin-top: 4px; }
#levelup.show { animation: levelIn 4s ease-out forwards; }
@keyframes levelIn { 0% { opacity: 0; transform: scale(0.6); } 10% { opacity: 1; transform: scale(1.1); } 18% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

#proc-alert { position: absolute; top: 34%; width: 100%; text-align: center; font-family: var(--serif); font-weight: 900; font-size: 34px; color: #ffe070; text-shadow: 0 0 18px #ff6a00, 0 3px 0 #5a1a00; opacity: 0; }
#proc-alert.show { animation: procIn 1.6s ease-out forwards; }
@keyframes procIn { 0% { opacity: 0; transform: scale(1.6); } 12% { opacity: 1; transform: scale(1); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
#proc-overlay .wing {
  position: absolute;
  top: 50%;
  width: 90px;
  height: 200px;
  margin-top: -130px;
  opacity: 0;
  transition: opacity 0.25s;
  background: radial-gradient(ellipse at 50% 60%, rgba(255, 220, 110, 0.9), rgba(255, 110, 20, 0.6) 35%, rgba(200, 30, 0, 0) 70%);
  filter: blur(2px);
  border-radius: 50% 50% 40% 40% / 70% 70% 30% 30%;
}
#proc-overlay .wing.left { left: calc(50% - 220px); transform: rotate(-12deg); }
#proc-overlay .wing.right { left: calc(50% + 130px); transform: rotate(12deg); }
#proc-overlay.on .wing { opacity: 0.85; animation: flicker 0.6s ease-in-out infinite alternate; }
@keyframes flicker { from { filter: blur(2px) brightness(1); } to { filter: blur(3px) brightness(1.3); } }

#flash { position: absolute; inset: 0; opacity: 0; mix-blend-mode: screen; }
#vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(200, 0, 0, 0.7) 100%); }

/* ---------------------------------------------------------------- Cast bar and action bar */
#cast-bar { position: absolute; bottom: 118px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; }
.cb-icon { width: 26px; height: 26px; background-size: cover; border: 1px solid #000; box-shadow: 0 0 0 1px #6b5424; }
.cb-bar { position: relative; width: 260px; height: 20px; background: rgba(0, 0, 0, 0.75); border: 1px solid #000; box-shadow: 0 0 0 1px #6b5424, 0 3px 8px rgba(0, 0, 0, 0.5); border-radius: 2px; overflow: hidden; }
.cb-bar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#ffe070, #e0a010 50%, #8a5a00); }
#cast-bar.channel .cb-bar .fill { background: linear-gradient(#a0ff90, #3ac03a 50%, #1a6a1a); }
.cb-bar .name { position: absolute; left: 8px; top: 0; bottom: 0; display: flex; align-items: center; font-size: 13px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.cb-bar .time { position: absolute; right: 8px; top: 0; bottom: 0; display: flex; align-items: center; font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; }

#bottom { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
#action-bar {
  display: flex;
  gap: 5px;
  padding: 7px 9px;
  background: linear-gradient(rgba(30, 24, 18, 0.9), rgba(12, 10, 8, 0.92));
  border: 2px solid var(--panel-edge);
  border-radius: 8px;
  box-shadow: 0 0 0 1px #000, 0 6px 18px rgba(0, 0, 0, 0.6);
}
.slot {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 4px;
  border: 1px solid #000;
  box-shadow: 0 0 0 1px #5a4a2a, inset 0 0 6px #000;
  cursor: pointer;
  overflow: visible;
}
.slot .icon { position: absolute; inset: 0; background-size: cover; border-radius: 3px; }
.slot .cd { position: absolute; inset: 0; border-radius: 3px; }
.slot .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 900; font-size: 20px; color: #ffe; text-shadow: 0 0 3px #000, 0 2px 2px #000; }
.slot .key { position: absolute; top: 2px; right: 4px; font-size: 12px; font-weight: 700; color: #eee; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.slot .lock { display: none; }
.slot:hover { box-shadow: 0 0 0 1px var(--gold), 0 0 8px rgba(255, 209, 0, 0.5); }
.slot.locked .icon { filter: grayscale(1) brightness(0.35); }
.slot.locked .lock { display: flex; position: absolute; inset: 0; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #bbb; text-shadow: 0 1px 2px #000; }
.slot.nomana .icon { filter: saturate(0.4) brightness(0.55) sepia(1) hue-rotate(180deg); }
.slot.oor .key { color: #ff3030; }
.slot.active { box-shadow: 0 0 0 2px #fff4a0, 0 0 10px rgba(255, 240, 160, 0.8); }
.slot.proc { box-shadow: 0 0 0 2px #ffd100, 0 0 16px 4px rgba(255, 170, 0, 0.9); animation: procGlow 0.5s ease-in-out infinite alternate; }
@keyframes procGlow { from { box-shadow: 0 0 0 2px #ffd100, 0 0 10px 2px rgba(255, 170, 0, 0.7); } to { box-shadow: 0 0 0 2px #fff4a0, 0 0 22px 6px rgba(255, 120, 0, 1); } }
.slot.pressed .icon { animation: press 0.18s ease-out; }
@keyframes press { 0% { transform: scale(0.88); filter: brightness(1.6); } 100% { transform: scale(1); } }

#xp-bar { position: relative; width: 560px; max-width: 90vw; height: 12px; background: rgba(0, 0, 0, 0.75); border: 1px solid #000; box-shadow: 0 0 0 1px #4a3a5a; border-radius: 2px; overflow: hidden; }
#xp-bar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#d09aff, #8a3adf 50%, #4a1a80); transition: width 0.3s; }
#xp-bar .txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; }
#money { position: absolute; bottom: 14px; right: 16px; font-weight: 700; color: #ffe08a; text-shadow: 0 1px 2px #000; background: var(--panel); border: 1px solid var(--panel-edge); padding: 3px 10px; border-radius: 12px; font-size: 13px; }

/* ---------------------------------------------------------------- Chat */
#chat { position: absolute; left: 14px; bottom: 14px; width: 400px; max-width: 40vw; }
#chat-log { max-height: 190px; overflow-y: auto; font-size: 14px; line-height: 1.3; text-shadow: 0 1px 2px #000, 0 0 3px #000; scrollbar-width: none; pointer-events: auto; }
#chat-log::-webkit-scrollbar { display: none; }
#chat-log .line { transition: opacity 1s; }
#chat-log .line.old { opacity: 0.35; }
#chat-log .sys { color: #ffe680; }
#chat-log .xp { color: #c89bff; }
#chat-log .loot { color: #7ad0ff; }
#chat-log .quest { color: #ffd100; }
#chat-log .level { color: #ffe070; font-weight: 700; }
#chat-log .say { color: #ffffff; }
#chat-log .yell { color: #ff4a3a; font-weight: 700; }
#chat-log .emote { color: #ff9a3a; }
#chat-log .error { color: #ff5a5a; }
#chat-log .whisper { color: #ff8ee8; }
#chat-log .party { color: #8ab8ff; }
.mod-bots { padding: 6px 14px 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; border-top: 1px solid rgba(107, 84, 36, 0.35); font-size: 13px; }
.mod-bots-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
.mod-bots-state { font-weight: 700; }
.mod-bots-state.running { color: #6aff6a; }
.mod-bots-state.paused { color: #ffd100; }
.mod-bots-state.stopped { color: #ff6a5a; }
#chat-log .world { color: #ffc8a0; }
#chat-log .trade { color: #ffb070; }
#chat-tabs { display: flex; gap: 2px; margin-bottom: 3px; pointer-events: auto; }
#chat-tabs button { font: 12px var(--sans); color: #d8c89a; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(107, 84, 36, 0.6); border-bottom: 0; border-radius: 4px 4px 0 0; padding: 2px 9px; cursor: pointer; position: relative; }
#chat-tabs button.on { color: var(--gold); background: rgba(40, 30, 12, 0.85); border-color: var(--gold-dim); }
#chat-tabs button.unread::after { content: ''; position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: #ffd100; }
#chat-log .guild { color: #5aff7a; }
#chat-input { width: 100%; margin-top: 6px; padding: 6px 8px; font-size: 14px; font-family: var(--sans); color: #fff; background: rgba(0, 0, 0, 0.7); border: 1px solid var(--gold-dim); border-radius: 3px; outline: none; }

/* ---------------------------------------------------------------- Windows */
#quest-dialog, #quest-log { left: 24px; top: 120px; width: 380px; max-height: calc(100vh - 360px); display: flex; flex-direction: column; }
#quest-log { left: 50%; transform: translateX(-50%); width: 480px; top: 12%; }
#help { left: 50%; top: 50%; transform: translate(-50%, -60%); width: 560px; max-width: calc(100vw - 32px); }
.qd-head { padding: 10px 14px 8px; border-bottom: 1px solid #4a3a1a; display: flex; align-items: baseline; gap: 10px; position: relative; }
.qd-name { font-family: var(--serif); font-weight: 700; color: var(--gold); font-size: 17px; }
.qd-title { color: var(--muted); font-size: 13px; }
.x { position: absolute; right: 8px; top: 6px; background: none; border: none; color: #c9a44a; font-size: 22px; cursor: pointer; }
.qd-body { padding: 12px 16px; overflow-y: auto; font-size: 15px; line-height: 1.45; color: #efe4c8; background: linear-gradient(rgba(60, 44, 20, 0.25), rgba(0, 0, 0, 0)); }
.qd-body h3 { font-family: var(--serif); color: var(--gold); margin: 0 0 8px; font-size: 18px; }
.qd-body h4 { font-family: var(--serif); color: #e8c060; margin: 12px 0 4px; font-size: 14px; }
.qd-body p { margin: 0 0 10px; }
.qd-obj { margin: 0; padding-left: 18px; }
.reward { color: #fff2c0; }
.qd-foot { padding: 10px 14px; border-top: 1px solid #4a3a1a; display: flex; gap: 8px; justify-content: flex-end; }
.qd-quest { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: rgba(0, 0, 0, 0.3); border: 1px solid transparent; color: #ffe8a0; font-size: 15px; font-family: var(--sans); font-weight: 700; padding: 6px 8px; margin-top: 4px; border-radius: 4px; cursor: pointer; }
.qd-quest:hover { border-color: var(--gold-dim); background: rgba(255, 209, 0, 0.08); }
.qd-locked { display: flex; align-items: center; gap: 8px; color: #888; padding: 6px 8px; }
.qm { font-family: var(--serif); font-weight: 900; font-size: 18px; width: 16px; text-align: center; }
.qm.gold { color: var(--gold); text-shadow: 0 0 6px rgba(255, 209, 0, 0.6); }
.qm.grey { color: #999; }
.ql-q { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.ql-q.done { opacity: 0.55; }
.ql-q ul { margin: 0 0 6px; padding-left: 18px; }
.ql-q li.ok { color: #7aff5a; }
.tag { font-family: var(--sans); font-size: 12px; padding: 1px 6px; border-radius: 8px; margin-left: 6px; vertical-align: middle; }
.tag.done { background: #333; color: #aaa; }
.tag.ready { background: #2a5a1a; color: #aaffa0; }
.help-grid { display: grid; gap: 7px; font-size: 15px; }
.help-grid b { color: var(--gold); }
.help-grid .tip { margin-top: 6px; padding: 10px; background: rgba(255, 140, 40, 0.08); border: 1px solid rgba(255, 160, 60, 0.25); border-radius: 6px; }

#death { position: absolute; top: 30%; left: 50%; transform: translateX(-50%); text-align: center; background: var(--panel); border: 2px solid var(--panel-edge); padding: 20px 36px; border-radius: 8px; }
.d-title { font-family: var(--serif); font-size: 26px; color: #ff5a4a; margin-bottom: 14px; }

#banner { position: absolute; top: 24%; left: 50%; transform: translateX(-50%) scale(0.8); opacity: 0; pointer-events: none; text-align: center; padding: 26px 44px; background: radial-gradient(ellipse, rgba(40, 20, 0, 0.9), rgba(10, 5, 0, 0.8)); border: 2px solid var(--gold-dim); border-radius: 10px; transition: all 0.6s; }
#banner.show { opacity: 1; transform: translateX(-50%) scale(1); pointer-events: auto; cursor: pointer; }
.b-title { font-family: var(--serif); font-weight: 900; font-size: 40px; color: #ffe070; text-shadow: 0 0 20px #ff9a00; }
.b-sub { font-size: 18px; margin-top: 8px; }
.b-hint { font-size: 12px; color: var(--muted); margin-top: 12px; }

#tooltip { position: fixed; width: 290px; padding: 10px 12px; background: rgba(8, 8, 20, 0.95); border: 1px solid #5a5a7a; border-radius: 5px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); font-size: 14px; z-index: 30; pointer-events: none; }
.tt-name { font-weight: 700; font-size: 16px; color: #fff; margin-bottom: 4px; }
.tt-row { display: flex; justify-content: space-between; color: #fff; }
.tt-desc { margin-top: 6px; color: #ffd100; line-height: 1.35; }
.tt-lock { margin-top: 6px; color: #ff4040; }

/* ---------------------------------------------------------------- Nameplates and combat text */
#nameplates, #fct { position: absolute; inset: 0; overflow: hidden; }
.plate { position: absolute; left: 0; top: 0; text-align: center; white-space: nowrap; will-change: transform; }
.bubble { position: absolute; left: 0; top: 0; max-width: 240px; width: max-content; padding: 6px 10px; border-radius: 8px; background: rgba(250, 246, 234, 0.94); color: #1e1a12; font: 13px/1.3 var(--sans); text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); will-change: transform; overflow-wrap: anywhere; transform-origin: 50% 100%; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: rgba(250, 246, 234, 0.94); }
.bubble.party { background: rgba(214, 228, 255, 0.95); color: #10203c; }
.bubble.party::after { border-top-color: rgba(214, 228, 255, 0.95); }
.pname { font-weight: 700; font-size: 14px; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.ptitle { font-size: 11px; color: #ccc; text-shadow: 0 1px 2px #000; margin-top: -2px; }
.plate.npc .pname { color: #5aff5a; }
.plate.npc .ptitle { color: #9fdc9f; }
.plate.friend .pname { color: #6ab8ff; }
.plate.npc .pbar, .plate.friend .pbar { display: none; }
.pbar { width: 90px; height: 7px; margin: 2px auto 0; background: rgba(0, 0, 0, 0.75); border: 1px solid #000; border-radius: 2px; overflow: hidden; }
.pfill { height: 100%; background: linear-gradient(#ff6a5a, #c81a0a); }
.pcast { display: none; width: 90px; height: 5px; margin: 2px auto 0; background: rgba(0, 0, 0, 0.75); border: 1px solid #000; }
.pcfill { height: 100%; background: #ffb030; }
.plate.targeted .pbar { box-shadow: 0 0 0 1px #fff, 0 0 6px rgba(255, 255, 255, 0.6); }
.plate.targeted .pname { font-size: 15px; }
.plate.dead { opacity: 0.6; }
.plate.dead .pfill { width: 0 !important; }
.pmark { font-family: var(--serif); font-weight: 900; font-size: 34px; line-height: 1; height: 0; transform: translateY(-34px); text-shadow: 0 0 3px #000, 0 2px 2px #000; animation: bob 1.4s ease-in-out infinite; }
.pmark.gold { color: var(--gold); text-shadow: 0 0 10px rgba(255, 209, 0, 0.8), 0 2px 2px #000; }
.pmark.grey { color: #aaa; }
@keyframes bob { 0%, 100% { margin-top: 0; } 50% { margin-top: -5px; } }

.fct { position: absolute; left: 0; top: 0; font-family: var(--serif); font-weight: 900; white-space: nowrap; text-shadow: 0 2px 0 #000, 0 0 4px #000, 0 0 2px #000; will-change: transform, opacity; }
.fct.crit { letter-spacing: 0.02em; }

/* ---------------------------------------------------------------- Action combat */
#classes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.cls { text-align: left; padding: 10px; border-radius: 6px; border: 1px solid #5a4a2a; background: rgba(0, 0, 0, 0.45); color: var(--text); cursor: pointer; font-family: var(--sans); }
.cls b { display: block; font-family: var(--serif); color: var(--gold); font-size: 15px; margin-bottom: 3px; }
.cls span { font-size: 13px; color: var(--muted); }
.cls.on { border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 209, 0, 0.35); background: rgba(60, 40, 10, 0.5); }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; display: none; }
body.combat-mode #crosshair { display: block; }
#crosshair .dot { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.7); }
#dodge-ring { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; opacity: 0; transition: opacity 0.2s;
  -webkit-mask: radial-gradient(circle, transparent 11px, #000 12px); mask: radial-gradient(circle, transparent 11px, #000 12px); }
#hitmarker { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; opacity: 0; transform: rotate(45deg) scale(0.6); }
#hitmarker::before, #hitmarker::after { content: ''; position: absolute; background: #fff; box-shadow: 0 0 3px #000; }
#hitmarker::before { left: 12px; top: 0; width: 2px; height: 26px; -webkit-mask: linear-gradient(#000 35%, transparent 35% 65%, #000 65%); mask: linear-gradient(#000 35%, transparent 35% 65%, #000 65%); }
#hitmarker::after { top: 12px; left: 0; height: 2px; width: 26px; -webkit-mask: linear-gradient(90deg, #000 35%, transparent 35% 65%, #000 65%); mask: linear-gradient(90deg, #000 35%, transparent 35% 65%, #000 65%); }
#hitmarker.show { opacity: 1; transform: rotate(45deg) scale(1); transition: transform 0.08s ease-out; }
#hitmarker.crit::before, #hitmarker.crit::after { background: #ffd24a; }
#hitmarker.kill { transform: rotate(45deg) scale(1.5); }
#hitmarker.kill.show { transform: rotate(45deg) scale(1.7); }
#hitmarker.kill::before, #hitmarker.kill::after { background: #ff3a2a; width: 3px; }
#hitmarker.kill::after { width: 26px; height: 3px; }

#reticle { position: absolute; left: 50%; top: 50%; display: none; }
body.cls-fighter #reticle { display: block; }
.ret { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: rgba(255, 255, 255, 0.18); text-shadow: 0 0 3px #000; transition: color 0.08s, transform 0.08s; }
#ret-overhead { transform: translateY(-42px); }
#ret-thrust { transform: translateY(42px); }
#ret-left { transform: translateX(-46px); }
#ret-right { transform: translateX(46px); }
.ret.aim { color: rgba(255, 255, 255, 0.55); }
.ret.wind { color: #ffe070; text-shadow: 0 0 8px #ffb000; }
.ret.heavy { color: #ff9a30; text-shadow: 0 0 12px #ff5a00; font-size: 24px; }
.ret.swing { color: #ffffff; text-shadow: 0 0 10px #fff; }
.ret.block { color: #7ac8ff; text-shadow: 0 0 10px #2a8aff; font-size: 24px; }
.ret.danger { color: #ff5a4a; text-shadow: 0 0 8px #ff0000; }
.ret.danger-hi { color: #ff2010; text-shadow: 0 0 14px #ff0000; font-size: 26px; animation: dangerPulse 0.15s infinite alternate; }
.ret.block.danger, .ret.block.danger-hi { color: #b0f0ff; text-shadow: 0 0 14px #5ad0ff, 0 0 4px #ff2010; }
@keyframes dangerPulse { from { opacity: 1; } to { opacity: 0.6; } }
#combo { position: absolute; left: 50%; top: calc(50% + 70px); transform: translateX(-50%); text-align: center; font-family: var(--serif); font-weight: 700; text-shadow: 0 1px 3px #000; }
#combo .chain { color: #ffe0a0; font-size: 18px; letter-spacing: 4px; }
#combo .riposte { display: block; color: #9fe0ff; font-size: 16px; animation: dangerPulse 0.2s infinite alternate; }

#dmgdirs { position: absolute; inset: 0; pointer-events: none; }
.dmgdir { position: absolute; left: 50%; top: 50%; width: 46vmin; height: 46vmin; border-radius: 50%;
  border-top: 7px solid rgba(255, 30, 20, 0.85); filter: blur(1px); animation: dmgFade 0.9s ease-out forwards;
  -webkit-mask: conic-gradient(from -30deg, #000 0 60deg, transparent 60deg); mask: conic-gradient(from -30deg, #000 0 60deg, transparent 60deg); }
@keyframes dmgFade { from { opacity: 1; } to { opacity: 0; } }

.bar.stamina .fill { background: linear-gradient(#ffe38a, #e0a820 45%, #7a5400) !important; }
.slot .mb { position: absolute; bottom: 2px; left: 3px; font-size: 9px; font-weight: 700; color: #ffe; background: rgba(0, 0, 0, 0.55); padding: 0 3px; border-radius: 2px; }
.pmark.atk { color: #ff3a2a; font-size: 30px; text-shadow: 0 0 8px #ff0000, 0 2px 2px #000; animation: none; }
.pmark.guard { color: #8ac8ff; font-size: 16px; line-height: 20px; height: 20px; width: 26px; margin: 0 auto; transform: translateY(-26px); border: 2px solid #5aa8ff; border-radius: 4px 4px 13px 13px; background: rgba(20, 50, 100, 0.6); text-shadow: none; animation: none; }
body.cls-mage .fighter-only, body.cls-fighter .mage-only { display: none; }
#help .red { color: #ff5a4a; font-weight: 700; }
#help .blue { color: #7ac8ff; font-weight: 700; }

/* Zone travel fade */
#travel {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(20, 14, 30, 0.85), rgba(4, 3, 8, 0.97));
  transition: opacity 0.25s;
}
#travel.hidden { opacity: 0; pointer-events: none; display: flex; }
#travel .msg { font-family: Cinzel, serif; color: #e8d8a0; font-size: 26px; letter-spacing: 0.06em; text-shadow: 0 2px 8px #000; }
.qd-quest.svc .qm.svc { color: #9fd3ff; }

/* ---------------------------------------------------------------- Item windows */
.win { display: flex; flex-direction: column; z-index: 20; }
.win .x, #quest-log .x { position: absolute; right: 8px; top: 4px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.win .x:hover { color: var(--gold); }
#bag-win { right: 24px; top: 96px; width: 760px; max-width: calc(100vw - 48px); }
#shop-win { left: 24px; top: 120px; width: 340px; max-height: calc(100vh - 300px); }
#bank-win, #chest-win { left: 24px; top: 120px; width: 340px; }
#trade-win { left: 24px; top: 120px; width: 600px; max-width: calc(100vw - 480px); }
.trade-body { display: flex; gap: 20px; }
.trade-gold { margin-top: 8px; color: var(--gold); font-family: var(--serif); font-size: 14px; }
.trade-gold input { width: 80px; margin-left: 6px; background: #0c0a08; color: #fff; border: 1px solid #4a3a1a; border-radius: 3px; padding: 3px 6px; }
.trade-flag { margin-top: 6px; min-height: 18px; color: #6aff6a; font-size: 13px; }
.trade-row { padding: 0 14px; gap: 8px; }
#invite-box { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); padding: 12px 16px; z-index: 40; min-width: 280px; text-align: center; color: #f2e0b0; }
.win-body { display: flex; gap: 12px; padding: 12px 14px; }
.doll { display: grid; grid-template-columns: repeat(2, 64px); gap: 6px 8px; align-content: start; }
.doll-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.doll-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.bagside { flex: 1; }
.win-label { font-family: var(--serif); color: #e8c060; font-size: 13px; margin-bottom: 6px; }
.grid { display: grid; grid-template-columns: repeat(5, 46px); gap: 5px; }
.islot { width: 46px; height: 46px; border-radius: 5px; background: linear-gradient(#1c1812, #0c0a08); border: 1px solid #4a3a1a; box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8); position: relative; cursor: pointer; }
.islot.empty { cursor: default; opacity: 0.55; }
.islot:not(.empty):hover { border-color: var(--gold); box-shadow: 0 0 8px rgba(255, 209, 0, 0.35), inset 0 0 8px rgba(0, 0, 0, 0.8); }
.islot img { width: 100%; height: 100%; image-rendering: auto; pointer-events: none; }
.islot .qty { position: absolute; right: 3px; bottom: 1px; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.gold-line { margin-top: 10px; color: var(--gold); font-family: var(--serif); font-size: 14px; }
.win-hint { padding: 6px 14px 10px; color: var(--muted); font-size: 12px; }
.win-row { margin-top: 10px; display: flex; justify-content: flex-end; }
.shop-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid rgba(107, 84, 36, 0.3); }
.shop-name { flex: 1; color: #efe4c8; }
.btn.small { font-size: 12px; padding: 4px 10px; }
#item-menu { position: fixed; z-index: 80; background: #14100a; border: 1px solid var(--panel-edge); border-radius: 4px; padding: 3px; display: flex; flex-direction: column; min-width: 140px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); }
#item-menu button { background: none; border: 0; color: #f2e0b0; text-align: left; padding: 6px 10px; font-family: var(--sans); font-size: 14px; cursor: pointer; border-radius: 3px; }
#item-menu button:hover { background: rgba(255, 209, 0, 0.12); color: var(--gold); }
#tooltip .tt-name { font-weight: 700; font-size: 15px; color: #fff; }
#tooltip .tt-name.weapon, #tooltip .tt-name.armor { color: #9fd3ff; }
#tooltip .tt-name.quest { color: #ffd100; }
#tooltip .tt-name.scroll, #tooltip .tt-name.spellbook, #tooltip .tt-name.spell { color: #d8a8ff; }
#tooltip .tt-name.mount { color: #ffb347; }
#tooltip .tt-sub { color: var(--muted); font-size: 12px; text-transform: capitalize; margin-bottom: 4px; }
#tooltip .tt-desc { color: #e8d8a0; font-style: italic; margin-top: 4px; }
#tooltip .tt-use { color: #6aff6a; }
#tooltip .tt-val, #tooltip .tt-price { color: var(--gold); margin-top: 4px; font-size: 12px; }

#login-err { color: #ff7a6a; min-height: 18px; font-size: 14px; margin-top: 6px; }
#password { width: 100%; }

/* ---------------------------------------------------------------- Moderator panel */
#mod-win { left: 50%; transform: translateX(-50%); top: 9%; width: 720px; max-height: 80vh; }
.mod-top, .mod-toggles { display: flex; gap: 8px; padding: 10px 14px 0; flex-wrap: wrap; }
.mod-tog { background: rgba(0, 0, 0, 0.35); border: 1px solid #4a3a1a; color: #c8b890; padding: 5px 12px; border-radius: 14px; cursor: pointer; font-family: var(--sans); font-weight: 700; }
.mod-tog.on { border-color: #6aff8a; color: #6aff8a; background: rgba(40, 120, 60, 0.3); }
.mod-cols { display: flex; gap: 14px; padding: 10px 14px 14px; min-height: 0; }
.mod-col { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.mod-col input { background: #0c0a08; border: 1px solid #4a3a1a; color: var(--text); padding: 5px 8px; border-radius: 4px; margin-bottom: 6px; font-family: var(--sans); }
.mod-list { overflow-y: auto; max-height: 52vh; display: flex; flex-direction: column; gap: 3px; }
.mod-row { display: flex; justify-content: space-between; align-items: center; background: rgba(0, 0, 0, 0.3); border: 1px solid transparent; color: #f2e0b0; padding: 5px 8px; border-radius: 4px; cursor: pointer; font-family: var(--sans); font-size: 14px; text-align: left; }
.mod-row:hover { border-color: var(--gold-dim); }
.mod-row.here { border-color: #ffe24a; }
.mod-row em { color: var(--muted); font-size: 11px; }
.mod-player { background: rgba(0, 0, 0, 0.3); border-radius: 4px; padding: 6px 8px; }
.mp-name { font-weight: 700; color: #ffe8a0; }
.mp-name em, .mp-zone { color: var(--muted); font-size: 12px; font-style: normal; }
.mp-acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mp-acts button { background: #2a1a10; border: 1px solid #6b5424; color: var(--gold); font-size: 12px; padding: 3px 8px; border-radius: 3px; cursor: pointer; }
.mp-acts button:hover { filter: brightness(1.3); }

/* ---------------------------------------------------------------- Full map */
#map-win { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.55); }
.map-frame { position: relative; display: flex; flex-direction: column; }
.map-tabs { display: flex; gap: 4px; margin-left: 14px; }
.map-tabs button { background: rgba(0, 0, 0, 0.35); border: 1px solid #4a3a1a; color: #c8b890; padding: 3px 12px; border-radius: 3px; cursor: pointer; font-family: var(--serif); font-size: 12px; }
.map-tabs button.on { color: var(--gold); border-color: var(--gold-dim); }
#map-canvas { display: block; margin: 8px 12px; border-radius: 4px; }
.map-foot { padding: 0 14px 10px; color: var(--muted); font-size: 13px; }

#bag-grid { max-height: 330px; overflow-y: auto; padding-right: 4px; }

#classes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
/* Class picker (J) */
#class-win { left: 50%; top: 50%; transform: translate(-50%, -50%); width: 560px; }
.class-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px; }
.class-card { background: rgba(0, 0, 0, 0.35); border: 1px solid #4a3a1a; border-radius: 6px; padding: 12px; cursor: pointer; color: var(--text); text-align: left; font-family: var(--sans); }
.class-card:hover { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 209, 0, 0.25); }
.class-card.on { border-color: #6aff8a; }
.class-card b { display: block; font-family: var(--serif); color: var(--gold); font-size: 17px; margin-bottom: 4px; }
.class-card span { color: #cfc2a0; font-size: 13px; line-height: 1.35; }
.class-card kbd { float: right; color: var(--muted); font-size: 12px; }
.mod-classes { display: flex; gap: 8px; align-items: center; padding: 10px 14px 0; }
.mod-classes .win-label { margin: 0 6px 0 0; }

/* Guarding (every class): the reticle shows incoming blows and your guard */
body.guarding #reticle { display: block; }
.ret.danger-heavy { text-shadow: 0 0 14px #ff6a00, 0 0 4px #ff0000; font-size: 28px; }
.ret.eguard { border: 2px solid rgba(90, 168, 255, 0.85); border-radius: 4px 4px 13px 13px; background: rgba(20, 50, 100, 0.35); color: #8ac8ff; }
.ret.eguard.aim, .ret.eguard.wind, .ret.eguard.heavy { border-color: #ff9a6a; box-shadow: 0 0 8px rgba(255, 90, 40, 0.6); }
.plate.neutral .pfill { background: linear-gradient(#ffe45c, #c8a010); }
#mod-level-in { width: 56px; background: #0c0a08; border: 1px solid #4a3a1a; color: var(--text); padding: 4px 6px; border-radius: 4px; font-family: var(--sans); }
.mod-classes { flex-wrap: wrap; }
.band { margin-bottom: 6px; }
.band-head { display: flex; flex-direction: column; align-items: flex-start; width: 100%; background: linear-gradient(90deg, rgba(107, 84, 36, 0.45), rgba(107, 84, 36, 0.05)); border: 0; border-left: 3px solid var(--gold-dim); color: var(--gold); padding: 5px 8px; margin: 2px 0 3px; cursor: pointer; text-align: left; font-family: var(--serif); font-size: 13px; }
.band-head.static { cursor: default; }
.band-head em { font-family: var(--sans); font-style: italic; color: var(--muted); font-size: 11px; }
.mod-row.map.child { margin-left: 16px; padding-top: 3px; padding-bottom: 3px; font-size: 13px; background: rgba(0, 0, 0, 0.18); }
.mod-row .tw { color: var(--muted); margin-right: 5px; font-weight: 400; }
.mod-row em { display: flex; gap: 5px; align-items: center; font-style: normal; }
.mod-row i { font-style: normal; font-size: 10px; padding: 1px 5px; border-radius: 8px; background: rgba(255, 255, 255, 0.07); color: #cbbd98; }
.mod-row i.lv { background: rgba(255, 209, 0, 0.12); color: var(--gold); min-width: 38px; text-align: center; }
.mod-row i.type.dungeon, .mod-row i.type.cave { color: #ff9a7a; }
.mod-row i.type.village, .mod-row i.type.custom { color: #9fd3ff; }
.mod-row i.diff.medium { color: #ffd070; }
.mod-row i.diff.hard { color: #ff9a4a; }
.mod-row i.diff.extreme { color: #ff5a4a; background: rgba(255, 60, 40, 0.15); }

/* ---------------------------------------------------------------- The map (M) */
#map-win { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, rgba(10, 6, 2, 0.55), rgba(0, 0, 0, 0.8)); }
#map-win .map-frame {
  position: relative; display: flex; flex-direction: column; width: min(1400px, calc(100vw - 48px)); height: min(920px, calc(100vh - 48px));
  background: linear-gradient(#5a3a1c, #3a2410); border: 2px solid #b08a44; border-radius: 10px; padding: 10px 12px 8px;
  box-shadow: 0 0 0 1px #1a0e04, 0 20px 60px rgba(0, 0, 0, 0.7), inset 0 0 24px rgba(0, 0, 0, 0.6);
}
#map-win .map-frame::before { content: ''; position: absolute; inset: 5px; border: 1px solid rgba(232, 200, 120, 0.35); border-radius: 7px; pointer-events: none; }
.map-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 8px; }
.map-title { font-family: Cinzel, Georgia, serif; font-weight: 900; font-size: 26px; letter-spacing: 0.08em; background: linear-gradient(#fff4c0, #e8b040); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.map-sub { color: #d8c49a; font-size: 14px; margin-top: -2px; }
.map-sub b { color: #fff0c8; }
.map-tools { display: flex; gap: 6px; }
.map-tools button { background: linear-gradient(#6a4a26, #3a2612); border: 1px solid #b08a44; color: #f0dca8; border-radius: 5px; padding: 5px 11px; font-family: Cinzel, Georgia, serif; font-size: 13px; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 230, 170, 0.2); }
.map-tools button:hover { filter: brightness(1.25); }
.map-tools .map-x { font-size: 18px; padding: 2px 10px; }
.map-body { position: relative; flex: 1; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 2px #2a1808, inset 0 0 30px rgba(40, 20, 0, 0.6); }
#map-canvas { width: 100%; height: 100%; display: block; cursor: grab; margin: 0; border-radius: 6px; }
#map-tip { position: absolute; pointer-events: none; background: rgba(28, 18, 8, 0.94); border: 1px solid #b08a44; border-radius: 5px; padding: 6px 10px; display: flex; flex-direction: column; gap: 1px; min-width: 120px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6); }
#map-tip b { font-family: Cinzel, Georgia, serif; color: #ffe8a8; font-size: 14px; }
#map-tip span { font-size: 12px; font-weight: 700; }
#map-tip em { color: #c8b890; font-size: 12px; }
#map-win .map-foot { color: #c8b48a; font-size: 12px; padding: 6px 6px 0; }
.mod-list .mod-row.map { width: 100%; box-sizing: border-box; }
.mod-list .mod-row.map.child { width: calc(100% - 16px); }

/* ---------------------------------------------------------------- Cutscenes */
body.cinematic #hud > *:not(#nameplates):not(#fct) { opacity: 0; pointer-events: none; transition: opacity 0.4s; }
body.cinematic #nameplates { opacity: 0; }
#cine { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
#cine .cine-bar { position: absolute; left: 0; right: 0; height: 13vh; background: #000; transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
#cine .cine-bar.top { top: 0; transform: translateY(-100%); }
#cine .cine-bar.bottom { bottom: 0; transform: translateY(100%); display: flex; align-items: center; justify-content: center; }
#cine.on .cine-bar { transform: translateY(0); }
.cine-sub { max-width: 860px; padding: 0 24px; text-align: center; }
.cine-who { font-family: Cinzel, Georgia, serif; color: #ffd100; font-weight: 700; font-size: 15px; letter-spacing: 0.08em; margin-bottom: 4px; }
.cine-text { color: #f4ecd8; font-size: 22px; line-height: 1.35; min-height: 30px; text-shadow: 0 2px 4px #000; font-family: 'Alegreya Sans', sans-serif; }
.cine-skip { position: absolute; right: 22px; top: calc(13vh + 12px); color: rgba(255, 255, 255, 0.75); font-size: 13px; text-shadow: 0 1px 3px #000; opacity: 0; transition: opacity 0.6s 0.4s; }
#cine.on .cine-skip { opacity: 1; }
.cine-skip b { color: #ffd100; }
.cine-hint { position: absolute; left: 22px; top: calc(13vh + 12px); color: rgba(255, 230, 160, 0.8); font-size: 13px; text-shadow: 0 1px 3px #000; }

/* Bigger, clearer attack and guard arrows */
.ret { width: 48px; height: 48px; margin: -24px 0 0 -24px; font-size: 28px; }
#ret-overhead { transform: translateY(-66px); }
#ret-thrust { transform: translateY(66px); }
#ret-left { transform: translateX(-72px); }
#ret-right { transform: translateX(72px); }
.ret.heavy { font-size: 36px; }
.ret.block { font-size: 36px; }
.ret.danger { font-size: 40px; color: #ff4a3a; text-shadow: 0 0 12px #ff0000, 0 0 2px #000; }
.ret.danger-hi { font-size: 50px; text-shadow: 0 0 20px #ff0000, 0 0 3px #000; }
.ret.danger-heavy { font-size: 54px; }
.ret.block.danger, .ret.block.danger-hi { font-size: 50px; }
.pmark.atk { font-size: 46px; transform: translateY(-46px); text-shadow: 0 0 12px #ff0000, 0 2px 3px #000; }

/* A quick fade through doors, with where you are going. */
#door-fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.24s ease; z-index: 40; display: flex; align-items: center; justify-content: center; }
#door-fade.on { opacity: 1; }
#door-fade .msg { font-family: Cinzel, Georgia, serif; color: #e8d4a8; font-size: 28px; letter-spacing: 6px; text-transform: uppercase; opacity: 0.85; }

/* Cooking at a campfire */
#use-hint { position: absolute; left: 50%; bottom: 205px; transform: translateX(-50%); padding: 7px 16px; font: 15px var(--sans); color: #f0e2c0; background: rgba(12, 9, 5, 0.78); border: 1px solid var(--gold-dim); border-radius: 5px; pointer-events: none; opacity: 0; transition: opacity 0.2s; text-shadow: 0 1px 2px #000; }
#use-hint.on { opacity: 1; }
#use-hint b { display: inline-block; min-width: 20px; margin-right: 6px; padding: 0 5px; color: #1a1206; background: var(--gold); border-radius: 3px; text-align: center; }
#cook-win { width: 440px; }
.cook-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(107, 84, 36, 0.35); }
.cook-row:last-child { border-bottom: 0; }
.cook-row.off .islot { opacity: 0.45; }
.cook-text { flex: 1; min-width: 0; }
.cook-needs { font-size: 12.5px; color: #c9b68a; margin-top: 2px; }
.cook-needs em { font-style: normal; color: #9a8a66; }
.cook-needs .short { color: #e07a5a; }
.cook-btns { display: flex; flex-direction: column; gap: 4px; }
.cook-btns .btn[disabled] { opacity: 0.4; cursor: default; }

/* ---------------------------------------------------------------- Character sheet */
.cs-body { display: flex; gap: 16px; padding: 12px 14px 4px; }
.cs-left { flex: 0 0 440px; display: flex; flex-direction: column; gap: 10px; }
.cs-doll { display: flex; gap: 10px; align-items: stretch; }
.cs-col { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; width: 64px; }
.cs-view { position: relative; flex: 1; min-height: 330px; border-radius: 8px; overflow: hidden; border: 1px solid #4a3a1a;
  background: radial-gradient(ellipse at 50% 38%, rgba(96, 76, 44, 0.55), rgba(18, 14, 10, 0.95) 70%), #0e0b08;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.75); transition: box-shadow 0.15s, border-color 0.15s; }
.cs-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.cs-view canvas.turning { cursor: grabbing; }
.cs-turn { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 11px; color: rgba(232, 216, 170, 0.45); pointer-events: none; letter-spacing: 0.04em; }
.cs-view.can-drop, .grid.can-drop { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 209, 0, 0.35), inset 0 0 30px rgba(0, 0, 0, 0.6); }
.doll-slot { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.doll-slot .islot { width: 54px; height: 54px; }
.doll-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; text-align: center; line-height: 1.1; }
.doll-empty { display: flex; align-items: center; justify-content: center; opacity: 1 !important; }
.doll-empty svg { width: 30px; height: 30px; fill: rgba(200, 176, 120, 0.16); }
.islot.can-drop { border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 209, 0, 0.55), inset 0 0 8px rgba(0, 0, 0, 0.8); animation: can-drop 0.9s ease-in-out infinite alternate; }
@keyframes can-drop { from { box-shadow: 0 0 4px rgba(255, 209, 0, 0.3), inset 0 0 8px rgba(0, 0, 0, 0.8); } to { box-shadow: 0 0 14px rgba(255, 209, 0, 0.7), inset 0 0 8px rgba(0, 0, 0, 0.8); } }
.islot.lifted { opacity: 0.35; }
#bag-win.dragging .islot:not(.can-drop) { cursor: grabbing; }
#drag-ghost { position: fixed; left: 0; top: 0; width: 46px; height: 46px; z-index: 100; pointer-events: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.7)); }
#drag-ghost img { width: 100%; height: 100%; }
.cs-stats { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 6px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(107, 84, 36, 0.45); }
.cs-bar { position: relative; height: 18px; border-radius: 3px; background: rgba(0, 0, 0, 0.6); border: 1px solid #000; overflow: hidden; }
.cs-fill { position: absolute; left: 0; top: 0; bottom: 0; }
.cs-bar.hp .cs-fill { background: linear-gradient(#3fd04a, #178a20); }
.cs-bar.mana .cs-fill { background: linear-gradient(#4a8cf0, #1a4ab0); }
.cs-bar.stam .cs-fill { background: linear-gradient(#e8c24a, #a07a1a); }
.cs-bar.xp { height: 12px; }
.cs-bar.xp .cs-fill { background: linear-gradient(#b87aff, #6a3ab8); }
.cs-bar-t { position: relative; display: block; padding: 0 8px; font-size: 12px; line-height: 16px; color: #f2ead8; text-shadow: 0 1px 2px #000; }
.cs-bar.xp .cs-bar-t { font-size: 10px; line-height: 11px; }
.cs-bar-t b { float: right; font-weight: 700; }
.cs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin: 2px 0; }
.cs-stat { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); border-bottom: 1px dotted rgba(107, 84, 36, 0.4); padding: 2px 0; cursor: default; }
.cs-stat b { color: #f2ead8; font-family: var(--serif); font-size: 13px; }
.cs-bag { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cs-bag-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cs-bag-head .win-label { margin: 0; }
.cs-bag .grid { padding: 4px; border-radius: 6px; border: 1px solid transparent; max-height: 420px; overflow-y: auto; scrollbar-width: thin; }
#tooltip .tt-compare { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
#tooltip .tt-cmp-head { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
#tooltip .tt-up { color: #5ae65a; }
#tooltip .tt-down { color: #ff6a5a; }
#tooltip .tt-same { color: var(--muted); font-size: 12px; }
#tooltip .tt-hint { margin-top: 6px; font-size: 11px; color: #b8a878; font-style: italic; }
@media (max-width: 900px) { .cs-body { flex-direction: column; } .cs-left { flex-basis: auto; } }

/* ---------------------------------------------------------------- Character creator */
#creator { position: fixed; inset: 0; z-index: 70; opacity: 0; transition: opacity 0.6s ease; font-family: var(--sans); color: var(--text); }
#creator.in { opacity: 1; }
#creator.leaving { opacity: 0; transition-duration: 0.45s; }
#cr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; z-index: 1; }
#cr-canvas.turning { cursor: grabbing; }
.cr-shade { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 42% 60% at 52% 55%, rgba(40, 30, 18, 0.35), rgba(8, 6, 10, 0.88) 75%), linear-gradient(rgba(6, 5, 8, 0.4), rgba(6, 5, 8, 0.75)); backdrop-filter: blur(3px); }
.cr-top { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); z-index: 3; text-align: center; pointer-events: none; }
.cr-kicker { font-family: var(--serif); font-size: 13px; letter-spacing: 0.4em; text-transform: uppercase; color: #c9a76a; }
.cr-name { font-family: var(--serif); font-weight: 700; font-size: 44px; letter-spacing: 0.06em; color: var(--gold); text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 180, 60, 0.25); }
.cr-summary { font-size: 16px; color: #e8dcc0; margin-top: -2px; letter-spacing: 0.04em; text-shadow: 0 1px 6px #000; }
.cr-left, .cr-right { position: absolute; z-index: 3; top: 104px; bottom: 96px; display: flex; flex-direction: column; }
.cr-left { left: 28px; width: 400px; }
.cr-right { right: 28px; width: 340px; padding: 18px 20px; overflow-y: auto; scrollbar-width: thin; }
.cr-steps { display: flex; border-bottom: 1px solid #4a3a1a; }
.cr-step { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: 600 13px var(--serif); padding: 12px 4px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: color 0.15s, border-color 0.15s; }
.cr-step span { width: 24px; height: 24px; border-radius: 50%; border: 1px solid #6b5424; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.cr-step:hover { color: #efe0b8; }
.cr-step.on { color: var(--gold); border-bottom-color: var(--gold); }
.cr-step.on span { background: var(--gold); color: #1a1206; border-color: var(--gold); }
.cr-step.done span { background: rgba(201, 167, 106, 0.25); color: #efe0b8; }
.cr-page { flex: 1; overflow-y: auto; padding: 14px 18px 18px; scrollbar-width: thin; }
.cr-sec { margin-bottom: 16px; }
.cr-sec h3 { margin: 0 0 8px; font: 600 12px var(--serif); letter-spacing: 0.18em; text-transform: uppercase; color: #c9a76a; }
.cr-swatches { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.cr-sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.6); background: var(--c); cursor: pointer; box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08); transition: transform 0.12s, box-shadow 0.12s; }
.cr-sw:hover { transform: scale(1.1); }
.cr-sw.on { box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(255, 209, 0, 0.5), inset 0 -3px 6px rgba(0, 0, 0, 0.35); transform: scale(1.1); }
.cr-sw.auto { background: linear-gradient(135deg, #3a2e1e, #6b5424); color: #efe0b8; font: 700 12px var(--serif); }
.cr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cr-chip { background: rgba(0, 0, 0, 0.4); border: 1px solid #4a3a1a; border-radius: 16px; padding: 6px 13px; color: #e8dcc0; font: 14px var(--sans); cursor: pointer; transition: all 0.12s; }
.cr-chip:hover { border-color: #8a6d2a; color: #fff; }
.cr-chip.on { background: rgba(255, 209, 0, 0.14); border-color: var(--gold); color: var(--gold); }
.cr-slider { margin: 6px 0 10px; }
.cr-lab { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.cr-range { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.cr-range input { flex: 1; accent-color: var(--gold); }
.cr-classes { display: flex; flex-direction: column; gap: 10px; }
.cr-class { text-align: left; background: rgba(0, 0, 0, 0.4); border: 1px solid #4a3a1a; border-radius: 8px; padding: 14px 16px; cursor: pointer; color: #e8dcc0; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; transition: all 0.15s; }
.cr-class b { font: 700 20px var(--serif); color: #f6ead0; }
.cr-class em { font-style: normal; font-size: 13px; color: #c9a76a; align-self: center; }
.cr-class span { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.cr-class:hover { border-color: #8a6d2a; }
.cr-class.on { border-color: var(--gold); background: linear-gradient(90deg, rgba(255, 209, 0, 0.12), rgba(0, 0, 0, 0.4)); box-shadow: 0 0 16px rgba(255, 209, 0, 0.18); }
.cr-class.on b { color: var(--gold); }
.cr-note, .cr-hint { font-size: 13px; color: var(--muted); line-height: 1.4; }
.cr-note { margin-top: 14px; }
.cr-hint { margin-top: 6px; }
.cr-outfits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.cr-outfit { background: rgba(0, 0, 0, 0.4); border: 1px solid #4a3a1a; border-radius: 6px; padding: 8px 6px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #e8dcc0; font: 13px var(--sans); }
.cr-outfit i { display: block; width: 44px; height: 7px; border-radius: 2px; }
.cr-outfit span { margin-top: 3px; }
.cr-outfit.on { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 10px rgba(255, 209, 0, 0.2); }
.cr-origins { display: flex; flex-direction: column; gap: 8px; }
.cr-origin { text-align: left; background: rgba(0, 0, 0, 0.4); border: 1px solid #4a3a1a; border-radius: 7px; padding: 10px 14px; cursor: pointer; color: #e8dcc0; }
.cr-origin b { display: block; font: 700 15px var(--serif); color: #f6ead0; margin-bottom: 2px; }
.cr-origin span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.cr-origin.on { border-color: var(--gold); background: linear-gradient(90deg, rgba(255, 209, 0, 0.12), rgba(0, 0, 0, 0.4)); }
.cr-origin.on b { color: var(--gold); }
.cr-cls-name { font: 700 30px var(--serif); color: var(--gold); letter-spacing: 0.04em; }
.cr-cls-role { font: 600 12px var(--serif); letter-spacing: 0.24em; text-transform: uppercase; color: #c9a76a; }
.cr-cls-line { font-size: 16px; color: #f2e8d0; font-style: italic; margin: 10px 0 12px; line-height: 1.35; }
.cr-stats { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid rgba(107, 84, 36, 0.5); border-bottom: 1px solid rgba(107, 84, 36, 0.5); }
.cr-stat { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.cr-pips { display: flex; gap: 4px; }
.cr-pips i { width: 26px; height: 7px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); }
.cr-pips i.on { background: linear-gradient(#ffd66a, #c8901e); box-shadow: 0 0 6px rgba(255, 190, 60, 0.35); }
.cr-cls-text { font-size: 14px; line-height: 1.45; color: #d8ccb0; }
.cr-abils { display: flex; flex-direction: column; gap: 8px; }
.cr-abil { display: flex; gap: 10px; align-items: center; }
.cr-abil img { width: 38px; height: 38px; border-radius: 6px; border: 1px solid #6b5424; flex: none; }
.cr-abil b { display: block; font: 600 14px var(--serif); color: #f6ead0; }
.cr-abil span { font-size: 12.5px; color: var(--muted); }
.cr-turn { position: absolute; z-index: 3; left: 50%; bottom: 104px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(232, 216, 170, 0.55); }
.cr-bottom { position: absolute; z-index: 3; left: 28px; right: 28px; bottom: 24px; display: flex; gap: 10px; align-items: center; }
.cr-grow { flex: 1; }
#cr-next { min-width: 280px; width: auto; flex: none; margin: 0; }
#creator button { font-family: var(--sans); }
#creator .cr-class b, #creator .cr-origin b, #creator .cr-step { font-family: var(--serif); }
.cr-bottom .btn { margin: 0; }
@media (max-width: 1100px) { .cr-right { display: none; } .cr-left { width: 360px; } }
.cs-restyle { align-self: center; margin-top: -2px; }
