:root {
  color-scheme: dark;
  --gold: #e6bb55; --red: #c23a2c; --ink: #f2ece0; --muted: #a59c8c; --cyan: #6fd6f5;
  --bg: rgba(16, 13, 11, 0.88); --bg-soft: rgba(16, 13, 11, 0.62); --cell: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.1); --line-strong: rgba(230, 187, 85, 0.5);
  --radius: 8px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0a08; color: var(--ink); font-size: 14px; }
[hidden] { display: none !important; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
h1, h2 { margin: 0; font-weight: 700; }
:root { --cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M3 2v24l6.500-6 4.500 10 5.500-2.500-4.500-10H24z' fill='%23ff1414' stroke='%233a0000' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") 3 2, default; --cursor-hit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M3 2v24l6.500-6 4.500 10 5.500-2.500-4.500-10H24z' fill='%23ff5a3c' stroke='%23ffe0d0' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") 3 2, pointer; }
html, body, body * { cursor: var(--cursor); }
input, textarea { cursor: text; }
input[type="checkbox"], input[type="range"], select, a { cursor: var(--cursor-hit); }
h1 { font-size: 44px; letter-spacing: 0.14em; color: var(--gold); }
h2 { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
h2:first-child { margin-top: 0; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
button, input { font: inherit; color: inherit; }
button { padding: 8px 12px; background: var(--cell); border: 1px solid var(--line); border-radius: 6px; cursor: var(--cursor-hit); transition: background 0.12s, border-color 0.12s; }
button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.11); border-color: rgba(255, 255, 255, 0.25); }
button:disabled { opacity: 0.45; cursor: var(--cursor); }
button.primary { background: linear-gradient(180deg, #d0a03c, #a87a24); border-color: #f0cf80; color: #1c1408; font-weight: 700; }
button.primary:hover:not(:disabled) { background: linear-gradient(180deg, #e6bb55, #bc8c2e); }
button.active { border-color: var(--gold); background: rgba(230, 187, 85, 0.16); color: var(--gold); }
.wide { width: 100%; margin-top: 8px; }
input { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; }
input:focus { outline: none; border-color: var(--gold); }
kbd { font: inherit; font-size: 10px; color: var(--muted); margin-left: 3px; }
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; backdrop-filter: blur(10px); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45); }
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.screen.dim { background: rgba(0, 0, 0, 0.55); z-index: 5; }

#login { background: radial-gradient(circle at 50% 40%, rgba(40, 14, 16, 0.15), rgba(12, 6, 5, 0.72)); }
.login { width: min(420px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; display: grid; gap: 12px; padding: 22px 30px 26px; text-align: center; background: linear-gradient(180deg, rgba(44, 38, 33, 0.96), rgba(22, 16, 13, 0.97)); border: 1px solid #8a6a3a; outline: 1px solid rgba(90, 20, 32, 0.9); outline-offset: 3px; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(90, 20, 32, 0.22); }
.login-crest { width: 110px; height: 88px; justify-self: center; }
.login h1 { font-family: Georgia, "Times New Roman", serif; font-size: 38px; letter-spacing: 0.12em; color: #e6c060; text-shadow: 0 2px 0 #3a1a10, 0 0 14px rgba(150, 30, 30, 0.45); border-bottom: 1px solid #8a6a3a; padding-bottom: 8px; }
.login input { background: rgba(0, 0, 0, 0.45); border-color: rgba(138, 106, 58, 0.7); font-size: 15px; }
#auth-tabs button { font-size: 14px; padding: 8px; background: rgba(90, 20, 32, 0.28); border-color: rgba(138, 106, 58, 0.6); }
#auth-tabs button.active { background: #5a1420; }
.login p { color: var(--muted); }
.check { color: var(--muted); font-size: 13px; }
#auth-fields { display: grid; gap: 10px; }
#auth-fields .seg { margin: 0; }
#auth-tabs button.active { border-color: var(--gold); color: var(--gold); }
.pw-row { display: flex; gap: 6px; }
.pw-row input { flex: 1; min-width: 0; }
.pw-row button { padding: 0 10px; font-size: 12px; }
#auth-session { color: var(--ink); }
.error { color: #ff9a8a; min-height: 18px; font-size: 13px; }
.controls { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 12px; text-align: left; padding-top: 10px; border-top: 1px solid var(--line); }
.controls dt { color: var(--gold); font-weight: 600; }
.controls dd { margin: 0; color: var(--muted); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#top-left { position: absolute; top: 12px; left: 12px; width: 238px; display: grid; gap: 8px; }
#map-tag { font-size: 17px; text-shadow: 0 1px 3px #000; display: flex; justify-content: space-between; align-items: center; }
#ping { margin-left: auto; padding-left: 8px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
#pvp-tag { color: #fff; background: var(--red); padding: 1px 8px; border-radius: 4px; font-size: 13px; font-weight: 700; }
#minimap { width: 238px; height: 185px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); }
#objective { background: var(--bg-soft); border-radius: var(--radius); padding: 9px 11px; font-size: 15px; display: grid; gap: 3px; }
#objective div { display: flex; justify-content: space-between; color: var(--ink); }
#objective div.done { color: #8fd18f; }
.quest-gems { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.quest-gems svg { width: 14px; height: 14px; }
.shop-group { grid-column: 1 / -1; margin: 8px 0 2px; font-size: 15px; font-weight: 800; color: #6fd6f5; }
.forge-scroll { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; font-weight: 700; color: #6fd6f5; }
.rename-box { display: grid; gap: 8px; padding-top: 8px; font-size: 13px; }
.rename-box .acts { display: flex; gap: 8px; }
.shop-note { grid-column: 1 / -1; margin: 0 0 4px; font-size: 13px; font-weight: 700; color: #ff8a66; }
#buffs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-bottom: 4px; }
#buffs:not(:has(.buff:not([hidden]))) { display: none; }
#top-stack { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
#top-row { display: flex; align-items: stretch; justify-content: center; gap: 6px; max-width: 100%; }
#arena-bar { display: flex; align-items: center; gap: 5px; padding: 2px 10px; font-size: 13px; font-weight: 800; letter-spacing: 0.03em; color: #ff9d7a; background: rgba(12, 9, 5, 0.82); border: 1px solid #8a4a30; border-radius: var(--radius); white-space: nowrap; pointer-events: auto; }
#arena-bar svg { width: 15px; height: 15px; flex: none; }
#arena-bar b { color: #fff; font-variant-numeric: tabular-nums; }
#premium-bar { display: flex; align-items: center; gap: 6px; padding: 2px 10px; font-size: 13px; font-weight: 800; letter-spacing: 0.03em; color: #aaa; background: rgba(12, 9, 5, 0.82); border: 1px solid #5a5040; border-radius: var(--radius); white-space: nowrap; pointer-events: auto; }
#premium-bar svg { width: 15px; height: 15px; flex: none; }
#premium-bar.on { color: #ffd76a; border-color: #e6bb55; }
#premium-bar b { font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
#premium-get { padding: 1px 8px; font-size: 12px; }
#safe-zone { padding: 2px 12px; font-size: 20px; font-weight: 800; letter-spacing: 0.03em; line-height: 1.2; color: #5ab4ff; white-space: nowrap; background: rgba(6, 12, 24, 0.66); border-radius: var(--radius); text-shadow: 0 0 4px #000, 0 2px 6px #000; }
#boss-banner { max-width: min(860px, max(240px, calc(100vw - 580px))); text-align: center; font-size: clamp(9px, 0.85vw, 11px); font-weight: 700; line-height: 1.25; color: #ff8a1f; text-shadow: 0 1px 3px #000, 0 0 3px #000; animation: boss-banner 4s ease-in-out forwards; }
@keyframes boss-banner { 0% { opacity: 0; } 8% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; } }
#entry-warning { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: rgba(6, 4, 3, 0.96); }
#entry-warning > div { width: min(520px, 100%); display: grid; gap: 8px; text-align: center; font-size: 15px; font-weight: 600; color: var(--ink); }
#entry-warning p { margin: 0; }
#entry-warning h1 { margin: 0 0 6px; font-size: clamp(20px, 3vw, 28px); line-height: 1.2; letter-spacing: 0; color: #ff5a4a; }
#entry-warning .entry-note { font-size: 13px; color: #d8b8a8; }
#entry-start { justify-self: center; min-width: 180px; min-height: 48px; margin-top: 12px; font-size: 17px; }
.buff { display: inline-flex; align-items: center; gap: 3px; padding: 1px 5px; pointer-events: auto; background: rgba(12, 9, 5, 0.9); border: 1px solid currentColor; border-radius: 3px; font-size: 13px; line-height: 1.2; }
.buff.heal { color: #ff8d8d; border-style: dashed; }
.buff.defense { color: var(--cyan); }
.buff.attack { color: #ff9a5a; }
.buff.crit { color: #ffd84a; }
.buff b { font-variant-numeric: tabular-nums; }
#buffs .ico { margin: 0; width: 1em; height: 1em; }
.bslot .cool { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; pointer-events: none; }
#party-list { display: grid; gap: 4px; font-size: 15px; text-shadow: 0 1px 3px #000; }
.party-mate b { display: block; overflow: hidden; color: #5fe37a; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.party-hp { width: 80px; max-width: 100%; height: 5px; margin-top: 2px; overflow: hidden; border-radius: 3px; background: rgba(0, 0, 0, 0.65); }
.party-hp i { display: block; height: 100%; background: #e5352b; transition: width 0.3s; }
#top-right { position: absolute; top: 12px; right: 12px; max-width: min(440px, calc(50vw - 270px)); display: grid; justify-items: end; gap: 6px; }
#resources { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; justify-content: center; gap: 18px; padding: 8px 16px; max-width: calc(100vw - 16px); width: max-content; background: rgba(12, 9, 5, 0.9); border: 1px solid rgba(230, 187, 85, 0.55); border-radius: var(--radius); font-size: 15px; font-weight: 700; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
#resources span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#resources b { color: #fff; font-size: 17px; }
#resources svg { width: 20px; height: 20px; flex: none; }
.ico { width: 18px; height: 18px; margin-right: 6px; vertical-align: -4px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.risk-tag { color: #ff8a66; }
.c-gold { color: var(--gold); }
.c-diamond { color: var(--cyan); }
.c-fame { color: #ff8a66; }
#menu { display: flex; gap: 4px; pointer-events: auto; flex-wrap: wrap; justify-content: flex-end; }
#menu button { font-size: 15px; font-weight: 600; padding: 6px 11px; color: #fff; background: rgba(12, 9, 5, 0.88); white-space: nowrap; }
#menu kbd { font-size: 12px; margin-left: 4px; color: var(--gold); }
#auction-toggle.live { background: var(--red); border-color: #ffb0a0; }
#killfeed { display: grid; gap: 3px; justify-items: end; font-size: 13px; margin-top: 4px; }
.kill { background: var(--bg-soft); padding: 3px 10px; border-radius: 5px; animation: slide-in 0.2s ease-out; }
.kill b { color: var(--gold); }
.kill i { color: #ff8a66; font-style: normal; }
.kill.boss { border-left: 3px solid #ff5a44; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }

#boss { width: min(230px, 23vw); min-width: 130px; text-align: center; }
#boss .pname { font-size: 10px; margin-bottom: 1px; }
#boss .bar.hp { height: 8px; }
.pname { font-size: 14px; font-weight: 600; text-shadow: 0 1px 3px #000; margin-bottom: 3px; }
.bar { position: relative; height: 16px; background: rgba(0, 0, 0, 0.62); border-radius: 4px; overflow: hidden; margin-bottom: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1); }
.bar i { display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #ea5b47, #a11f17); transition: width 0.1s linear; }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 11px; font-weight: 600; line-height: 16px; text-shadow: 0 1px 2px #000; font-variant-numeric: tabular-nums; }
.bar.st { height: 7px; }
.bar.st i { background: linear-gradient(180deg, #f2cf74, #b88a25); }
.bar.low i { background: linear-gradient(180deg, #ff8a3c, #c04c10); }
.plates { position: absolute; top: 88px; left: 262px; right: 450px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: start; }
.plate.flip { text-align: right; }
.plate.flip .bar i { margin-left: auto; }
.round { text-align: center; background: var(--bg-soft); border-radius: var(--radius); padding: 3px 14px; }
#round-label { font-size: 11px; color: var(--muted); }
#timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
#score { font-size: 12px; color: var(--gold); }

#center-text { position: absolute; top: 26%; left: 0; right: 0; text-align: center; font-size: 60px; font-weight: 800; letter-spacing: 0.04em; color: var(--gold); text-shadow: 0 3px 16px #000; }
#center-text.pop { animation: pop 0.34s cubic-bezier(0.2, 1.6, 0.4, 1); }
#center-text.success { color: #8fe08f; }
#center-text.boss { color: #ff8a1f; font-size: 28px; }
html.touch #center-text.boss { font-size: 14px; }
#center-text.fail { color: #ffb35a; }
#center-text.broken { color: #ff5a44; }
#sub-text { position: absolute; top: calc(26% + 74px); left: 0; right: 0; text-align: center; font-size: 18px; font-weight: 600; color: var(--ink); text-shadow: 0 2px 8px #000; }
@keyframes pop { from { transform: scale(1.5); opacity: 0; } }

#counters { position: absolute; top: 40%; right: 18px; display: grid; gap: 10px; justify-items: end; }
#combo-box, #slay-box { text-align: right; text-shadow: 0 2px 8px #000; }
#combo-box b, #slay-box b { display: inline-block; font-size: 40px; font-weight: 800; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
#combo-box.bump b, #slay-box.bump b { animation: bump 0.16s ease-out; }
@keyframes bump { from { transform: scale(1.35); color: var(--gold); } }
#combo-box small, #slay-box small { display: block; font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
#slay-box b { font-size: 30px; color: #ff8a66; }
#slay-bonus { font-size: 12px; color: var(--gold); font-weight: 600; }
#combo-pips { display: flex; gap: 3px; justify-content: flex-end; margin-top: 3px; }
#combo-pips i { width: 16px; height: 5px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); }
#combo-pips i.on { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
#combo-pips i.on.final { background: #ff6a3c; box-shadow: 0 0 8px #ff6a3c; }
.slaybar { width: 90px; height: 3px; margin-top: 3px; margin-left: auto; background: rgba(255, 255, 255, 0.16); }
.slaybar i { display: block; height: 100%; background: #ff8a66; }

#self { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); width: min(420px, 60vw); }
#self-head { display: none; }
#self-head b { color: var(--gold); }
.xpbar { height: 4px; background: rgba(0, 0, 0, 0.6); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
#self-xp { height: 100%; background: linear-gradient(90deg, #7fb6ff, #c8e0ff); }
#hud-belt { display: flex; gap: 5px; justify-content: center; }
.bslot { position: relative; width: 46px; height: 46px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; pointer-events: auto; cursor: var(--cursor-hit); }
.bslot.spent img { opacity: 0.3; filter: grayscale(1); }
.bslot.spent i { color: #ff8a66; }
.bslot img { width: 100%; height: 100%; display: block; }
.bslot b { position: absolute; left: 3px; top: 1px; font-size: 10px; color: var(--ink); text-shadow: 0 1px 2px #000; }
.bslot i { position: absolute; right: 3px; bottom: 0; font-size: 11px; font-style: normal; font-weight: 700; text-shadow: 0 1px 2px #000; }
#hint { position: absolute; bottom: 124px; left: 0; right: 0; text-align: center; font-size: 15px; font-weight: 600; color: var(--ink); text-shadow: 0 1px 4px #000; }
#hint kbd { display: inline-block; font-size: 12px; color: #1c1408; background: var(--gold); padding: 0 6px; border-radius: 3px; margin: 0 3px; }

.label { --s: var(--label-scale, 1); position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; text-align: center; font-size: calc(13px * var(--s)); font-weight: 700; line-height: 1.15; padding: 2px 6px 3px; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 2px #000; white-space: nowrap; }
.label .lvl { font-size: calc(11px * var(--s)); font-weight: 700; letter-spacing: 0.03em; color: #fff; }
.label .ttl { font-size: calc(14px * var(--s)); font-weight: 800; letter-spacing: 0.04em; color: var(--gold); }
.label.me, .label.mate, .label.rival { font-size: calc(15.6px * var(--s)); }
.label.me .lvl, .label.mate .lvl, .label.rival .lvl { font-size: calc(13.2px * var(--s)); }
.label.me .ttl, .label.mate .ttl, .label.rival .ttl { font-size: calc(16.8px * var(--s)); }
.label.me .mini, .label.mate .mini, .label.rival .mini { width: calc(88.8px * var(--s)); height: 7px; }
.label .lvl:empty, .label .ttl:empty { display: none; }
.label .nm { font-weight: 700; }
.label .nlv { margin-right: 0.35em; font-weight: 900; color: #4dff6a; }
#slow-warn { position: fixed; top: 110px; left: 50%; transform: translateX(-50%); z-index: 9; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; width: min(460px, calc(100vw - 16px)); padding: 8px 12px; font-size: 13px; text-align: center; }
.label .mini { width: calc(74px * var(--s)); height: 6px; margin: 3px auto 0; border: 1px solid rgba(0, 0, 0, 0.8); background: rgba(0, 0, 0, 0.65); border-radius: 2px; overflow: hidden; }
.label .mini i { display: block; height: 100%; background: #ea5b47; }
.label .pvp { color: #fff; background: var(--red); font-size: 9px; padding: 0 4px; border-radius: 3px; margin-right: 3px; }
.label.mob { color: #ff4d3d; }
.label.boss { font-size: 10px; }
.label.boss .mini { width: 37px; height: 3px; }
.label.mate { color: #8fd18f; }
.label.me { color: #5ab4ff; }
.label.rival { color: #ff9a3c; }
.label.mate .mini i { background: #6fcf6f; }
.label.me .mini i { background: #6fcf6f; }
.label.place { color: #ffb45a; font-size: 14px; }
.label.place .mini { display: none; }

.dmg { position: absolute; font-size: 22px; font-weight: 800; color: #fff; text-shadow: 0 2px 3px #000, 0 0 6px rgba(0, 0, 0, 0.7); pointer-events: none; animation: dmg 0.75s ease-out forwards; }
.dmg.mine { color: #ffe08a; }
.dmg.hurt { color: #ff5a44; }
.dmg.blocked { color: #b8c4d0; font-size: 17px; }
.dmg.crit { color: #ffb32e; font-size: 30px; white-space: nowrap; -webkit-text-stroke: 1px #4a1c00; }
.dmg.big { font-size: 32px; }
.dmg.gain { font-size: 15px; font-weight: 700; color: var(--gold); animation-duration: 1.2s; }
.dmg.gain.xp { color: #9fc8ff; }
.dmg.gain.gem { color: var(--cyan); }
.dmg.gain.fame { color: #ff8a66; font-size: 18px; }
@keyframes dmg {
  0% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
  18% { transform: translate(-50%, -80%) scale(1); }
  100% { transform: translate(-50%, -240%) scale(0.9); opacity: 0; }
}

/* Windows */
.win { position: fixed; top: 170px; right: 12px; width: min(470px, calc(100vw - 24px)); max-height: calc(100vh - 188px); overflow-y: auto; z-index: 6; }
.win.small { width: min(350px, calc(100vw - 24px)); }
/* Vertical bag: worn gear on top, a grid of slots below, item details beside the panel. */
#win-inv { width: 295px; max-width: calc(100vw - 24px); overflow: visible; font-size: 16px; }
#win-inv .gear { grid-template-columns: repeat(3, 1fr); padding-bottom: 8px; border-bottom: 1px solid #3a2f24; }
#win-inv #bag { grid-template-columns: repeat(4, 1fr); max-height: clamp(130px, calc(100vh - 620px), 265px); overflow-y: auto; margin-bottom: 0; }
#win-inv .square b, #win-inv .square i { font-size: 14px; }
#win-inv .square.empty { font-size: 11px; }
#win-inv header h2 { font-size: 19px; }
#win-inv #sell-zone { font-size: 14px; }
#win-inv.expanded #bag { max-height: clamp(130px, calc(100vh - 500px), 600px); }
#win-inv #tip { position: absolute; top: 0; right: calc(100% + 8px); width: 270px; max-height: calc(100vh - 110px); overflow-y: auto; padding: 12px; background: #1d1712; border: 1px solid #3a2f24; border-radius: 8px; }
@media (max-width: 560px) {
  #win-inv { overflow-y: auto; }
  #win-inv #tip { position: static; width: auto; margin-top: 8px; }
}
.win header, #auction header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.win header h2, #auction h2 { margin: 0; font-size: 15px; letter-spacing: 0.02em; text-transform: none; color: var(--ink); }
.win header h2 small { color: var(--muted); font-weight: 400; }
.win header button, #auction-close { padding: 0 9px; font-size: 16px; }
.seg { display: flex; gap: 4px; margin-bottom: 8px; }
.seg button { flex: 1; padding: 6px; font-size: 12px; }
.arenas { display: grid; gap: 4px; }
.arenas button { text-align: left; padding: 7px 10px; }
.arenas small { display: block; color: var(--muted); font-size: 11px; }
#maps button.here { border-color: var(--gold); background: rgba(230, 187, 85, 0.12); }
.who { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; overflow-wrap: anywhere; }
.who small { display: block; color: var(--gold); font-size: 11px; }
.who .on { color: #8fd18f; }
.who .acts { display: flex; gap: 3px; }
.who button { padding: 2px 8px; font-size: 12px; }
.detail { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; min-height: 96px; }
.detail b { font-size: 15px; }
.detail p { margin: 3px 0; color: var(--muted); }
.detail .acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.detail .acts button { padding: 4px 10px; font-size: 12px; }

.squares { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-bottom: 8px; min-height: 52px; }
.square { position: relative; aspect-ratio: 1; padding: 0; background: #16110d; border: 1px solid #3a2f24; border-radius: 6px; overflow: hidden; }
.square img { width: 100%; height: 100%; display: block; }
.square.empty { display: grid; place-items: center; font-size: 9px; color: var(--muted); background: var(--cell); }
.square.locked { opacity: 0.45; }
.square.selected { outline: 2px solid #fff; outline-offset: 1px; }
.square b { position: absolute; right: 3px; bottom: 0; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
.square i { position: absolute; left: 3px; top: 0; font-size: 11px; font-style: normal; font-weight: 700; color: var(--gold); text-shadow: 0 1px 2px #000; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; }
.card-item { background: var(--cell); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-size: 12px; display: grid; gap: 4px; align-content: start; }
.card-item img { width: 76px; height: 76px; justify-self: center; border-radius: 6px; }
.card-item small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.card-item button { padding: 4px 6px; font-size: 12px; }
.class-card { padding: 8px 0; border-top: 1px solid var(--line); display: grid; gap: 3px; }
.class-card small { color: var(--muted); }
.class-card.current b { color: var(--gold); }
.class-card button { font-size: 12px; padding: 5px; }
#profile { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; font-size: 13px; }
#profile div { display: flex; justify-content: space-between; }
#profile span { color: var(--muted); }
#profile .wide-row { grid-column: 1 / -1; font-size: 16px; font-weight: 700; color: var(--gold); display: block; margin-bottom: 4px; }
.title-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 3px 0; color: var(--muted); }
.title-row b { font-weight: 600; }
.title-row.reached { color: var(--ink); }
.title-row.locked { opacity: 0.55; }
.title-summary { display: grid; gap: 2px; padding: 6px 0; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.title-summary b { color: var(--gold); font-size: 15px; }
.title-summary span { color: var(--muted); }
.title-row.active { color: var(--gold); font-weight: 700; }
.quest { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.quest.done { color: #8fd18f; }
.quest small { display: block; color: var(--muted); font-size: 11px; }
.progress { height: 5px; background: rgba(0, 0, 0, 0.5); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.progress i { display: block; height: 100%; background: var(--gold); }
.quest.done .progress i { background: #6fcf6f; }

/* Demirci */
.win.forge { width: min(750px, calc(100vw - 24px)); right: auto; left: 50%; transform: translateX(-50%); top: 70px; max-height: calc(100vh - 84px); display: flex; flex-direction: column; overflow: hidden; }
.forge-lists { flex: 0 0 auto; }
#forge-worn { grid-template-columns: 1fr 1fr; }
.forge-batch { display: grid; gap: 4px; margin-top: 8px; font-size: 14px; }
.forge-batch div { display: flex; justify-content: space-between; gap: 10px; }
.forge-batch b { color: var(--gold); white-space: nowrap; }
.forge-bottom { display: grid; grid-template-columns: 150px 1fr; gap: 14px; flex: 1 1 auto; min-height: 0; overflow-y: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.forge-head { margin: 0 0 6px; font-size: 16px; color: var(--gold); }
.forge-list { display: grid; gap: 4px; height: min(190px, 24vh); overflow-y: auto; margin-bottom: 8px; align-content: start; padding: 2px; }
.forge-list .muted { margin: 0; font-size: 13px; }
.forge-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; text-align: left; font-size: 15px; }
.forge-row img { width: 38px; height: 38px; border-radius: 4px; display: block; }
.forge-row b { color: var(--gold); }
.forge-row.selected { outline: 2px solid #fff; outline-offset: 0; background: rgba(230, 187, 85, 0.22); }
.stat-diff { display: grid; gap: 2px; margin-top: 8px; font-size: 13px; }
.stat-diff div { display: flex; justify-content: space-between; gap: 8px; }
.stat-diff span { color: var(--muted); }
.stat-break { grid-column: 1 / -1; display: grid !important; gap: 1px; padding-top: 4px; }
.stat-break small { color: var(--muted); font-size: 11px; }
#forge-preview { position: relative; width: 150px; height: 150px; border-radius: var(--radius); overflow: hidden; background: radial-gradient(circle at 50% 60%, #4a2a12, #120c08 72%); }
#forge-canvas { width: 100%; height: 100%; display: block; }
#forge-preview.hammer { animation: shake 0.14s linear 3; }
#forge-flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
#forge-flash.success { animation: flash-gold 1.1s ease-out; }
#forge-flash.fail { animation: flash-red 0.8s ease-out; }
#forge-flash.broken { animation: flash-red 1.4s ease-out; }
#forge-canvas.success { animation: glow-gold 1.3s ease-out; }
#forge-canvas.fail { animation: glow-red 0.8s ease-out; }
#forge-canvas.broken { animation: shatter 0.9s ease-in forwards; }
@keyframes flash-gold { 0% { opacity: 1; background: radial-gradient(circle, #fff6c8, #ffc23a 45%, transparent 74%); } 100% { opacity: 0; background: radial-gradient(circle, #fff6c8, #ffc23a 45%, transparent 74%); } }
@keyframes flash-red { 0% { opacity: 1; background: radial-gradient(circle, #ff8060, #c01408 50%, #300 100%); } 100% { opacity: 0; background: radial-gradient(circle, #ff8060, #c01408 50%, #300 100%); } }
@keyframes glow-gold { 0% { filter: brightness(3) saturate(1.5); transform: scale(1.12); } 100% { filter: none; transform: none; } }
@keyframes glow-red { 0% { filter: sepia(1) saturate(6) hue-rotate(-40deg) brightness(1.4); } 100% { filter: none; } }
@keyframes shatter { 40% { filter: brightness(2.4) sepia(1) hue-rotate(-40deg); transform: scale(1.1) rotate(-3deg); } 100% { filter: blur(6px) brightness(0.3); transform: scale(0.5) rotate(14deg); opacity: 0; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translate(-3px, 2px); } 75% { transform: translate(3px, -2px); } }
#forge-result { margin-top: 6px; min-height: 22px; font-size: 14px; font-weight: 700; text-align: center; }
#forge-result .ok { color: #8fe08f; }
#forge-result .bad { color: #ff7a64; }
.forge-info { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; }
.forge-info div { display: flex; justify-content: space-between; gap: 8px; }
.forge-info span { color: var(--muted); }
.forge-info .short { color: #ff7a64; }
.forge-title { font-size: 17px; font-weight: 700; display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.forge-title em { font-style: normal; color: var(--gold); }
.chance { height: 8px; background: rgba(0, 0, 0, 0.5); border-radius: 4px; overflow: hidden; margin-top: 8px; display: flex; }
.chance i { display: block; height: 100%; background: linear-gradient(90deg, #5ab860, #8fe08f); }
.chance u { display: block; height: 100%; background: #c0301f; margin-left: auto; }
.risk { margin-top: 6px; font-size: 13px; font-weight: 600; text-align: center; color: var(--muted); }
.risk.downgrade { color: #ffb35a; }
.risk.break { color: #ff5a44; }
.stat-diff { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: center; }

.result { width: min(620px, 100%); display: grid; gap: 10px; text-align: center; padding: 22px; max-height: calc(100vh - 32px); overflow-y: auto; }
.result h1 { font-size: 30px; letter-spacing: 0.05em; }
.result p { color: var(--muted); }
.result table { width: 100%; border-collapse: collapse; }
.result th { color: var(--muted); font-weight: 400; font-size: 12px; }
.result td, .result th { padding: 4px 6px; }
.result tr.won td { color: var(--gold); }
.row { display: flex; gap: 8px; justify-content: center; }
#bracket { font-size: 12px; color: var(--muted); }

#auction { position: fixed; top: 92px; left: 262px; width: 370px; max-height: calc(100vh - 110px); overflow-y: auto; z-index: 6; }
.lot { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px; }
.lot canvas { width: 96px; height: 96px; background: radial-gradient(#3b2c1b, #120d09); border-radius: 6px; }
.lot b { font-size: 14px; display: block; }
.lot small { color: var(--muted); display: block; }
.lot .price { color: var(--gold); margin-top: 3px; }
.lot .time { font-weight: 700; }
.lot .time.low { color: #ff7a64; }
.lot .bidrow { display: flex; gap: 4px; margin-top: 4px; }
.lot .bidrow input { width: 86px; padding: 3px 6px; }
.lot .bidrow button { flex: 1; padding: 3px 6px; }

/* 390 × 161 is the old 300 × 124 plus 30%; the width gives way before it would reach the health bars in the middle. */
#chat { position: fixed; left: 12px; bottom: 12px; width: min(390px, max(230px, calc(50vw - 230px))); z-index: 4; }
#chat-body { position: relative; }
#chat-log { height: min(161px, 26vh); overflow-y: auto; font-size: 13px; line-height: 1.45; background: rgba(12, 9, 5, 0.42); border-radius: 4px; margin: 3px 0; text-shadow: 0 1px 3px #000; overflow-wrap: anywhere; padding: 4px 7px; }
#chat-log b { color: var(--gold); }
#chat-log .sys { color: #d6c8a8; }
#chat-log > div { margin-bottom: 2px; }
#chat-log .pvp-line { color: #ffe04d; font-weight: 600; }
#chat-log .forge-line.ok { color: #8fe08f; }
#chat-log .forge-line.bad { color: #ff8a76; }
#chat-log .item-name { font-weight: 700; }
#chat-log .info-out { color: #ffe08a; }
#chat-log .info-in { color: #ff8a76; }
#chat-log .info-gain { color: #8fe08f; }
#chat-log .info-lost { color: #ff8a76; }
#chat-new { position: absolute; right: 8px; bottom: 36px; padding: 2px 9px; font-size: 12px; font-weight: 700; color: #1c1408; background: var(--gold); border-color: #f0cf80; }
#chat-new:hover:not(:disabled) { background: #f0cf80; }
#chat-input { flex: 1; min-width: 0; font-size: 13px; padding: 6px 8px; background: var(--bg-soft); }
#chat-form { display: flex; gap: 4px; }
#chat-to { width: 96px; font-size: 13px; padding: 6px; background: var(--bg-soft); }
#chat-head { display: flex; gap: 4px; align-items: flex-start; }
#chat-head .seg { flex: 1; min-width: 0; margin: 0; flex-wrap: wrap; gap: 3px; }
#chat-head .seg button { flex: 1 1 auto; min-height: 27px; padding: 3px 7px; font-size: 12px; font-weight: 600; background: rgba(12, 9, 5, 0.82); }
#chat-head .seg button.active { background: #3a2c12; }
.chat-badge { display: inline-block; min-width: 15px; margin-left: 4px; padding: 0 3px; font-size: 10px; font-style: normal; font-weight: 700; line-height: 15px; text-align: center; color: #fff; background: var(--red); border-radius: 8px; }
#chat-fold { min-height: 27px; padding: 1px 9px; font-size: 12px; background: rgba(12, 9, 5, 0.82); }
#chat.folded #chat-body { display: none; }
#chat-log .name { cursor: var(--cursor-hit); font-weight: 700; color: var(--gold); background: none; border: 0; padding: 0; font-size: inherit; }
#chat-log .ch-whisper { color: #e59cff; }
#chat-log .ch-whisper .name { color: #e59cff; }
#chat-log .ch-clan { color: #7fe0a8; }
#chat-log .ch-clan .name { color: #7fe0a8; }
.rank-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 2px; font-size: 13px; border-bottom: 1px solid #3a2f24; }
.rank-row b { font-variant-numeric: tabular-nums; }
.rank-head { color: var(--muted); font-size: 11px; }
.rank-name { overflow-wrap: anywhere; font-weight: 600; }
.rank-title { overflow-wrap: anywhere; color: var(--gold); }
.rank-row.mine { background: rgba(230, 187, 85, 0.14); }
#exit-panel { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.45); }
#exit-panel .panel { width: min(380px, 100%); text-align: center; }
#exit-panel h2 { margin: 0 0 6px; font-size: 18px; letter-spacing: 0; text-transform: none; color: var(--ink); }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#settings-back { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.35); }
#win-settings { position: fixed; z-index: 31; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; }
#win-settings header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#win-settings header h2 { margin: 0; font-size: 15px; color: var(--ink); text-transform: none; }
#win-settings header button { padding: 0 9px; font-size: 16px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; border-bottom: 1px solid #3a2f24; }
.set-slider { display: flex; align-items: center; gap: 8px; width: 210px; }
.set-slider input { flex: 1; min-width: 0; }
.set-slider b { width: 38px; text-align: right; font-weight: 600; }
.set-row select { width: 150px; }
#win-settings .acts { display: flex; gap: 6px; margin-top: 10px; }
#fps { position: absolute; left: calc(100% + 8px); top: 32px; font-size: 14px; font-weight: 700; color: #fff; background: rgba(12, 9, 5, 0.9); border: 1px solid var(--line); padding: 3px 9px; border-radius: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.red-tag { display: block; color: #ff3b30; font-size: 11px; letter-spacing: 0.08em; }
#death-screen { position: fixed; z-index: 25; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; }
#death-screen h2 { color: #ff6a5a; text-transform: none; }
#death-screen ul { margin: 6px 0 10px 18px; padding: 0; font-size: 13px; }
#deliveries-box { margin-top: 10px; padding-top: 8px; border-top: 1px solid #3a2f24; }
#name-menu { position: fixed; z-index: 9; padding: 4px; }
.clan-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid #3a2f24; font-size: 12px; }
.clan-row .acts { display: flex; gap: 3px; }
.clan-row button { padding: 2px 6px; font-size: 12px; }
.clan-row .on { color: #8fd18f; }
.clan-foot { display: flex; gap: 6px; margin-top: 10px; }
.clan-foot button { flex: 1; }
.clan-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; margin-bottom: 8px; border: 1px solid var(--red); border-radius: 6px; font-size: 13px; }
.clan-ask span { flex: 1 1 100%; }
#clan-body h2 { margin: 10px 0 4px; }
.clan-row .off { opacity: 0.5; }
#clan-body input { width: 100%; margin-bottom: 6px; }
#sell-zone { margin-top: 8px; padding: 11px 6px; min-height: 48px; text-align: center; font-size: 11px; color: var(--muted); border: 1px dashed #6a5438; border-radius: 6px; }
#sell-zone.over { color: #fff; border-color: var(--gold); background: rgba(217, 171, 59, 0.14); }
#sell-zone.refuse { color: #ff8a7a; border-color: #b0402e; }
#sell-zone button, #sell-zone input { margin: 4px 2px 0; padding: 2px 8px; font-size: 11px; }
#sell-zone input { width: 52px; }
#drag-ghost { position: fixed; z-index: 20; width: 44px; height: 44px; pointer-events: none; opacity: 0.85; transform: translate(-50%, -50%); }
.square { touch-action: none; }
#toasts { position: fixed; top: max(16%, 122px); left: 50%; transform: translateX(-50%); display: grid; gap: 4px; z-index: 7; pointer-events: none; justify-items: center; }
.toast { background: var(--bg); border-radius: 6px; padding: 5px 12px; font-size: 13px; text-align: center; max-width: 560px; animation: slide-up 0.18s ease-out; }
.toast.drop { border: 1px solid currentColor; font-weight: 600; font-size: 14px; }
.map-name { font-size: 16px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; }
.map-pvp { font-weight: 900; color: #ff2d20; }
@keyframes slide-up { from { transform: translateY(8px); opacity: 0; } }
#invite { position: fixed; top: 150px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; gap: 8px; align-items: center; }
#win-match { right: auto; left: 262px; top: 92px; }

@media (max-width: 1300px) {
  #resources { top: 6px; padding: 5px 12px; gap: 12px; font-size: 13px; }
  #resources b { font-size: 14px; }
  #resources svg { width: 16px; height: 16px; }
  #top-left, #top-right { top: 48px; }
  #top-right { max-width: 440px; }
  #top-stack { top: 44px; }
  #safe-zone { font-size: 18px; }
  .plates { top: 76px; left: 340px; right: 460px; }
  .win { top: 215px; max-height: calc(100vh - 233px); }
}
@media (max-width: 900px) {
}
@media (max-width: 1000px) {
  .plates { left: 12px; right: 12px; top: 200px; }
  #counters { top: 34%; }
}
@media (max-width: 640px) {
  #resources { gap: 7px; padding: 4px 7px; font-size: 10.5px; letter-spacing: 0; }
  #resources b { font-size: 11px; }
  #resources span { gap: 3px; }
  #resources svg { width: 12px; height: 12px; }
  #top-stack { top: 32px; gap: 3px; }
  #premium-bar, #arena-bar { font-size: 11px; padding: 1px 6px; }
  #arena-bar span { display: none; }
  #safe-zone { font-size: 14px; }
  #top-left, #top-right { top: 38px; }
  .ico { margin-right: 3px; }
  #menu { max-width: calc(100vw - 195px); }
  #menu button { padding: 4px 6px; font-size: 13px; }
  .ico { width: 15px; height: 15px; vertical-align: -3px; }
  #menu kbd { display: none; }
  .forge-bottom { grid-template-columns: 1fr; gap: 6px; }
  #forge-worn { grid-template-columns: 1fr; }
  .forge-list { height: 16vh; }
  #forge-preview { display: none; }
  #chat { display: none; }
  #self { width: calc(100vw - 24px); }
  #top-left { width: 163px; }
  #minimap { width: 163px; height: 127px; }
  #map-tag { font-size: 14px; }
  #objective { font-size: 12px; padding: 6px 8px; }
  #fps { left: 0; top: calc(100% + 4px); font-size: 12px; }
}

/* Stat colours: the single list. Rarity colours stay on item names only. */
.stat-list { display: flex; flex-wrap: wrap; gap: 1px 10px; margin: 3px 0; font-size: 12px; line-height: 1.35; font-weight: 600; }
.stat-list span { overflow-wrap: anywhere; }
.stat-attack, .stat-attack > * { color: #ff6f61 !important; }
.stat-defense, .stat-defense > * { color: #74bcff !important; }
.stat-hp, .stat-hp > * { color: #63e07e !important; }
.stat-crit, .stat-crit > * { color: #ffa23f !important; }
.stat-speed, .stat-speed > * { color: #ffe352 !important; }
.stat-diamond, .stat-diamond > * { color: #cc9bff !important; }
.stat-fame, .stat-fame > * { color: #f4cb4e !important; }
.stat-other, .stat-other > * { color: #cfd2d6 !important; }
.stat-bad, .stat-bad > * { color: #ff5c7c !important; font-weight: 800; }
@media (max-width: 1120px) {
  #premium-bar, #arena-bar { font-size: 11px; padding: 1px 6px; gap: 4px; }
  #premium-get { padding: 1px 5px; }
  #arena-bar span { display: none; }
}
@media (max-width: 900px) {
  #premium-text { display: none; }
  #top-left, #top-right { top: 72px; }
}
#sold-list { display: grid; gap: 3px; margin-top: 6px; }
@media (min-width: 561px) {
  #win-inv #sold-list { position: absolute; bottom: 0; right: calc(100% + 8px); width: 270px; margin: 0; padding: 8px; background: #1d1712; border: 1px solid #3a2f24; border-radius: 8px; }
}
#sold-list small { color: var(--muted); }
.sold-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; align-items: center; gap: 6px; font-size: 12px; }
.sold-row img { width: 26px; height: 26px; }
.sold-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sold-row span { color: var(--muted); white-space: nowrap; }
.sold-row button { padding: 2px 8px; font-size: 12px; }
.square.fresh { box-shadow: 0 0 0 2px #7dff9a, 0 0 10px #7dff9a; }
#menu button.has-new { border-color: #7dff9a; box-shadow: 0 0 8px #7dff9a; }
#sell-zone { cursor: var(--cursor-hit); }
#sell-zone small { display: block; margin-top: 2px; color: var(--gold); font-size: 12px; }
#chat-log .pvp-line .pvp-name { color: #63e07e; font-weight: 700; }
#announcements { margin-top: 10px; padding: 8px 10px; text-align: left; font-size: 13px; line-height: 1.35; color: #f2ece0; background: rgba(217, 171, 59, 0.12); border: 1px solid rgba(230, 187, 85, 0.55); border-radius: 6px; }
#announcements b { display: block; margin-bottom: 2px; color: var(--gold); }
.entry-news { color: #7dff9a !important; font-weight: 700; }

/* Connection notice, on every device */
#reconnect { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); z-index: 30; padding: 8px 16px; font-size: 15px; font-weight: 700; color: #1c1408; background: var(--gold); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6); pointer-events: none; }

/* Touch: phones and tablets. Everything below applies only with html.touch, so the desktop layout is untouched. */
.touch-only, .touch-controls { display: none !important; }
html.touch {
  --safe-t: env(safe-area-inset-top); --safe-r: env(safe-area-inset-right); --safe-b: env(safe-area-inset-bottom); --safe-l: env(safe-area-inset-left);
  --tap: 52px;
  touch-action: manipulation; overscroll-behavior: none; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
html.touch body { overscroll-behavior: none; position: fixed; inset: 0; width: 100%; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
html.touch input, html.touch textarea { user-select: text; -webkit-user-select: text; font-size: 16px; } /* iOS zooms into anything smaller. */
html.touch select { font-size: 16px; min-height: 44px; }
html.touch, html.touch body, html.touch body * { cursor: auto; }
html.touch #view, html.touch #hud, html.touch #hud * { touch-action: none; }
html.touch .touch-only { display: revert !important; }
html.touch [hidden].touch-only, html.touch #t-fullscreen[hidden] { display: none !important; }
html.touch .controls:not(.touch-controls) { display: none; }
html.touch .touch-controls { display: grid !important; }
html.touch button { min-height: 44px; }
html.touch button:active:not(:disabled) { filter: brightness(1.4); transform: scale(0.97); }
html.touch button.armed { background: #c23a2c !important; border-color: #ffb0a0; color: #fff; }
html.touch button:hover:not(:disabled) { background: var(--cell); border-color: var(--line); }
html.touch button.primary:hover:not(:disabled) { background: linear-gradient(180deg, #d0a03c, #a87a24); }
html.touch .muted, html.touch small { font-size: 13px; }
html.touch .login { padding: 14px 20px; max-height: calc(100dvh - 16px); }
html.touch .login-crest { width: 70px; height: 56px; }
html.touch .login h1 { font-size: 28px; }
html.touch .screen { padding: max(8px, var(--safe-t)) max(8px, var(--safe-r)) max(8px, var(--safe-b)) max(8px, var(--safe-l)); }

/* Top bar */
html.touch #resources { top: calc(var(--safe-t) + 4px); padding: 3px 8px; gap: 10px; font-size: 13px; }
html.touch #resources em { display: none; }
html.touch #resources b { font-size: 14px; }
html.touch #resources svg { width: 15px; height: 15px; }
html.touch #top-stack { top: calc(var(--safe-t) + 34px); gap: 3px; max-width: calc(100vw - 16px); }
html.touch #premium-bar, html.touch #arena-bar { font-size: 12px; padding: 1px 6px; min-height: 22px; }
html.touch #premium-text, html.touch #arena-bar span { display: none; }
html.touch #premium-get { min-height: 22px; padding: 0 6px; font-size: 12px; }
html.touch #safe-zone { font-size: 14px; padding: 1px 10px; }
html.touch #boss-banner { max-width: calc(100vw - 24px); font-size: 8px; }
html.touch #boss { width: min(210px, 42vw); }
html.touch #boss .pname { font-size: 9px; }
html.touch #boss .bar.hp { height: 9px; }
html.touch .label.boss { font-size: 9px; }
html.touch .label.boss .mini { width: 44px; height: 5px; }
html.touch #toasts { max-width: calc(100vw - 24px); }
html.touch #slow-warn { top: calc(var(--safe-t) + 96px); gap: 4px 6px; padding: 4px 8px; font-size: 11px; }
html.touch #slow-warn button { min-height: 34px; padding: 0 10px; font-size: 12px; }
html.touch .toast { max-width: 100%; }
html.touch .toast.drop { padding: 0 4px; border: 0; font-size: 9px; background: rgba(0, 0, 0, 0.18); text-shadow: 0 1px 2px #000; }

/* Corners */
html.touch #top-left { top: calc(var(--safe-t) + 4px); left: calc(var(--safe-l) + 6px); width: 118px; gap: 3px; }
html.touch #map-tag { font-size: 12px; flex-wrap: wrap; }
html.touch #ping { font-size: 11px; padding-left: 4px; }
html.touch #minimap { width: 118px; height: 92px; }
html.touch #objective { font-size: 12px; padding: 3px 6px; }
html.touch #party-list { font-size: 12px; }
html.touch #fps { font-size: 12px; }
html.touch #top-right { top: 0; right: 0; max-width: none; pointer-events: none; }
html.touch #killfeed { display: none; }
html.touch #menu { display: none; }
html.touch body.menu-open #menu { position: fixed; display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; left: 0; right: 0; bottom: 0; max-height: 80dvh; overflow-y: auto; touch-action: pan-y; padding: 12px max(12px, var(--safe-r)) max(12px, var(--safe-b)) max(12px, var(--safe-l)); background: rgba(16, 13, 11, 0.97); border-top: 1px solid var(--line-strong); z-index: 12; }
html.touch #menu button { min-height: var(--tap); font-size: 14px; white-space: normal; }
html.touch #menu kbd { display: none; }
#t-rail { position: absolute; top: calc(var(--safe-t, 0px) + 4px); right: calc(var(--safe-r, 0px) + 6px); }
html.touch #t-rail { display: flex !important; gap: 6px; pointer-events: auto; }
html.touch #t-rail button { width: 48px; height: 48px; min-height: 48px; padding: 0; font-size: 20px; color: #fff; background: rgba(12, 9, 5, 0.86); }
html.touch #t-rail .ico { margin: 0; width: 24px; height: 24px; }
html.touch #t-rail button.has-new { border-color: #7dff9a; box-shadow: 0 0 8px #7dff9a; }

/* Stick: rests in its corner, comes to the thumb when pressed. */
#stick { position: absolute; left: calc(var(--safe-l, 0px) + 86px); bottom: calc(var(--safe-b, 0px) + 86px); width: 120px; height: 120px; margin: -60px 0 -60px -60px; pointer-events: none; border-radius: 50%; }
html.touch #stick { display: block !important; background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.28); }
html.touch #stick.on { background: rgba(255, 255, 255, 0.13); border-color: rgba(230, 187, 85, 0.8); }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: rgba(240, 232, 215, 0.55); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
html.touch #stick.on #stick-knob { background: var(--gold); }

/* Combat: an arc under the right thumb */
#t-actions { position: absolute; right: calc(var(--safe-r, 0px) + 10px); bottom: calc(var(--safe-b, 0px) + 10px); width: 196px; height: 176px; pointer-events: none; }
html.touch #t-actions { display: block !important; }
.t-btn { position: absolute; width: 60px; height: 60px; padding: 0; border-radius: 50%; font-size: 13px; font-weight: 800; color: #fff; pointer-events: auto; background: rgba(12, 9, 5, 0.72); border: 2px solid rgba(255, 255, 255, 0.35); text-shadow: 0 1px 2px #000; }
html.touch .t-btn:hover:not(:disabled) { background: rgba(12, 9, 5, 0.72); border-color: rgba(255, 255, 255, 0.35); }
html.touch .t-btn.on, html.touch .t-btn.on:hover:not(:disabled) { background: rgba(230, 187, 85, 0.85); border-color: #fff; color: #1c1408; text-shadow: none; transform: scale(0.94); }
#t-attack { right: 0; bottom: 0; width: 92px; height: 92px; font-size: 16px; background: rgba(150, 30, 24, 0.75); border-color: #ff9a8a; }
html.touch #t-attack:hover:not(:disabled) { background: rgba(150, 30, 24, 0.75); border-color: #ff9a8a; }
#t-heavy { right: 104px; bottom: 0; }
#t-dodge { right: 92px; bottom: 72px; }
#t-block { right: 16px; bottom: 104px; }
html.touch #hint { bottom: 200px; font-size: 13px; }
html.touch #counters { top: 22%; right: calc(var(--safe-r) + 8px); }
html.touch #combo-box b { font-size: 26px; }
html.touch #slay-box b { font-size: 22px; }
html.touch #center-text { font-size: clamp(30px, 8vw, 48px); top: 22%; }
html.touch #sub-text { top: calc(22% + 54px); font-size: 14px; }
html.touch .dmg { font-size: 18px; }
html.touch .dmg.crit, html.touch .dmg.big { font-size: 24px; }
html.touch .label { font-size: 12px; }
html.touch .label.locked { outline: 2px solid var(--gold); }
html.touch .plates { left: 8px; right: 8px; top: calc(var(--safe-t) + 140px); }

/* Own bars and potions */
html.touch #self { width: min(324px, calc(100vw - 340px)); min-width: 164px; bottom: calc(var(--safe-b) + 6px); }
html.touch #self-head { font-size: 11px; margin-bottom: 1px; }
html.touch #self-level { display: none; }
html.touch #self .bar.hp { height: 14px; }
html.touch #self .bar.hp span { line-height: 14px; font-size: 12px; }
html.touch #hud-belt { display: grid; grid-template-columns: repeat(auto-fit, 48px); gap: 6px; justify-content: center; }
html.touch .bslot { width: 48px; height: 48px; }
html.touch .bslot.on, html.touch .bslot:active { border-color: var(--gold); filter: brightness(1.4); }
html.touch .buff { font-size: 12px; }

/* Windows are full pages on touch; the combat controls wait behind them. */
html.touch .win, html.touch .win.small, html.touch #win-inv, html.touch #win-settings, html.touch #auction {
  position: fixed; inset: 0; transform: none; margin: 0; box-sizing: border-box; width: 100%; max-width: none; height: 100dvh; max-height: none; border-radius: 0; z-index: 14; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; backdrop-filter: none; background: #15110c;
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 12px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 12px); font-size: 15px;
}
/* The Demirci: the list and the details scroll apart, so the button is never far. */
html.touch .win.forge { display: flex; flex-direction: column; overflow: hidden; }
html.touch .win.forge header { position: static; flex: 0 0 auto; }
html.touch .forge-bottom { display: block; flex: 1 1 0; min-height: 0; overflow-y: auto; touch-action: pan-y; }
html.touch #forge-worn { grid-template-columns: 1fr 1fr; gap: 6px; height: auto; max-height: 34dvh; margin-bottom: 6px; touch-action: pan-y; }
html.touch .forge-row { min-height: 58px; grid-template-columns: 46px 1fr auto; gap: 8px; padding: 4px 8px 4px 4px; font-size: 15px; }
html.touch .forge-row img { width: 46px; height: 46px; }
html.touch .forge-row b { font-size: 17px; }
html.touch .forge-info, html.touch .forge-batch { font-size: 15px; gap: 6px 14px; }
html.touch .forge-title { font-size: 19px; }
html.touch #forge-result { min-height: 0; margin: 0 0 4px; font-size: 15px; }
html.touch #forge-body > button.primary { position: sticky; bottom: 0; z-index: 1; min-height: 56px; font-size: 17px; margin-top: 8px; }
@media (orientation: landscape) {
  html.touch .win.forge { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 14px; }
  html.touch .win.forge header { grid-column: 1 / -1; }
  html.touch .forge-lists { min-height: 0; overflow-y: auto; touch-action: pan-y; }
  html.touch #forge-worn { grid-template-columns: 1fr; max-height: none; overflow: visible; }
  html.touch .forge-bottom { border-top: 0; padding-top: 0; }
}
html.touch #win-match { position: fixed; inset: auto 0 0 0; height: auto; max-height: 75dvh; }
html.touch .win header, html.touch #auction header, html.touch #win-settings header { position: sticky; top: calc(-8px - var(--safe-t)); z-index: 2; background: #15110c; padding: 4px 0; }
html.touch .win header h2, html.touch #auction h2 { font-size: 18px; }
html.touch .win header button, html.touch #auction-close, html.touch #settings-close { min-width: 48px; min-height: 48px; font-size: 22px; }
html.touch #win-inv #bag { max-height: none; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); overflow: visible; }
html.touch #win-inv.expanded #bag { max-height: none; }
html.touch #win-inv .gear { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); }
html.touch #bag-expand { display: none; }
html.touch .square { touch-action: pan-y; min-height: 52px; }
html.touch #win-inv #sell-zone { position: sticky; bottom: calc(-16px - var(--safe-b)); min-height: 64px; display: grid; place-items: center; background: #2a1c12; z-index: 2; }
html.touch #win-inv #sold-list { position: static; width: auto; }
html.touch #win-inv #tip { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 62dvh; overflow-y: auto; touch-action: pan-y; padding: 12px calc(var(--safe-r) + 14px) calc(var(--safe-b) + 14px) calc(var(--safe-l) + 14px); border-radius: 12px 12px 0 0; border: 1px solid var(--line-strong); background: #1d1712; z-index: 15; font-size: 15px; }
html.touch #win-inv #tip:empty { display: none; }
html.touch .tip-close { float: right; width: 48px; height: 48px; font-size: 22px; padding: 0; margin: -4px -4px 4px 8px; }
html.touch #forge-preview { display: none; }
html.touch .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
html.touch input[type="checkbox"] { width: 26px; height: 26px; }
html.touch input[type="range"] { min-height: 32px; }
html.touch .set-row { min-height: 48px; }
html.touch #settings-back { display: none; }
html.touch #death-screen { position: fixed; inset: auto 8px calc(var(--safe-b) + 8px) 8px; width: auto; max-height: 90dvh; overflow-y: auto; touch-action: pan-y; z-index: 16; transform: none; top: auto; left: 8px; }
html.touch #exit-panel, html.touch #results, html.touch #entry-warning { z-index: 40; }
html.touch #results .panel { max-height: 90dvh; overflow-y: auto; touch-action: pan-y; }
html.touch #invite { top: calc(var(--safe-t) + 60px); max-width: calc(100vw - 16px); flex-wrap: wrap; justify-content: center; z-index: 17; }
html.touch body:has(.win:not([hidden]):not(#win-match)) #hud,
html.touch body:has(#win-settings:not([hidden])) #hud,
html.touch body:has(#auction:not([hidden])) #hud { visibility: hidden; }
html.spectating #t-actions, html.spectating #stick { display: none !important; }

/* Chat waits behind the menu on touch. */
html.touch #chat { display: none; }
html.touch body.chat-open #chat:not([hidden]) { display: flex; flex-direction: column; position: fixed; inset: 0; width: auto; height: 100dvh; max-height: none; z-index: 13; background: #15110c; padding: calc(var(--safe-t) + 6px) calc(var(--safe-r) + 8px) calc(var(--safe-b) + 6px) calc(var(--safe-l) + 8px); }
html.touch body.chat-open #chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
html.touch body.chat-open #chat-log { flex: 1; max-height: none; height: auto; touch-action: pan-y; font-size: 14px; }
html.touch #chat-fold { display: none; }
html.touch #chat-head { display: flex; gap: 6px; }
html.touch #chat-head .seg { flex: 1; flex-wrap: wrap; margin: 0; }
html.touch #chat-close { width: 48px; font-size: 22px; padding: 0; flex: none; }

/* Upright phone: the stack gets its own rows, and the bars rise above the thumbs. */
@media (orientation: portrait) {
  html.touch #self { width: calc(100vw - 16px); max-width: 480px; bottom: calc(var(--safe-b) + 196px); }
  html.touch #hint { bottom: 300px; }
  html.touch #top-stack { top: calc(var(--safe-t) + 60px); }
  html.touch #resources { top: calc(var(--safe-t) + 54px); left: 50%; }
  html.touch #top-stack { top: calc(var(--safe-t) + 84px); }
  html.touch #top-left { width: 84px; }
  html.touch #minimap { width: 84px; height: 66px; }
  html.touch #map-tag { font-size: 11px; }
  html.touch #t-rail button { width: 46px; }
}
@media (orientation: portrait) and (min-width: 700px) {
  html.touch #top-left { width: 150px; }
  html.touch #minimap { width: 150px; height: 116px; }
  html.touch #resources { top: calc(var(--safe-t) + 4px); }
  html.touch #top-stack { top: calc(var(--safe-t) + 60px); }
}
/* Wide but short: the bar shrinks and the belt becomes two short rows if it must. */
@media (orientation: landscape) and (max-height: 430px) {
  html.touch #self-head b { font-size: 11px; }
  html.touch .xpbar { margin-bottom: 3px; }
  html.touch #top-left { width: 104px; }
  html.touch #minimap { width: 104px; height: 80px; }
  html.touch #objective, html.touch #party-list { font-size: 10px; line-height: 1.2; }
  html.touch #objective { gap: 0; padding: 2px 5px; }
  html.touch #stick { left: calc(var(--safe-l) + 76px); bottom: calc(var(--safe-b) + 72px); }
}
@media (orientation: landscape) and (max-width: 700px) {
  html.touch #self { width: 164px; min-width: 164px; }
  html.touch #self-head { display: none; }
  html.touch #hud-belt { grid-template-columns: repeat(3, 48px); }
  html.touch #t-rail button { width: 44px; }
  html.touch #resources { left: 50%; gap: 6px; padding: 2px 6px; }
  html.touch #top-row { display: none; }
  html.touch #top-stack { top: calc(var(--safe-t) + 30px); }
}
@media (orientation: portrait) and (max-width: 420px) {
  html.touch #hud-belt { gap: 3px; }
  html.touch #objective { display: none; }
}
@media (orientation: portrait) and (max-height: 640px) {
  html.touch #self-head { display: none; }
  html.touch #self { bottom: calc(var(--safe-b) + 184px); }
  html.touch #t-actions { transform: scale(0.94); transform-origin: bottom right; }
}
/* Phones: the status panels stay small so the arena stays visible. */
html.touch .label { --s: calc(var(--label-scale, 1) * 0.65); }
html.touch .label.me, html.touch .label.mate, html.touch .label.rival { --s: calc(var(--label-scale, 1) * 0.5); font-size: 9px; padding: 1px 4px 2px; }
html.touch .label.me .mini, html.touch .label.mate .mini, html.touch .label.rival .mini { height: 4px; margin-top: 2px; }
@media (max-width: 899px), (max-height: 599px) {
  html.touch #resources { gap: 7px; padding: 2px 6px; font-size: 11px; letter-spacing: 0; }
  html.touch #resources b { font-size: 11.5px; }
  html.touch #resources span { gap: 3px; }
  html.touch #resources svg { width: 12px; height: 12px; }
  html.touch #top-stack { gap: 2px; }
  html.touch #top-row { gap: 3px; }
  html.touch #premium-bar, html.touch #arena-bar { font-size: 10px; padding: 0 5px; gap: 3px; min-height: 16px; letter-spacing: 0; }
  html.touch #premium-bar svg, html.touch #arena-bar svg { width: 11px; height: 11px; }
  html.touch #premium-get { min-height: 16px; padding: 0 5px; font-size: 10px; }
  html.touch #safe-zone { font-size: 9px; padding: 0 6px; }
  html.touch #center-text { font-size: clamp(18px, 5vw, 26px); top: 20%; letter-spacing: 0.02em; }
  html.touch #sub-text { top: calc(20% + 30px); font-size: 11px; }
  html.touch .dmg { font-size: 12px; }
  html.touch .dmg.blocked { font-size: 11px; }
  html.touch .dmg.crit, html.touch .dmg.big { font-size: 15px; -webkit-text-stroke: 0.5px #4a1c00; }
  html.touch .dmg.gain { font-size: 10px; }
  html.touch .dmg.gain.fame { font-size: 11px; }
  html.touch #self { width: min(219px, calc(100vw - 16px)); min-width: 0; }
  html.touch #self-head, html.touch #self-head b { font-size: 10px; }
  html.touch #self .bar.hp { height: 10px; }
  html.touch #self .bar.hp span { line-height: 10px; font-size: 9px; }
  html.touch #self .bar.st { height: 3px; }
  html.touch .xpbar { height: 2px; margin-bottom: 2px; }
  html.touch #hud-belt { grid-template-columns: repeat(auto-fit, 34px); gap: 3px; }
  html.touch .bslot { width: 34px; height: 34px; }
  html.touch .bslot b { font-size: 8px; }
  html.touch .bslot i { font-size: 9px; }
}
@media (orientation: portrait) and (max-width: 699px) {
  html.touch #top-stack { top: calc(var(--safe-t) + 76px); }
}
@media (orientation: portrait) and (max-width: 360px) {
  html.touch #t-rail { gap: 4px; }
  html.touch #t-rail button { width: 42px; height: 42px; min-height: 42px; }
}
@media (orientation: landscape) and (max-height: 599px) {
  html.touch #self { bottom: calc(var(--safe-b) + 14px); }
  html.touch #center-text { top: calc(var(--safe-t) + 58px); font-size: 20px; }
  html.touch #sub-text { top: calc(var(--safe-t) + 83px); }
  html.touch #top-stack { top: calc(var(--safe-t) + 26px); }
}
@media (orientation: landscape) and (max-width: 700px) {
  html.touch #self { left: calc(50% - 24px); }
  html.touch #hud-belt { grid-template-columns: repeat(6, 34px); }
  /* The buttons along the top leave only the gap beside the minimap. */
  html.touch #resources, html.touch #top-stack { left: calc(var(--safe-l) + 116px); transform: none; align-items: flex-start; }
}
/* Tablets have room for more. */
@media (min-width: 900px) and (min-height: 600px) {
  html.touch #self-level { display: inline; }
  html.touch #top-left { width: 180px; }
  html.touch #minimap { width: 180px; height: 140px; }
  html.touch #killfeed { display: grid; position: absolute; top: 60px; right: 8px; }
  html.touch .win, html.touch .win.small, html.touch #win-inv, html.touch #win-settings, html.touch #auction { padding-left: calc(50vw - 340px); padding-right: calc(50vw - 340px); }
}
