/* ─────────────────────────────────────────────────────────────────────────────
   테일즈테일즈 — one interface kit.
   Every panel, window, slot, bar and button shares the same language: a dark
   ink body, a 1 px black outline, a hairline of gold just inside it, light from
   the top left (a faint highlight on the top and left edges, shade on the
   bottom and right), 4 px corners. Frames stay neutral; gold is the one accent,
   and colour is kept for health, mana and item rarity.
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  /* self-hosted Galmuri first (hud.css @font-face), then whatever the system has: no font CDN */
  --font: "Galmuri11", Pretendard, "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  --serif: "Galmuri11", "Noto Serif KR", "Nanum Myeongjo", serif;
  --ink: #06070a;
  --panel-a: rgba(30, 32, 42, .94);
  --panel-b: rgba(17, 18, 25, .95);
  --well: #0b0c11;
  --line: rgba(214, 184, 122, .34);
  --line-hi: rgba(226, 196, 134, .75);
  --gold: #e2c486;
  --gold-hi: #fff0c8;
  --text: #e8e3d6;
  --muted: #9d988b;
  --hp: #c83e48; --hp-hi: #ee7078; --hp-lo: #7c1c26;
  --mp: #3a68c8; --mp-hi: #74a0f0; --mp-lo: #1c3474;
  --xp: #c8a04e; --xp-hi: #f6dc98;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r: 4px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--sf0, #050608); color: var(--text);
  font: 13px/1.5 var(--font); letter-spacing: -.1px; user-select: none; -webkit-user-select: none; touch-action: none;
}
[hidden] { display: none !important; }
canvas, img { image-rendering: pixelated; image-rendering: crisp-edges; }
#world, #text { position: fixed; left: 0; top: 0; }
#text { pointer-events: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus { outline: none; }
button:focus-visible { outline: 1px solid var(--gold); outline-offset: 1px; }
kbd { font: 600 9px/1 var(--font); letter-spacing: 0; }
img.gi { width: 12px; height: 12px; image-rendering: pixelated; vertical-align: -1px; flex: none; }

/* ── the kit ── */
.frame, .window {
  background: linear-gradient(var(--panel-a), var(--panel-b));
  border: 1px solid var(--ink); border-radius: var(--r);
  box-shadow: inset 0 0 0 1px var(--line), inset 1px 1px 0 1px rgba(255, 255, 255, .05), inset -1px -1px 0 1px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .45);
}
/* a sunken well: slots, bars, inputs, inset panels */
.well, .slot, .bar, .detail, .stats, .say, #chat-in, #guild-body input {
  background: var(--well); border: 1px solid #000; border-radius: 3px;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .7), inset -1px -1px 0 rgba(255, 255, 255, .05);
}
/* buttons: raised with a bevel; hover lifts one step; pressed inverts and drops a pixel */
.btn, .btns button, .list button, .pick button, #invite button, .part .step {
  position: relative; padding: 4px 12px; font-weight: 600; font-size: 12px; color: var(--tx, #ece6d4);
  background: linear-gradient(var(--sf4, #353844), var(--sf2, #23252e)); border: 1px solid var(--ink); border-radius: 3px;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .1), inset -1px -1px 0 rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(214, 184, 122, .18);
}
.btn:hover, .btns button:hover, .list button:hover, .pick button:hover, #invite button:hover, .part .step:hover {
  background: linear-gradient(var(--sf4, #41444f), var(--sf3, #2b2d37)); color: var(--tx, #fff6dc); box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .14), inset -1px -1px 0 rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(226, 196, 134, .45);
}
.btn:active, .btns button:active, .list button:active, .pick button:active, #invite button:active {
  transform: translate(1px, 1px); box-shadow: inset -1px -1px 0 rgba(255, 255, 255, .08), inset 1px 1px 0 rgba(0, 0, 0, .5);
}
.btn.gold, #b-start, #b-create, #b-respawn {
  color: #2a1c08; background: linear-gradient(#f2d898, #c89a50);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5), inset -1px -1px 0 rgba(90, 50, 10, .45);
}
.btn.gold:hover { background: linear-gradient(#fbe6b0, #d6aa60); color: #2a1c08; }
.btn.small { padding: 2px 8px; font-size: 11px; }
.btn.big, .big { font-family: var(--serif); font-size: 15px; letter-spacing: 3px; padding: 8px 28px; }
button:disabled { filter: grayscale(1); opacity: .45; cursor: default; }
.btn.toggle.off { color: var(--muted); }

.gold { color: var(--gold); font-weight: 600; }
.hint { margin: 8px 0 0; font-size: 11px; color: var(--muted); line-height: 1.5; }
.say { margin: 0 0 8px; padding: 8px 10px; line-height: 1.6; font-size: 12px; }
.ds { color: var(--muted); font-size: 11px; }

/* ── windows ── */
#windows { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.window { position: absolute; pointer-events: auto; width: 300px; max-width: calc(100vw - 16px); display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.window > header {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 12px; flex: none; cursor: move; touch-action: none;
  background: linear-gradient(rgba(255, 255, 255, .05), transparent); border-bottom: 1px solid var(--line);
}
.window > header .t { font-family: var(--serif); font-size: 14px; letter-spacing: 1px; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.window > header kbd { font-size: 10px; padding: 2px 4px; border: 1px solid #000; border-radius: 2px; background: var(--well); color: var(--muted); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.window > header .x { margin-left: auto; width: 20px; height: 20px; padding: 0; flex: none; position: relative; background: var(--well); border: 1px solid #000; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.window > header .x::before, .window > header .x::after { content: ""; position: absolute; left: 4px; right: 4px; top: 8px; height: 2px; background: #b8b2a2; transform: rotate(45deg); }
.window > header .x::after { transform: rotate(-45deg); }
.window > header .x:hover { box-shadow: inset 0 0 0 1px #c85a5a; }
.window > header .x:hover::before, .window > header .x:hover::after { background: #ff9a8a; }
.window .body { padding: 10px 12px 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(214, 184, 122, .35) transparent; }
.window.top { box-shadow: inset 0 0 0 1px var(--line-hi), inset 1px 1px 0 1px rgba(255, 255, 255, .05), 0 10px 26px rgba(0, 0, 0, .55); }
#w-inv { width: 296px; } #w-char { width: 360px; } #w-skill { width: 400px; } #w-quest { width: 580px; } #w-party { width: 310px; }
#w-guild { width: 310px; } #w-shop { width: 330px; } #w-smith { width: 350px; } #w-train { width: 330px; } #w-rank { width: 280px; }
#w-talk { width: 320px; } #w-help { width: 460px; } #w-settings { width: 280px; }
.section { display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--gold); font-family: var(--serif); font-size: 13px; letter-spacing: 1px; }
.section:first-child { margin-top: 0; }

/* slots and items */
.grid { display: grid; grid-template-columns: repeat(6, 42px); gap: 3px; justify-content: center; }
.slot { position: relative; width: 42px; height: 42px; cursor: pointer; }
.slot:hover { border-color: #000; box-shadow: inset 0 0 0 1px var(--line-hi), inset 1px 1px 0 rgba(0, 0, 0, .7); }
.slot img { position: absolute; left: 4px; top: 4px; width: 32px; height: 32px; image-rendering: pixelated; pointer-events: none; }
.slot .n { position: absolute; right: 2px; bottom: 0; font-size: 10px; font-weight: 700; text-shadow: 1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000; pointer-events: none; }
.slot .e { position: absolute; left: 2px; top: 0; font-size: 10px; font-weight: 700; color: var(--gold); text-shadow: 1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000; pointer-events: none; }
.slot.sel { box-shadow: inset 0 0 0 2px var(--gold), inset 1px 1px 0 rgba(0, 0, 0, .7); }
.slot.q1 { box-shadow: inset 0 0 0 1px #5a8ae0, inset 0 0 10px rgba(90, 138, 224, .3); }
.slot.q2 { box-shadow: inset 0 0 0 1px #d8b84a, inset 0 0 10px rgba(216, 184, 74, .3); }
.slot.q3 { box-shadow: inset 0 0 0 1px #e8803a, inset 0 0 12px rgba(232, 128, 58, .45); }
.slot.q4 { box-shadow: inset 0 0 0 1px #5fd47a, inset 0 0 12px rgba(95, 212, 122, .4); }
.slot.q5 { box-shadow: inset 0 0 0 1px #d2b48c, inset 0 0 12px rgba(210, 180, 140, .45); }
.slot.q1.sel, .slot.q2.sel, .slot.q3.sel, .slot.q4.sel, .slot.q5.sel { outline: 2px solid var(--gold); outline-offset: -2px; }
.slot .sk { position: absolute; left: 3px; bottom: 3px; display: flex; gap: 1px; pointer-events: none; }
.slot .sk i { width: 4px; height: 4px; background: #000; border: 1px solid #777; border-radius: 50%; }
.slot .sk i.on { background: #ffd84a; border-color: #fff; }
.slot .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.slot .ph img.gi { position: static; width: 16px; height: 16px; opacity: .22; }
.slot.empty { cursor: default; }
.inv-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.inv-top .gold { display: inline-flex; align-items: center; gap: 4px; }
#inv-count { color: var(--muted); font-size: 11px; }
#inv-sort { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.detail { margin-top: 8px; padding: 8px 10px; min-height: 36px; }
.detail:empty { display: none; }

/* the tooltip and everything that describes an item */
#tip { position: fixed; z-index: 80; width: 250px; padding: 9px 11px 10px; pointer-events: none; font-size: 12px; line-height: 1.5; }
#tip.pinned { pointer-events: auto; }
.nm { font-size: 14px; font-weight: 700; }
.rar { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.af { color: var(--tx-info, #8ab4f0); } .lg { color: var(--tx-bad, #ff9a4a); margin-top: 3px; } .so { color: var(--tx2, #a8a498); margin-top: 3px; } .rw { color: var(--gold); }
.st { color: var(--tx-ok, #5fd47a); } .st.off { color: var(--tx3, #6a7a70); } .st.on { color: var(--tx-ok, #9af0ae); }
.cmp { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.cmp + .nm { font-size: 13px; }
.err-line { color: var(--tx-bad, #ff9a9a); font-size: 11px; margin-top: 3px; }
#tip .gold-line { margin: 4px 0 0; font-size: 11px; }
#tip .hint { margin-top: 6px; }
.tip-act { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.btns { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; align-items: center; }

/* lists: shop, smith, trainer, party, guild, rank, bounties */
.list { display: flex; flex-direction: column; gap: 4px; }
.list .it { display: flex; align-items: center; gap: 8px; padding: 5px 7px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(0, 0, 0, .6); border-radius: 3px; }
.list .it img { width: 32px; height: 32px; flex: none; image-rendering: pixelated; background: var(--well); border: 1px solid #000; border-radius: 3px; }
.list .it .tx { flex: 1; min-width: 0; line-height: 1.35; font-size: 12px; font-weight: 600; }
.list .it small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.list .rk { display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(0, 0, 0, .6); border-radius: 3px; font-size: 12px; }
.list .rk i { font-style: normal; color: var(--gold); width: 22px; font-weight: 700; }
.list .rk b { flex: 1; font-weight: 600; }
.list .rk span { color: var(--muted); font-size: 11px; }
.list .rk.me { box-shadow: inset 0 0 0 1px var(--line-hi); }
.gold-line { color: var(--gold); margin: 0 0 8px; font-weight: 600; }

/* the character sheet: a paper-doll, then stats in groups */
.doll { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; align-items: center; }   /* minmax: the portrait shrinks in a narrow docked panel instead of pushing the right column out */
.doll .col { display: flex; flex-direction: column; gap: 6px; }
.portrait { text-align: center; }
#char-cv { width: 132px; max-width: 100%; height: auto; aspect-ratio: 132 / 168; display: block; margin: 0 auto; border: 1px solid #000; border-radius: 3px; image-rendering: pixelated;
  background: radial-gradient(ellipse at 50% 72%, rgba(226, 196, 134, .16), rgba(0, 0, 0, .25) 70%), var(--well); box-shadow: inset 0 0 0 1px var(--line); }
#char-title { margin-top: 5px; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 5px; }
#char-title small { color: var(--gold); font-weight: 600; font-size: 11px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 10px; padding: 8px 10px; }
.stats .grp h4 { margin: 0 0 3px; font: 600 11px/1.4 var(--serif); letter-spacing: 1px; color: var(--gold); border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.stats span { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; line-height: 1.6; }
.stats span img.gi { opacity: .8; }
.stats span b { margin-left: auto; font-weight: 700; color: var(--tx-info, #cfe2f6); }
#char-powers { margin-top: 8px; font-size: 12px; }
#char-powers:empty { display: none; }

/* skills */
.skill { display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; padding: 8px; margin-bottom: 6px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(0, 0, 0, .6); border-radius: 3px; }
.skill .ic { grid-row: span 2; width: 44px; height: 44px; padding: 4px; image-rendering: pixelated; background: var(--well); border: 1px solid #000; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line); }
.skill .hd { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.skill .hd b { font-size: 13px; color: var(--text); }
.skill .hd kbd { padding: 1px 4px; border: 1px solid #000; border-radius: 2px; background: var(--well); color: var(--gold-hi); }
.skill .hd small { color: var(--muted); font-size: 11px; }
.skill .hd small.mp { color: var(--mp-hi); }
.skill p { margin: 0; font-size: 12px; color: var(--tx2, #cfc9ba); line-height: 1.5; }
.skill.locked { opacity: .5; }
.skill.locked .hd b::after { content: " 🔒"; font-size: 10px; }
.skill.basic .ic { padding: 4px; }

/* quests: a list on the left, the chosen one on the right */
.qwin { display: grid; grid-template-columns: 196px 1fr; gap: 12px; min-height: 300px; }
.qlist { display: flex; flex-direction: column; gap: 2px; padding: 6px; max-height: 60vh; overflow-y: auto; }
.qlist .grp { margin: 8px 4px 3px; font: 600 11px/1.4 var(--serif); letter-spacing: 1px; color: var(--gold); }
.qlist .grp:first-child { margin-top: 2px; }
.qlist button { display: flex; align-items: center; gap: 6px; text-align: left; padding: 5px 7px; font-size: 12px; background: transparent; border: 1px solid transparent; border-radius: 3px; color: var(--text); }
.qlist button small { margin-left: auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.qlist button:hover { background: rgba(255, 255, 255, .04); }
.qlist button.on { background: rgba(226, 196, 134, .1); border-color: var(--line); color: var(--gold-hi); }
.qlist button.done small { color: var(--tx-ok, #9af0ae); }
.qlist button.past { color: var(--muted); }
.qlist button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qdetail { min-width: 0; }
.q-title { color: var(--gold); font-family: var(--serif); font-size: 15px; letter-spacing: 1px; margin-bottom: 6px; }
.q-goal { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 12px; }
.q-goal .bar { flex: 1; height: 8px; margin: 0; }
.q-goal .bar i { background: linear-gradient(var(--xp-hi) 0 2px, var(--xp) 2px); }
.q-reward { margin-top: 6px; font-size: 12px; color: var(--tx, #b8f0c0); }
.mk { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.mk span { flex: 1; } .mk b { color: var(--gold); letter-spacing: 1px; font-weight: normal; } .mk small { color: var(--muted); min-width: 92px; text-align: right; }

/* party and guild */
.pframe { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 8px; align-items: center; padding: 6px 8px; margin-bottom: 4px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(0, 0, 0, .6); border-radius: 3px; }
.pframe .cg { grid-row: span 2; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--well); border: 1px solid #000; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line); }
.pframe .cg img.gi { width: 16px; height: 16px; }
.pframe b { font-size: 12px; }
.pframe b.lead::before { content: "★ "; color: var(--gold); }
.pframe small { color: var(--muted); font-size: 11px; }
.pframe .bar { grid-column: 2 / -1; height: 8px; margin: 0; }
.pframe:not(:has(.bar)) .cg { grid-row: auto; }
.pframe small { text-align: right; white-space: nowrap; }
.pframe.me { box-shadow: inset 0 0 0 1px var(--line-hi); }
#guild-body input { flex: 1; min-width: 0; padding: 6px 8px; color: inherit; font: inherit; outline: none; user-select: text; -webkit-user-select: text; }
#guild-body .btns { display: flex; gap: 6px; align-items: center; }

/* settings and help */
.set-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); font-size: 12px; }
.set-row span { flex: 1; }
.set-row kbd { padding: 1px 4px; border: 1px solid #000; border-radius: 2px; background: var(--well); color: var(--muted); }
.set-row input.vol { width: 130px; height: 14px; margin: 0; accent-color: #d8b25a; cursor: pointer; }
.help p { margin: 0 0 7px; font-size: 12px; line-height: 1.6; } .help b { color: var(--gold); font-weight: 600; }

/* ── death, title, creation ── */
#dead { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(30, 4, 8, .55); }
#dead .frame { padding: 22px 34px 24px; text-align: center; }
#dead p { color: var(--tx2, #cfc9ba); font-size: 12px; margin: 0 0 14px; }
h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: 2px; color: var(--gold); }

/* the title, the server list and character creation: lobby.css */
.pick { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pick button.on { color: var(--gold-hi); box-shadow: inset 0 0 0 1px var(--line-hi), inset 1px 1px 0 rgba(255, 255, 255, .1); background: linear-gradient(var(--sf4, #4a4232), var(--sf2, #2e2a22)); }

/* ── mini-games ── */
#minigame { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(6, 8, 16, .45); }
.mg { width: min(380px, calc(100vw - 20px)); padding: 14px 16px 16px; text-align: center; }
.mg.win { background: linear-gradient(var(--panel-a), var(--panel-b)); border: 1px solid var(--ink); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line), 0 8px 24px rgba(0, 0, 0, .5); }
.mg header { font-family: var(--serif); font-size: 16px; color: var(--gold); margin-bottom: 4px; }
.mg-hint { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.mg-lane { width: 100%; max-width: 340px; border-radius: 3px; border: 1px solid #000; box-shadow: 0 0 0 1px var(--line); image-rendering: auto; touch-action: manipulation; cursor: pointer; }
.mg-info { min-height: 1.5em; margin-top: 8px; font-size: 13px; }
.mg-time { height: 6px; background: #000; border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.mg-time i { display: block; height: 100%; width: 100%; }
.mg-pan { display: grid; grid-template-columns: repeat(4, 44px); gap: 3px; justify-content: center; padding: 10px; margin: 0 auto 10px; width: max-content; background: var(--sf3, #2a2c36); border-radius: 50% 50% 46% 46% / 18%; border: 3px solid var(--sf5, #50525e); }
.mg-pan .cell { width: 44px; height: 44px; border-radius: 6px; background: rgba(0, 0, 0, .35); cursor: pointer; }
.mg-pan .cell.on { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), inset 0 3px 0 rgba(255, 255, 255, .25); }
.mg-pan .cell.ghost { opacity: .45; }
.mg-tray { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; min-height: 64px; }
.mg-tray .piece { display: grid; gap: 2px; padding: 6px; border-radius: 3px; border: 1px solid #000; background: var(--well); cursor: pointer; }
.mg-tray .piece.sel { box-shadow: inset 0 0 0 1px var(--line-hi); background: rgba(226, 196, 134, .14); }
.mg-tray .piece i { width: 14px; height: 14px; border-radius: 3px; }
.mg .btns { justify-content: center; margin-top: 8px; }

/* ── CRT: an old tube telly, drawn by the compositor over the world ── */
#crt, #crt-frame { display: none; position: fixed; inset: 0; pointer-events: none; }
body.crt #crt { display: block; z-index: 3; overflow: hidden; animation: crt-flicker 3.2s infinite; }
body.crt #crt-frame { display: block; z-index: 90; background: radial-gradient(ellipse 60% 40% at 28% 14%, rgba(255, 255, 255, .045), transparent 70%); }
body.crt #crt::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(6, 4, 14, .16) 2px 3px); }
body.crt #crt::after { content: ""; position: absolute; inset: 0; opacity: .55; background: repeating-linear-gradient(to right, rgba(255, 40, 60, .07) 0 1px, rgba(40, 255, 120, .05) 1px 2px, rgba(60, 120, 255, .08) 2px 3px); }
body.crt #crt .roll { position: absolute; left: 0; right: 0; top: 0; height: 22vh; animation: crt-roll 9s linear infinite;
  background: linear-gradient(to bottom, transparent, rgba(220, 240, 255, .045) 45%, rgba(220, 240, 255, .07) 52%, transparent); }
body.crt #world { filter: saturate(1.18) contrast(1.07) brightness(1.07); }
body.crt #text { filter: drop-shadow(1px 0 0 rgba(255, 40, 80, .45)) drop-shadow(-1px 0 0 rgba(40, 170, 255, .45)); }
@keyframes crt-roll { from { transform: translateY(-25vh); } to { transform: translateY(125vh); } }
@keyframes crt-flicker { 0%, 100% { opacity: 1; } 41% { opacity: 1; } 42% { opacity: .82; } 43% { opacity: 1; } 77% { opacity: .92; } 78% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body.crt #crt, body.crt #crt .roll { animation: none; } }

@media (max-width: 560px) {
  .qwin { grid-template-columns: 1fr; }
  .qlist { max-height: 30vh; }
  .grid { grid-template-columns: repeat(6, 1fr); }
  .slot { width: auto; height: auto; aspect-ratio: 1; }
  .slot img { inset: 10%; left: 10%; top: 10%; width: 80%; height: 80%; }
  #banner { font-size: 26px; }
}

/* ───────────── waypoints, dailies, achievements, collection, event, first steps ───────────── */
#w-warp { width: 340px; } #w-daily { width: 360px; } #w-achieve { width: 420px; } #w-collect { width: 440px; }
.list .it.wp .wpi, .list .it.ach .achi { width: 26px; height: 26px; flex: none; display: grid; place-items: center; background: var(--well); border: 1px solid #000; border-radius: 3px; }
.list .it.wp .wpi img.gi, .list .it.ach .achi img.gi { width: 16px; height: 16px; }
.list .it.wp.locked, .list .it.ach.locked { opacity: .55; }
.list .it.wp.cur { box-shadow: inset 0 0 0 1px var(--line-hi); }
.list .it.wp.pick { box-shadow: inset 0 0 0 1px #8ad8ff; }
.list .it.ach.got .tx { color: var(--gold-hi, var(--tx-gold, #f3dca6)); }
.list .it.ach.on { box-shadow: inset 0 0 0 1px #ffcf6a; }
.list .it .pts { font-style: normal; font-size: 11px; color: var(--gold); white-space: nowrap; }
.say { margin: 0 0 8px; font-size: 12px; line-height: 1.5; color: var(--tx2, #d8d2c2); }
.tabs { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px 0 8px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 3px 9px; font-size: 11px; font-weight: 600; color: var(--muted); background: transparent; border: 1px solid transparent; border-bottom: none; border-radius: 3px 3px 0 0; cursor: pointer; }
.tabs button.on { color: var(--gold); border-color: var(--line); background: rgba(226, 196, 134, .08); }
.tabs button.done::after { content: " ✓"; color: var(--tx-ok, #9af0ae); }
.ach-top, .daily-top { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.ach-top small, .daily-top b { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 11px; }
.daily-top { margin-bottom: 8px; color: var(--tx2, #d8d2c2); }
.dcard { padding: 8px 9px; margin-bottom: 6px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(0, 0, 0, .6); border-radius: 3px; }
.dcard .dh { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.dcard .dh b { flex: 1; font-weight: 600; }
.dcard .dh span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.dcard .bar { height: 6px; margin: 6px 0; }
.dcard .bar i { background: linear-gradient(var(--xp-hi) 0 1px, var(--xp) 1px); }
.dcard .df { display: flex; align-items: center; gap: 8px; }
.dcard .df small { flex: 1; color: var(--gold); font-size: 11px; }
.dcard.done { box-shadow: inset 0 0 0 1px #9af0ae; }
.dcard.claimed { opacity: .55; }
.dcard.bonus { border-color: var(--rim, #6a5418); background: rgba(226, 196, 134, .07); }
.col-bonus { display: flex; gap: 8px; align-items: center; font-size: 11px; padding: 6px 8px; margin-bottom: 8px; border: 1px dashed var(--line); border-radius: 3px; color: var(--muted); }
.col-bonus b { color: var(--tx2, #d8d2c2); font-weight: 600; } .col-bonus span { margin-left: auto; color: var(--gold); }
.col-bonus.done { border-style: solid; border-color: #4a8a5a; } .col-bonus.done b { color: var(--tx-ok, #9af0ae); }
.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.col-region { display: flex; align-items: center; gap: 6px; margin: 5px 0; }
.col-region select { flex: 1; min-width: 0; padding: 3px; background: var(--well); color: inherit; font: inherit; }
.col-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; background: rgba(255, 255, 255, .03); border: 1px solid rgba(0, 0, 0, .6); border-radius: 3px; text-align: center; }
.col-cell img { width: 54px; height: 54px; image-rendering: pixelated; background: var(--well); border: 1px solid #000; border-radius: 3px; }
.col-cell b { font-size: 11px; font-weight: 600; line-height: 1.25; }
.col-cell small { font-size: 10px; color: var(--muted); }
.col-lore { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.col-cell .bar { width: 100%; height: 4px; margin: 2px 0 0; }
.col-cell .bar i { background: var(--gold); }
.col-cell.ok { box-shadow: inset 0 0 0 1px rgba(226, 196, 134, .5); } .col-cell.ok small { color: var(--tx-ok, #9af0ae); }
#cast { position: fixed; left: 50%; bottom: calc(104px + var(--safe-b, 0px)); transform: translateX(-50%); z-index: 7; width: 200px; text-align: center; pointer-events: none; }
#cast b { display: block; font-size: 11px; color: #ffe08a; text-shadow: 0 1px 2px #000; margin-bottom: 2px; }
#cast > i { display: block; height: 8px; background: #000; border: 1px solid #6a5418; border-radius: 2px; overflow: hidden; }
#cast > i > i { display: block; height: 100%; width: 0; background: linear-gradient(#fff2b0, #e0a83a); }
#fade { position: fixed; inset: 0; z-index: 80; pointer-events: none; background: #fff; animation: fade-in .7s ease-out forwards; }
@keyframes fade-in { from { opacity: .85; } to { opacity: 0; } }
/* through a house door: a warm dusk fade instead of the white flash */
#fade.door { background: #1e120a; animation: fade-door .9s ease-out forwards; }
@keyframes fade-door { 0% { opacity: 1; } 25% { opacity: .9; } 100% { opacity: 0; } }
/* ── growth: the fifth and sixth skills, the warehouse, scrolls, the death panel, settings ── */
/* (HUD rules live in hud.css) */
#st-buffs span.scr { color: var(--tx-info, #bfe6ff); box-shadow: inset 0 0 0 1px rgba(120, 190, 255, .45); }
#dead .dead-btns { display: flex; gap: 10px; justify-content: center; }
#dead .dead-btns .btn:disabled { opacity: .45; cursor: default; }
#dead p.hint { margin: 12px 0 0; color: var(--tx3, #a8a294); font-size: 11px; }
.set-row select.sel { background: var(--well); color: inherit; border: 1px solid #000; border-radius: 2px; padding: 2px 4px; font: inherit; }
#w-settings .set-row span { white-space: nowrap; }
#w-settings .set-row #opt-ahp, #w-settings .set-row #opt-amp { width: 110px; }
#w-train .body, #w-skill .body, #w-shop .body { max-height: calc(100vh - 150px); overflow-y: auto; }
.set-row .pct { width: 52px; text-align: right; font-size: 11px; color: var(--gold); font-weight: 600; }
#w-bank { width: min(620px, calc(100vw - 8px)); }
.bank-top { display: flex; gap: 16px; justify-content: space-between; margin-bottom: 6px; font-size: 12px; }
.bank-top .gold { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); }
.bank-panes { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.bank-panes .pane { flex: 1 1 270px; }
.bank-panes .pt { font-size: 11px; color: var(--muted); margin: 0 0 4px 2px; }
.bank-grid { max-height: 316px; overflow-y: auto; padding-right: 2px; }
.bank-gold { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 8px; }
.bank-gold input { width: 120px; background: var(--well); color: inherit; border: 1px solid #000; border-radius: 2px; padding: 3px 6px; font: inherit; }
.it.sellall { box-shadow: inset 0 0 0 1px rgba(216, 178, 90, .35); }
.it.sk-row img { image-rendering: pixelated; }
.it.sk-row .sklv, .skill .sklv { color: var(--gold); font-weight: 700; }
.it.sk-row.locked { opacity: .5; }
