/* Magic World — ornate fantasy pixel UI (original style) */
:root {
  --bg: #0c0812;
  --ink: #120a06;
  --gold: #d8a84a;
  --gold-hi: #ffe7a0;
  --gold-lo: #7a5222;
  --bronze: #9a6a32;
  --violet: #8a5cff;
  --text: #efe7d6;
  --dim: #a89c8a;
  --good: #6ee36e;
  --bad: #ff5c5c;
  --warn: #ffb347;
  --hp1: #ff7a6a; --hp2: #d42a2a; --hp3: #6a0c10;
  --mp1: #7ab8ff; --mp2: #2a62d8; --mp3: #0c2268;
  --r0: #9a9a9a; --r1: #4fd34f; --r2: #3a92ff; --r3: #b45cff; --r4: #ff9a2a;
  --ui-scale: 1;
  --chat-font: 13px;
  --joy-size: 120px;
  --joy-opacity: 0.6;
  --px: 'Press Start 2P', 'Rubik', monospace;
  --sans: 'Rubik', 'Noto Sans', 'Segoe UI', 'Malgun Gothic', 'Apple SD Gothic Neo', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  /* 9-slice ornate gold frame (slice 6) with violet corner gems */
  --frame: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' shape-rendering='crispEdges'%3E%3Cpath fill-rule='evenodd' fill='%23140a04' d='M0 0h24v24H0zM1 1v22h22V1z'/%3E%3Cpath fill-rule='evenodd' fill='%23ffe7a0' d='M1 1h22v22H1zM2 2v20h20V2z'/%3E%3Cpath fill='%236a4418' d='M22 2h1v21H2v-1h20z'/%3E%3Cpath fill-rule='evenodd' fill='%23c08a34' d='M2 2h20v20H2zM4 4v16h16V4z'/%3E%3Cpath fill-rule='evenodd' fill='%23281406' d='M4 4h16v16H4zM5 5v14h14V5z'/%3E%3Cpath fill='%23140a04' d='M0 0h6v6H0zM18 0h6v6h-6zM0 18h6v6H0zM18 18h6v6h-6z'/%3E%3Cpath fill='%23e0b050' d='M1 1h4v4H1zM19 1h4v4h-4zM1 19h4v4H1zM19 19h4v4h-4z'/%3E%3Cpath fill='%238a5cff' d='M2 2h2v2H2zM20 2h2v2h-2zM2 20h2v2H2zM20 20h2v2h-2z'/%3E%3Cpath fill='%23d8c0ff' d='M2 2h1v1H2zM20 2h1v1h-1zM2 20h1v1H2zM20 20h1v1h-1z'/%3E%3C/svg%3E");
  /* thin bronze frame (slice 3) */
  --frame-thin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill-rule='evenodd' fill='%23100804' d='M0 0h9v9H0zM1 1v7h7V1z'/%3E%3Cpath fill-rule='evenodd' fill='%23b07c3a' d='M1 1h7v7H1zM2 2v5h5V2z'/%3E%3Cpath fill='%23e8c070' d='M1 1h7v1H2v6H1z'/%3E%3Cpath fill-rule='evenodd' fill='%232a1608' d='M2 2h5v5H2zM3 3v3h3V3z'/%3E%3C/svg%3E");
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --leather: var(--noise), radial-gradient(ellipse at 50% 0%, rgba(140, 90, 200, .16), transparent 60%), linear-gradient(180deg, #2b1f2c 0%, #1b131d 55%, #140e16 100%);
  --stone: var(--noise), linear-gradient(180deg, #2a2430, #19141e);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 var(--sans); overflow: hidden; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
h2, h3 { font-family: var(--px); font-weight: 400; color: var(--gold-hi); margin: 0 0 12px; letter-spacing: .5px; text-shadow: 0 2px 0 #000, 0 0 10px rgba(216, 168, 74, .35); line-height: 1.5; }
h2 { font-size: 14px; } h3 { font-size: 11px; margin-top: 14px; color: var(--gold); }
a { color: var(--gold-hi); }
img.ico { width: 32px; height: 32px; image-rendering: pixelated; display: block; pointer-events: none; }
img.ico.sm { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; margin-right: 3px; }
img.ico.big { width: 48px; height: 48px; }
.ico-missing { display: inline-block; width: 16px; height: 16px; background: #333; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- frames, panels, buttons ---------- */
.panel, .win, .hud-panel, #tip, #pop, #ctx, .invite {
  border: 6px solid transparent;
  border-image: var(--frame) 6 / 6px stretch;
  background: var(--leather);
  background-clip: padding-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.panel { padding: 16px 18px; }
.btn {
  position: relative; font-family: var(--sans); font-weight: 700; font-size: 14px; letter-spacing: .2px;
  padding: 7px 14px; border: 2px solid #120a04; border-radius: 4px; color: #f6ecd8;
  background: linear-gradient(180deg, rgba(255, 255, 255, .22) 0, rgba(255, 255, 255, .06) 45%, rgba(0, 0, 0, 0) 50%), linear-gradient(180deg, #5b3f86, #2c1c48);
  box-shadow: inset 0 0 0 1px #b88a3e, inset 0 -3px 0 rgba(0, 0, 0, .35), 0 2px 0 #000;
  text-shadow: 0 1px 0 #000; white-space: nowrap; transition: filter .12s, transform .06s;
}
.btn:hover:not(:disabled) { filter: brightness(1.2) saturate(1.1); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 0 0 1px #b88a3e, inset 0 2px 0 rgba(0, 0, 0, .4); }
.btn:disabled { filter: grayscale(.7) brightness(.7); cursor: not-allowed; }
.btn.primary { color: #2a1604; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); background: linear-gradient(180deg, rgba(255, 255, 255, .45) 0, rgba(255, 255, 255, .1) 45%, rgba(0, 0, 0, 0) 50%), linear-gradient(180deg, #f0c254, #b0741e); box-shadow: inset 0 0 0 1px #fff0b8, inset 0 -3px 0 rgba(90, 40, 0, .4), 0 2px 0 #000, 0 0 12px rgba(240, 190, 80, .25); }
.btn.danger { background: linear-gradient(180deg, rgba(255, 255, 255, .2) 0, rgba(255, 255, 255, .05) 45%, transparent 50%), linear-gradient(180deg, #a8323e, #5a121c); }
.btn.big { font-size: 16px; padding: 10px 24px; }
.btn.small { font-size: 12px; padding: 4px 10px; }
.btn.test { background: linear-gradient(180deg, rgba(255, 255, 255, .25) 0, transparent 50%), linear-gradient(180deg, #46a858, #1f5a2a); white-space: normal; line-height: 1.2; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--dim); font-size: 14px; padding: 4px 8px; border-radius: 3px; }
.icon-btn:hover { border-color: var(--gold-lo); color: var(--text); }
.icon-btn.danger:hover { color: var(--bad); border-color: var(--bad); }
input[type=text], input[type=password], input[type=number], textarea, select {
  font: 14px var(--sans); color: var(--text); background: rgba(4, 2, 8, .75);
  border: 2px solid #3a2a1a; border-radius: 3px; padding: 8px 10px; outline: none; width: 100%;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .5);
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .5), 0 0 0 2px rgba(216, 168, 74, .2); }
textarea { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.field > span { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.field.inline { flex-direction: row; align-items: center; gap: 6px; margin: 0; }
.field.inline input { width: 110px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 12px; }
.row.between { justify-content: space-between; margin-top: 12px; }
.hint { color: var(--dim); font-size: 13px; margin: 6px 0; }
.hint.small { font-size: 11px; }
.form-err { color: var(--bad); min-height: 18px; font-size: 13px; margin: 4px 0; }
.loading { color: var(--dim); padding: 14px; text-align: center; }
.empty-note { color: var(--dim); text-align: center; padding: 18px; font-style: italic; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 9px; background: #2a1d3a; border: 1px solid #6a5a86; margin-left: 6px; }
.badge.good { background: #1a3e22; border-color: var(--good); color: #c8ffd0; }
.money { display: inline-flex; align-items: center; gap: 4px; font: 10px var(--px); color: var(--gold-hi); white-space: nowrap; text-shadow: 0 1px 0 #000; }
.money img.ico { width: 16px; height: 16px; }
.valor-ico { color: #ff8a8a; font-family: var(--sans); font-size: 14px; }
.divider { height: 6px; margin: 10px 0; background: linear-gradient(90deg, transparent, var(--gold-lo) 15%, var(--gold) 50%, var(--gold-lo) 85%, transparent) center / 100% 2px no-repeat; }

/* ---------- pre-game screens ---------- */
#screens { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; }
#titleBg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.screen-wrap { position: relative; z-index: 1; min-height: 100%; }
.screen { min-height: 100vh; padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; }
.screen.center { justify-content: center; gap: 14px; }
.langbar { position: absolute; top: calc(10px + var(--safe-t)); right: 12px; display: flex; gap: 4px; z-index: 3; }
.lang { font-size: 12px; font-weight: 600; padding: 5px 10px; background: rgba(16, 10, 20, .8); border: 1px solid #5a4020; border-radius: 3px; }
.lang.on { border-color: var(--gold); color: var(--gold-hi); box-shadow: 0 0 8px rgba(216, 168, 74, .4); }
.logo { text-align: center; margin-bottom: 6px; animation: logoIn 1s ease-out both; }
.logo-title {
  font-family: 'Press Start 2P', monospace; font-size: clamp(24px, 6vw, 56px); letter-spacing: 3px; line-height: 1.25;
  background: linear-gradient(180deg, #fff6c8 0%, #ffd35a 42%, #c8701e 52%, #ffcf5a 75%, #fff0b0 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: var(--gold-hi);
  filter: drop-shadow(0 3px 0 #3a1a04) drop-shadow(0 6px 0 #140804) drop-shadow(0 0 16px rgba(138, 92, 255, .75));
}
.logo.small .logo-title { font-size: clamp(16px, 3.6vw, 28px); }
.logo-sub { font-weight: 600; color: #e0d0ff; margin-top: 12px; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; text-shadow: 0 2px 0 #000; }
@keyframes logoIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
.login-panel { width: min(380px, 100%); }
.login-panel .btn { width: 100%; margin-top: 8px; }
.switch { text-align: center; margin-top: 12px; font-size: 13px; color: var(--dim); }
.foot { color: var(--dim); font-size: 11px; opacity: .8; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.acct, .realm-chip { font-weight: 600; color: var(--dim); font-size: 13px; }
.realm-panel { width: min(840px, 100%); }
.realms { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 10px; margin: 10px 0; }
.realm-card { position: relative; padding: 14px 10px; border: 6px solid transparent; border-image: var(--frame-thin) 3 / 6px stretch; background: var(--stone); background-clip: padding-box; text-align: center; transition: transform .12s, filter .12s; }
.realm-card:hover { transform: translateY(-3px); filter: brightness(1.15); }
.realm-card.rec { border-image: var(--frame) 6 / 6px stretch; }
.flag { font-family: var(--px); font-size: 12px; color: #fff; padding: 9px 0; margin: 0 auto 8px; width: 60px; border-radius: 2px; background: #444; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .3), 0 0 0 2px #140a04; }
.flag-eu { background: #2d47a8; color: #ffd35a; }
.flag-us { background: linear-gradient(180deg, #b33 0 33%, #eee 33% 66%, #2d47a8 66%); text-shadow: 0 1px 2px #000; }
.flag-kr { background: #f4f4f4; color: #c33; }
.flag-cn { background: #c8281e; color: #ffd35a; }
.flag-ua { background: linear-gradient(180deg, #2a62c8 50%, #f5d020 50%); text-shadow: 0 1px 2px #000; }
.realm-name { font-weight: 700; font-size: 15px; }
.realm-online { font-size: 12px; color: var(--good); margin-top: 4px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #666; margin-right: 5px; }
.dot.on, .realm-online .dot { background: var(--good); box-shadow: 0 0 6px var(--good); }
.realm-lang { font-size: 11px; color: var(--dim); }
.rec-badge { position: absolute; top: -12px; right: 4px; font-size: 10px; background: var(--gold); color: #1a1206; padding: 1px 7px; border-radius: 6px; font-weight: 700; box-shadow: 0 0 0 1px #140a04; }
.chars-panel { width: min(660px, 100%); }
.char-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; max-height: 50vh; overflow-y: auto; }
.char-card { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border: 6px solid transparent; border-image: var(--frame-thin) 3 / 6px stretch; background: var(--stone); background-clip: padding-box; cursor: pointer; }
.char-card.sel { border-image: var(--frame) 6 / 6px stretch; box-shadow: 0 0 16px rgba(216, 168, 74, .3); }
.char-info { flex: 1; }
.char-name { font-weight: 700; font-size: 18px; color: var(--gold-hi); }
.char-meta { font-size: 13px; }
.char-meta2 { font-size: 12px; font-weight: 600; }
canvas.pv { background: radial-gradient(circle at 50% 70%, rgba(138, 92, 255, .25), transparent 70%); }
.screen.create { padding-top: calc(50px + var(--safe-t)); }
.create-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; width: min(1100px, 100%); }
.alliance { margin-bottom: 8px; }
.alliance-name { font: 9px var(--px); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
.fac-row, .cls-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cls-row { grid-template-columns: repeat(5, 1fr); }
.fac-card, .cls-card { border: 6px solid transparent; border-image: var(--frame-thin) 3 / 6px stretch; background: var(--stone); background-clip: padding-box; padding: 8px; text-align: center; transition: filter .12s, transform .1s; }
.fac-card { box-shadow: inset 3px 0 0 var(--ac, #888); }
.fac-card:hover, .cls-card:hover { filter: brightness(1.2); transform: translateY(-1px); }
.fac-card.sel, .cls-card.sel { border-image: var(--frame) 6 / 6px stretch; box-shadow: 0 0 14px rgba(216, 168, 74, .35), inset 3px 0 0 var(--ac, transparent); }
.fac-name, .cls-name { font-weight: 700; }
.fac-race, .cls-role { font-size: 11px; color: var(--dim); }
.cls-card canvas { margin: 0 auto; display: block; }
.fac-desc, .cls-desc { margin-top: 8px; padding: 8px 10px; background: rgba(0, 0, 0, .35); border-left: 3px solid var(--gold); font-size: 13px; }
.bonus { color: var(--good); }
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; font-size: 12px; color: var(--dim); }
.skills-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.skill-chip { font-size: 12px; background: #1c1424; border: 1px solid #4a3a28; padding: 2px 6px; border-radius: 3px; }
.preview-box { position: relative; display: flex; flex-direction: column; align-items: center; padding: 10px; background: radial-gradient(ellipse at 50% 70%, rgba(138, 92, 255, .3), transparent 65%), rgba(0, 0, 0, .35); border: 1px solid #3a2a1a; }
.big-preview { width: 160px; height: 200px; }
.pv-label { font-weight: 700; color: var(--gold-hi); }
.app-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; color: var(--dim); }
.swatches { display: flex; gap: 6px; }
.swatches.wrap { flex-wrap: wrap; }
.sw { width: 28px; height: 28px; border: 2px solid #140a04; border-radius: 3px; padding: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.sw.small { width: 22px; height: 22px; }
.sw.sel { border-color: var(--gold-hi); box-shadow: 0 0 0 2px var(--gold-lo), 0 0 8px var(--gold); }
.stepper { display: flex; gap: 4px; }
.step { min-width: 32px; padding: 5px 8px; background: #1c1424; border: 2px solid #3a2a1a; border-radius: 3px; font-weight: 700; }
.step.sel { border-color: var(--gold); color: var(--gold-hi); }
.step.wide { min-width: 70px; }

/* ---------- game canvases ---------- */
#game { position: fixed; inset: 0; overflow: hidden; touch-action: none; }
#world, #overlay { position: absolute; left: 0; top: 0; }
#overlay { touch-action: none; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' shape-rendering='crispEdges'%3E%3Cpath fill='%23140a04' d='M0 0h4v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h-5v1h1v2h1v2h-2v-2H8v-2H7v1H6v1H5v1H4v1H3v1H2v1H0z'/%3E%3Cpath fill='%23ffd35a' d='M1 1h2v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h-4v1H8v1H7v1H6v1H5v1H4v1H3v1H2v-1H1z'/%3E%3Cpath fill='%23fff3c0' d='M1 1h1v14H1z'/%3E%3C/svg%3E") 1 1, default; }
body.low-hp #game::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 140px rgba(220, 20, 20, .55); animation: pulse 1.1s ease-in-out infinite; z-index: 5; }
body.whisper-flash .chat { filter: drop-shadow(0 0 10px rgba(224, 138, 255, .8)); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
.hud-panel { position: absolute; padding: 4px 6px; zoom: var(--ui-scale); border-width: 8px; border-image: var(--frame) 6 / 8px stretch; }
.num { font-family: var(--px); }

/* player frame */
.pf { left: calc(6px + var(--safe-l)); top: calc(6px + var(--safe-t)); width: 276px; padding: 4px 8px 6px 4px; }
.pf-top { display: flex; gap: 8px; align-items: center; }
.portrait-wrap { position: relative; width: 62px; height: 62px; flex: none; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #4a3a6a, #140c1e 75%); box-shadow: 0 0 0 2px #140a04, 0 0 0 4px #c08a34, 0 0 0 5px #ffe7a0, 0 0 0 7px #140a04, 0 3px 10px #000; overflow: hidden; }
.portrait { width: 62px; height: 62px; display: block; }
.pf-lvl { position: absolute; left: 50px; top: 46px; z-index: 2; min-width: 24px; height: 22px; padding: 0 4px; display: flex; align-items: center; justify-content: center; font: 9px var(--px); color: #2a1604; background: linear-gradient(180deg, #fff0b0, #e0a83a 60%, #9a6018); border: 2px solid #140a04; border-radius: 11px; box-shadow: 0 2px 0 #000; }
.pf-bars { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-name { font-weight: 700; color: var(--gold-hi); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #000; }
.bar { position: relative; height: 16px; background: linear-gradient(180deg, #050307, #1a1016); border: 2px solid #140a04; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px #7a5222, inset 0 2px 3px #000; }
.bar-fill { position: absolute; inset: 0 auto 0 0; transition: width .2s linear; }
.bar-fill::after { content: ''; position: absolute; left: 0; right: 0; top: 1px; height: 35%; background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, .05)); border-radius: 2px; }
.bar-hp .bar-fill, .bar-thp .bar-fill, .bar-php .bar-fill { background: linear-gradient(180deg, var(--hp1), var(--hp2) 55%, var(--hp3)); }
.bar-mp .bar-fill { background: linear-gradient(180deg, var(--mp1), var(--mp2) 55%, var(--mp3)); }
.bar-thp:not(.enemy) .bar-fill { background: linear-gradient(180deg, #a0ff8a, #3aa83a 55%, #145a14); }
.bar-txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 8px var(--px); color: #fff; text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000; }
.buffs { display: flex; flex-wrap: wrap; gap: 3px; margin: 5px 0 0 2px; }
.buffs:empty { display: none; }
.buff { position: relative; width: 26px; height: 26px; border: 2px solid #140a04; border-radius: 3px; background: #120c18; box-shadow: 0 0 0 1px #9a6a32; }
.buff img.ico { width: 22px; height: 22px; }
.buff .bt { position: absolute; bottom: -4px; left: 0; right: 0; text-align: center; font: 7px var(--px); color: #fff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
.buff.ending { animation: blink .5s step-end infinite; }
@keyframes blink { 50% { opacity: .4; } }

/* XP bar along the bottom */
.xpbar { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; padding: 0; background: #07040a; border-top: 2px solid #140a04; box-shadow: 0 -1px 0 #7a5222; pointer-events: auto; z-index: 2; }
.xpbar .xp-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #fff0a0, #e0a83a 50%, #8a5a10); transition: width .3s; }
.xpbar .xp-ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0, 0, 0, .7) calc(10% - 1px) 10%); }
.xpbar .xp-txt { position: absolute; left: 50%; bottom: 11px; transform: translateX(-50%); font: 8px var(--px); color: var(--gold-hi); text-shadow: 1px 1px 0 #000; opacity: 0; transition: opacity .2s; white-space: nowrap; pointer-events: none; }
.xpbar:hover .xp-txt { opacity: 1; }

/* party */
.party-frames { left: calc(6px + var(--safe-l)); top: calc(118px + var(--safe-t)); width: 180px; display: flex; flex-direction: column; gap: 4px; }
.pm { cursor: pointer; padding: 3px 4px; border-radius: 2px; }
.pm:hover { background: rgba(255, 255, 255, .06); }
.pm.far { opacity: .55; }
.pm-name { font-weight: 700; font-size: 12px; color: #b8ffc0; text-shadow: 0 1px 0 #000; }
.pm-lvl { color: var(--dim); font: 7px var(--px); }
.pm .bar { height: 9px; border-width: 1px; }

/* target */
.tf { left: 50%; transform: translateX(-50%); top: calc(6px + var(--safe-t)); width: 300px; display: flex; gap: 8px; align-items: center; padding: 4px 8px 6px 4px; }
.tf-portrait { width: 48px; height: 48px; flex: none; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #5a2a2a, #140808 75%); box-shadow: 0 0 0 2px #140a04, 0 0 0 4px #c08a34, 0 0 0 6px #140a04; }
.tf-main { flex: 1; min-width: 0; }
.tf-row { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.tf-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #000; }
.tf-sub { font-size: 11px; color: var(--dim); margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.tf-lvl { font: 8px var(--px); padding: 2px 4px; border-radius: 3px; background: #140a04; }
.tf-tag { font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 3px; background: #4a1a10; color: #ffb347; border: 1px solid #ff8a3a; }
.tf-tag.boss { background: #4a0a1a; color: #ff6a8a; border-color: #ff3b6a; }
.tf-x { background: none; border: none; color: var(--dim); padding: 0 4px; font-size: 14px; }

/* minimap */
.mm { right: calc(6px + var(--safe-r)); top: calc(6px + var(--safe-t)); padding: 3px; }
.mm-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px 3px; }
.zone-name { font-weight: 700; font-size: 12px; color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #000; max-width: 150px; }
.mm-btn { width: 22px; height: 22px; padding: 0; border: 2px solid #140a04; border-radius: 3px; background: linear-gradient(180deg, #f0c254, #9a6018); color: #2a1604; font: 9px var(--px); box-shadow: inset 0 0 0 1px #fff0b8; flex: none; }
#minimap { display: block; border: 2px solid #140a04; box-shadow: 0 0 0 1px #7a5222, inset 0 0 12px #000; image-rendering: pixelated; }
.mm-info { display: flex; justify-content: space-between; gap: 6px; margin-top: 3px; padding: 0 2px; }
.coords { font: 7px var(--px); color: var(--dim); }
.ping { font: 7px var(--px); }
.ping.good { color: var(--good); } .ping.mid { color: var(--warn); } .ping.bad { color: var(--bad); }

.tracker { right: calc(6px + var(--safe-r)); top: calc(222px + var(--safe-t)); width: 210px; cursor: pointer; border-image: var(--frame-thin) 3 / 6px stretch; background: rgba(14, 9, 16, .78); background-clip: padding-box; padding: 6px 8px; }
.tr-title { font-weight: 700; font-size: 13px; color: var(--gold-hi); text-shadow: 0 1px 0 #000; }
.tr-line { font-size: 12px; }
.tr-line.done { color: var(--good); }
.tr-hint { font-size: 11px; color: var(--good); }
.currency { position: absolute; right: calc(8px + var(--safe-r)); bottom: calc(76px + var(--safe-b)); display: flex; gap: 12px; font: 9px var(--px); color: var(--gold-hi); text-shadow: 1px 1px 0 #000; zoom: var(--ui-scale); }
.cur { display: inline-flex; align-items: center; gap: 4px; }
.cur img.ico { width: 16px; height: 16px; }

/* chat */
.chat { left: calc(6px + var(--safe-l)); bottom: calc(14px + var(--safe-b)); width: 390px; height: 226px; display: flex; flex-direction: column; border-image: var(--frame-thin) 3 / 6px stretch; background: rgba(10, 6, 14, .72); background-clip: padding-box; padding: 4px 6px 6px; }
.chat.mini { height: 70px; }
.chat.mini .chat-log { opacity: .7; }
.chat-tabs { display: flex; gap: 2px; margin-bottom: 3px; border-bottom: 1px solid #3a2a1a; }
.ctab { font-weight: 700; font-size: 12px; background: none; border: none; border-bottom: 2px solid transparent; padding: 2px 9px; color: var(--dim); }
.ctab.on { color: var(--gold-hi); border-bottom-color: var(--gold); }
.ctab.min { margin-left: auto; }
.chat-log { flex: 1; overflow-y: auto; font-size: var(--chat-font); line-height: 1.38; padding-right: 4px; user-select: text; }
.chat-log::-webkit-scrollbar { width: 6px; } .chat-log::-webkit-scrollbar-thumb { background: #5a4020; }
.cl { word-wrap: break-word; text-shadow: 1px 1px 0 #000; }
.cn { color: #ffd98a; cursor: pointer; font-weight: 700; }
.cpre { opacity: .85; }
.ch-world { color: #ffc89a; } .ch-guild { color: #8aff9a; } .ch-party { color: #8ad0ff; } .ch-whisper { color: #e8a0ff; } .ch-system { color: #ffe066; font-style: italic; }
.chat-in { margin-top: 4px; padding: 5px 8px; font-size: 13px; }
.chat-toggle, .menu-toggle { display: none; }
.hud-btn { position: absolute; width: 46px; height: 46px; border-radius: 50%; border: 2px solid #140a04; background: radial-gradient(circle at 40% 30%, #6a4a9a, #22163a); box-shadow: 0 0 0 2px #c08a34, 0 3px 6px #000; font-size: 20px; zoom: var(--ui-scale); color: var(--gold-hi); }
.hud-btn.unread::after { content: ''; position: absolute; top: 2px; right: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 6px var(--bad); }

/* skill bar */
.skillbar { left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b)); display: flex; gap: 6px; align-items: center; padding: 6px 8px; }
.skillbar .sep { width: 4px; height: 44px; margin: 0 2px; background: linear-gradient(180deg, transparent, var(--gold) 20%, var(--gold-lo) 80%, transparent); }
.skill { position: relative; width: 56px; height: 56px; padding: 8px; border: 2px solid #140a04; border-radius: 4px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #2e2238, #0c0810 80%);
  box-shadow: inset 0 0 0 1px #b07c3a, inset 2px 2px 0 rgba(255, 255, 255, .08), inset -2px -2px 0 rgba(0, 0, 0, .5), 0 2px 0 #000; transition: transform .06s, filter .1s; }
.skill img.ico { width: 36px; height: 36px; }
.skill:hover { filter: brightness(1.2); }
.skill.pressed { transform: scale(.92); box-shadow: inset 0 0 0 2px var(--gold-hi), 0 0 12px var(--gold); }
.skill .cd { position: absolute; inset: 0; pointer-events: none; }
.skill .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 12px var(--px); color: #fff; text-shadow: 2px 2px 0 #000; pointer-events: none; }
.skill .key { position: absolute; top: 2px; left: 3px; font: 7px var(--px); color: var(--gold-hi); text-shadow: 1px 1px 0 #000; }
.skill .q { position: absolute; bottom: 2px; right: 3px; font: 8px var(--px); color: #fff; text-shadow: 1px 1px 0 #000; }
.skill .lock { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; font-size: 18px; background: rgba(0, 0, 0, .6); }
.skill.locked .lock { display: flex; }
.skill.locked img { filter: grayscale(1) brightness(.5); }
.skill.lowmp::before { content: ''; position: absolute; inset: 0; background: rgba(20, 60, 200, .45); mix-blend-mode: multiply; z-index: 1; pointer-events: none; }
.skill.lowmp img { filter: saturate(.4) brightness(.7); }
.skill.nomana { animation: shakeX .3s; }
.skill.pot { width: 48px; height: 48px; padding: 6px; }
.skill.pot img.ico { width: 32px; height: 32px; }
.skill.pot.off img { opacity: .35; }
@keyframes shakeX { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.attack-btn { font-size: 26px; color: var(--gold-hi); }

/* menu */
.menubar { right: calc(6px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); display: flex; gap: 4px; padding: 5px; }
.menu-btn { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; padding: 0; border: 2px solid #140a04; border-radius: 4px; background: radial-gradient(circle at 50% 35%, #3a2a48, #120c18 80%); box-shadow: inset 0 0 0 1px #9a6a32, 0 2px 0 #000; }
.menu-btn:hover { filter: brightness(1.3); box-shadow: inset 0 0 0 1px var(--gold-hi), 0 0 10px rgba(216, 168, 74, .5); }
.menu-btn img.ico { width: 28px; height: 28px; }
.menu-btn .gear { font: 14px var(--px); color: var(--gold-hi); }
.menu-lbl { display: none; }
.menu-key { position: absolute; bottom: 1px; right: 2px; font: 6px var(--px); color: var(--gold-hi); text-shadow: 1px 1px 0 #000; }
body.ticket-unread .menu-btn.mb-support::after { content: ''; position: absolute; top: 2px; right: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

#joy { display: none; position: absolute; left: calc(24px + var(--safe-l)); bottom: calc(26px + var(--safe-b)); width: var(--joy-size); height: var(--joy-size); opacity: var(--joy-opacity); touch-action: none; }
.joy-base { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(138, 92, 255, .25), rgba(16, 10, 20, .65)); box-shadow: 0 0 0 3px #140a04, 0 0 0 5px #c08a34, inset 0 0 20px #000; display: flex; align-items: center; justify-content: center; }
.joy-knob { width: 42%; height: 42%; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff0b8, #d8a03a 55%, #6a4010); box-shadow: 0 0 0 2px #140a04, 0 4px 8px #000; }
#joy.active { opacity: 1; }
.spec-badge { position: absolute; top: calc(70px + var(--safe-t)); left: 50%; transform: translateX(-50%); background: #b01828; color: #fff; font: 10px var(--px); padding: 7px 14px; border: 2px solid #ff6a6a; border-radius: 3px; letter-spacing: 1px; animation: pulse 2s infinite; pointer-events: none; }
body.spectate .skillbar, body.spectate .menubar, body.spectate #joy, body.spectate .chat-in, body.spectate .menu-toggle, body.spectate .tf-x, body.spectate .mm-btn { display: none !important; }
body.spectate #overlay { pointer-events: none; }

/* ---------- windows ---------- */
/* modal layer: one centered, fixed window over a dim backdrop (click backdrop / Esc closes) */
#windows { position: absolute; inset: 0; pointer-events: none; z-index: 30; display: flex; align-items: center; justify-content: center; padding: calc(12px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l)); }
#windows.modal-on { pointer-events: auto; background: radial-gradient(ellipse at 50% 45%, rgba(8, 4, 14, .58), rgba(2, 1, 6, .82)); animation: fadeIn .12s; }
.win { border-width: 10px; border-image: var(--frame) 6 / 10px stretch; position: relative; width: 480px; max-width: min(720px, 100%); max-height: min(560px, calc(100vh - 24px)); display: flex; flex-direction: column; pointer-events: auto; zoom: var(--ui-scale); animation: winIn .14s ease-out; padding: 0; box-shadow: 0 0 0 1px #000, 0 18px 50px rgba(0, 0, 0, .75); }
.win.wide { width: 640px; }
.win.xwide { width: 720px; }
.win.narrow { width: 360px; }
@keyframes winIn { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }
.win-head { flex: none; display: flex; align-items: center; justify-content: center; position: relative; padding: 7px 40px; background: linear-gradient(180deg, rgba(216, 168, 74, .26), rgba(216, 168, 74, .04)), #1c1218; border-bottom: 2px solid #140a04; box-shadow: 0 1px 0 #7a5222; }
.win-title { font: 10px var(--px); color: var(--gold-hi); text-shadow: 2px 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.6; }
.win-title::before, .win-title::after { content: '◆'; color: var(--violet); margin: 0 8px; font-size: 8px; vertical-align: 2px; }
.win-close { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 2px solid #140a04; border-radius: 3px; background: linear-gradient(180deg, #b83a3a, #5a1010); color: #ffe0d0; font-weight: 700; box-shadow: inset 0 0 0 1px #ff9a7a; padding: 0; }
.win-close:hover { filter: brightness(1.3); }
.win-body { padding: 10px 12px 12px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.win-body::-webkit-scrollbar { width: 8px; } .win-body::-webkit-scrollbar-thumb { background: #5a4020; border-radius: 4px; }
.tabs { display: flex; gap: 3px; margin-bottom: 10px; border-bottom: 2px solid #3a2a1a; flex-wrap: wrap; }
.tab { font-weight: 700; font-size: 13px; background: linear-gradient(180deg, #2a1e30, #150e18); border: 2px solid #3a2a1a; border-bottom: none; padding: 5px 12px; color: var(--dim); border-radius: 4px 4px 0 0; margin-bottom: -2px; }
.tab.on { color: var(--gold-hi); background: linear-gradient(180deg, #4a3220, #241810); border-color: var(--gold-lo); box-shadow: inset 0 2px 0 var(--gold); }
.sec { margin-top: 12px; }
.sec-title, details.sec > summary { font: 9px var(--px); color: var(--gold); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .6px; padding-bottom: 4px; background: linear-gradient(90deg, var(--gold-lo), transparent) bottom / 100% 1px no-repeat; }
details.sec > summary { cursor: pointer; }
.kv-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; align-items: center; margin: 6px 0; }

/* item slots */
.slot { position: relative; width: 46px; height: 46px; padding: 5px; flex: none; cursor: pointer; border-radius: 3px;
  background: linear-gradient(135deg, #0a070c, #1c1520 60%, #120d16);
  border: 2px solid #3d3242;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .7), inset -1px -1px 0 rgba(255, 255, 255, .07), 0 0 0 1px #0a0608; }
.slot img.ico { width: 32px; height: 32px; }
.slot.empty { cursor: default; }
.slot .ph { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: #4a3d52; font-size: 18px; }
.slot.r0 { border-color: #6a6a6a; }
.slot.r1 { border-color: var(--r1); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .7), inset 0 0 8px rgba(79, 211, 79, .3), 0 0 0 1px #0a0608, 0 0 5px rgba(79, 211, 79, .35); }
.slot.r2 { border-color: var(--r2); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .7), inset 0 0 9px rgba(58, 146, 255, .4), 0 0 0 1px #0a0608, 0 0 6px rgba(58, 146, 255, .45); }
.slot.r3 { border-color: var(--r3); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .7), inset 0 0 10px rgba(180, 92, 255, .45), 0 0 0 1px #0a0608, 0 0 8px rgba(180, 92, 255, .55); }
.slot.r4 { border-color: var(--r4); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .7), inset 0 0 12px rgba(255, 154, 42, .5), 0 0 0 1px #0a0608, 0 0 10px rgba(255, 154, 42, .6); animation: legend 2.4s ease-in-out infinite; }
@keyframes legend { 50% { box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .7), inset 0 0 16px rgba(255, 154, 42, .7), 0 0 0 1px #0a0608, 0 0 16px rgba(255, 154, 42, .8); } }
.slot:not(.empty):hover { filter: brightness(1.3); }
.slot.broken { background: repeating-linear-gradient(45deg, #3a1018 0 4px, #1a0a10 4px 8px); }
.slot.broken img { filter: grayscale(.8) brightness(.7); }
.slot.broken::before { content: '✖'; position: absolute; right: 2px; bottom: 0; color: var(--bad); font-size: 11px; z-index: 1; }
.slot.sel, .slot.intrade { outline: 2px solid var(--gold-hi); outline-offset: 1px; }
.slot.intrade::after { content: '⇄'; position: absolute; top: 0; left: 2px; font-size: 11px; color: var(--gold-hi); }
.slot.big { width: 60px; height: 60px; } .slot.big img.ico { width: 46px; height: 46px; }
.slot .q { position: absolute; bottom: 1px; right: 2px; font: 7px var(--px); color: #fff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
.slot .plus { position: absolute; top: 1px; right: 1px; font: 7px var(--px); color: #2a1604; background: linear-gradient(180deg, #fff0b0, #e0a83a); padding: 1px 2px; border-radius: 2px; box-shadow: 0 0 0 1px #140a04; }
.slot .gems { position: absolute; left: 2px; bottom: 2px; display: flex; gap: 2px; }
.slot .gems i { width: 5px; height: 5px; transform: rotate(45deg); background: #120c18; border: 1px solid #8a7aa0; }
.slot .gems i.on { background: #c77dff; border-color: #fff; box-shadow: 0 0 4px #c77dff; }
.bag-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.bag-count { margin-left: auto; color: var(--dim); font: 8px var(--px); }
.fair { font-size: 11px; color: var(--good); flex: 1; }
.bag-grid { display: grid; grid-template-columns: repeat(6, 46px); gap: 4px; justify-content: center; }
.bag-grid.small { grid-template-columns: repeat(auto-fill, 46px); }

/* inventory window */
.inv-win { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.doll { display: grid; grid-template-columns: 46px 132px 46px; grid-template-rows: repeat(4, auto) auto; gap: 6px 8px; align-items: center; justify-items: center; padding: 8px; background: radial-gradient(ellipse at 50% 55%, rgba(138, 92, 255, .22), transparent 65%), rgba(0, 0, 0, .3); border: 1px solid #3a2a1a; }
.doll-mid { grid-column: 2; grid-row: 1 / 5; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.doll-bottom { grid-column: 1 / 4; display: flex; gap: 10px; justify-content: center; }
.eq-slot { display: flex; flex-direction: column; align-items: center; }
.eq-lbl { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .3px; margin-top: 1px; }
.char-pv { width: 128px; height: 150px; }
.eq-costume .slot { border-color: #c9a0ff; background: radial-gradient(circle at 50% 45%, rgba(255, 211, 90, .22), rgba(138, 72, 255, .28) 60%, rgba(20, 10, 30, .85)); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .7), inset 0 0 10px rgba(199, 125, 255, .45), 0 0 0 1px #0a0608, 0 0 7px rgba(255, 211, 90, .45); }
.eq-costume .slot .ph { color: #ffd35a; text-shadow: 0 0 6px #c77dff; }
.eq-costume .eq-lbl { color: #e0c3ff; }
.costume-toggle { display: flex; align-items: center; gap: 3px; font-size: 10px; color: #e0c3ff; cursor: pointer; white-space: nowrap; }
.costume-toggle input { accent-color: #b07cff; margin: 0; }
.tt-costume { color: #e0c3ff; margin-top: 3px; text-shadow: 0 0 4px rgba(199, 125, 255, .6); }
.rot { display: flex; gap: 6px; }
.rot button { width: 28px; height: 24px; padding: 0; border: 2px solid #140a04; border-radius: 3px; background: linear-gradient(180deg, #4a3260, #22163a); color: var(--gold-hi); box-shadow: inset 0 0 0 1px #9a6a32; }
.doll-stats { grid-column: 1 / 4; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 12px; margin-top: 4px; }
.doll-stats div { display: flex; justify-content: space-between; border-bottom: 1px dotted #3a2a1a; }
.doll-stats b { font: 8px var(--px); color: var(--gold-hi); align-self: center; }
.bag-side { min-width: 0; }
.bag-tabs { display: flex; gap: 2px; margin-bottom: 6px; flex-wrap: wrap; align-items: center; }
.bag-tabs .tab { font-size: 12px; padding: 4px 9px; border-bottom: 2px solid #3a2a1a; border-radius: 3px; margin: 0; }
.bag-tabs .sort { margin-left: auto; }
.currencies { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 6px 8px; margin-top: 8px; background: rgba(0, 0, 0, .35); border: 1px solid #3a2a1a; }

/* character window */
.char-head { text-align: center; margin-bottom: 8px; }
.ch-name { font-weight: 700; font-size: 20px; color: var(--gold-hi); text-shadow: 0 2px 0 #000; }
.ch-sub { font-size: 12px; color: var(--dim); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-top: 10px; }
.stat-group { background: rgba(0, 0, 0, .35); border: 1px solid #3a2a1a; border-radius: 3px; padding: 6px 8px; }
.sg-title { font: 8px var(--px); color: var(--gold); margin-bottom: 6px; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.sg-title .sgi { font-family: var(--sans); font-size: 14px; }
.stat-row { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 0; border-bottom: 1px dotted #2a2030; cursor: help; }
.stat-row .si { width: 16px; text-align: center; font-size: 12px; opacity: .9; }
.stat-row .sk { flex: 1; }
.stat-row .sv { font: 8px var(--px); color: var(--gold-hi); }
.spec-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.spec-row.dim { opacity: .55; }
.spec-card { border: 6px solid transparent; border-image: var(--frame-thin) 3 / 6px stretch; background: var(--stone); background-clip: padding-box; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.spec-name { font-weight: 700; font-size: 15px; color: var(--gold-hi); }
.spec-desc { font-size: 12px; color: var(--good); flex: 1; }
.spec-cur { font-size: 13px; }
.skill-row { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.skill-row img.ico { width: 30px; height: 30px; border: 2px solid #140a04; box-shadow: 0 0 0 1px #9a6a32; }
.skill-row.dim { opacity: .5; }
.sr-name { font-weight: 700; font-size: 13px; }
.sr-sub { font-size: 11px; color: var(--dim); }
.pvp-card { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 10px; background: linear-gradient(90deg, rgba(160, 30, 40, .25), transparent); border-left: 3px solid #d83a3a; }
.pvp-card b { font: 9px var(--px); color: var(--gold-hi); }

/* shop / lists */
.shop-list { display: flex; flex-direction: column; gap: 4px; }
.shop-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; background: rgba(0, 0, 0, .3); border: 1px solid #2e2218; border-radius: 3px; }
.shop-row:hover { background: rgba(216, 168, 74, .06); }
.shop-info { flex: 1; min-width: 0; }
.shop-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-sub { font-size: 11px; color: var(--dim); }
input.qty { width: 60px; padding: 4px; }

/* smith */
.smith-grid { display: grid; grid-template-columns: 210px 1fr; gap: 10px; }
.smith-grid > .rates { grid-column: 1 / -1; }
.smith-left { max-height: 380px; overflow-y: auto; }
.pick-grid { display: flex; flex-direction: column; gap: 3px; }
.pick { display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; padding: 3px; border: 1px solid transparent; border-radius: 3px; cursor: pointer; }
.pick .slot { grid-row: 1 / 3; }
.pick:hover { background: rgba(255, 255, 255, .05); }
.pick.sel { border-color: var(--gold); background: rgba(216, 168, 74, .1); }
.pick-name { font-weight: 700; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-sub { font-size: 10px; color: var(--good); }
.enh-panel { position: relative; background: radial-gradient(ellipse at 50% 20%, rgba(255, 140, 40, .12), transparent 60%), rgba(0, 0, 0, .4); border: 1px solid #3a2a1a; border-radius: 3px; padding: 12px; overflow: hidden; }
.enh-panel.empty { display: flex; align-items: center; justify-content: center; min-height: 220px; }
.enh-item { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.enh-name { font-weight: 700; font-size: 16px; }
.enh-arrow { font: 14px var(--px); color: var(--gold-hi); margin-top: 6px; text-shadow: 2px 2px 0 #000; }
.chance-wrap { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin: 10px 0 2px; }
.chance-label { font-size: 12px; color: var(--dim); }
.chance-bar { position: relative; height: 18px; background: #07040a; border: 2px solid #140a04; box-shadow: 0 0 0 1px #7a5222; border-radius: 3px; overflow: hidden; }
.chance-fill { height: 100%; transition: width .3s; position: relative; }
.chance-fill::after { content: ''; position: absolute; inset: 1px 0 auto; height: 40%; background: linear-gradient(180deg, rgba(255, 255, 255, .5), transparent); }
.chance-val { font: 16px var(--px); color: var(--gold-hi); text-shadow: 2px 2px 0 #000; }
.chance-break { font-size: 11px; color: var(--dim); margin-bottom: 6px; }
.enh-fail { font-size: 12px; padding: 6px 8px; border-left: 3px solid; margin: 6px 0; background: rgba(0, 0, 0, .3); }
.enh-fail.ok { border-color: var(--good); } .enh-fail.warn { border-color: var(--warn); } .enh-fail.bad { border-color: var(--bad); color: #ffc0c0; }
.enh-warn { padding: 6px 8px; font-size: 12px; margin: 6px 0; border-radius: 3px; }
.enh-warn.bad { background: rgba(176, 24, 40, .3); color: #ffc0c0; } .enh-warn.warn { background: rgba(255, 179, 71, .15); color: #ffd8a0; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 5px 0; cursor: pointer; padding: 4px 6px; background: rgba(0, 0, 0, .25); border: 1px solid #2e2218; border-radius: 3px; }
.chk img.ico { width: 20px; height: 20px; }
.chk input { accent-color: var(--gold); width: 16px; height: 16px; }
.chk .cnt { margin-left: auto; color: var(--dim); font-size: 11px; }
.chk.dis { opacity: .45; }
.enh-cost { font-size: 12px; margin: 10px 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.enh-cost img.ico { width: 16px; height: 16px; display: inline-block; }
.enh-go { width: 100%; font-size: 17px; padding: 12px; }
.enh-res { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; animation: resIn 2.2s ease-out forwards; z-index: 3; }
.res-text { position: relative; font: 22px var(--px); text-shadow: 3px 3px 0 #000, 0 0 18px currentColor; text-align: center; }
.res-burst { position: absolute; inset: -40%; }
.enh-res.success { color: #ffe066; background: radial-gradient(circle, rgba(255, 224, 102, .5), transparent 65%); }
.enh-res.success .res-burst { background: repeating-conic-gradient(rgba(255, 230, 140, .4) 0 8deg, transparent 8deg 24deg); animation: spin 2.2s linear; }
.enh-res.fail { color: #d0d0dc; background: radial-gradient(circle, rgba(120, 120, 140, .4), transparent 65%); }
.enh-res.drop { color: #ffb347; background: radial-gradient(circle, rgba(255, 120, 40, .45), transparent 65%); animation: resIn 2.2s ease-out forwards, shakeX .35s 2; }
.enh-res.break { color: #ff5a5a; background: radial-gradient(circle, rgba(200, 20, 30, .55), transparent 65%); animation: resIn 2.2s ease-out forwards, shakeX .3s 3; }
.enh-res.break .res-burst { background: linear-gradient(115deg, transparent 48%, #ff8a8a 49%, transparent 51%), linear-gradient(70deg, transparent 58%, #ff8a8a 59%, transparent 60%); }
@keyframes resIn { 0% { opacity: 0; transform: scale(1.6); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes spin { to { transform: rotate(180deg); } }
details.rates summary { font-size: 12px; color: var(--dim); cursor: pointer; }
.rate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 3px; margin-top: 4px; }
.rate { font-size: 11px; display: flex; justify-content: space-between; padding: 2px 5px; background: rgba(95, 227, 106, .1); border-radius: 2px; }
.rate.warn { background: rgba(255, 179, 71, .12); } .rate.bad { background: rgba(255, 90, 90, .14); }
.socket-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-bottom: 1px dotted #3a2a1a; flex-wrap: wrap; }
.socket { width: 30px; height: 30px; transform: rotate(45deg); border: 2px solid #6a5a86; background: #0c0810; display: flex; align-items: center; justify-content: center; margin: 4px; box-shadow: inset 0 0 6px #000; }
.socket.full { border-color: #c77dff; box-shadow: 0 0 8px #c77dff; }
.socket img.ico { transform: rotate(-45deg); width: 22px; height: 22px; }
.sock-info { flex: 1; font-size: 12px; min-width: 120px; }
.rune-pick { display: flex; gap: 4px; flex-wrap: wrap; }
.rune-btn img.ico { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }

/* quests — parchment */
.quest-card { position: relative; color: #3a2410; padding: 12px 14px; margin-bottom: 10px; border-radius: 2px;
  background: var(--noise), radial-gradient(ellipse at 50% 40%, #f4e2b8, #e0c48a 70%, #c8a060);
  box-shadow: inset 0 0 0 2px #8a6030, inset 0 0 18px rgba(120, 70, 20, .45), 0 3px 8px #000; }
.quest-card.active { box-shadow: inset 0 0 0 2px #3a8a30, inset 0 0 18px rgba(120, 70, 20, .45), 0 3px 8px #000; }
.q-name { font-weight: 700; font-size: 16px; color: #5a2a08; }
.q-desc { font-size: 13px; margin: 4px 0; font-style: italic; }
.q-obj { font-size: 12px; font-weight: 700; color: #6a3010; }
.q-prog { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 4px 0; font-weight: 600; }
.q-bar { flex: 1; height: 10px; background: #5a4020; border: 1px solid #3a2410; }
.q-fill { height: 100%; background: linear-gradient(180deg, #a0f08a, #3a9a3a); }
.quest-card .reward { color: #3a2410; }
.quest-card .money { color: #6a4008; text-shadow: none; }
.quest-card .hint { color: #5a3a18; }
.reward { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; margin: 6px 0; }
.rw-item { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.rw-item img.ico { width: 16px; height: 16px; }
.q-done { font-size: 12px; color: var(--dim); }

/* guild / party */
.guild-head { text-align: center; margin-bottom: 6px; }
.g-tag { font: 11px var(--px); color: var(--gold); margin-right: 6px; }
.g-name { font-weight: 700; font-size: 18px; color: var(--gold-hi); }
.member-list { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; }
.member { display: flex; align-items: center; gap: 8px; padding: 5px 7px; background: rgba(0, 0, 0, .3); border-radius: 2px; font-size: 13px; }
.member.off { opacity: .55; }
.m-name { font-weight: 700; flex: 1; }
.m-sub { font-size: 11px; color: var(--dim); }
.m-off { font-size: 10px; color: var(--dim); }
.mini-hp { width: 60px; height: 6px; background: #1a0e14; border: 1px solid #000; } .mini-hp > div { height: 100%; background: var(--hp2); }

/* trade */
.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.trade-side { background: rgba(0, 0, 0, .35); border: 2px solid #3a2a1a; border-radius: 3px; padding: 8px; min-height: 140px; }
.trade-side.locked { border-color: var(--warn); }
.trade-side.confirmed { border-color: var(--good); box-shadow: 0 0 10px rgba(95, 227, 106, .3); }
.ts-head { font-weight: 700; font-size: 14px; color: var(--gold-hi); margin-bottom: 6px; }
.ts-gold { margin-bottom: 6px; }
.ts-items { display: flex; flex-wrap: wrap; gap: 4px; }

/* exchange */
.ex-info { background: rgba(95, 227, 106, .1); border: 1px solid #3a8a44; border-radius: 3px; padding: 8px 10px; font-size: 13px; color: #d8ffd8; }
.ex-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.ex-table th { text-align: left; color: var(--gold); font-weight: 700; border-bottom: 1px solid #3a2a1a; padding: 4px; }
.ex-table td { padding: 4px; border-bottom: 1px dotted #2a2030; }
.ex-table tr.mine td { background: rgba(216, 168, 74, .08); }
.ex-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-items: end; }
.ex-form .ex-sum, .ex-form .btn, .ex-form .enh-warn { grid-column: 1 / -1; }
.ex-sum { font-size: 13px; margin: 6px 0; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

/* premium */
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pack-card { text-align: center; padding: 12px 8px; border: 6px solid transparent; border-image: var(--frame-thin) 3 / 6px stretch; background: radial-gradient(circle at 50% 30%, rgba(138, 92, 255, .45), transparent 70%), var(--stone); background-clip: padding-box; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .12s; }
.pack-card:hover { transform: translateY(-2px); }
.pack-amt { font: 14px var(--px); color: #e0c8ff; text-shadow: 2px 2px 0 #000, 0 0 10px rgba(180, 120, 255, .8); }
.pack-price { font-size: 12px; color: var(--dim); }
.test-note { grid-column: 1 / -1; font-size: 12px; color: #ffd8a0; background: rgba(255, 179, 71, .12); padding: 6px 8px; border-radius: 3px; }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.skin-card { text-align: center; padding: 6px; border: 6px solid transparent; border-image: var(--frame-thin) 3 / 6px stretch; background: radial-gradient(ellipse at 50% 60%, color-mix(in srgb, var(--aura, #8a5cff) 40%, transparent), transparent 70%), var(--stone); background-clip: padding-box; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.skin-card.wearing { border-image: var(--frame) 6 / 6px stretch; }
.skin-pv { width: 96px; height: 112px; }
.skin-name { font-weight: 700; font-size: 12px; min-height: 32px; }
.queue-anim { text-align: center; font: 11px var(--px); color: var(--gold-hi); padding: 12px; animation: pulse 1.4s infinite; }

/* world map */
.wm-wrap { position: relative; }
.wm-canvas { width: 100%; display: block; image-rendering: auto; border: 2px solid #5a3a14; box-shadow: inset 0 0 20px rgba(90, 50, 10, .5), 0 3px 10px #000; cursor: pointer; }
.wm-you { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: radial-gradient(circle, #fff, #ff4040 55%, #8a0000); box-shadow: 0 0 0 2px #140a04, 0 0 12px #ff3030; animation: pulse 1s infinite; pointer-events: none; }
.wm-info { margin-top: 8px; padding: 8px 10px; background: rgba(0, 0, 0, .35); border-left: 3px solid var(--gold); font-size: 13px; min-height: 40px; }
.wm-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--dim); margin-top: 6px; }
.wm-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; vertical-align: -1px; border: 1px solid #3a2410; }

/* settings */
.settings { display: grid; grid-template-columns: 150px 1fr; gap: 12px; min-height: 380px; }
.set-tabs { display: flex; flex-direction: column; gap: 3px; border-right: 2px solid #3a2a1a; padding-right: 8px; }
.set-tab { text-align: left; font-weight: 700; font-size: 13px; background: none; border: 1px solid transparent; border-radius: 3px; padding: 7px 9px; color: var(--dim); }
.set-tab:hover { color: var(--text); }
.set-tab.on { color: var(--gold-hi); border-color: var(--gold-lo); background: linear-gradient(90deg, rgba(216, 168, 74, .2), transparent); box-shadow: inset 3px 0 0 var(--gold); }
.set-body { min-width: 0; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dotted #2e2218; }
.set-label { font-size: 13px; font-weight: 600; }
.set-help { font-size: 11px; color: var(--dim); font-weight: 400; }
.set-ctl { flex: none; max-width: 60%; }
.set-sub { font: 8px var(--px); color: var(--gold); text-transform: uppercase; margin: 16px 0 2px; letter-spacing: .6px; }
.seg { display: inline-flex; border: 2px solid #140a04; box-shadow: 0 0 0 1px #7a5222; border-radius: 3px; overflow: hidden; flex-wrap: wrap; }
.seg.wrap { display: flex; }
.seg-btn { background: #1a1220; border: none; border-right: 1px solid #3a2a1a; padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--dim); }
.seg-btn:last-child { border-right: none; }
.seg-btn.on { background: linear-gradient(180deg, #f0c254, #b0741e); color: #2a1604; }
.switch-ctl { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch-ctl input { opacity: 0; width: 0; height: 0; }
.switch-ctl .slider { position: absolute; inset: 0; background: #1a1220; border: 2px solid #140a04; box-shadow: 0 0 0 1px #5a4020; border-radius: 12px; transition: .15s; cursor: pointer; }
.switch-ctl .slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #8a7e70; border-radius: 50%; transition: .15s; }
.switch-ctl input:checked + .slider { background: #6a4a10; box-shadow: 0 0 0 1px var(--gold); }
.switch-ctl input:checked + .slider::before { transform: translateX(20px); background: var(--gold-hi); box-shadow: 0 0 6px var(--gold); }
.sl { display: flex; align-items: center; gap: 8px; }
.sl input[type=range] { width: 150px; accent-color: var(--gold); }
.sl-val { font: 8px var(--px); color: var(--gold-hi); min-width: 48px; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.chip { font-size: 12px; padding: 3px 9px; border: 1px solid #4a3a28; border-radius: 10px; cursor: pointer; color: var(--dim); }
.chip input { display: none; }
.chip.on { border-color: var(--gold); color: var(--gold-hi); background: rgba(216, 168, 74, .1); }
.keybtn { min-width: 80px; font-family: var(--px) !important; font-size: 9px !important; }
.keybtn.cap { animation: pulse .8s infinite; }
.lang-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.lang-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 6px solid transparent; border-image: var(--frame-thin) 3 / 6px stretch; background: var(--stone); background-clip: padding-box; font-weight: 700; font-size: 15px; }
.lang-card.on { border-image: var(--frame) 6 / 6px stretch; color: var(--gold-hi); }
.lc-short { font: 9px var(--px); background: #2a1e30; padding: 5px 6px; border-radius: 2px; }
.acct-card { background: rgba(0, 0, 0, .35); border: 1px solid #3a2a1a; border-radius: 3px; padding: 8px 10px; }
.kv { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.kv b { display: inline-flex; align-items: center; gap: 3px; color: var(--gold-hi); }
.kv img.ico { width: 16px; height: 16px; }
.acct-msg { padding: 7px 10px; border-radius: 3px; margin: 8px 0; font-size: 13px; }
.acct-msg.info { background: rgba(74, 168, 255, .15); color: #c8e4ff; } .acct-msg.good { background: rgba(95, 227, 106, .15); color: #c8ffd0; } .acct-msg.bad { background: rgba(255, 90, 90, .15); color: #ffc8c8; }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { flex: 1; min-width: 150px; }
.link-btn.apple { background: linear-gradient(180deg, #3a3a40, #0a0a0c); }
.link-btn.google { background: linear-gradient(180deg, #ffffff, #d8d8d8); color: #222; text-shadow: none; }
.acct-actions { margin-top: 18px; }

/* support */
.tk-list { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.tk-row { display: flex; align-items: center; gap: 8px; text-align: left; padding: 7px 9px; background: rgba(0, 0, 0, .35); border: 1px solid #3a2a1a; border-radius: 3px; }
.tk-row:hover { border-color: var(--gold-lo); }
.tk-sub { flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 6px var(--bad); flex: none; }
.badge.tk-open { background: #1e2c4a; border-color: #4a7ad8; } .badge.tk-answered { background: #1a3e22; border-color: var(--good); } .badge.tk-closed { background: #2a2a2a; border-color: #666; color: #aaa; }
.tk-subject { font-weight: 700; font-size: 14px; color: var(--gold-hi); margin: 8px 0 4px; }
.tk-msgs { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; max-height: 300px; overflow-y: auto; }
.tk-msg { padding: 7px 10px; border-radius: 4px; max-width: 88%; font-size: 13px; }
.tk-msg.player { align-self: flex-end; background: rgba(138, 92, 255, .2); border: 1px solid #5a3a9a; }
.tk-msg.staff { align-self: flex-start; background: rgba(216, 168, 74, .14); border: 1px solid var(--gold-lo); }
.tk-meta { font-size: 10px; color: var(--dim); }
.tk-text { white-space: pre-wrap; user-select: text; }
.tk-reply { display: flex; flex-direction: column; gap: 6px; }

/* ---------- tooltip / popover / ctx ---------- */
#tip { position: fixed; display: none; z-index: 200; pointer-events: none; padding: 8px 10px; max-width: 300px; background: var(--noise), linear-gradient(180deg, rgba(26, 16, 30, .97), rgba(12, 8, 14, .97)); background-clip: padding-box; }
#pop { position: fixed; z-index: 150; padding: 8px; max-width: 320px; }
.pop-acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tt { font-size: 12px; min-width: 190px; }
.tt-name { font-weight: 700; font-size: 15px; margin-bottom: 1px; text-shadow: 0 1px 0 #000; }
.tt-sub { color: var(--dim); font-size: 11px; margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid #3a2a1a; }
.tt-stat { color: #f0f0f0; }
.tt-plus { color: var(--gold-hi); }
.tt-bonus { color: var(--good); }
.tt-bad { color: var(--bad); }
.tt-dim { color: var(--dim); }
.tt-set { color: #ffd35a; margin-top: 6px; font-weight: 700; }
.tt-desc { color: #d8c8a0; font-style: italic; margin-top: 5px; }
.tt-price { margin-top: 6px; color: var(--gold-hi); display: flex; align-items: center; gap: 4px; }
.tt-sockets { margin-top: 5px; }
.tt-socket { display: flex; align-items: center; gap: 5px; }
.tt-cmp { margin-top: 6px; padding-top: 4px; border-top: 1px dashed #3a2a1a; }
.tt-cmp-h { font-size: 10px; color: var(--dim); text-transform: uppercase; }
.up { color: var(--good); } .down { color: var(--bad); }
.gem-ico { display: inline-block; width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid #6a5a86; background: #0e0a18; }
.gem-ico.full { border-color: #fff; box-shadow: 0 0 4px currentColor; }
#ctx { position: fixed; z-index: 160; padding: 4px; min-width: 180px; display: flex; flex-direction: column; }
.ctx-title { font-weight: 700; font-size: 13px; color: var(--gold-hi); padding: 4px 8px; border-bottom: 1px solid var(--gold-lo); margin-bottom: 2px; }
.ctx-item { text-align: left; background: none; border: none; padding: 8px 10px; font-size: 13px; font-weight: 600; border-radius: 2px; }
.ctx-item:hover { background: rgba(216, 168, 74, .15); color: var(--gold-hi); }

/* ---------- overlays ---------- */
#toasts { position: fixed; top: calc(84px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; width: min(460px, 92vw); }
.toast { padding: 7px 16px; background: rgba(14, 8, 16, .92); border: 2px solid #140a04; box-shadow: 0 0 0 1px var(--gold-lo); border-radius: 3px; font-size: 13px; font-weight: 600; text-align: center; animation: toastIn .2s ease-out; transition: opacity .5s, transform .5s; text-shadow: 0 1px 0 #000; }
.toast.good { box-shadow: 0 0 0 1px var(--good); color: #c8ffd0; } .toast.bad { box-shadow: 0 0 0 1px var(--bad); color: #ffc8c8; }
.toast.epic { box-shadow: 0 0 0 1px #c77dff, 0 0 18px rgba(199, 125, 255, .5); color: #f0d8ff; font-size: 15px; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
#banner { position: absolute; top: 20%; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; z-index: 40; opacity: 0; }
#banner.show { animation: bannerAnim 7s ease-out forwards; }
.banner-inner { font: clamp(12px, 2.2vw, 20px)/1.6 var(--px); color: var(--gold-hi); text-align: center; padding: 14px 44px; max-width: 90vw; background: linear-gradient(90deg, transparent, rgba(16, 8, 24, .88) 15%, rgba(16, 8, 24, .88) 85%, transparent); border-top: 2px solid var(--gold); border-bottom: 2px solid var(--gold); text-shadow: 3px 3px 0 #000, 0 0 18px rgba(255, 200, 80, .8); }
@keyframes bannerAnim { 0% { opacity: 0; transform: scale(1.3); } 6% { opacity: 1; transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }
#zone { position: absolute; top: 26%; left: 0; right: 0; text-align: center; pointer-events: none; z-index: 35; opacity: 0; }
#zone.show { animation: zoneAnim 3.6s ease-out forwards; }
.zone-title { font: clamp(16px, 3.6vw, 32px)/1.5 var(--px); color: #fff6d8; text-shadow: 3px 3px 0 #000, 0 0 22px rgba(138, 92, 255, .95); letter-spacing: 2px; }
.zone-lvl { font: clamp(9px, 1.4vw, 12px) var(--px); color: var(--gold-hi); text-shadow: 2px 2px 0 #000; margin-top: 6px; }
.zone-orn { width: min(420px, 70vw); height: 8px; margin: 8px auto; background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold-hi) 50%, var(--gold) 80%, transparent) center / 100% 2px no-repeat; position: relative; }
.zone-orn::after { content: '◆'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%); color: var(--violet); font-size: 12px; text-shadow: 0 0 6px var(--violet); }
.zone-sub { font-weight: 700; font-size: 15px; color: #c8ffd0; text-shadow: 0 2px 0 #000; }
.zone-sub.pvp { color: #ff8a8a; }
@keyframes zoneAnim { 0% { opacity: 0; letter-spacing: 12px; } 15% { opacity: 1; letter-spacing: 2px; } 75% { opacity: 1; } 100% { opacity: 0; } }
#invites { position: absolute; top: calc(74px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 6px; zoom: var(--ui-scale); }
.invite { padding: 10px 12px; min-width: 300px; animation: winIn .2s; }
.inv-text { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.inv-timer { color: var(--dim); font: 8px var(--px); margin-right: auto; }
#death { position: absolute; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, rgba(40, 0, 0, .35), rgba(20, 0, 4, .85)); animation: fadeIn .6s; }
.death-inner { text-align: center; }
.death-title { font: clamp(20px, 5vw, 40px)/1.5 var(--px); color: #ff5a5a; text-shadow: 4px 4px 0 #000, 0 0 24px #a00; margin-bottom: 10px; }
.death-count { font: 11px var(--px); color: var(--text); margin-bottom: 16px; min-height: 22px; }
@keyframes fadeIn { from { opacity: 0; } }
#conn { position: absolute; top: calc(76px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 95; padding: 7px 14px; background: rgba(120, 20, 30, .92); border: 2px solid #140a04; box-shadow: 0 0 0 1px var(--bad); border-radius: 3px; font-size: 13px; font-weight: 700; animation: pulse 1.2s infinite; }
#loading { position: absolute; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.loading-inner { text-align: center; font: 10px var(--px); color: var(--gold-hi); }
.spinner { width: 44px; height: 44px; margin: 0 auto 14px; border: 4px solid #3a2a1a; border-top-color: var(--gold); border-radius: 50%; animation: spin2 .9s linear infinite; }
@keyframes spin2 { to { transform: rotate(360deg); } }
#notice { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; background: rgba(6, 2, 10, .9); padding: 16px; }
.notice-box { max-width: 480px; text-align: center; }

/* =====================================================================
   UI pass: try-on previews, character sheet, contrast fixes, HUD sizes
   ===================================================================== */
/* live preview (rotatable, attack toggle) */
.lpv { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lpv-stage { position: relative; border-radius: 4px; background: radial-gradient(ellipse at 50% 78%, rgba(255, 211, 90, .16), transparent 55%), radial-gradient(ellipse at 50% 40%, rgba(138, 92, 255, .22), rgba(8, 5, 12, .9) 75%); box-shadow: inset 0 0 0 1px #5a4020, inset 0 0 18px #000; }
.lpv-canvas { display: block; }
.lpv-ctrl { display: flex; gap: 4px; }
.lpv-btn { width: 30px; height: 24px; padding: 0; border: 2px solid #140a04; border-radius: 3px; background: linear-gradient(180deg, #4a3260, #22163a); color: var(--gold-hi); box-shadow: inset 0 0 0 1px #9a6a32; font-size: 12px; line-height: 1; }
.lpv-btn:hover { filter: brightness(1.25); }
.lpv-btn.on { background: linear-gradient(180deg, #f0c254, #b0741e); color: #2a1604; box-shadow: inset 0 0 0 1px #fff0b8; }
.lpv-label { font-size: 11px; text-align: center; max-width: 160px; min-height: 15px; line-height: 1.3; color: var(--text); }
.shop-split { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.shop-split.nopv { grid-template-columns: 1fr; }
.shop-pv { position: sticky; top: 0; padding: 6px; background: rgba(0, 0, 0, .35); border: 1px solid #3a2a1a; border-radius: 3px; }
.shop-row.can-pv, .skin-card.can-pv { cursor: pointer; }
.shop-row.pv-on { border-color: var(--gold); background: rgba(216, 168, 74, .12); box-shadow: inset 3px 0 0 var(--gold); }
.skin-card.pv-on { outline: 2px solid var(--gold-hi); outline-offset: -2px; }

/* paper doll */
.doll { display: grid; grid-template-columns: 50px auto 50px; grid-template-rows: auto auto; gap: 6px 8px; align-items: start; justify-items: center; padding: 8px; background: radial-gradient(ellipse at 50% 45%, rgba(138, 92, 255, .18), transparent 65%), rgba(0, 0, 0, .3); border: 1px solid #3a2a1a; border-radius: 3px; }
.doll-col { display: flex; flex-direction: column; gap: 6px; }
.doll-mid { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.doll-bottom { grid-column: 1 / 4; grid-row: 2; display: flex; gap: 10px; justify-content: center; }
.doll-stats { grid-column: 1 / 4; grid-row: 3; }
.eq-lbl { font-size: 9px; color: #b8ac98; max-width: 54px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.costume-toggle { margin-top: 2px; padding: 4px 8px; font-size: 11px; font-weight: 700; color: #f0e0ff; background: rgba(90, 50, 150, .45); border: 1px solid #b07cff; border-radius: 12px; box-shadow: 0 0 8px rgba(176, 124, 255, .35); }
.costume-toggle input { width: 15px; height: 15px; }
.slot-pick { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; margin-top: 6px; }
.slot-pick-row { display: flex; align-items: center; gap: 8px; padding: 3px 4px; background: rgba(0, 0, 0, .3); border: 1px solid #2e2218; border-radius: 3px; }
.slot-pick-row .shop-name { flex: 1; min-width: 0; }

/* character sheet */
.char-win2 { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; }
.cw-left { display: flex; flex-direction: column; align-items: center; }
.cw-left .char-head { margin-bottom: 6px; }
.cw-right .tabs { margin-bottom: 8px; }
.cw-right .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.cw-right .tab { font-size: 11px; padding: 4px 7px; white-space: nowrap; flex: 1 1 auto; text-align: center; }
.cw-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cw-group { background: rgba(0, 0, 0, .38); border: 1px solid #3a2a1a; border-radius: 3px; padding: 5px 7px; }
.cw-group:nth-child(2) { grid-row: span 2; }
.cw-gtitle { font: 8px var(--px); color: var(--gold); margin-bottom: 4px; text-transform: uppercase; display: flex; align-items: center; gap: 6px; padding-bottom: 3px; border-bottom: 1px solid #3a2a1a; }
.cw-gtitle .sgi { font-family: var(--sans); font-size: 13px; }
.cw-stat { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px; border-radius: 2px; cursor: help; color: var(--text); }
.cw-stat:hover, .cw-stat:focus { background: rgba(216, 168, 74, .12); outline: none; }
.cw-stat .si { width: 15px; text-align: center; color: #c8b890; }
.cw-stat .sk { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-stat .sv { font-weight: 700; font-size: 13px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.cw-stat .sv.up { color: #9dff9d; }
.tt-total { color: var(--gold-hi); }
.tt-brks { margin-top: 6px; padding-top: 4px; border-top: 1px solid #3a2a1a; }
.tt-brk { display: flex; justify-content: space-between; gap: 12px; }
.tt-brk b { color: var(--text); }
.tt-brk.gear b { color: #8ac8ff; } .tt-brk.bonus b { color: var(--good); }
.tt .small { font-size: 11px; margin-top: 4px; }
.cw-rep, .cw-arena { display: flex; flex-direction: column; gap: 8px; }
.cw-card { background: rgba(0, 0, 0, .38); border: 1px solid #3a2a1a; border-radius: 3px; padding: 8px 10px; }
.cw-card-title { font: 8px var(--px); color: var(--gold); text-transform: uppercase; margin-bottom: 6px; }
.cw-big { font: 18px var(--px); color: #ffb0b0; text-shadow: 2px 2px 0 #000; }
.cw-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 2px 0; border-bottom: 1px dotted #2e2218; }
.cw-kv b { color: var(--gold-hi); text-align: right; }
.cw-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cw-tile { text-align: center; padding: 10px 4px; background: rgba(0, 0, 0, .4); border: 1px solid #3a2a1a; border-radius: 3px; }
.cw-tile.gold { border-color: var(--gold-lo); box-shadow: inset 0 0 12px rgba(216, 168, 74, .2); }
.cw-tile-v { font: 14px var(--px); color: var(--gold-hi); text-shadow: 2px 2px 0 #000; }
.cw-tile-l { font-size: 11px; color: #c8bca8; margin-top: 4px; }

/* contrast: parchment quest cards keep dark ink; reward chips get their own dark plate */
.quest-card .tt-dim, .quest-card .q-done { color: #5a3a18; }
.quest-card .reward { background: rgba(28, 16, 8, .88); color: var(--text); padding: 5px 8px; border-radius: 3px; box-shadow: inset 0 0 0 1px #8a6030; }
.quest-card .reward .tt-dim { color: #d0c0a0; }
.quest-card .reward .money { color: var(--gold-hi); text-shadow: 0 1px 0 #000; }
.quest-card .q-prog span { color: #3a2410; }
.skin-card { background: radial-gradient(ellipse at 50% 55%, color-mix(in srgb, var(--aura, #8a5cff) 24%, transparent), transparent 70%), var(--stone); background-clip: padding-box; }
.skin-name { color: var(--text); text-shadow: 0 1px 0 #000, 0 0 4px #000; }
.pack-price, .shop-sub, .m-sub, .tk-meta, .set-help, .hint, .tt-dim, .empty-note, .loading { color: #b4a892; }
.quest-card .hint { color: #5a3a18; }
.tab { color: #bcb0a0; }
#tip { max-width: 320px; color: var(--text); }
select, option { background: #1a1220; color: var(--text); }
.badge { color: var(--text); }
.btn.primary .money { color: #2a1604; text-shadow: 0 1px 0 rgba(255, 255, 255, .45); }
.btn.test { color: #f2ffec; text-shadow: 0 1px 0 #000; }
.slot .ph { color: #84769a; }

/* HUD: slightly more compact */
.pf { width: 252px; }
.portrait-wrap, .portrait { width: 54px; height: 54px; }
.pf-lvl { left: 42px; top: 40px; }
.pf-name { font-size: 14px; }
.bar { height: 14px; }
.tf { width: 272px; }
.tf-portrait { width: 42px; height: 42px; }
.skill { width: 50px; height: 50px; padding: 7px; }
.skill img.ico { width: 32px; height: 32px; }
.skill.pot { width: 44px; height: 44px; padding: 5px; }
.menu-btn { width: 40px; height: 40px; }
.menu-btn img.ico { width: 26px; height: 26px; }
.chat { width: 360px; height: 206px; }
.party-frames { top: calc(108px + var(--safe-t)); }

@media (max-width: 760px), (max-height: 500px) {
  .char-win2 { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .cw-right { width: 100%; min-width: 0; }
  .cw-right .tabs { flex-wrap: wrap; }
  .cw-tiles { grid-template-columns: repeat(2, 1fr); }
  .shop-split { grid-template-columns: 1fr; }
  .shop-pv { position: static; order: -1; justify-self: center; }
}
@media (max-width: 420px) {
  .cw-stats { grid-template-columns: 1fr; }
  .cw-group:nth-child(2) { grid-row: auto; }
}
@media (max-height: 500px) {
  #windows { padding: 0; }
  .win, .win.wide, .win.narrow, .win.xwide { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-width: 6px; zoom: 1; }
}

/* ---------- touch / phones ---------- */
@media (pointer: coarse) {
  #joy { display: block; }
  body.no-joy #joy { display: none; }
  #overlay { cursor: default; }
  .pf { width: 220px; }
  .portrait-wrap, .portrait { width: 52px; height: 52px; }
  .pf-lvl { left: 40px; top: 38px; }
  .party-frames { top: calc(100px + var(--safe-t)); width: 150px; }
  .tf { width: 230px; }
  .tf-portrait { width: 38px; height: 38px; }
  .chat { display: none; left: 50%; transform: translateX(-50%); top: calc(70px + var(--safe-t)); bottom: auto; width: min(440px, 94vw); height: 42vh; z-index: 60; }
  .chat.open { display: flex; }
  .chat-toggle { display: block; left: calc(10px + var(--safe-l)); top: calc(160px + var(--safe-t)); }
  .menu-toggle { display: block; right: calc(10px + var(--safe-r)); top: calc(176px + var(--safe-t)); }
  .menubar { display: none; right: calc(64px + var(--safe-r)); top: calc(170px + var(--safe-t)); bottom: auto; flex-wrap: wrap; width: 252px; z-index: 50; }
  .menubar.open { display: flex; }
  .menu-btn { width: 56px; height: 56px; flex-direction: column; }
  .menu-lbl { display: block; font-size: 9px; font-weight: 700; line-height: 1; margin-top: 2px; max-width: 52px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .menu-key { display: none; }
  .tracker { top: calc(226px + var(--safe-t)); width: 170px; font-size: 11px; }
  .currency { display: none; }
  .skillbar { left: auto; right: calc(10px + var(--safe-r)); transform: none; bottom: calc(18px + var(--safe-b)); display: grid; grid-template-columns: repeat(3, auto); gap: 8px; border: none; background: none; box-shadow: none; }
  .skillbar .sep { display: none; }
  .skill { width: 62px; height: 62px; border-radius: 50%; padding: 12px; }
  .skill img.ico { width: 34px; height: 34px; }
  .skill .key { display: none; }
  .skill.pot { width: 48px; height: 48px; padding: 7px; }
  .skill.attack-btn { width: 80px; height: 80px; font-size: 34px; grid-column: 3; grid-row: 1 / 3; align-self: center; background: radial-gradient(circle at 40% 30%, #a85a2a, #3a1608); box-shadow: 0 0 0 2px #140a04, 0 0 0 4px var(--gold), 0 4px 10px #000; }
  body.left-handed #joy { left: auto; right: calc(24px + var(--safe-r)); }
  body.left-handed .skillbar { right: auto; left: calc(10px + var(--safe-l)); }
  .slot { width: 50px; height: 50px; }
  .bag-grid { grid-template-columns: repeat(6, 50px); }
  .btn { min-height: 40px; }
  .btn.small { min-height: 34px; }
}
@media (max-width: 760px) {
  #windows { padding: 0; }
  .win, .win.wide, .win.narrow, .win.xwide { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-width: 6px; padding-top: var(--safe-t); padding-bottom: var(--safe-b); zoom: 1; animation: sheetIn .18s ease-out; }
  @keyframes sheetIn { from { transform: translateY(24px); } }
  .win-head { padding: 10px 48px; }
  .win-close { width: 38px; height: 38px; font-size: 18px; }
  .create-grid { grid-template-columns: 1fr; }
  .cls-row { grid-template-columns: repeat(3, 1fr); }
  .smith-grid { grid-template-columns: 1fr; }
  .smith-left { max-height: 190px; }
  .settings { grid-template-columns: 1fr; }
  .set-tabs { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 2px solid #3a2a1a; padding: 0 0 6px; }
  .set-row { flex-wrap: wrap; }
  .set-ctl { max-width: 100%; }
  .trade-grid { grid-template-columns: 1fr; }
  .ex-form { grid-template-columns: 1fr; }
  .inv-win { grid-template-columns: 1fr; justify-items: center; }
  .tf { top: calc(78px + var(--safe-t)); }
  .pf { width: 196px; }
}
@media (max-height: 480px) and (pointer: coarse) {
  .pf { width: 190px; }
  .party-frames { display: none; }
  .tracker { display: none !important; }
  .skill { width: 54px; height: 54px; padding: 10px; }
  .skill.attack-btn { width: 66px; height: 66px; }
}

/* ---------- progression UI (progui.js): skill tree, talents, action bar, crafting, dungeon finder ---------- */
.skill.empty { opacity: .45; }
.skill .ac { display: none; position: absolute; bottom: 2px; right: 3px; font: 7px var(--px); color: #0c0812; background: var(--good); padding: 1px 2px; border-radius: 2px; pointer-events: none; }
.skill.auto .ac { display: block; }
.skill.auto { box-shadow: inset 0 0 0 2px var(--good); }
.badge.gold { background: #3a2a10; border-color: var(--gold); color: var(--gold-hi); }
.prog-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 6px; }
.prog-head .btn { margin-left: auto; }
.prog-pts b { color: var(--gold-hi); font-size: 15px; }
.ptree { display: flex; flex-direction: column; gap: 4px; max-height: 58vh; overflow-y: auto; padding-right: 4px; }
.ptree-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; background: rgba(0, 0, 0, .3); border: 1px solid #2e2218; border-radius: 3px; }
.ptree-row.unlearned { opacity: .72; }
.ptree-row.secret { border-color: #6a4a18; background: rgba(216, 168, 74, .06); }
.ptree-ico { position: relative; flex: none; }
.ptree-ico img.ico { width: 36px; height: 36px; border: 2px solid #140a04; box-shadow: 0 0 0 1px var(--bronze); }
.ptree-r { position: absolute; right: -4px; bottom: -4px; font: 7px var(--px); background: #140a04; color: var(--gold-hi); padding: 2px 3px; border: 1px solid var(--bronze); }
.ptree-main { flex: 1; min-width: 0; }
.ptree-name { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ptree-desc { font-size: 12px; color: var(--dim); }
.ptree-sub, .ptree-next { font-size: 11px; color: var(--dim); }
.ptree-next.bad { color: var(--warn); } .ptree-next.good { color: var(--good); }
.pips { display: inline-flex; gap: 2px; margin-left: 6px; }
.pips i { width: 8px; height: 8px; border: 1px solid var(--bronze); background: #140a04; transform: rotate(45deg); }
.pips i.on { background: var(--gold); box-shadow: 0 0 4px var(--gold); }
.ptree-act { display: flex; flex-direction: column; gap: 4px; align-items: stretch; flex: none; min-width: 92px; }
.auto-tg { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; cursor: pointer; }
.pbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.pbar-slot { position: relative; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; background: #140a04; border: 2px solid #3a2a18; border-radius: 4px; cursor: pointer; }
.pbar-slot img.ico { width: 34px; height: 34px; }
.pbar-slot.on { border-color: var(--gold-hi); box-shadow: 0 0 10px var(--gold); }
.pbar-slot.auto { box-shadow: inset 0 0 0 2px var(--good); }
.pbar-empty { color: var(--dim); font-size: 20px; }
.pbar-n { position: absolute; top: 1px; left: 3px; font: 7px var(--px); color: var(--gold-hi); }
.pbar-x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; padding: 0; font-size: 10px; line-height: 16px; border-radius: 50%; background: #3a1010; color: #fff; border: 1px solid var(--bad); cursor: pointer; }
.pbar-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
.pbar-pick { display: flex; gap: 6px; align-items: center; padding: 4px 6px; background: rgba(0, 0, 0, .3); border: 1px solid #2e2218; color: var(--text); border-radius: 3px; cursor: pointer; text-align: left; font: inherit; font-size: 12px; }
.pbar-pick img.ico { width: 24px; height: 24px; }
.pbar-pick.used { opacity: .55; }
.pbar-pick:disabled { cursor: default; }
.ptal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-height: 60vh; overflow-y: auto; }
@media (max-width: 760px) { .ptal { grid-template-columns: 1fr; } }
.ptal-branch { display: flex; flex-direction: column; gap: 4px; padding: 6px; background: rgba(0, 0, 0, .25); border: 1px solid #3a2a18; border-radius: 3px; }
.ptal-branch.dim { opacity: .55; }
.ptal-title { display: flex; gap: 6px; align-items: center; font-weight: 700; color: var(--gold-hi); }
.ptal-title img.ico { width: 22px; height: 22px; }
.ptal-bp { margin-left: auto; font: 9px var(--px); color: var(--gold); }
.ptal-node { position: relative; padding: 5px 6px; border: 1px solid #2e2218; background: #140a04; border-radius: 3px; font-size: 12px; }
.ptal-node.on { border-color: var(--bronze); }
.ptal-node.max { border-color: var(--gold); box-shadow: inset 0 0 8px rgba(216, 168, 74, .25); }
.ptal-node.locked { opacity: .55; }
.ptal-top { display: flex; justify-content: space-between; gap: 4px; }
.ptal-r { font: 8px var(--px); color: var(--gold-hi); }
.ptal-mods { color: var(--good); font-size: 11px; }
.ptal-req { color: var(--dim); font-size: 10px; }
.ptal-node .btn { position: absolute; right: 4px; bottom: 4px; padding: 0 8px; }
.craft-list { display: flex; flex-direction: column; gap: 4px; max-height: 56vh; overflow-y: auto; margin-top: 6px; }
.craft-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; background: rgba(0, 0, 0, .3); border: 1px solid #2e2218; border-radius: 3px; }
.craft-row.dim { opacity: .7; }
.craft-info { flex: 1; min-width: 0; }
.craft-mats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.craft-mat { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--good); }
.craft-mat.miss { color: var(--bad); }
.craft-mat .slot { transform: scale(.6); margin: -8px; }
.df { display: grid; grid-template-columns: 210px 1fr; gap: 10px; }
@media (max-width: 760px) { .df { grid-template-columns: 1fr; } }
.df-list { display: flex; flex-direction: column; gap: 4px; }
.df-item { display: grid; grid-template-columns: 1fr auto; gap: 0 6px; text-align: left; padding: 6px 8px; background: rgba(0, 0, 0, .3); border: 1px solid #2e2218; color: var(--text); border-radius: 3px; cursor: pointer; font: inherit; }
.df-item span { font-size: 11px; color: var(--dim); }
.df-item.on { border-color: var(--gold); background: rgba(216, 168, 74, .1); }
.df-item.dim { opacity: .55; }
.df-ok { color: var(--good) !important; } .df-lock { grid-column: 2; }
.df-detail h3 { margin: 0 0 4px; color: var(--gold-hi); }
.df-facts { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.df-secret { color: #c8a8ff; font-style: italic; }
.df-loot { display: flex; flex-wrap: wrap; gap: 4px; }
.df-detail .good { color: var(--good); }
/* 8-slot action bar + 11-button menu: menu folds into two rows, bar avoids the chat (desktop / mouse only) */
@media (pointer: fine) {
  .menubar { display: grid; grid-template-columns: repeat(6, auto); }
  .currency { bottom: calc(124px + var(--safe-b)); }
}
@media (pointer: fine) and (max-width: 1700px) {
  .skillbar { left: calc(372px + var(--safe-l)); transform: none; }
}
.sb-skills .skill.empty, .sb-items .skill.empty { opacity: .35; }
@media (pointer: fine) and (max-width: 1320px) {
  .skillbar { left: auto; right: calc(6px + var(--safe-r)); bottom: calc(146px + var(--safe-b)); }
}
@media (pointer: coarse) {
  .skill.empty { display: none; }
}
/* world map v2 (worldmap.js) */
.wm-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.wm-title { font: 10px var(--px); color: var(--gold-hi); }
.wm-zones { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.wm-zones .tab { font-size: 11px; padding: 3px 8px; }
.wm-pct { color: var(--dim); font-size: 10px; }
.wm-legend .wm-lg { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-right: 4px; border-radius: 50%; border: 1.5px solid; background: #f6ead0; font-size: 10px; vertical-align: -3px; }
.wm-canvas { cursor: default; }
/* ---------- pets (petsui.js) ---------- */
.pet-frame { position: absolute; left: calc(6px + var(--safe-l)); top: calc(96px + var(--safe-t)); display: flex; gap: 6px; align-items: center; padding: 3px 8px 3px 4px; cursor: pointer; pointer-events: auto; }
.pet-frame canvas { background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%); border-radius: 50%; }
.pf2-name { font-size: 11px; font-weight: 700; color: #bfe8ff; white-space: nowrap; }
.pf2-name span { color: var(--dim); font-weight: 400; }
.pf2-bars { display: grid; grid-template-columns: auto 54px; gap: 1px 4px; align-items: center; font-size: 8px; }
.party-frames { top: calc(150px + var(--safe-t)); }
.pbar2 { height: 6px; background: #140a04; border: 1px solid #3a2a18; border-radius: 3px; overflow: hidden; min-width: 40px; }
.pbar2 i { display: block; height: 100%; background: linear-gradient(90deg, #8a6aff, #c8a8ff); }
.pbar2.bond i { background: linear-gradient(90deg, #ff5a8a, #ffb0c8); }
.pbar2.sat i { background: linear-gradient(90deg, #d88a3a, #ffd07a); }
.pbar2.low i { background: linear-gradient(90deg, #a02020, #ff5a5a); }
.pbar2.xp i { background: linear-gradient(90deg, #4a9a3a, #a8ff7a); }
.pet-split { display: grid; grid-template-columns: 190px 1fr; gap: 10px; }
@media (max-width: 760px) { .pet-split { grid-template-columns: 1fr; } }
.pet-list { display: flex; flex-direction: column; gap: 4px; max-height: 62vh; overflow-y: auto; }
.pet-item { display: flex; align-items: center; gap: 6px; text-align: left; padding: 4px 6px; background: rgba(0,0,0,.3); border: 1px solid #2e2218; color: var(--text); border-radius: 3px; cursor: pointer; font: inherit; position: relative; }
.pet-item b { display: block; font-size: 13px; } .pet-item span { font-size: 11px; color: var(--dim); }
.pet-item.on { border-color: var(--gold); background: rgba(216,168,74,.1); }
.pet-out { position: absolute; right: 6px; top: 4px; color: var(--good) !important; }
.pet-detail { display: flex; flex-direction: column; gap: 8px; max-height: 64vh; overflow-y: auto; padding-right: 4px; }
.pet-head { display: flex; gap: 12px; align-items: flex-start; }
.pet-head > canvas { flex: none; background: radial-gradient(circle at 50% 60%, rgba(216,168,74,.18), transparent 70%); border: 1px solid #3a2a18; border-radius: 6px; }
.pet-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pet-name { font-size: 18px; font-weight: 700; color: var(--gold-hi); display: flex; align-items: center; gap: 6px; }
.pet-ren { padding: 0 6px; min-height: 0; }
.pet-tags { display: flex; flex-wrap: wrap; gap: 4px; } .pet-tags .badge { margin-left: 0; }
.badge.dark { background: #2a1020; border-color: #a03a6a; color: #ffc0d8; }
.pet-stat { display: grid; grid-template-columns: 90px 1fr 70px; gap: 6px; align-items: center; font-size: 12px; }
.pet-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pet-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (max-width: 760px) { .pet-modes { grid-template-columns: 1fr; } }
.pet-mode { text-align: left; padding: 5px 7px; background: rgba(0,0,0,.3); border: 1px solid #2e2218; color: var(--text); border-radius: 3px; cursor: pointer; font: inherit; }
.pet-mode b { display: block; font-size: 12px; } .pet-mode span { font-size: 10px; color: var(--dim); }
.pet-mode.on { border-color: var(--good); box-shadow: inset 3px 0 0 var(--good); }
.pet-skills { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.pet-skill.locked { opacity: .5; }
.pet-coll { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; max-height: 64vh; overflow-y: auto; }
.pet-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; text-align: center; background: rgba(0,0,0,.3); border: 1px solid #2e2218; border-radius: 4px; }
.pet-card.own { border-color: #5a4220; }
.pet-card > canvas { background: radial-gradient(circle at 50% 60%, rgba(216,168,74,.16), transparent 70%); }
.pet-card-name { font-weight: 700; color: var(--gold-hi); }
.pet-card .row.end { width: 100%; align-items: center; gap: 8px; margin-top: auto; }
.pet-card .pet-skills { font-size: 11px; text-align: left; width: 100%; }
.pet-food { margin: 18px 0; transform: scale(1.4); }
.btn.danger { border-color: #a03030; color: #ffb0b0; }
/* ---------- action bar v2: preset switcher + item row (8) + skill row (12) ---------- */
.skillbar { align-items: flex-end; gap: 4px; padding: 4px 6px; }
.sb-rows { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.sb-items, .sb-skills { display: flex; gap: 3px; }
.sb-skills .skill { width: 44px; height: 44px; padding: 5px; }
.sb-skills .skill img.ico { width: 30px; height: 30px; }
.sb-items .skill.pot { width: 34px; height: 34px; padding: 3px; }
.sb-items .skill.pot img.ico { width: 24px; height: 24px; }
.sb-items .skill .key { font-size: 6px; }
.sb-preset { display: flex; flex-direction: column; align-items: center; gap: 1px; align-self: stretch; justify-content: center; }
.sb-pbtn { width: 24px; height: 16px; padding: 0; font-size: 8px; line-height: 1; background: #1a1024; color: var(--gold-hi); border: 1px solid #4a3a28; border-radius: 3px; cursor: pointer; }
.sb-pname { width: 24px; min-height: 30px; padding: 0; font: 8px var(--px); color: var(--gold-hi); background: #140a04; border: 1px solid var(--bronze); border-radius: 3px; cursor: pointer; writing-mode: vertical-rl; overflow: hidden; }
.skill.aura { border-radius: 50%; }
.skill.aura-on { box-shadow: inset 0 0 0 2px #7dffd8, 0 0 10px #7dffd8; animation: auraPulse 1.6s ease-in-out infinite; }
@keyframes auraPulse { 50% { box-shadow: inset 0 0 0 2px #7dffd8, 0 0 16px #7dffd8; } }
.buff.aura { box-shadow: 0 0 0 1px #7dffd8; }
.badge.aura { background: #10303a; border-color: #7dffd8; color: #c8fff0; }
.badge.tome { background: #3a2a10; border-color: #ffb347; color: #ffe0a8; }
.ptree-sub.tome { color: #ffb347; }
.pset-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pset { display: flex; align-items: center; border: 1px solid #3a2a18; border-radius: 3px; background: rgba(0,0,0,.3); }
.pset.on { border-color: var(--gold); box-shadow: 0 0 6px rgba(216,168,74,.5); }
.pset-name { padding: 4px 10px; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; }
.pset.on .pset-name { color: var(--gold-hi); font-weight: 700; }
.pset-ic { padding: 2px 6px; background: none; border: 0; color: var(--dim); cursor: pointer; }
.pbar-slot.small { width: 46px; height: 46px; }
.pbar-slot .slot, .pbar-pick .slot { transform: scale(.7); margin: -6px; pointer-events: none; }
.pbar-ico { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; overflow: hidden; }
.slot-ic img.ico { width: 26px; height: 26px; }
@media (pointer: coarse) {
  .skillbar { display: flex; gap: 4px; }
  .sb-skills { display: grid; grid-template-columns: repeat(3, auto); gap: 4px; }
  .sb-skills .skill { width: 46px; height: 46px; border-radius: 50%; padding: 7px; }
  .sb-skills .skill img.ico { width: 30px; height: 30px; }
  .sb-rows { align-items: flex-end; }
  .sb-items { gap: 4px; }
  .sb-items .skill.pot { width: 34px; height: 34px; }
  .sb-touch { display: flex; flex-direction: column; gap: 8px; align-items: center; }
  .skill.page-btn { width: 40px; height: 32px; padding: 0; font: 9px var(--px); color: var(--gold-hi); border-radius: 6px; }
}
/* ---------- effects (effects.js): buff / debuff icons, hover card, mana rate ---------- */
.buffs { display: flex; flex-wrap: wrap; gap: 3px; }
.eff { position: relative; width: 24px; height: 24px; border-radius: 3px; border: 1px solid #5fe36a; background: #0c0812; box-shadow: 0 0 0 1px #000; }
.eff.debuff { border-color: #ff4d4d; box-shadow: 0 0 0 1px #000, inset 0 0 6px rgba(255, 60, 60, .5); }
.eff.aura { border-color: #7dffd8; }
.eff.ending { animation: effBlink .6s step-end infinite; }
@keyframes effBlink { 50% { opacity: .45; } }
.eff img.ico { width: 100%; height: 100%; display: block; }
.eff .et { position: absolute; right: -1px; bottom: -2px; font: 7px var(--px); color: #fff; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; pointer-events: none; }
.tf-eff { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }
.mp-rate { font-size: 9px; color: #8fc8ff; line-height: 1.1; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-rate.neg { color: #ff9a8a; }
.hover-card { position: fixed; z-index: 400; pointer-events: none; min-width: 120px; max-width: 240px; padding: 5px 8px; background: rgba(12, 8, 18, .92); border: 1px solid #5a4220; border-radius: 4px; box-shadow: 0 2px 8px #000; font-size: 12px; }
.hc-name { font-weight: 700; color: #a8e8ff; } .hc-name.hostile { color: #ff8a7a; }
.hc-lvl { color: var(--dim); font-weight: 400; }
.hc-bar { position: relative; height: 10px; margin-top: 3px; background: #2a0a0a; border: 1px solid #000; }
.hc-bar i { display: block; height: 100%; background: linear-gradient(#6dff7a, #2a9a3a); }
.hc-bar.enemy i { background: linear-gradient(#ff7a6a, #b02a2a); }
.hc-bar span { position: absolute; inset: 0; font-size: 8px; line-height: 10px; text-align: center; color: #fff; text-shadow: 1px 1px 0 #000; }
.hc-eff { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.mana-block .sv.bad { color: var(--bad); }
/* ---------- weapon skins ---------- */
.eq-slot.ws-off .slot { opacity: .45; filter: grayscale(.6); }
.ws-filter { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px 0; }
.ws-filter .tab { font-size: 11px; padding: 3px 7px; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; max-height: 58vh; overflow-y: auto; }
.ws-card { align-items: center; text-align: center; }
.ws-ico { width: 64px; height: 64px; image-rendering: pixelated; filter: drop-shadow(0 0 6px var(--aura)); }
.ws-type { font-size: 10px; color: var(--dim); }
.ws-pair { font-size: 10px; color: #d8b8ff; }

/* fixed-size try-on column: hovering items must not resize the window */
.shop-pv { width: 176px; box-sizing: border-box; }
.shop-pv .lpv-label { width: 160px; min-height: 30px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.win .win-body { scrollbar-gutter: stable; }
.tr-where { font-size: 10px; color: #ffe28a; margin-top: 2px; }
/* ---------- movable / hideable HUD (hudlayout.js) ---------- */
.hud-hidden { display: none !important; }
body.hud-all-hidden #hud > *:not(.joy):not(#joy) { display: none !important; }
body.hud-edit .hud-hidden-edit { opacity: .35; }
.hud-grip { position: absolute; inset: -6px; z-index: 5; border: 2px dashed #ffd35a; border-radius: 4px; background: rgba(255, 211, 90, .08); cursor: move; display: flex; align-items: flex-start; justify-content: space-between; padding: 2px 4px; touch-action: none; }
.hg-name { font: 8px var(--px); color: #ffd35a; text-shadow: 1px 1px 0 #000; pointer-events: none; }
.hg-eye { background: #1a1024; border: 1px solid #ffd35a; color: #fff; border-radius: 3px; cursor: pointer; font-size: 11px; padding: 0 4px; }
.hud-edit-bar { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 12px; background: rgba(12, 8, 18, .94); border: 1px solid #ffd35a; border-radius: 6px; font-size: 12px; color: var(--text); max-width: 94vw; }
.hl-hidden { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.mm-head .mm-btn + .mm-btn { margin-left: 2px; }

/* ---------- compact HUD (settings → interface, on by default): the world stays visible, as little chrome as possible ---------- */
@media (pointer: fine) {
  body.hud-compact .menubar { display: none; right: calc(6px + var(--safe-r)); bottom: calc(74px + var(--safe-b)); grid-template-columns: repeat(4, 66px); gap: 6px; padding: 8px; z-index: 50; }
  body.hud-compact .menubar.open { display: grid; }
  body.hud-compact .menu-btn { width: 66px; height: 60px; flex-direction: column; }
  body.hud-compact .menu-lbl { display: block; font-size: 10px; font-weight: 700; line-height: 1; margin-top: 3px; max-width: 62px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
  body.hud-compact .menu-key { display: none; }
  body.hud-compact .skillbar { background: rgba(10, 6, 14, .35); }
  body.hud-compact .menu-toggle { display: block; right: calc(10px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); width: 52px; height: 52px; }
  body.hud-compact .currency { bottom: calc(76px + var(--safe-b)); right: calc(72px + var(--safe-r)); }
  body.hud-compact .chat:not(:hover):not(:focus-within):not(.open) { background: none; border-image: none; border-color: transparent; box-shadow: none; }
  body.hud-compact .chat:not(:hover):not(:focus-within):not(.open) .chat-tabs,
  body.hud-compact .chat:not(:hover):not(:focus-within):not(.open) .chat-in { visibility: hidden; }
  body.hud-compact .chat:not(:hover):not(:focus-within):not(.open) .chat-log { overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 55%); mask-image: linear-gradient(to bottom, transparent, #000 55%); }
  body.hud-compact .sb-skills .skill.empty, body.hud-compact .sb-items .skill.empty { opacity: .14; }
  body.hud-compact .sb-skills .skill.empty:hover, body.hud-compact .sb-items .skill.empty:hover { opacity: .6; }
}

/* painted skill pictures (skillart.js, 64 px): smooth downscale keeps the detail */
img.ico.skart { image-rendering: auto; }

.death-hint { font-size: 12px; color: #c8b8a0; max-width: 320px; margin: 4px auto 10px; text-align: center; }
.death-rez { margin-top: 8px; display: inline-flex; gap: 6px; align-items: center; }

/* install (PWA) */
.install-btn { background: linear-gradient(180deg, #d8a03a, #8a5a1a); color: #fff8e0; border-color: #ffd27a; font-weight: 700; }
.install-tip { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(520px, 92vw); z-index: 999; background: rgba(16,10,24,.95); border: 1px solid #d8a03a; color: #f0e6c8; padding: 10px 14px; border-radius: 6px; font-size: 14px; line-height: 1.4; box-shadow: 0 6px 20px #000; cursor: pointer; }
