:root {
  --panel: rgba(6, 5, 4, 0.82);
  --edge: #3b3127;
  --edge-hi: #6b5537;
  --text: #c9bfa8;
  --dim: #7d7466;
  --rust: #b0532e;
  --gold: #d0a64c;
  --bone: #e2d8c0;
  --font: Consolas, "DejaVu Sans Mono", Menlo, "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font-family: var(--font); font-size: 13px; }
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; cursor: crosshair; }
.hidden { display: none !important; }
.panel { background: var(--panel); border: 1px solid var(--edge); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7), 0 6px 24px rgba(0, 0, 0, 0.6); }

#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#labels .lbl { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; text-shadow: 1px 1px 0 #000, 0 0 4px #000; will-change: transform; }
#labels .name { color: #cfd8dc; }
#labels .hp { width: 44px; height: 5px; background: #4a0e0a; border: 1px solid #000; }
#labels .hp i { display: block; height: 100%; background: #c23a22; }
#labels .lvl { color: #f0d060; font-size: 10px; font-weight: bold; min-width: 14px; text-align: center; background: rgba(0, 0, 0, 0.75); border: 1px solid #6b5537; line-height: 11px; padding: 0 2px; }
#labels .warn { color: #fff; background: #c41a0c; font-size: 20px; font-weight: 900; line-height: 26px; width: 26px; text-align: center; border-radius: 50%; box-shadow: 0 0 12px 3px rgba(255, 40, 10, 0.85); text-shadow: none; animation: warnpulse 0.25s ease-in-out infinite alternate; }
@keyframes warnpulse { from { box-shadow: 0 0 8px 2px rgba(255, 40, 10, 0.6); } to { box-shadow: 0 0 18px 6px rgba(255, 60, 20, 1); } }
#labels .float { font-size: 15px; font-weight: bold; }
#labels .float.dealt { color: #f2e6c8; }
#labels .float.crit { color: #ffd23c; font-size: 20px; }
#labels .float.fire { color: #ff8a2a; }
#labels .float.taken { color: #ff4030; }
#labels .float.evade { color: #8ec8ff; font-size: 12px; }
#labels .plate { color: var(--bone); background: rgba(4, 3, 2, 0.72); border: 1px solid #4a3c2a; padding: 1px 7px; font-size: 12px; letter-spacing: 0.04em; }
#labels .plate.loot { border-color: currentColor; box-shadow: 0 0 6px currentColor; }
#labels .plate.active { border-color: #d0a64c; box-shadow: 0 0 8px rgba(208, 166, 76, 0.45); }
#labels .plate.active::before { content: 'E'; display: inline-block; margin-right: 6px; padding: 0 4px; font-size: 10px; line-height: 14px; color: #000; background: #d0a64c; border-radius: 2px; }
#labels .prompt { color: var(--bone); background: rgba(0, 0, 0, 0.6); padding: 2px 6px; border: 1px solid var(--edge-hi); }

#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; }
#deathmsg { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px; opacity: 0; pointer-events: none; transition: opacity 1.2s; background: radial-gradient(ellipse at center, rgba(40, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.75) 70%); }
#deathmsg.show { opacity: 1; pointer-events: auto; }
#deathmsg .t { margin: 0; font-family: var(--font); font-size: clamp(5px, 1.05vw, 12px); line-height: 1.05; color: #d0281a; text-shadow: 0 0 10px rgba(220, 40, 20, 0.75); transform: scale(1.06); transition: transform 3s ease-out; }
#deathmsg.show .t { transform: scale(1); }
#deathmsg button { opacity: 0; transition: opacity 0.6s 1.6s; }
#deathmsg.show button { opacity: 1; }
.btn { background: linear-gradient(180deg, #5a2414, #30120a); border: 1px solid #8a3a1e; color: var(--bone); font: inherit; padding: 9px 18px; cursor: pointer; letter-spacing: 1px; }
.btn:hover { filter: brightness(1.25); }
.btn.ghost { background: transparent; border-color: var(--edge); color: var(--dim); }

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#status { position: absolute; top: 12px; left: 12px; padding: 7px 12px; min-width: 260px; line-height: 1.5; }
#status .row { display: flex; justify-content: space-between; gap: 16px; white-space: nowrap; }
#status .name { color: var(--bone); letter-spacing: 1px; }
#status .dim { color: var(--dim); }
#status .loc { color: var(--gold); }

#mapwrap { position: absolute; top: 62px; right: 52px; width: 190px; pointer-events: none; }
#mapframe { z-index: 2; } /* canvas: a lit ASCII bezel drawn by src/client/mapframe.js */
#minimap { position: relative; z-index: 1; }
#minimap { width: 190px; height: 190px; display: block; border-radius: 50%; box-shadow: 0 0 0 1px #000, 0 6px 24px rgba(0, 0, 0, 0.7), inset 0 0 18px rgba(0, 0, 0, 0.8); }
#maplabel { position: relative; z-index: 3; margin-top: 48px; text-align: center; color: var(--gold); font-size: 12px; letter-spacing: 2px; text-shadow: 1px 1px 0 #000; }
#drops { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); pointer-events: none; display: flex; flex-direction: column; align-items: center; }
#drops .drop { color: var(--gold); text-shadow: 1px 1px 0 #000; font-size: 14px; animation: rise 1.8s ease-out forwards; }
#drops .drop.loot { color: #b8d0a0; }
@keyframes rise { 0% { opacity: 0; transform: translateY(14px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-40px); } }
#banner { position: absolute; top: 26%; left: 50%; transform: translateX(-50%); pointer-events: none; color: var(--gold); font-size: 26px; letter-spacing: 6px; text-shadow: 0 0 14px rgba(208, 166, 76, 0.5), 2px 2px 0 #000; opacity: 0; }
#banner.show { animation: banner 2.6s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

#hud { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
#bars { padding: 5px 12px; line-height: 1.35; white-space: nowrap; font-size: 12px; }
#bars b { color: var(--dim); font-weight: normal; display: inline-block; width: 40px; }
#bars .hp { color: #c23a22; }
#bars .low { color: #ff3a1a; }
#bars .em { color: #e08a2a; }
#bars .xp { color: #8a7a4a; }
#embar.flash { animation: flash 0.4s; }
@keyframes flash { 0%, 100% { background: transparent; } 50% { background: rgba(224, 138, 42, 0.35); } }
#actionbar { display: flex; gap: 4px; }
#actionbar .slot { position: relative; width: 50px; height: 50px; background: var(--panel); border: 1px solid var(--edge); display: flex; align-items: center; justify-content: center; overflow: hidden; }
#actionbar .slot .ic { font-size: 22px; color: var(--bone); }
#actionbar .slot .k { position: absolute; top: 1px; left: 3px; font-size: 10px; color: var(--gold); }
#actionbar .slot .n { position: absolute; bottom: 1px; right: 3px; font-size: 10px; color: var(--text); }
#actionbar .slot .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, 0.72); }
#actionbar .slot.off .ic { color: #4a443a; }

#chat { position: absolute; left: 12px; bottom: 12px; width: min(440px, 28vw); height: 140px; padding: 6px 10px; }
#log { height: 100%; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; font-size: 12px; }
#log .line { line-height: 1.45; }
#log .line.world { color: #9fb3c0; }
#log .line.help { color: var(--dim); }
#log .line.level { color: var(--gold); }
#log .line.bad { color: #e0503a; }

#pack { position: absolute; right: 12px; bottom: 12px; width: 292px; user-select: none; }
#pack .head .key { float: right; color: var(--dim); }
#packcount { color: var(--dim); font-size: 11px; margin-left: 6px; }
#equipped { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--edge); font-size: 12px; }
#equipped .lbl { color: var(--dim); }
#equipped .g { font-size: 18px; width: 18px; text-align: center; }
#equipped .nm { color: var(--bone); }
#packgrid { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 6px; }
#packgrid .slot { position: relative; height: 62px; background: rgba(0, 0, 0, 0.45); border: 1px solid #2a231c; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; padding: 2px; }
#packgrid .slot.empty { cursor: default; background: rgba(0, 0, 0, 0.25); border-color: #1c1813; }
#packgrid .slot:not(.empty):hover { border-color: var(--edge-hi); background: rgba(176, 83, 46, 0.15); }
#packgrid .slot.food { box-shadow: inset 0 -2px 0 rgba(120, 180, 90, 0.35); }
#packgrid .slot.weapon { box-shadow: inset 0 -2px 0 rgba(200, 200, 220, 0.3); }
#packgrid .slot .g { font-size: 22px; line-height: 1; text-shadow: 0 0 6px rgba(0, 0, 0, 0.9); }
#packgrid .slot .nm { font-size: 9.5px; line-height: 1.1; color: var(--text); text-align: center; margin-top: 3px; max-height: 2.2em; overflow: hidden; }
#packgrid .slot .q { position: absolute; top: 1px; left: 4px; font-size: 10px; color: #e6c35a; }
#ctx { position: fixed; z-index: 20; min-width: 150px; padding-bottom: 3px; }
#ctx .head { padding: 5px 9px; border-bottom: 1px solid var(--edge); font-size: 12px; }
#ctx .opt { padding: 4px 10px; cursor: pointer; }
#ctx .opt:hover { background: rgba(176, 83, 46, 0.35); color: #fff; }
#tooltip { position: fixed; z-index: 19; width: 230px; padding: 7px 10px; font-size: 12px; line-height: 1.45; pointer-events: none; }
#tooltip .g { color: #9fcf7a; }
#labels .name.foe { color: #f0d060; font-weight: bold; }
#pack .head { padding: 6px 10px; color: var(--rust); border-bottom: 1px solid var(--edge); letter-spacing: 1px; }
#pack .head span { color: var(--dim); font-size: 11px; }

#packgrid .empty { color: var(--dim); padding: 8px; }

#title { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(ellipse at center, rgba(20, 6, 2, 0.05) 0%, rgba(0, 0, 0, 0.65) 75%); transition: opacity 1.2s ease; padding: 16px; }
#title.gone { opacity: 0; pointer-events: none; transition-delay: 0.9s; }
#titlefx, #titlelogo { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
#titlelogo { z-index: 1; }
#title > :not(#titlefx):not(#titlelogo) { position: relative; z-index: 2; }
#title .spacer { height: 50vh; }
#title .subtitle { font-family: "Cinzel", serif; font-weight: 700; font-size: clamp(14px, 2vw, 24px); letter-spacing: 0.55em; text-transform: uppercase; color: #f3d9b0; text-shadow: 0 0 10px rgba(255, 120, 40, 0.9), 0 0 28px rgba(255, 70, 20, 0.6); opacity: 0; animation: subin 1.4s ease-out 2.2s forwards; margin-bottom: 14px; }
@keyframes subin { from { opacity: 0; transform: translateY(6px); letter-spacing: 0.8em; } to { opacity: 1; transform: none; letter-spacing: 0.55em; } }
#logo { margin: 0; font-size: clamp(5px, 1.35vw, 15px); line-height: 1.05; background: linear-gradient(180deg, #d9804e 0%, #a3281e 60%, #4a120c 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 0 18px rgba(176, 60, 30, 0.45)); }
#title .sub { color: var(--dim); letter-spacing: 6px; text-transform: uppercase; font-size: 12px; }
#title .loading { display: flex; gap: 12px; align-items: center; justify-content: center; color: var(--gold); font-size: 12px; letter-spacing: 1px; transition: opacity 0.6s ease; }
#title .loading .bar { letter-spacing: 0; text-shadow: 0 0 6px rgba(208, 166, 76, 0.45); }
#title .loading .lbl { color: var(--dim); min-width: 20ch; }
#title .loading.done { opacity: 0; }
.btn:disabled { filter: grayscale(0.7) brightness(0.55); cursor: wait; }
#title .quality { display: flex; gap: 6px; align-items: center; justify-content: center; }
#title .quality span { color: var(--dim); font-size: 11px; letter-spacing: 3px; text-transform: uppercase; margin-right: 6px; }
#title .quality .btn { padding: 5px 12px; font-size: 12px; }
#title .form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
#title label { color: var(--dim); }
#title input { background: rgba(0, 0, 0, 0.6); border: 1px solid var(--edge); color: var(--bone); font: inherit; padding: 8px 10px; width: 160px; margin-left: 6px; outline: none; }

#title > .foot { position: absolute !important; right: 12px; bottom: 12px; display: flex; gap: 12px; align-items: center; }
#title .foot .btn { padding: 5px 12px; font-size: 12px; }
#title .foot .btn.new { color: var(--gold); border-color: var(--edge-hi); }
#title .foot .btn.new::after { content: ' (new)'; font-size: 11px; }
#title .foot .ver { color: var(--dim); font-size: 11px; letter-spacing: 2px; cursor: pointer; }
#notes { position: fixed; z-index: 60; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: min(72vh, 660px); display: flex; flex-direction: column; }
#notes .head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; color: var(--rust); border-bottom: 1px solid var(--edge); letter-spacing: 1px; }
#notes .x { background: none; border: 0; color: var(--dim); font: inherit; cursor: pointer; padding: 0 4px; }
#notes .x:hover { color: var(--bone); }
#notes .body { overflow-y: auto; padding: 4px 14px 14px; }
#notes h3 { margin: 14px 0 2px; font-size: 13px; font-weight: normal; color: var(--gold); letter-spacing: 1px; }
#notes h3 .d { color: var(--dim); margin-left: 8px; letter-spacing: 0; }
#notes .name { color: var(--bone); margin-bottom: 6px; }
#notes ul { margin: 0; padding: 0; list-style: none; }
#notes li { padding-left: 14px; text-indent: -14px; line-height: 1.5; margin-bottom: 3px; }
#notes li::before { content: '- '; color: var(--dim); }
#title .controls { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; max-width: 720px; color: var(--dim); font-size: 12px; }
#title .controls b { color: var(--text); font-weight: normal; }
#title .err { color: #e0503a; text-align: center; line-height: 1.6; }

@media (max-width: 900px) {
  #chat { display: none; }
  #actionbar .slot { width: 38px; height: 38px; }
}
