:root {
  --bg: #0f1216;
  --panel: #171c22;
  --panel-2: #1e252d;
  --line: #2b343e;
  --text: #e9e4d8;
  --muted: #8f99a3;
  --gold: #e6b44c;
  --fire: #e8613a;
  --water: #3d9be0;
  --air: #d9c98a;
  --earth: #6fa64a;
  --hp: #c94a4a;
  --mana: #4a79c9;
  --exp: #d7a83c;
  --ok: #5fb36a;
  --bad: #d65b5b;
  --accent: #e6b44c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover { border-color: #46525e; }
button.primary { background: var(--accent); color: #1b1408; border-color: transparent; font-weight: 600; }
button.danger { background: transparent; border-color: #5a2b2b; color: #f0a0a0; width: 100%; margin-top: 10px; }
button.ghost { background: transparent; }
button.chip { padding: 3px 9px; font-size: 12px; }
button.chip.on { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
input { font: inherit; color: var(--text); background: #0c0f13; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; margin-top: 4px; }
label { display: block; margin: 8px 0; color: var(--muted); font-size: 13px; }
h1, h2, h3 { margin: 0 0 10px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); min-height: 1.2em; margin: 8px 0 0; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); margin-left: 6px; text-transform: none; letter-spacing: 0; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(760px, 100%); }
.panel.narrow { width: min(380px, 100%); }
.logo { font-size: 30px; letter-spacing: .02em; }
.logo span { color: var(--accent); }

.elements { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.element { border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--panel-2); text-align: center; }
.element.on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.element b { color: var(--c); display: block; font-size: 16px; }
.element p { margin: 6px 0 0; font-size: 12px; color: var(--muted); min-height: 3.2em; }
.element canvas { image-rendering: pixelated; width: 96px; height: 96px; }
.outfits { display: flex; gap: 6px; }
.outfits canvas { image-rendering: pixelated; width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 8px; background: #0c0f13; cursor: pointer; }
.outfits canvas.on { border-color: var(--accent); }
@media (max-width: 640px) { .elements { grid-template-columns: repeat(2, 1fr); } }

#game { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 0; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.who { display: flex; align-items: center; gap: 8px; min-width: 190px; }
.who canvas { image-rendering: pixelated; width: 40px; height: 40px; }
.lvl { flex: 1; max-width: 520px; }
.lvl > div:first-child { display: flex; justify-content: space-between; font-size: 13px; }
.gold { display: flex; align-items: center; gap: 6px; color: var(--gold); font-size: 16px; }
.coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe39a, #c48a20); display: inline-block; }
#logout { margin-left: auto; }

.bar { position: relative; height: 10px; background: #0b0e11; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; transition: width .4s; }
.bar.exp i { background: var(--exp); }
.bar.hp { height: 18px; }
.bar.hp i { background: var(--hp); }
.bar.hp span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; }

.layout { flex: 1; display: grid; grid-template-columns: 300px 1fr 300px; min-height: 0; }
.hunts, .side { overflow-y: auto; padding: 12px; background: var(--panel); }
.hunts { border-right: 1px solid var(--line); }
.side { border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.hunts-head { display: flex; align-items: baseline; justify-content: space-between; }
.hunts-head label { margin: 0; display: flex; gap: 4px; align-items: center; }
.hunts-head input { width: auto; margin: 0; }
.hunt { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: var(--panel-2); }
.hunt:hover { border-color: #46525e; }
.hunt.active { border-color: var(--accent); }
.hunt.locked { opacity: .5; cursor: default; }
.hunt canvas { image-rendering: pixelated; width: 52px; height: 52px; background: #0c0f13; border-radius: 8px; }
.hunt .t { display: flex; justify-content: space-between; gap: 6px; }
.hunt .t b { font-size: 13px; }
.hunt .m { font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; }
.tag { font-size: 10px; padding: 0 6px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; height: 17px; }
.tag.ok { color: var(--ok); border-color: #2f5a35; }
.tag.bad { color: var(--bad); border-color: #5a2b2b; }

.stage { position: relative; overflow: hidden; background: #050607; min-width: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.stage-hud { position: absolute; left: 10px; top: 10px; right: 10px; display: flex; justify-content: space-between; pointer-events: none; }
.place { background: rgba(10,12,15,.8); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.floors { display: flex; gap: 4px; pointer-events: auto; }
.floors button { padding: 3px 8px; font-size: 12px; background: rgba(10,12,15,.8); }
.floors button.on { border-color: var(--accent); color: var(--accent); }
#floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floater { position: absolute; font-weight: 700; font-size: 13px; text-shadow: 0 1px 2px #000, 0 0 3px #000; animation: rise 1.4s ease-out forwards; white-space: nowrap; }
@keyframes rise { from { transform: translate(-50%, 0); opacity: 1; } to { transform: translate(-50%, -46px); opacity: 0; } }

.card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel-2); }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 12px; margin-top: 10px; }
.stats span:nth-child(odd) { color: var(--muted); }
.stats span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.potion { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; font-size: 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.potion:last-child { border-bottom: 0; }
.potion .n { font-variant-numeric: tabular-nums; color: var(--muted); }
.potion button { padding: 2px 7px; font-size: 11px; }
.toggle { display: flex; gap: 8px; margin: 4px 0 8px; }
.toggle label { margin: 0; display: flex; gap: 4px; align-items: center; font-size: 12px; }
.toggle input { width: auto; margin: 0; }
.kv { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.kv span:last-child { font-variant-numeric: tabular-nums; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal h2 { color: var(--accent); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; z-index: 20; }
.loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--bg); z-index: 30; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 250px 1fr; }
  .side { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; }
  .side .card { flex: 1 1 240px; }
}
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .stage { height: 52vh; }
  .hunts { max-height: 40vh; border-right: 0; }
  .topbar { flex-wrap: wrap; gap: 8px; }
}

/* daily task, ALPHA, craft */
.task { padding: 6px 0; border-bottom: 1px solid var(--line, #2a2f3a); }
.task:last-of-type { border-bottom: 0; }
.task.done .bar i { background: var(--earth, #7fb85a); }
.row.tight { gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.bad { color: #e0605a; }
.ok { color: #8fc46a; }
.drop span:first-child { color: #f0c84a; font-weight: 600; }
.craft { max-height: 420px; overflow-y: auto; }
.recipe { padding: 6px 0; border-bottom: 1px solid var(--line, #2a2f3a); }
.glove { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line, #2a2f3a); }
.glove select { width: 100%; margin-top: 6px; }

/* ── talent tree overlay ─────────────────────────────────────────────── */
.tal-open { border-color: #4a3a1a; background: linear-gradient(180deg, #2a2213, #1b160c); color: var(--gold); position: relative; }
.tal-open #tal-badge:empty { display: none; }
.tal-open #tal-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--gold); color: #1a1408; font-weight: 700; font-size: 12px; }
.tal-open.has { animation: tal-call 2s ease-in-out infinite; }
@keyframes tal-call { 0%, 100% { box-shadow: 0 0 0 0 rgba(230, 180, 76, 0); } 50% { box-shadow: 0 0 14px 2px rgba(230, 180, 76, .45); } }

.talents { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr auto; color: var(--text);
  background: radial-gradient(ellipse at 50% 45%, #17344d 0%, #0e2233 45%, #081420 100%); animation: tal-in .35s ease-out both; }
.talents.hidden { display: none; }
.talents.closing { animation: tal-out .26s ease-in both; }
@keyframes tal-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tal-out { to { opacity: 0; transform: scale(.98); } }
.tal-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tal-bg i { position: absolute; width: 140vmax; height: 140vmax; left: 50%; top: 50%; margin: -70vmax; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(120, 180, 230, .035) 0 2deg, transparent 2deg 12deg); animation: tal-spin 120s linear infinite; }
.tal-bg i:nth-child(2) { animation-duration: 180s; animation-direction: reverse; opacity: .6; }
.tal-bg i:nth-child(3) { background: radial-gradient(circle, rgba(255, 255, 255, .06) 1px, transparent 1.5px) 0 0 / 38px 38px; animation: tal-drift 60s linear infinite; border-radius: 0; }
@keyframes tal-spin { to { transform: rotate(360deg); } }
@keyframes tal-drift { to { transform: translate(38px, 38px); } }

.tal-head { position: relative; display: flex; align-items: center; gap: 16px; padding: 14px 18px; }
.tal-head h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; color: var(--gold); letter-spacing: .5px; }
.tal-head > div:first-child { flex: 1; display: flex; flex-direction: column; }
.tal-points { display: flex; align-items: baseline; gap: 6px; padding: 6px 14px; border: 1px solid #2c4a63; border-radius: 999px; background: rgba(8, 20, 32, .6); }
.tal-points b { font-size: 20px; color: var(--muted); }
.tal-points.has b { color: var(--gold); text-shadow: 0 0 12px rgba(230, 180, 76, .7); }
.tal-head .ghost { font-size: 18px; width: 40px; height: 40px; padding: 0; border-radius: 50%; }

.tal-stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 0 8px; }
.tal-stage svg { width: min(100%, 92vh); height: 100%; max-height: calc(100vh - 150px); overflow: visible; }
.tal-title { font: italic 34px Georgia, "Times New Roman", serif; fill: var(--gold); opacity: .85; paint-order: stroke; stroke: rgba(0, 0, 0, .35); stroke-width: 4px; }

/* edges */
.tal-edge { stroke: #3a5568; stroke-width: 3; opacity: .45; stroke-dasharray: 6 7; }
.tal-edge.ready { opacity: .8; stroke-dasharray: none; }
.tal-edge.ready.b-offense { stroke: #8a4430; }
.tal-edge.ready.b-defense { stroke: #2d5f86; }
.tal-edge.ready.b-flow { stroke: #85692a; }
.tal-edge.lit { opacity: 1; stroke-width: 4; stroke-dasharray: 14 10; animation: tal-flow 1.2s linear infinite; }
.tal-edge.lit.b-offense { stroke: var(--fire); filter: drop-shadow(0 0 5px var(--fire)); }
.tal-edge.lit.b-defense { stroke: var(--water); filter: drop-shadow(0 0 5px var(--water)); }
.tal-edge.lit.b-flow { stroke: var(--gold); filter: drop-shadow(0 0 5px var(--gold)); }
@keyframes tal-flow { to { stroke-dashoffset: -24; } }
.intro .tal-edge { animation: tal-draw .7s ease-out var(--delay) both; stroke-dasharray: var(--len); }
.intro .tal-edge.lit { animation: tal-draw .7s ease-out var(--delay) both; }
@keyframes tal-draw { from { stroke-dashoffset: var(--len); opacity: 0; } to { stroke-dashoffset: 0; } }

/* centre */
.tal-center { animation: tal-center-in .6s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes tal-center-in { from { transform: scale(.2) rotate(-60deg); opacity: 0; } }
.tal-rhomb { stroke: rgba(0, 0, 0, .45); stroke-width: 3; stroke-linejoin: round; }
.tal-rtext { font: 600 13px system-ui, sans-serif; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .5); stroke-width: 3px; }
.tal-rnum { font: 700 15px system-ui, sans-serif; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .5); stroke-width: 3px; }
.tal-core { fill: #0b1824; stroke-width: 4; filter: drop-shadow(0 0 10px rgba(0, 0, 0, .8)); }
.tal-elem { font: italic 600 15px Georgia, serif; paint-order: stroke; stroke: #000; stroke-width: 3px; }
.tal-aura { fill: none; stroke: rgba(230, 180, 76, .35); stroke-width: 2; stroke-dasharray: 3 9; animation: tal-spin 24s linear infinite; transform-origin: 0 0; }
.tal-aura.two { stroke: rgba(120, 190, 240, .25); stroke-dasharray: 18 14; animation-duration: 40s; animation-direction: reverse; }

/* nodes */
.tal-node { cursor: pointer; }
.tal-pop { transform-box: fill-box; transform-origin: center; transition: transform .15s; }
.intro .tal-pop { animation: tal-pop .5s cubic-bezier(.2, 1.6, .4, 1) var(--delay) both; }
@keyframes tal-pop { from { transform: scale(0); opacity: 0; } }
.tal-node:hover .tal-pop { transform: scale(1.1); }
.tal-hex { fill: #13283a; stroke: #3a5568; stroke-width: 3; }
.tal-fill { opacity: 0; transition: opacity .3s; }
.tal-icon { font-size: 24px; filter: grayscale(1) brightness(.7); transition: filter .3s; pointer-events: none; }
.cap .tal-icon { font-size: 30px; }
.tal-badge rect { fill: #0b1824; stroke: #3a5568; stroke-width: 1.5; }
.tal-count { font: 700 12px system-ui, sans-serif; fill: var(--muted); }
.tal-ring { fill: none; stroke: #3a5568; stroke-width: 2; stroke-dasharray: 4 6; }
.tal-node.locked { opacity: .45; }
.tal-node.open .tal-hex, .tal-node.partial .tal-hex { stroke-width: 3.5; }
.tal-node.b-offense:not(.locked) .tal-hex { stroke: var(--fire); }
.tal-node.b-defense:not(.locked) .tal-hex { stroke: var(--water); }
.tal-node.b-flow:not(.locked) .tal-hex { stroke: var(--gold); }
.tal-node.partial .tal-icon, .tal-node.full .tal-icon { filter: none; }
.tal-node.full .tal-count, .tal-node.partial .tal-count { fill: #fff; }
.tal-node.full.b-offense .tal-pop { filter: url(#glow-offense); }
.tal-node.full.b-defense .tal-pop { filter: url(#glow-defense); }
.tal-node.full.b-flow .tal-pop { filter: url(#glow-flow); }
.tal-node.full .tal-ring { stroke: var(--gold); animation: tal-spin 10s linear infinite; transform-box: fill-box; transform-origin: center; }
.tal-node.can .tal-hex { animation: tal-breathe 1.6s ease-in-out infinite; }
@keyframes tal-breathe { 50% { stroke-width: 6; stroke-opacity: .6; } }
.tal-node.sel .tal-badge rect { stroke: var(--gold); }
.tal-node.sel .tal-hex { stroke: #fff !important; stroke-width: 4; }

/* point burst */
.tal-burst circle { fill: none; stroke: var(--c); stroke-width: 4; animation: tal-ring .7s ease-out forwards; transform-box: fill-box; transform-origin: center; }
.tal-burst line { stroke: var(--c); stroke-width: 3; stroke-linecap: round; animation: tal-spark .8s ease-out forwards; }
@keyframes tal-ring { from { transform: scale(.8); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
@keyframes tal-spark { from { opacity: 1; transform: translate(0, 0); } to { opacity: 0; transform: translate(var(--dx), var(--dy)); } }

/* detail panel */
.tal-panel { position: absolute; right: 18px; bottom: 70px; width: 290px; padding: 14px; border-radius: 14px; border: 1px solid #2c4a63;
  background: linear-gradient(180deg, rgba(20, 40, 58, .96), rgba(10, 22, 34, .96)); box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; display: flex; flex-direction: column; gap: 8px; }
.tal-panel.show { opacity: 1; transform: none; pointer-events: auto; }
.tal-ptitle { display: flex; gap: 10px; align-items: center; border-left: 3px solid var(--c); padding-left: 10px; }
.tal-ptitle b { display: block; font-size: 16px; }
.tal-ptitle span { font-size: 12px; color: var(--muted); }
.tal-picon { font-size: 26px; }
.tal-pline { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.tal-pline span { color: var(--muted); }
.tal-foot { position: relative; display: flex; justify-content: center; padding: 10px 18px 16px; }
@media (max-width: 700px) {
  .tal-panel { left: 12px; right: 12px; width: auto; bottom: 64px; }
  .tal-title { font-size: 44px; }
  .tal-head { padding: 10px 12px; }
  .tal-head .muted { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .talents *, .talents { animation: none !important; transition: none !important; }
}

.floater.small { font-size: 11px; font-weight: 600; opacity: .9; }

/* ══ Avatar shell ══════════════════════════════════════════════════════════
   Parchment, bronze and the four nations: earth green, fire red, water blue,
   air saffron. The world fills the screen; HUD pieces float over it. */
:root {
  --parch: #f3e5c2;
  --parch-2: #e9d6a6;
  --parch-3: #dcc38a;
  --ink: #3a2814;
  --ink-2: #6e5332;
  --bronze: #8a5a2b;
  --bronze-d: #4a2e14;
  --n-earth: #4f8a3c;
  --n-fire: #c4402b;
  --n-water: #2f7fc0;
  --n-air: #e0a63a;
}
#game.screen { position: fixed; inset: 0; padding: 0; overflow: hidden; display: block; }
#game.screen.hidden { display: none; }
#game .stage { position: absolute; inset: 0; border: 0; border-radius: 0; }
#game .stage canvas { width: 100%; height: 100%; display: block; }

/* bronze frame shared by HUD pieces */
.hud-char, .hud-tabs, .hud-wallet .pill, .chip-stop, .hud-run, .skillbar, .spellcard {
  background: linear-gradient(180deg, #f6ead0, var(--parch-2));
  border: 2px solid var(--bronze-d);
  box-shadow: 0 0 0 2px #c79a5b inset, 0 4px 14px rgba(0, 0, 0, .45);
  color: var(--ink);
}

/* character card */
.hud-char { position: absolute; left: 12px; top: 12px; z-index: 5; display: flex; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 14px; width: 300px; transform: rotate(-.6deg); }
.hc-portrait { position: relative; width: 68px; height: 68px; flex: none; border-radius: 10px; border: 2px solid var(--bronze-d); background: radial-gradient(circle at 50% 35%, #fff6dc, #c9a66a); overflow: hidden; }
.hc-portrait canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.hc-level { position: absolute; right: -2px; bottom: -2px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; background: var(--bronze-d); color: #ffe7a8; font: 700 12px/24px system-ui, sans-serif; text-align: center; border: 2px solid #c79a5b; }
.hc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hc-name { display: flex; align-items: baseline; gap: 6px; font-family: Georgia, "Palatino Linotype", serif; }
.hc-name b { font-size: 16px; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-elem { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.hbar { position: relative; height: 14px; border-radius: 7px; background: #3a2a17; border: 1.5px solid var(--bronze-d); overflow: hidden; }
.hbar i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; transition: width .4s; }
.hbar.hp i { background: linear-gradient(180deg, #ef6b5b, #b8322a); }
.hbar.mana i { background: linear-gradient(180deg, #5ea6ee, #2c64b0); }
.hbar.exp { height: 8px; }
.hbar.exp i { background: linear-gradient(180deg, #f3cf6a, #c4902a); }
.hbar span { position: relative; display: block; text-align: center; font: 700 10px/12px system-ui, sans-serif; color: #fff; text-shadow: 0 1px 1px #000; }
.hbar.exp span { display: none; }

/* tab bar */
.hud-tabs { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 6; display: flex; gap: 4px; padding: 6px; border-radius: 14px; }
.hud-tabs button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 58px; padding: 6px 2px 4px; border-radius: 10px;
  background: linear-gradient(180deg, #a8743d, #6b4520); border: 1.5px solid var(--bronze-d); color: #fbe9c3; box-shadow: 0 2px 0 #3a230e; cursor: pointer; }
.hud-tabs button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.hud-tabs button span { font: 600 10px system-ui, sans-serif; letter-spacing: .2px; }
.hud-tabs button:hover { filter: brightness(1.12); transform: translateY(-1px); }
.hud-tabs button.on { background: linear-gradient(180deg, #f2cf73, #c48a2e); color: var(--bronze-d); box-shadow: 0 0 12px rgba(242, 207, 115, .7); }
.hud-tabs button:nth-child(1) svg { color: #9fe0ff; }
.tab-badge { position: absolute; top: -5px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--n-fire); color: #fff; font: 700 11px/18px system-ui, sans-serif; font-style: normal; border: 2px solid #fbe9c3; }
.tab-badge:empty { display: none; }
#talents-btn.has { animation: tal-call 2s ease-in-out infinite; }

/* wallet */
.hud-wallet { position: absolute; right: 12px; top: 14px; z-index: 5; display: flex; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 999px; font: 700 13px system-ui, sans-serif; }
.coin, .acoin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; }
.coin { background: radial-gradient(circle at 35% 35%, #fff2a8, #d9a520 60%, #8a6210); border: 1px solid #6b4b0b; }
.acoin { background: radial-gradient(circle at 35% 35%, #c7f2ff, #3fa3d8 55%, #1d4f7a); border: 1px solid #12324d; position: relative; }
.acoin::after { content: ''; position: absolute; inset: 4px; border: 1.5px solid rgba(255, 255, 255, .8); border-radius: 50%; }

/* hunt chip */
.hud-hunt { position: absolute; left: 50%; top: 86px; transform: translateX(-50%); z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chip-stop { padding: 5px 14px; border-radius: 10px; font: 700 13px Georgia, serif; letter-spacing: .5px; cursor: pointer; text-transform: uppercase; }
.chip-stop b { margin-left: 8px; font-family: system-ui, sans-serif; }
.chip-stop:hover { filter: brightness(1.05); }
.hud-place { display: flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 8px; background: rgba(10, 8, 4, .55); color: #f6e7c6; font-size: 12px; }
.hud-place .floors { display: flex; gap: 4px; }
.hud-place .floors button { padding: 1px 7px; font-size: 11px; border-radius: 6px; background: #2a1f12; color: #f6e7c6; border: 1px solid #6b4520; }
.hud-place .floors button.on { background: #c48a2e; color: #2a1f12; }

/* run stats */
.hud-run { position: absolute; right: 12px; top: 64px; z-index: 4; width: 220px; padding: 10px 12px; border-radius: 12px; font-size: 12px; }
.hud-run .stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.hud-run .stats span:nth-child(odd) { color: var(--ink-2); }
.hud-run .stats span:nth-child(even) { text-align: right; font-weight: 700; }
.hud-run .pull-row { margin-top: 8px; gap: 6px; align-items: center; }
.hud-run .chip { min-width: 30px; padding: 3px 8px; background: var(--parch-3); color: var(--ink); border: 1px solid var(--bronze); }
.hud-run .chip.on { background: var(--bronze); color: #fbe9c3; }

/* skill bar */
.hud-skills { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5; max-width: calc(100vw - 24px); }
.skillbar { display: flex; gap: 5px; padding: 7px; border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.skill { position: relative; flex: none; width: 50px; height: 50px; padding: 0; border-radius: 10px; overflow: hidden; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, #3b4a52, #141a1e); border: 2px solid var(--bronze-d); box-shadow: 0 0 0 1.5px #c79a5b inset; }
.skill canvas { position: absolute; inset: 1px; width: 44px; height: 44px; image-rendering: pixelated; }
.skill .cd { position: absolute; inset: 0; border-radius: 8px; }
.skill .cdt { position: absolute; inset: 0; display: grid; place-items: center; font: 800 13px system-ui, sans-serif; color: #fff; text-shadow: 0 1px 2px #000; }
.skill .hk { position: absolute; right: 2px; bottom: 0; font: 700 9px system-ui, sans-serif; color: #fbe9c3; text-shadow: 0 1px 1px #000; }
.skill .lv { position: absolute; inset: 0; display: grid; place-items: center; font: 800 13px system-ui, sans-serif; color: #fbe9c3; background: rgba(20, 14, 6, .55); }
.skill.locked canvas { filter: grayscale(1) brightness(.55); }
.skill.flash { box-shadow: 0 0 0 1.5px #c79a5b inset, 0 0 14px 3px rgba(255, 220, 140, .9); }
.spellcard { position: absolute; bottom: calc(100% + 10px); width: 240px; padding: 12px; border-radius: 12px; font-size: 12px; pointer-events: none; }
.sc-head { text-align: center; margin-bottom: 6px; }
.sc-head b { display: block; font: 700 16px Georgia, serif; color: var(--bronze-d); }
.sc-head span { color: var(--ink-2); font-size: 11px; }
.sc-row { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed #cdb27c; }
.sc-row span { color: var(--ink-2); }
.sc-lock { margin-top: 6px; color: var(--n-fire); font-weight: 700; }

/* windows */
.win { position: absolute; left: 50%; top: 92px; transform: translateX(-50%); z-index: 8; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 190px);
  display: flex; flex-direction: column; border-radius: 16px; background: var(--parch); border: 3px solid var(--bronze-d);
  box-shadow: 0 0 0 3px #c79a5b inset, 0 18px 50px rgba(0, 0, 0, .55); animation: win-in .22s cubic-bezier(.2, 1.3, .4, 1) both;
  --text: var(--ink); --muted: var(--ink-2); --panel: var(--parch-2); --panel-2: var(--parch-2); --line: #cdb27c; color: var(--ink); }
.win.wide { width: min(1040px, calc(100vw - 24px)); }
.win.hidden { display: none; }
@keyframes win-in { from { opacity: 0; transform: translate(-50%, 14px) scale(.97); } }
.win-head { position: relative; display: flex; justify-content: center; padding: 0 44px; margin-top: -16px; }
.win-ribbon { padding: 6px 26px; font: 700 15px Georgia, serif; letter-spacing: 1px; text-transform: uppercase; color: #fff4d6;
  background: linear-gradient(180deg, #d0533b, #8f2c1d); border: 2px solid #4a1a10; border-radius: 6px; box-shadow: 0 3px 0 #4a1a10;
  clip-path: polygon(0 50%, 10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%); }
.win-x { position: absolute; right: 8px; top: 20px; width: 30px; height: 30px; padding: 0; border-radius: 50%; background: #b8392a; color: #fff; border: 2px solid #4a1a10; font-weight: 700; }
.win-body { padding: 14px 16px 16px; overflow-y: auto; }
.win .sec { margin: 6px 0 8px; font: 700 13px Georgia, serif; text-transform: uppercase; letter-spacing: 1px; color: var(--bronze-d); border-bottom: 2px dashed #cdb27c; padding-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.win .badge { background: var(--bronze); color: #fbe9c3; }
.win button { background: linear-gradient(180deg, #fff4da, #e7d19e); color: var(--ink); border: 1.5px solid var(--bronze); }
.win button.primary { background: linear-gradient(180deg, #6fb35a, #3f7f2f); color: #fff; border-color: #24501b; }
.win button.danger { background: linear-gradient(180deg, #e0654f, #a33424); color: #fff; border-color: #5a1a10; }
.win button:disabled { opacity: .5; }
.win .muted, .win .hint { color: var(--ink-2); }
.win .hint { font-size: 11px; margin: 8px 0 0; }
.win-tools { margin-bottom: 8px; font-size: 12px; color: var(--ink-2); }
.win-hunts { display: grid; gap: 6px; }
.win .hunt { background: #fbf2dc; border: 1.5px solid #cdb27c; color: var(--ink); }
.win .hunt.active { border-color: var(--n-earth); box-shadow: 0 0 0 2px rgba(79, 138, 60, .3); }
.win .hunt .m span { color: var(--ink-2); }
.win .tag.ok { background: #d6ecc9; color: #2b5a1f; }
.win .tag.bad { background: #f3cfc6; color: #7a2216; }
.win .task, .win .recipe { border-color: #cdb27c; }
.win .bar.exp { background: #d8c08c; }

/* sheet */
.sheet { display: grid; grid-template-columns: 220px 1fr 250px; gap: 16px; align-items: start; }
.wanted { position: relative; padding: 12px; border-radius: 6px; text-align: center; background: linear-gradient(180deg, #fbf0d2, #ead39c); border: 2px solid var(--bronze-d); box-shadow: 0 3px 0 #b48b4a; transform: rotate(-1deg); }
.wanted::before { content: ''; position: absolute; top: -8px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #555; box-shadow: 0 2px 0 #222; }
.wanted-top { font: 900 22px Georgia, serif; letter-spacing: 3px; text-transform: uppercase; color: var(--el); text-shadow: 0 1px 0 #fff8; }
.wanted-pic { margin: 8px auto; width: 150px; height: 150px; border: 3px solid var(--bronze-d); background: radial-gradient(circle at 50% 30%, #fff8e0, var(--el) 220%); display: grid; place-items: center; }
.wanted-pic canvas { width: 128px; height: 128px; image-rendering: pixelated; }
.wanted-name { font: 700 18px Georgia, serif; }
.wanted-meta { display: flex; justify-content: center; gap: 12px; font-size: 12px; color: var(--ink-2); }
.wanted-power { margin-top: 6px; font: 800 18px system-ui, sans-serif; color: var(--n-fire); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.st { display: grid; grid-template-columns: 1fr auto; align-items: baseline; padding: 3px 0; border-bottom: 1px dashed #d9c08c; font-size: 13px; }
.st span { color: var(--ink-2); }
.st i { grid-column: 1 / -1; font-style: normal; font-size: 10px; color: #4f8a3c; text-align: right; margin-top: -2px; }
.absorb { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.res { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #e6d3a6; }
.res-fire { color: var(--n-fire); } .res-earth { color: var(--n-earth); } .res-drown, .res-ice { color: var(--n-water); } .res-energy { color: #a07a10; } .res-physical { color: #6b5232; }
.equip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.eq { position: relative; aspect-ratio: 1; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #fff7e2, #e2c894); border: 2px solid var(--bronze); display: grid; place-items: center; }
.eq canvas { width: 52px; height: 52px; image-rendering: pixelated; }
.eq span { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--ink-2); }
.eq.click { cursor: pointer; } .eq.click:hover { border-color: var(--n-fire); }
.bag-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; max-height: 330px; overflow-y: auto; padding-right: 2px; }
.slot { position: relative; aspect-ratio: 1; border-radius: 8px; background: #e4cc96; border: 1.5px solid #b48b4a; display: grid; place-items: center; }
.slot canvas { width: 38px; height: 38px; image-rendering: pixelated; }
.slot b { position: absolute; right: 3px; bottom: 1px; font: 800 10px system-ui, sans-serif; color: #fff; text-shadow: 0 1px 1px #000, 0 0 2px #000; }
.slot.empty { background: #ecdcb4; border-style: dashed; }
.slot.click { cursor: pointer; } .slot.click:hover { border-color: var(--n-fire); }
.bag-foot { display: flex; gap: 6px; margin-top: 8px; }
.bag-foot .pill { background: #fbf2dc; border: 1.5px solid #cdb27c; }
.glove-pick { display: grid; gap: 6px; margin: 8px 0; }
.glove-pick button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.glove-pick button.on { border-color: var(--gold); }
.glove-pick span { font-size: 11px; color: var(--muted); }

/* skills window */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.skill-card { display: flex; gap: 10px; padding: 8px; border-radius: 10px; background: #fbf2dc; border: 1.5px solid #cdb27c; }
.skill-card canvas { width: 56px; height: 56px; border-radius: 8px; background: radial-gradient(circle at 50% 40%, #3b4a52, #141a1e); border: 2px solid var(--bronze-d); image-rendering: pixelated; flex: none; }
.skill-card > div { flex: 1; font-size: 12px; }
.skill-card .sc-head { text-align: left; }
.skill-card.locked canvas { filter: grayscale(1) brightness(.6); }
.skill-card.locked { opacity: .75; }

/* the modal over the new shell */
#modal { z-index: 20; }

@media (max-width: 900px) {
  .sheet { grid-template-columns: 1fr; }
  .wanted { max-width: 240px; margin: 0 auto; }
  .hud-run { display: none; }
}
@media (max-width: 700px) {
  .hud-char { width: auto; right: 12px; transform: none; padding: 6px; }
  .hc-portrait { width: 52px; height: 52px; }
  .hud-tabs { top: auto; bottom: 74px; left: 6px; right: 6px; transform: none; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .hud-tabs button { width: 52px; flex: none; }
  .hud-wallet { top: 104px; right: 12px; }
  .hud-wallet .pill { padding: 2px 10px 2px 4px; font-size: 12px; }
  .hud-hunt { top: 104px; left: 12px; transform: none; align-items: flex-start; }
  .chip-stop { font-size: 11px; padding: 4px 10px; }
  .hud-skills { bottom: 6px; }
  .skill { width: 44px; height: 44px; }
  .skill canvas { width: 38px; height: 38px; }
  .win, .win.wide { top: 8px; width: calc(100vw - 16px); max-height: calc(100vh - 160px); }
  .stats-grid { grid-template-columns: 1fr; }
  .equip { grid-template-columns: repeat(4, 1fr); }
}

/* ══ world map ══════════════════════════════════════════════════════════ */
.map-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.map-bar b { font: 700 16px Georgia, serif; color: var(--bronze-d); flex: 1; }
.map-back { padding: 4px 12px; border-radius: 999px; font-weight: 700; }
.map-tabs { display: inline-flex; border: 1.5px solid var(--bronze); border-radius: 999px; overflow: hidden; }
.win .map-tabs button { border: 0; border-radius: 0; padding: 4px 14px; background: #fbf2dc; }
.win .map-tabs button.on { background: var(--bronze); color: #fbe9c3; }
.map-stage { position: relative; width: 100%; overflow: hidden; border-radius: 12px; border: 3px solid var(--bronze-d);
  box-shadow: 0 0 0 2px #c79a5b inset, inset 0 0 60px rgba(0, 20, 40, .55); background: #183e66; }
.map-stage img { position: absolute; width: 100%; image-rendering: pixelated; user-select: none; pointer-events: none; }
.map-stage.world img { inset: 0; height: 100%; }
.map-stage::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(10, 20, 30, .45)); }

.town { position: absolute; transform: translate(-50%, -50%); z-index: 1; pointer-events: none; }
.town i { display: block; width: 8px; height: 8px; margin: 0 auto; border-radius: 50%; background: #fff3c4; border: 2px solid #3a2814; }
.town span { display: block; margin-top: 2px; font: 700 10px Georgia, serif; color: #fff7dc; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; }

.win .region { position: absolute; z-index: 2; width: 0; height: 0; padding: 0; background: none; border: 0; cursor: pointer; }
.region-card { transition: transform .15s; }
.region:hover .region-card { transform: translate(-50%, -50%) scale(1.07); }
.region.here .region-card { animation: region-here 2s ease-in-out infinite; }
.cave { position: absolute; z-index: 1; width: 9px; height: 9px; transform: translate(-50%, -50%) rotate(45deg); border: 2px solid #2a1a0c; pointer-events: none; }
.cave.n-earth { background: var(--n-earth); } .cave.n-fire { background: var(--n-fire); } .cave.n-water { background: var(--n-water); } .cave.n-air { background: var(--n-air); }
@keyframes region-here { 50% { box-shadow: 0 0 22px 4px rgba(255, 220, 120, .55); } }
.region-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 128px; padding: 6px 10px 5px; border-radius: 10px; background: linear-gradient(180deg, #fbf0d2, #e8d29e); border: 2px solid var(--bronze-d);
  box-shadow: 0 3px 0 #6b4520, 0 6px 16px rgba(0, 0, 0, .45); color: var(--ink); }
.region-card svg { width: 22px; height: 22px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.n-earth .region-card svg, .n-earth.region-card svg { stroke: var(--n-earth); }
.n-fire .region-card svg { stroke: var(--n-fire); }
.n-water .region-card svg { stroke: var(--n-water); }
.n-air .region-card svg { stroke: var(--n-air); }
.region-card b { font: 700 13px Georgia, serif; white-space: nowrap; }
.region-card small { font-size: 10px; color: var(--ink-2); }
.region-card em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--n-earth); }
.region.locked .region-card { filter: grayscale(.8); opacity: .85; }
.you { position: absolute; z-index: 3; width: 16px; height: 16px; transform: translate(-50%, -50%); border-radius: 50%; background: #ffd34a; border: 3px solid #3a2814; animation: you 1.2s ease-in-out infinite; pointer-events: none; }
@keyframes you { 50% { box-shadow: 0 0 0 8px rgba(255, 211, 74, .25); } }

.region-view { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.map-stage.zoom img { height: auto; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.trail polyline { fill: none; stroke: #fff4d6; stroke-width: .9; stroke-dasharray: 2.2 1.6; stroke-linejoin: round; filter: drop-shadow(0 0 1px #000); vector-effect: non-scaling-stroke; stroke-width: 3; stroke-dasharray: 9 7; }
.pin { position: absolute; z-index: 2; transform: translate(-50%, -50%); padding: 0; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pin i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font: 800 14px system-ui, sans-serif; font-style: normal;
  background: linear-gradient(180deg, #fbf0d2, #e2c88e); color: var(--bronze-d); border: 3px solid var(--bronze-d); box-shadow: 0 3px 0 #3a2814; transition: transform .15s; }
.pin span { padding: 1px 6px; border-radius: 6px; background: rgba(251, 240, 210, .95); border: 1.5px solid var(--bronze-d); font: 700 10px Georgia, serif; color: var(--ink); white-space: nowrap; }
.pin:hover i { transform: scale(1.12); }
.pin.done i { background: linear-gradient(180deg, #7fd06a, #3f8f2f); color: #fff; border-color: #1f4a17; }
.pin.locked i { background: #8a7a60; color: #fff; filter: grayscale(.4); }
.pin.locked span { opacity: .7; }
.pin.active i { background: linear-gradient(180deg, #ffd96a, #d99a1e); animation: you 1.2s ease-in-out infinite; }
.pin.sel i { outline: 3px solid #fff4d6; outline-offset: 2px; }

.phase-panel { padding: 12px; border-radius: 12px; background: #fbf2dc; border: 2px solid #cdb27c; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.pp-top { display: flex; justify-content: space-between; align-items: center; }
.pp-step { font: 700 11px system-ui, sans-serif; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-2); }
.phase-panel h3 { margin: 0; font: 700 18px Georgia, serif; color: #8f2c1d; }
.pp-who { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; background: linear-gradient(135deg, #3a2a1c, #5b3f24); color: #fbe9c3; }
.pp-who > div:last-child { display: flex; flex-direction: column; }
.pp-who span { font-size: 11px; opacity: .85; }
.pp-ico { width: 56px; height: 56px; flex: none; border-radius: 8px; background: radial-gradient(circle, #6b5132, #2a1d10); border: 2px solid #c79a5b; }
.pp-ico canvas { width: 56px; height: 56px; image-rendering: pixelated; }
.pp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pp-stats div { display: flex; justify-content: space-between; padding: 3px 6px; border-radius: 6px; background: #f1e2bd; }
.pp-stats span { color: var(--ink-2); }
.pp-sec { margin-top: 4px; font: 700 11px Georgia, serif; text-transform: uppercase; letter-spacing: 1px; color: var(--bronze-d); display: flex; justify-content: space-between; }
.pp-sec small { font: 600 11px system-ui, sans-serif; text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.pp-mats { display: flex; flex-wrap: wrap; gap: 4px; }
.pp-mats canvas { width: 34px; height: 34px; border-radius: 6px; background: #e4cc96; border: 1.5px solid #b48b4a; image-rendering: pixelated; }
.pp-boss { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 10px; border: 2px solid #8f2c1d; background: linear-gradient(180deg, #fde9df, #f3cfc0); }
.pp-boss b { font: 700 13px Georgia, serif; color: #8f2c1d; }
.pp-actions { display: flex; gap: 6px; margin-top: 4px; }
.pp-actions button { flex: 1; padding: 8px; font-weight: 700; }
@media (max-width: 800px) {
  .region-view { grid-template-columns: 1fr; }
  .region-card { min-width: 0; padding: 4px 6px; }
  .region-card small, .region-card svg { display: none; }
  .pin i { width: 26px; height: 26px; font-size: 12px; }
  .pin span { display: none; }
}

.region-dot { display: none; }
.region-list { display: none; gap: 6px; margin-top: 10px; }
.win .rl { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 10px; background: #fbf2dc; border: 1.5px solid #cdb27c; }
.rl i { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; font: 800 13px system-ui, sans-serif; font-style: normal; color: #fff; border: 2px solid #2a1a0c; }
.rl.n-earth i { background: var(--n-earth); } .rl.n-fire i { background: var(--n-fire); } .rl.n-water i { background: var(--n-water); } .rl.n-air i { background: var(--n-air); }
.rl span { flex: 1; display: flex; flex-direction: column; }
.rl b { font: 700 14px Georgia, serif; } .rl small { font-size: 11px; color: var(--ink-2); }
.rl em { font-style: normal; font-weight: 800; color: var(--n-earth); font-size: 12px; }
.rl.locked { opacity: .65; } .rl.here { border-color: var(--n-air); box-shadow: 0 0 0 2px rgba(224, 166, 58, .35); }
@media (max-width: 800px) {
  .region-card { display: none; }
  .region-dot { display: grid; place-items: center; position: absolute; transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%;
    font: 800 12px system-ui, sans-serif; color: #fff; border: 2px solid #2a1a0c; box-shadow: 0 2px 0 #2a1a0c; }
  .n-earth .region-dot { background: var(--n-earth); } .n-fire .region-dot { background: var(--n-fire); } .n-water .region-dot { background: var(--n-water); } .n-air .region-dot { background: var(--n-air); }
  .region.locked .region-dot { filter: grayscale(.7); }
  .region-list { display: grid; }
}

/* ══ crew ═══════════════════════════════════════════════════════════════ */
.crew-strip { position: absolute; left: 12px; bottom: 12px; z-index: 5; display: flex; gap: 6px; }
.crew-mini { position: relative; width: 62px; height: 78px; padding: 4px 2px 2px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  background: linear-gradient(180deg, #f6ead0, var(--parch-2)); border: 2px solid var(--bronze-d); box-shadow: 0 0 0 1.5px #c79a5b inset, 0 3px 10px rgba(0,0,0,.45); color: var(--ink); cursor: pointer; transform: rotate(-1deg); }
.crew-mini:nth-child(even) { transform: rotate(1deg); }
.crew-mini .crew-pic { width: 46px; height: 46px; }
.crew-mini em { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); padding: 1px 6px; border-radius: 6px; background: var(--n-fire); color: #fff; font: 700 9px system-ui, sans-serif; font-style: normal; white-space: nowrap; border: 1.5px solid #4a1a10; }
.cm-name { font: 700 10px Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 58px; }
.cm-hp { display: block; width: 50px; height: 5px; border-radius: 3px; background: #3a2a17; overflow: hidden; }
.cm-hp b { display: block; height: 100%; background: #d9443a; }
.crew-mini.empty { justify-content: center; color: var(--ink-2); font-size: 20px; }
.crew-mini.empty small { font-size: 9px; }
.crew-mini.locked { filter: grayscale(.6); opacity: .8; }
.crew-pic { display: grid; place-items: center; border-radius: 8px; background: radial-gradient(circle at 50% 35%, #fff6dc, #c9a66a); border: 2px solid var(--bronze-d); overflow: hidden; }
.crew-pic canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.crew-pic span { font-size: 26px; color: var(--ink-2); }
.crew-pic.big { width: 84px; height: 84px; }
.el-fire .crew-pic { background: radial-gradient(circle at 50% 35%, #ffe7d4, #d06a4a); }
.el-water .crew-pic { background: radial-gradient(circle at 50% 35%, #e3f2ff, #5b9bd0); }
.el-air .crew-pic { background: radial-gradient(circle at 50% 35%, #fff6d8, #e2b04c); }
.el-earth .crew-pic { background: radial-gradient(circle at 50% 35%, #eef7dc, #6fa64a); }
.crew-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.crew-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.crew-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px; border-radius: 12px; text-align: center; background: #fbf2dc; border: 2px solid #cdb27c; }
.crew-card b { font: 700 15px Georgia, serif; }
.crew-card span { font-size: 11px; color: var(--ink-2); }
.crew-card small { font-size: 11px; color: var(--ink-2); }
.crew-card.in-party { border-color: var(--bronze); box-shadow: 0 0 0 2px rgba(138, 90, 43, .25); }
.crew-card.el-fire { border-top: 4px solid var(--n-fire); } .crew-card.el-water { border-top: 4px solid var(--n-water); }
.crew-card.el-air { border-top: 4px solid var(--n-air); } .crew-card.el-earth { border-top: 4px solid var(--n-earth); }
.crew-card.empty { border-style: dashed; justify-content: center; }
.crew-card.locked { opacity: .6; }
.crew-card.far { opacity: .7; }
.crew-cost { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 4px 0; }
.crew-cost .pill { background: #f1e2bd; border: 1px solid #cdb27c; padding: 2px 8px 2px 4px; font-size: 11px; }
.crew-cost .coin, .crew-cost .acoin { width: 14px; height: 14px; }
@media (max-width: 700px) {
  .crew-strip { bottom: 136px; left: 6px; }
  .crew-mini { width: 50px; height: 64px; }
  .crew-mini .crew-pic { width: 36px; height: 36px; }
  .crew-slots { grid-template-columns: repeat(2, 1fr); }
}

/* characters */
.crew-mini u { position: absolute; top: 2px; left: 2px; padding: 0 4px; border-radius: 4px; background: var(--gold); color: #2a1a0c; font: 700 8px system-ui, sans-serif; text-decoration: none; }
.cm-lv { position: absolute; top: 2px; right: 3px; font: 800 10px system-ui, sans-serif; color: var(--bronze-d); }
.crew-mini.lead { box-shadow: 0 0 0 1.5px #c79a5b inset, 0 0 12px rgba(230, 180, 76, .6), 0 3px 10px rgba(0,0,0,.45); }
.sheet-tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.win .sheet-tabs button { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 10px; flex: none; }
.sheet-tabs button canvas { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 6px; background: #e4cc96; }
.sheet-tabs button span { font: 700 13px Georgia, serif; }
.sheet-tabs button small { font-size: 10px; color: var(--ink-2); }
.win .sheet-tabs button.on { background: linear-gradient(180deg, #f2cf73, #c48a2e); border-color: var(--bronze-d); }
#elements .element span { display: block; margin-bottom: 4px; }

/* talents: character tabs */
.tal-chars { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tal-chars button { position: relative; display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: rgba(8, 20, 32, .6); border: 1px solid #2c4a63; color: var(--text); flex: none; }
.tal-chars button canvas { width: 28px; height: 28px; border-radius: 50%; background: #1d3a52; image-rendering: pixelated; }
.tal-chars button.on { border-color: var(--gold); box-shadow: 0 0 10px rgba(230, 180, 76, .45); }
.tal-chars button i { position: absolute; top: -5px; right: -3px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--gold); color: #1a1408; font: 700 10px/16px system-ui, sans-serif; font-style: normal; text-align: center; }
#train-who { max-width: 180px; }

/* ══ auth and creation: parchment over the four nations ═══════════════ */
#auth.screen, #create.screen {
  background:
    radial-gradient(circle at 12% 18%, rgba(196, 64, 43, .28), transparent 38%),
    radial-gradient(circle at 88% 20%, rgba(47, 127, 192, .28), transparent 38%),
    radial-gradient(circle at 15% 85%, rgba(79, 138, 60, .26), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(224, 166, 58, .26), transparent 40%),
    radial-gradient(ellipse at center, #1b2a38, #0a1018 75%);
}
#auth .panel, #create .panel {
  --text: var(--ink); --muted: var(--ink-2); --line: #cdb27c; color: var(--ink);
  background: linear-gradient(180deg, #f6ead0, var(--parch-2)); border: 3px solid var(--bronze-d); border-radius: 16px;
  box-shadow: 0 0 0 3px #c79a5b inset, 0 20px 60px rgba(0, 0, 0, .6); animation: win-in .3s ease-out both;
}
#auth .logo { font: 700 34px Georgia, "Palatino Linotype", serif; color: var(--bronze-d); text-align: center; margin: 0 0 4px; }
#auth .logo span { color: var(--n-fire); }
#auth .panel > p, #create .panel > p { text-align: center; }
#create h2 { margin: 0 0 4px; text-align: center; font: 700 24px Georgia, serif; color: var(--bronze-d); }
#auth input, #create input { background: #fffaf0; color: var(--ink); border: 1.5px solid #cdb27c; }
#auth input:focus, #create input:focus { outline: 2px solid var(--gold); border-color: var(--bronze); }
#auth label, #create label { color: var(--ink-2); }
#auth button, #create button { background: linear-gradient(180deg, #fff4da, #e7d19e); color: var(--ink); border: 1.5px solid var(--bronze); font-weight: 700; }
#auth button.primary, #create button.primary { background: linear-gradient(180deg, #d0533b, #8f2c1d); color: #fff4d6; border-color: #4a1a10; }
#create .element { background: #fbf2dc; border: 2px solid #cdb27c; transition: transform .15s, box-shadow .15s; }
#create .element:hover { transform: translateY(-2px); }
#create .element.on { border-color: var(--c); box-shadow: 0 0 0 2px var(--c), 0 8px 20px rgba(0, 0, 0, .25); }
#create .element canvas { background: radial-gradient(circle at 50% 40%, #fff6dc, #e2c894); border-radius: 12px; border: 2px solid var(--bronze-d); }
#create .element p { color: var(--ink-2); }
#create .create-row { margin-top: 12px; }
@media (max-width: 700px) {
  #create .elements { grid-template-columns: repeat(2, 1fr); }
}

/* ══ story bosses: wanted posters ══════════════════════════════════════ */
.wanted-pin { position: absolute; right: 10px; top: 10px; z-index: 4; width: 92px; padding: 6px 6px 5px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: linear-gradient(180deg, #fbf0d2, #e8d09a); border: 2px solid var(--bronze-d); border-radius: 4px; box-shadow: 0 4px 0 #6b4520, 0 8px 18px rgba(0,0,0,.5);
  transform: rotate(3deg); cursor: pointer; color: var(--ink); transition: transform .15s; }
.wanted-pin::before { content: ''; position: absolute; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #c0392b; box-shadow: 0 2px 0 #6b1b12; }
.wanted-pin:hover { transform: rotate(0deg) scale(1.05); }
.wanted-pin b { font: 900 11px Georgia, serif; letter-spacing: 1.5px; color: #8f2c1d; }
.wanted-pin .wp-pic { width: 64px; height: 64px; border: 2px solid var(--bronze-d); background: radial-gradient(circle at 50% 30%, #fff8e0, #d06a4a 220%); }
.wanted-pin .wp-pic canvas { width: 64px; height: 64px; image-rendering: pixelated; }
.wanted-pin i { font: 700 12px Georgia, serif; font-style: normal; }
.wanted-pin small { font: 800 10px system-ui, sans-serif; color: #8f2c1d; }
.wanted-pin.sel { outline: 3px solid #fff4d6; outline-offset: 2px; }
.wanted-pin.locked { filter: grayscale(.7) brightness(.85); }
.wanted-pin.beaten::after { content: 'DERROTADO'; position: absolute; top: 46%; left: -6px; right: -6px; transform: rotate(-18deg); padding: 2px 0; text-align: center;
  font: 900 11px Georgia, serif; letter-spacing: 1px; color: #fff; background: rgba(143, 44, 29, .9); border: 1.5px solid #4a1a10; }
.poster { margin: 4px auto 6px; width: 200px; padding: 10px; text-align: center; background: linear-gradient(180deg, #fbf0d2, #e5ca8e); border: 2px solid var(--bronze-d); box-shadow: 0 3px 0 #b48b4a; transform: rotate(-1deg); }
.poster-head { font: 900 24px Georgia, serif; letter-spacing: 3px; color: #8f2c1d; }
.poster-pic { margin: 6px auto; width: 120px; height: 120px; border: 3px solid var(--bronze-d); background: radial-gradient(circle at 50% 30%, #fff8e0, #d06a4a 220%); display: grid; place-items: center; }
.poster-pic canvas { width: 112px; height: 112px; image-rendering: pixelated; }
.poster-name { font: 700 20px Georgia, serif; }
.poster-title { font-size: 11px; color: var(--ink-2); }
.poster-bounty { margin-top: 4px; font-size: 12px; } .poster-bounty b { color: #8f2c1d; font-size: 15px; }

/* ══ first-steps guide ══════════════════════════════════════════════════ */
.guide { position: absolute; right: 12px; top: 250px; z-index: 7; width: 320px; padding: 12px 14px 10px; border-radius: 14px;
  background: linear-gradient(180deg, #fffaf0, var(--parch)); border: 2px solid var(--bronze-d); box-shadow: 0 0 0 2px #c79a5b inset, 0 10px 30px rgba(0,0,0,.5); color: var(--ink); }
.guide.hidden { display: none; }
.guide.g-in { animation: guide-in .35s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes guide-in { from { opacity: 0; transform: translateX(30px); } }
.g-head { display: flex; align-items: center; gap: 10px; }
.g-pic { width: 46px; height: 46px; flex: none; border-radius: 50%; overflow: hidden; border: 2px solid var(--bronze-d); background: radial-gradient(circle at 50% 35%, #ffe7d4, #d06a4a); }
.g-pic canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.g-head b { display: block; font: 700 15px Georgia, serif; color: #8f2c1d; }
.g-head small { color: var(--ink-2); font-size: 11px; }
.guide p { margin: 8px 0; font-size: 13px; line-height: 1.45; }
.g-btns { display: flex; gap: 8px; }
.g-btns button { flex: 1; padding: 6px; border-radius: 999px; font-weight: 700; background: linear-gradient(180deg, #fff4da, #e7d19e); color: var(--ink); border: 1.5px solid var(--bronze); }
.g-btns button.primary { background: linear-gradient(180deg, #6fb35a, #3f7f2f); color: #fff; border-color: #24501b; }
.g-off { display: block; margin: 6px auto 0; padding: 0; background: none; border: 0; color: var(--ink-2); font-size: 11px; text-decoration: underline; cursor: pointer; }
@media (max-width: 900px) { .guide { top: auto; bottom: 150px; right: 8px; left: 8px; width: auto; } }
