:root {
  --bg: #14110d; --bg2: #1e1913; --card: #261f17; --line: #4a3b27; --gold: #d9b26a; --gold2: #f3d996;
  --text: #eadfc8; --dim: #a99878; --red: #d0553f; --green: #7fb96a; --orange: #e09a45; --blue: #5b8fd6;
  --r: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 'Philosopher', Georgia, serif; }
body { background: radial-gradient(ellipse at top, #2b2116 0%, var(--bg) 70%) fixed; overscroll-behavior: none; }
body.offline::after { content: 'Перепідключення…'; position: fixed; inset: 0; background: rgba(10,8,5,.7); display: grid; place-items: center; color: var(--gold); z-index: 99; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; width: 100%; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); outline: none; }
input:focus { border-color: var(--gold); }
h2, h3, .logo { font-family: 'Cormorant SC', serif; color: var(--gold2); margin: 0; }
h2 { font-size: 22px; } h3 { font-size: 17px; margin: 14px 0 6px; color: var(--gold); }
p { margin: 6px 0; } small { color: var(--dim); }
.gold { color: var(--gold); } .red { color: var(--red); } .green { color: var(--green); } .orange { color: var(--orange); } .grey { color: #777; }
.up { color: var(--green); } .down { color: var(--red); }
.grow { flex: 1; min-width: 0; }

.screen { min-height: 100vh; padding: 12px 12px calc(80px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.screen.center { display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 12px; }
.logo { font-size: 64px; letter-spacing: 6px; text-shadow: 0 0 24px rgba(217,178,106,.45); }
.logo.small { font-size: 34px; text-align: center; }
.sub { color: var(--dim); margin-top: 8px; }

.card { background: linear-gradient(180deg, var(--card), #1f1912); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin: 6px 0; box-shadow: inset 0 1px 0 rgba(243,217,150,.06); }
.btn { background: linear-gradient(180deg, #c99a4c, #8e6528); border: 1px solid #e7c27a; color: #1b130a; font-weight: 700; padding: 10px 16px; border-radius: 10px; }
.btn:active { transform: translateY(1px); filter: brightness(.95); }
.btn:disabled { opacity: .45; }
.btn.big { width: 100%; font-size: 18px; padding: 14px; margin: 16px 0 8px; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--gold); border-color: var(--line); }
.chip { background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 5px 10px; margin: 6px 6px 0 0; font-size: 13px; color: var(--gold); }

/* create */
.create h2 { text-align: center; margin: 4px 0 10px; }
.lbl { display: block; margin: 14px 0 6px; color: var(--gold); font-family: 'Cormorant SC', serif; font-size: 16px; }
.seg { display: flex; gap: 6px; margin: 6px 0; }
.seg button { flex: 1; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.seg button.on, .pick.on, .av.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(217,178,106,.25); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.pick { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 8px 6px; margin: 0; }
.pick b { color: var(--gold2); } .pick small { font-size: 11px; line-height: 1.25; }
.pick-ico { font-size: 28px; }
.hero-preview { display: flex; gap: 12px; align-items: center; }
.stats-mini { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.stat { display: flex; justify-content: space-between; border-bottom: 1px dashed rgba(74,59,39,.6); padding: 2px 0; }
.stat span { color: var(--dim); font-size: 13px; }
.avs { display: flex; gap: 8px; }
.av { background: none; border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.skills-box { margin-top: 8px; }
.skill-row { display: flex; gap: 10px; padding: 5px 0; align-items: flex-start; }
.skill-row + .skill-row { border-top: 1px solid rgba(74,59,39,.5); }
.skill-row.locked { opacity: .45; }
.sk-ico { font-size: 22px; width: 30px; text-align: center; }

/* portrait placeholder */
.portrait { --h: 30; position: relative; width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; font-size: 28px; flex: none;
  background: radial-gradient(circle at 50% 35%, hsl(var(--h) 45% 42%), hsl(var(--h) 40% 14%)); border: 2px solid var(--gold); box-shadow: 0 0 10px rgba(0,0,0,.6) inset; }
.portrait i { position: absolute; right: 2px; bottom: 0; font-style: normal; font-size: 12px; color: var(--gold2); }
.portrait.sm { width: 46px; height: 46px; font-size: 24px; }
.portrait.lg { width: 96px; height: 96px; font-size: 52px; }

/* top bar */
#top { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; padding: 8px 10px; margin: -12px -12px 8px;
  background: rgba(20,17,13,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.top-mid { flex: 1; min-width: 0; }
.top-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.gold-box { text-align: center; font-size: 18px; } .gold-box b { display: block; font-size: 13px; color: var(--gold2); }
.bar { position: relative; height: 14px; background: #0d0b08; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; margin-top: 3px; }
.bar > div { height: 100%; transition: width .4s; }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 12px; color: #fff; text-shadow: 0 1px 2px #000; }
.bar.hp > div { background: linear-gradient(90deg, #8e2a1d, var(--red)); }
.bar.mp > div { background: linear-gradient(90deg, #233f78, var(--blue)); }
.bar.xp { height: 8px; } .bar.xp > div { background: linear-gradient(90deg, #8e6528, var(--gold)); } .bar.xp span { font-size: 0; }

/* tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(20,17,13,.97); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tabs button { flex: 1; background: none; border: 0; padding: 7px 0 8px; font-size: 12px; color: var(--dim); display: flex; flex-direction: column; align-items: center; position: relative; }
.tabs button span { font-size: 20px; }
.tabs button.on { color: var(--gold2); }
.tabs em { position: absolute; top: 6px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; }
.tabs em.on { background: var(--red); }

/* world */
.map { position: relative; height: 440px; border-radius: var(--r); border: 1px solid var(--line); overflow: hidden;
  background: radial-gradient(circle at 30% 70%, #3a4a2a 0%, transparent 45%), radial-gradient(circle at 75% 25%, #3e3a44 0%, transparent 40%), linear-gradient(160deg, #2c241a, #19150f); }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map line { stroke: rgba(217,178,106,.25); stroke-width: .8; stroke-dasharray: 2 1.5; vector-effect: non-scaling-stroke; }
.map line { stroke-width: 2; } .map line.on { stroke: var(--gold); }
.node { position: absolute; transform: translate(-50%, -50%); background: none; border: 0; display: flex; flex-direction: column; align-items: center; padding: 0; width: 90px; }
.node i { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: #2a2218; }
.node span { font-size: 12px; margin-top: 2px; text-shadow: 0 1px 3px #000; }
.node small { font-size: 10px; }
.node.near i { border-color: var(--gold); animation: pulse 1.8s infinite; }
.node.cur i { border-color: var(--gold2); box-shadow: 0 0 14px var(--gold); }
.node.cur span { color: var(--gold2); font-weight: 700; }
.node:disabled { cursor: default; opacity: .9; }
@keyframes pulse { 50% { box-shadow: 0 0 10px rgba(217,178,106,.6); } }
.node i.bg-town { background: radial-gradient(#6b5733, #2a2218); } .node i.bg-forest { background: radial-gradient(#3f6b33, #1a2a14); }
.node i.bg-mines { background: radial-gradient(#5b5560, #1f1c22); } .node i.bg-swamp { background: radial-gradient(#4a6b4f, #16261a); }
.node i.bg-ruins { background: radial-gradient(#6b4a6b, #241828); }
.loc { margin-top: 8px; }
.card.loc.bg-forest { background: linear-gradient(160deg, #24331d, #1b1710); } .card.loc.bg-mines { background: linear-gradient(160deg, #2b2a30, #1b1710); }
.card.loc.bg-swamp { background: linear-gradient(160deg, #1f2e25, #1b1710); } .card.loc.bg-ruins { background: linear-gradient(160deg, #2f2131, #1b1710); }
.card.loc.bg-town { background: linear-gradient(160deg, #3a2f1c, #1b1710); }
.row { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.card > .row + .row, .card > .tap + .tap { border-top: 1px solid rgba(74,59,39,.5); }
.row.mob { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
.mob-ico { font-size: 30px; }
.elite { font-style: normal; font-size: 11px; color: #1b130a; background: var(--gold); border-radius: 6px; padding: 0 5px; }
.players .pl { padding: 3px 0; }

/* items */
.it-ico { font-size: 24px; width: 30px; text-align: center; }
.item.t2 b { color: var(--green); } .item.t3 b { color: #6fa6e8; } .item.t4 b { color: #c18af0; }
.item.empty { opacity: .6; }
.btns { display: flex; flex-direction: column; gap: 4px; }
.tap { cursor: pointer; }
.hero-card { display: flex; gap: 12px; align-items: center; }
.grid-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.note { font-size: 12px; color: var(--dim); text-align: center; }

/* chat */
.chat { height: calc(100vh - 260px); min-height: 200px; overflow-y: auto; }
.msg { padding: 3px 0; word-wrap: break-word; } .msg b { color: var(--gold); }
.chat-form { display: flex; gap: 6px; }

/* fight */
.screen.fight { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }
.fight.bg-forest { background: linear-gradient(180deg, #1d2a17, var(--bg) 60%); } .fight.bg-mines { background: linear-gradient(180deg, #24232a, var(--bg) 60%); }
.fight.bg-swamp { background: linear-gradient(180deg, #17261d, var(--bg) 60%); } .fight.bg-ruins { background: linear-gradient(180deg, #281b2a, var(--bg) 60%); }
.foe { text-align: center; padding-top: 10px; }
.foe-ico { position: relative; font-size: 90px; line-height: 1.1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.7)); }
.foe-name { font-family: 'Cormorant SC', serif; font-size: 20px; color: var(--gold2); }
.bar.foe-hp { height: 18px; } .bar.foe-hp span { line-height: 16px; font-size: 11px; }
.round { position: relative; height: 18px; background: #0d0b08; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.round > div { height: 100%; background: linear-gradient(90deg, rgba(217,178,106,.15), rgba(217,178,106,.5)); width: 0; }
.round span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; color: var(--gold2); }
.flog { flex: 1; min-height: 120px; max-height: 32vh; overflow: hidden; font-size: 13px; background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.flog div { padding: 1px 0; } .flog div:nth-child(n+6) { opacity: .55; }
.flog .p { color: var(--text); } .flog .m { color: #e49a86; } .flog .s { color: var(--gold); }
.me-box { position: relative; display: flex; gap: 10px; align-items: center; }
#meFx { position: relative; min-width: 30px; font-size: 18px; }
.skills { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.skill { position: relative; background: linear-gradient(180deg, #2f261b, #1d1710); border: 1px solid var(--line); border-radius: 12px; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.skill span { font-size: 24px; } .skill small { font-size: 10px; color: var(--text); text-align: center; line-height: 1.1; }
.skill .mp { position: absolute; top: 2px; right: 4px; font-size: 10px; font-style: normal; color: #8fb3f0; }
.skill .cd { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 22px; font-weight: 700; color: #fff; pointer-events: none; }
.skill.cool { opacity: .5; } .skill.cool .cd { background: rgba(0,0,0,.45); }
.skill.nomp span { filter: grayscale(1); }
.skill.queued { border-color: var(--gold2); box-shadow: 0 0 12px rgba(243,217,150,.5); }
.fight-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.float { position: absolute; left: 50%; top: 10%; transform: translateX(-50%); font: 700 22px 'Philosopher'; color: #fff; text-shadow: 0 2px 4px #000; pointer-events: none; animation: rise 1.1s ease-out forwards; white-space: nowrap; }
.float.crit { color: var(--gold2); font-size: 30px; } .float.bad { color: #ff7a63; font-size: 18px; } .float.heal { color: #8fe07a; font-size: 18px; }
@keyframes rise { to { transform: translate(-50%, -40px); opacity: 0; } }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(8,6,4,.75); display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal .card { width: 100%; max-width: 360px; text-align: center; padding: 18px; }
.loot { margin: 8px 0; color: var(--gold2); }
#toast { position: fixed; left: 50%; top: 14px; transform: translate(-50%, -80px); background: var(--card); border: 1px solid var(--gold); color: var(--gold2); padding: 8px 14px; border-radius: 10px; z-index: 50; transition: transform .25s; max-width: 90vw; text-align: center; }
#toast.show { transform: translate(-50%, 0); } #toast.bad { border-color: var(--red); color: #ffb3a5; }

/* ---- generated art + enchant glow (GDD v3 §11) ---- */
.lore { grid-column: 1 / -1; margin: 4px 2px 0; font-size: 13px; color: var(--muted, #b9a988); font-style: italic; }
img.art { width: 1.25em; height: 1.25em; object-fit: contain; vertical-align: middle; }
.foe-ico img.art { width: 120px; height: 120px; }
.it-ico { position: relative; display: inline-grid; place-items: center; }
.it-ico[class*="glow-"]::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; pointer-events: none; mix-blend-mode: screen; }
.glow-1 > * { filter: drop-shadow(0 0 3px rgba(150, 190, 255, .7)); }
.glow-2 > * { filter: drop-shadow(0 0 5px rgba(120, 170, 255, .95)); }
.glow-2::after { background: radial-gradient(rgba(110, 160, 255, .35), transparent 70%); animation: ench-pulse 2.4s ease-in-out infinite; }
.glow-3 > * { filter: drop-shadow(0 0 6px rgba(200, 120, 255, 1)); }
.glow-3::after { background: radial-gradient(rgba(190, 110, 255, .45), transparent 70%); animation: ench-pulse 1.6s ease-in-out infinite; }
.glow-4 > * { filter: drop-shadow(0 0 7px rgba(255, 90, 60, 1)) drop-shadow(0 0 12px rgba(255, 200, 80, .8)); }
.glow-4::after { background: conic-gradient(from 0deg, rgba(255, 80, 40, .0), rgba(255, 180, 60, .55), rgba(255, 80, 40, .0)); animation: ench-spin 2.2s linear infinite; }
@keyframes ench-pulse { 0%, 100% { opacity: .45; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes ench-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .it-ico::after { animation: none !important; } }
/* zone art goes under the gradient fallback; missing file = gradient only */
.node i.bg-town { background-image: url(/art/zones/town.webp), radial-gradient(#6b5733, #2a2218); background-size: cover; }
.node i.bg-forest { background-image: url(/art/zones/forest.webp), radial-gradient(#3f6b33, #1a2a14); background-size: cover; }
.node i.bg-mines { background-image: url(/art/zones/mines.webp), radial-gradient(#5b5560, #1f1c22); background-size: cover; }
.node i.bg-swamp { background-image: url(/art/zones/swamp.webp), radial-gradient(#4a6b4f, #16261a); background-size: cover; }
.node i.bg-ruins { background-image: url(/art/zones/ruins.webp), radial-gradient(#6b4a6b, #241828); background-size: cover; }
/* ---- phase 2 ---- */
.gold-box small { display: block; font-size: 10px; color: var(--dim); }
.btn.xs { padding: 3px 8px; font-size: 12px; }
.players .pl { display: flex; align-items: center; gap: 6px; }
.btns { flex-wrap: wrap; justify-content: flex-end; max-width: 55%; }
.grade { font-style: normal; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 0 4px; vertical-align: 1px; }
.grade.g-D { background: #3c6fb0; color: #fff; } .grade.g-C { background: #a0582c; color: #fff; } .grade.g-B { background: #7a4fc0; color: #fff; } .grade.g-A { background: #d07a1c; color: #fff; }
.node i.bg-citadel { background: radial-gradient(#4a5570, #141a26); } .node i.bg-frost { background: radial-gradient(#6f9ec0, #10202c); } .node i.bg-graves { background: radial-gradient(#4b5040, #0f110c); } .node i.bg-storm { background: radial-gradient(#4a5a8a, #0e1226); } .node i.bg-eclipse { background: radial-gradient(#2a1a10, #050304); }
.card.loc.bg-citadel { background: linear-gradient(160deg, #222a38, #1b1710); } .card.loc.bg-frost { background: linear-gradient(160deg, #1a2a36, #1b1710); } .card.loc.bg-graves { background: linear-gradient(160deg, #1f2219, #1b1710); } .card.loc.bg-storm { background: linear-gradient(160deg, #1a2036, #1b1710); } .card.loc.bg-eclipse { background: linear-gradient(160deg, #140c08, #1b1710); }
.fight.bg-frost { background: linear-gradient(180deg, #14222e, var(--bg) 60%); } .fight.bg-graves { background: linear-gradient(180deg, #181a12, var(--bg) 60%); } .fight.bg-storm { background: linear-gradient(180deg, #141a30, var(--bg) 60%); } .fight.bg-eclipse { background: linear-gradient(180deg, #100804, var(--bg) 60%); }
.item.t5 b { color: #6fa6e8; } .item.t6 b { color: #c18af0; } .item.t7 b { color: #f0a24a; }
.party .pm-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; } .party .bar { height: 6px; margin-top: 3px; } .party .bar span { display: none; }
.quest { margin: 4px 0 8px 18px; padding: 0; font-size: 13px; } .quest li.ok { color: var(--green); }
.row.prof { align-items: center; } .dim { color: var(--dim); }
.skill-row { display: flex; align-items: center; gap: 8px; } .skill-row .grow { flex: 1; }
.chans { flex-wrap: wrap; } .chans button { flex: 1 0 28%; padding: 6px 4px; font-size: 12px; }
.chat .msg i { font-style: normal; color: var(--dim); font-size: 11px; }
.msg.ch-trade b { color: #7fc8a9; } .msg.ch-shout b { color: #f0a24a; } .msg.ch-party b { color: #6fa6e8; } .msg.ch-pm b { color: #d58ae0; }
.msg.sys { color: var(--gold2); font-size: 12px; font-style: italic; } .msg b[data-pm] { cursor: pointer; }
.pm-to { width: 30%; flex: none !important; }
.orange { color: #e89a4a; }
.node i.bg-brama { background-image: url(/art/zones/brama.webp), radial-gradient(#7a6a48, #2c2418); background-size: cover; }
.node i.bg-ash { background-image: url(/art/zones/ash.webp), radial-gradient(#7a3f28, #2a140c); background-size: cover; }
.node i.bg-spires { background-image: url(/art/zones/spires.webp), radial-gradient(#4f5f7a, #161c2a); background-size: cover; }
.node i.bg-abyss { background-image: url(/art/zones/abyss.webp), radial-gradient(#3a2050, #0c0614); background-size: cover; }
.card.loc.bg-brama { background: linear-gradient(160deg, #332a1c, #1b1710); } .card.loc.bg-ash { background: linear-gradient(160deg, #35190f, #1b1710); }
.card.loc.bg-spires { background: linear-gradient(160deg, #1f2533, #1b1710); } .card.loc.bg-abyss { background: linear-gradient(160deg, #1d1029, #1b1710); }
.fight.bg-brama { background: linear-gradient(180deg, #2a2216, var(--bg) 60%); } .fight.bg-ash { background: linear-gradient(180deg, #2e150c, var(--bg) 60%); }
.fight.bg-spires { background: linear-gradient(180deg, #1a2030, var(--bg) 60%); } .fight.bg-abyss { background: linear-gradient(180deg, #190d24, var(--bg) 60%); }
/* phase 3 */
.tabs button { font-size: 11px; }
.btn.danger { background: #8a2a22; border-color: #b8443a; color: #fff; }
.btn.warn { background: #b8443a !important; color: #fff; }
.pk-red { color: #ff5a4a !important; }
.pk-flag { color: #c07bff !important; }
.ctag { color: #8fb7ff; }
.card.raid { border: 1px solid #c9a24a; box-shadow: 0 0 12px rgba(201,162,74,.25); }
.card.clan .skills { margin-top: 8px; font-size: 13px; line-height: 1.6; }
.card.clan .skills .dim { opacity: .5; }
.row.mail { align-items: flex-start; }
.btns small { display: block; font-size: 11px; color: var(--dim); margin-bottom: 2px; }
.inp { width: 100%; box-sizing: border-box; margin: 6px 0; padding: 9px 10px; border-radius: 8px; border: 1px solid #3a3f55; background: #151826; color: inherit; font-size: 15px; }
.modal .log { max-height: 180px; overflow: auto; font-size: 12px; text-align: left; margin: 6px 0; }
.seg { flex-wrap: wrap; }

.hero-name { color: #f2c14e; text-shadow: 0 0 6px rgba(242,193,78,.6); }
[data-arena-cls] { background: #1c1f2b; color: inherit; border: 1px solid #3a3f55; border-radius: 6px; padding: 3px 6px; font-size: 12px; max-width: 55%; }
