:root { --ink: #2b1d10; --paper: #f6ead2; --gold: #e8b64a; --gold-d: #a8761c; --leaf: #3f7d32; --sky: #9fd2e8; --shadow: rgba(30, 18, 6, .45); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd2e8; font-family: Spectral, Georgia, serif; color: var(--ink); touch-action: none; -webkit-user-select: none; user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: 600 16px Spectral, Georgia, serif; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 2px solid var(--gold-d); background: #fff6e0; color: var(--ink); cursor: pointer; }
button.primary { background: linear-gradient(#f7cf6a, #d99a2b); border-color: #8a5a10; color: #2a1600; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 40%, rgba(255,240,200,.35), rgba(40,60,30,.55)); z-index: 5; }
.screen[hidden] { display: none; }
.title-card { width: min(420px, 100%); background: var(--paper); border: 3px solid var(--gold-d); border-radius: 18px; padding: 22px 20px; box-shadow: 0 10px 40px var(--shadow); text-align: center; }
.title-card h1 { font: 800 44px Cinzel, serif; margin: 0; color: #7a3e10; letter-spacing: 1px; text-shadow: 0 2px 0 #f7d68a; }
.tag-line { margin: 4px 0 16px; }
.field { display: grid; gap: 4px; text-align: left; font-weight: 600; }
input { font: 16px Spectral, serif; min-height: 44px; padding: 8px 12px; border: 2px solid var(--gold-d); border-radius: 10px; background: #fffaf0; }
.look-row { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 14px; gap: 8px; }
.btns { display: flex; gap: 10px; justify-content: center; }
.btns.col { flex-direction: column; }
.join-row { display: flex; gap: 8px; } .join-row input { flex: 1; text-transform: uppercase; letter-spacing: 4px; text-align: center; min-width: 0; }
.small-btns { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.small-btns button { font-size: 14px; }
.msg { min-height: 1.2em; color: #9a2a10; margin: 8px 0 0; }
body.no-server .online-only { display: none; }
#tags { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.tag { position: absolute; left: 0; top: 0; font: 600 13px Spectral, serif; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; }
.tag.me { color: #ffe08a; }
#hud { position: fixed; left: 12px; top: calc(10px + env(safe-area-inset-top)); z-index: 3; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.hud-area, .hud-code { background: rgba(30,20,8,.6); color: #fff1cf; padding: 6px 12px; border-radius: 999px; font: 600 14px Cinzel, serif; }
.hud-code { pointer-events: auto; }
.menu-btn { position: fixed; right: calc(10px + env(safe-area-inset-right)); top: calc(10px + env(safe-area-inset-top)); z-index: 6; width: 48px; height: 48px; padding: 0; font-size: 22px; border-radius: 12px; background: rgba(255,246,224,.92); }
.menu-btn .dot { position: absolute; right: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #e2382c; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(20,12,4,.5); }
.modal .panel { width: min(440px, 100%); max-height: calc(100% - 20px); overflow: auto; background: var(--paper); border: 3px solid var(--gold-d); border-radius: 16px; padding: 18px; box-shadow: 0 10px 40px var(--shadow); }
.modal h2 { font: 800 24px Cinzel, serif; margin: 0 0 12px; color: #7a3e10; }
.menu-list { display: grid; gap: 8px; }
.report textarea { width: 100%; min-height: 120px; font: 16px Spectral, serif; padding: 10px; border: 2px solid var(--gold-d); border-radius: 10px; margin: 10px 0; }
.report .row { display: inline-flex; gap: 6px; align-items: center; margin-right: 12px; }
.report .btns { justify-content: flex-end; margin-top: 10px; }
.stick-zone { position: fixed; left: 0; bottom: 0; width: 50%; height: 55%; z-index: 3; display: none; touch-action: none; }
.stick-zone.on { display: block; }
.stick { position: absolute; width: 0; height: 0; opacity: 0; transition: opacity .15s; }
.stick.on { opacity: 1; }
.stick i { position: absolute; left: -60px; top: -60px; width: 120px; height: 120px; border-radius: 50%; border: 3px solid rgba(255,255,255,.7); background: rgba(0,0,0,.18); }
.stick b { position: absolute; left: -28px; top: -28px; width: 56px; height: 56px; border-radius: 50%; background: rgba(255,240,200,.9); }
.row.small { font-size: 14px; display: flex; gap: 6px; align-items: center; justify-content: center; }
#banner { position: fixed; top: calc(64px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 8; background: rgba(120,30,10,.85); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 600; }
#banner[hidden] { display: none; }
.tag.away { opacity: .5; }
.invite .qr { width: 220px; height: 220px; margin: 0 auto; background: #fff; border-radius: 10px; padding: 8px; }
.invite .qr svg { width: 100%; height: 100%; }
.invite.huge .qr { width: min(80vw, 80vh); height: min(80vw, 80vh); }
.invite .code-big { text-align: center; font: 800 34px Cinzel, serif; letter-spacing: 6px; margin: 8px 0 0; }
.invite .url { text-align: center; font-size: 13px; word-break: break-all; margin: 4px 0 10px; }
.invite .who { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.invite .row { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
#title { background: url(../assets/art/key-art.webp) center / cover no-repeat, #6a8f4a; }
#title::before { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(20,12,4,.05), rgba(20,12,4,.45)); pointer-events: none; }
#title .title-card { position: relative; background: rgba(246,234,210,.94); }
@media (min-width: 700px) { #title { place-items: end center; padding-bottom: 6vh; } }
#heroes { margin-bottom: 12px; }
.hero-list { display: grid; gap: 6px; max-height: 40vh; overflow: auto; }
.hero { display: flex; gap: 10px; align-items: center; text-align: left; padding: 4px 10px; min-height: 56px; }
.hero.on { background: #ffe9b0; border-color: #7a3e10; box-shadow: inset 0 0 0 2px #e8b64a; }
.hero .face { width: 40px; height: 50px; flex: none; display: grid; place-items: center; overflow: hidden; }
.hero .face svg { width: 100%; height: 100%; }
.hero .face.plus { font: 800 28px Cinzel, serif; color: var(--gold-d); }
.hero .who { display: grid; } .hero .who small { font-weight: 400; opacity: .8; }
.hero-tools { display: flex; justify-content: flex-end; margin-top: 4px; }
.hero-tools .del { font-size: 13px; min-height: 32px; padding: 2px 10px; background: transparent; border-color: transparent; color: #8a2a10; }
.create { display: grid; gap: 10px; }
.create .face.big { width: 120px; height: 150px; margin: 0 auto; }
.create .face.big svg { width: 100%; height: 100%; }
.races { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.races button { padding: 6px 4px; font-size: 14px; }
.races button.on { background: #ffe9b0; box-shadow: inset 0 0 0 2px #e8b64a; }
/* ---- fight HUD ---- */
#fight { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
#fight[hidden] { display: none; }
#fight button { pointer-events: auto; }
.me-frame { position: absolute; left: 12px; top: calc(54px + env(safe-area-inset-top)); display: flex; gap: 8px; align-items: center; background: rgba(30,20,8,.62); padding: 6px 10px 6px 6px; border-radius: 14px; border: 2px solid rgba(232,182,74,.7); }
.me-frame .lvl { width: 36px; height: 36px; border-radius: 50%; background: #2b1d10; color: #ffe08a; display: grid; place-items: center; font: 800 16px Cinzel, serif; border: 2px solid #e8b64a; }
.me-frame .bars { display: grid; gap: 3px; width: min(220px, 42vw); }
.me-frame .nm { color: #fff1cf; font: 600 13px Cinzel, serif; }
.hp, .mp { position: relative; display: block; height: 14px; border-radius: 7px; background: rgba(0,0,0,.55); overflow: hidden; }
.hp b { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#ff6b5a, #b8261b); }
.mp b { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#6fb6ff, #2456b8); }
.hp span, .mp span { position: relative; display: block; text-align: center; color: #fff; font: 600 10px/14px Spectral, serif; text-shadow: 0 1px 1px #000; }
.tg-frame { position: absolute; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); width: min(320px, 58vw); background: rgba(30,20,8,.62); padding: 6px 10px; border-radius: 12px; border: 2px solid rgba(220,80,60,.7); color: #fff1cf; }
.tg-frame[hidden] { display: none; }
.tg-frame .nm { font: 600 13px Cinzel, serif; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tg-frame .lv { font: 400 12px Spectral, serif; opacity: .85; }
.tcast { margin-top: 4px; } .tcast[hidden] { display: none; }
.tcast i, .cast-bar i { display: block; height: 10px; border-radius: 5px; background: rgba(0,0,0,.5); overflow: hidden; }
.tcast b { display: block; height: 100%; background: #9a9a9a; } .tcast.int b { background: #ffb84a; }
.tcast span { font-size: 11px; }
.cast-bar { position: absolute; left: 50%; bottom: calc(120px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(260px, 60vw); text-align: center; color: #fff; font: 600 12px Spectral, serif; text-shadow: 0 1px 2px #000; }
.cast-bar[hidden] { display: none; }
.cast-bar i { height: 12px; border: 1px solid #e8b64a; } .cast-bar b { display: block; height: 100%; background: linear-gradient(#ffe08a, #e8a42a); }
.nope { position: absolute; left: 50%; top: 32%; transform: translateX(-50%); color: #ff6040; font: 700 16px Spectral, serif; text-shadow: 0 1px 2px #000; opacity: 0; transition: opacity .2s; }
.nope.on { opacity: 1; }
.xp-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0,0,0,.4); } .xp-bar b { display: block; height: 100%; background: #b78cff; }
.action-bar { position: absolute; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; background: rgba(30,20,8,.55); border-radius: 14px; }
.slot, .arc-btn { position: relative; width: 58px; height: 58px; min-height: 0; padding: 0; border-radius: 12px; background: linear-gradient(#4a3a26, #2b1d10); border: 2px solid #e8b64a; color: #fff1cf; overflow: hidden; }
.slot .ic, .arc-btn .ic { font-size: 24px; line-height: 40px; display: block; }
.slot .key { position: absolute; left: 4px; top: 2px; font: 700 11px Spectral, serif; color: #ffe08a; }
.slot small, .arc-btn small { position: absolute; left: 0; right: 0; bottom: 2px; font: 600 9px Spectral, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.slot .cd, .arc-btn .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,.6); }
.slot.poor, .arc-btn.poor { filter: saturate(.3) brightness(.7); }
.arc { display: none; }
#fight.touch .action-bar { display: none; }
#fight.touch .arc { display: block; position: absolute; right: calc(10px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 230px; height: 230px; }
#fight.touch .arc-btn { position: absolute; width: 56px; height: 56px; border-radius: 50%; }
#fight.touch .arc-btn.big { width: 92px; height: 92px; right: 8px; bottom: 8px; } #fight.touch .arc-btn.big .ic { font-size: 38px; line-height: 70px; }
#fight.touch .arc-btn:nth-child(2) { right: 112px; bottom: 6px; }
#fight.touch .arc-btn:nth-child(3) { right: 104px; bottom: 72px; }
#fight.touch .arc-btn:nth-child(4) { right: 66px; bottom: 124px; }
#fight.touch .arc-btn:nth-child(5) { right: 6px; bottom: 112px; }
#fight.touch .arc-btn.next { right: 160px; bottom: 150px; width: 48px; height: 48px; }
#fight.touch .cast-bar { bottom: calc(260px + env(safe-area-inset-bottom)); }
.dead-panel { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: rgba(30,12,8,.85); color: #fff1cf; padding: 16px 20px; border-radius: 14px; text-align: center; border: 2px solid #b8261b; pointer-events: auto; }
.dead-panel[hidden] { display: none; } .dead-panel h2 { font: 800 22px Cinzel, serif; margin: 0 0 6px; }
.float { position: absolute; transform: translate(-50%, 0); font: 800 18px Spectral, serif; color: #fff; text-shadow: 0 2px 2px #000, 0 0 4px #000; pointer-events: none; transition: transform 1s ease-out, opacity 1s ease-in; opacity: 1; }
.float.go { transform: translate(-50%, -48px); opacity: 0; }
.float.deal { color: #fff6d0; } .float.hurt { color: #ff6b5a; font-size: 16px; } .float.crit { font-size: 26px; color: #ffd040; }
.float.heal { color: #7aff8a; } .float.xp { color: #c9a8ff; font-size: 14px; } .float.int { color: #ffb84a; font-size: 15px; }
.float.ty-fire { color: #ff9a3a; } .float.ty-frost { color: #9fe0ff; } .float.ty-storm { color: #b8c8ff; } .float.ty-poison { color: #8aff6a; } .float.ty-shadow { color: #c090ff; }
.foe-tag { position: absolute; left: 0; top: 0; display: grid; justify-items: center; gap: 2px; pointer-events: none; }
.foe-tag[hidden] { display: none; }
.foe-tag .nm { font: 600 11px Spectral, serif; color: #ffd8c8; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.foe-tag.tg .nm { color: #fff; font-size: 12px; }
.foe-tag.rk-champion .nm { color: #7ab8ff; } .foe-tag.rk-rare .nm { color: #ffd040; } .foe-tag.rk-boss .nm { color: #ff8a3a; }
.foe-tag .bar { display: block; width: 52px; height: 6px; border-radius: 3px; background: rgba(0,0,0,.6); overflow: hidden; border: 1px solid rgba(0,0,0,.6); }
.foe-tag .bar b { display: block; height: 100%; background: #e2382c; }
.big-banner { position: fixed; left: 50%; top: 28%; transform: translateX(-50%); font: 800 42px Cinzel, serif; color: #ffe08a; text-shadow: 0 3px 0 #7a3e10, 0 0 20px rgba(255,200,80,.8); z-index: 9; pointer-events: none; animation: bb 2.2s ease-out forwards; }
@keyframes bb { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 80% { opacity: 1; } 100% { opacity: 0; } }
.in-game #hud { top: calc(10px + env(safe-area-inset-top)); }
@media (max-width: 600px) {
  .in-game #hud { display: none; }                            /* zone name + code live in ☰ on a phone (top bar rule) */
  .me-frame { top: calc(10px + env(safe-area-inset-top)); padding: 4px 8px 4px 4px; }
  .me-frame .bars { width: min(190px, 48vw); }
  .tg-frame { left: 12px; transform: none; top: calc(68px + env(safe-area-inset-top)); width: min(260px, 64vw); }
}
.float.ab { color: #ffb070; font-size: 14px; font-style: italic; }
/* ---- character sheet + bag ---- */
.bag-btn { position: absolute; right: calc(68px + env(safe-area-inset-right)); top: calc(10px + env(safe-area-inset-top)); width: 48px; height: 48px; padding: 0; font-size: 22px; border-radius: 12px; background: rgba(255,246,224,.92); pointer-events: auto; }
.bag-btn .dot { position: absolute; right: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #3ecf5a; }
.bag-btn .dot[hidden] { display: none; }
.sheet-ui { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; padding: 10px; background: rgba(20,12,4,.45); }
.sheet-ui[hidden] { display: none; }
.sheet-panel { width: min(640px, 100%); max-height: 100%; overflow: auto; background: var(--paper); border: 3px solid var(--gold-d); border-radius: 16px; padding: 12px; box-shadow: 0 10px 40px var(--shadow); }
.sheet-panel header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; position: relative; padding-right: 48px; }
.sheet-panel h2 { font: 800 22px Cinzel, serif; margin: 0; color: #7a3e10; }
.sheet-panel .x { position: absolute; right: 0; top: -2px; width: 44px; height: 44px; padding: 0; font-size: 24px; }
.sheet-panel .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
@media (max-width: 560px) { .sheet-panel .cols { grid-template-columns: 1fr; } }
.equip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; align-content: start; }
.eq, .bag .item { position: relative; min-height: 0; padding: 0; font-size: 22px; border-radius: 8px; background: #3a2c1c; color: #fff; border: 2px solid #6a5a40; }
.eq { aspect-ratio: 1; display: grid; place-items: center; } .eq small { position: absolute; bottom: 1px; left: 0; right: 0; font: 600 8px Spectral, serif; color: #e8d8b0; }
.eq.empty { background: #d8c8a8; border-style: dashed; } .eq.empty small { color: #6a5a40; } .eq.broken { filter: grayscale(1) brightness(.7); }
.swap { grid-column: 1 / -1; font-size: 13px; min-height: 36px; }
.r-normal { border-color: #c8c8c8 !important; } .r-magic { border-color: #4a8aff !important; box-shadow: inset 0 0 8px #4a8aff88; } .r-rare { border-color: #ffd040 !important; box-shadow: inset 0 0 8px #ffd04088; }
.r-unique { border-color: #c87a2a !important; box-shadow: inset 0 0 10px #ff9a3a99; } .r-legendary { border-color: #ff5a1a !important; box-shadow: inset 0 0 12px #ff5a1acc; } .r-unid { border-color: #aa6aff !important; }
.attrs .attr { display: grid; grid-template-columns: 1fr auto 44px; align-items: center; gap: 6px; padding: 2px 0; } .attrs .attr button { min-height: 32px; padding: 0; }
.attrs .pts { color: #1e7a2e; font-weight: 700; } .attrs .xp { font-size: 13px; opacity: .8; }
.nums { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 14px; margin-top: 6px; } .nums .res { grid-column: 1 / -1; font-size: 12px; }
.ty-fire { color: #c2501a; } .ty-frost { color: #2a7ab0; } .ty-storm { color: #5a5ac0; } .ty-poison { color: #3a8a1a; } .ty-shadow { color: #7a3ab0; }
.bag { display: grid; grid-template-columns: repeat(var(--w), 1fr); grid-template-rows: repeat(var(--h), minmax(36px, 1fr)); gap: 2px; background: #2a1f12; padding: 4px; border-radius: 8px; aspect-ratio: calc(var(--w) / var(--h)); }
.bag .cell { background: #4a3a26; border-radius: 3px; }
.bag .item { z-index: 1; display: grid; place-items: center; } .bag .item.sel { outline: 3px solid #fff; }
.gold { margin-top: 6px; font-weight: 600; } .actions { display: flex; gap: 8px; margin-top: 8px; min-height: 44px; }
.tip-float { position: fixed; z-index: 30; pointer-events: none; max-width: min(320px, 92vw); }
.tip { background: rgba(20,14,8,.96); color: #f0e6d0; border: 2px solid #8a7a5a; border-radius: 10px; padding: 10px 12px; font: 14px/1.35 Spectral, serif; }
.tip h4 { margin: 0; font: 700 16px Cinzel, serif; } .tip.r-magic h4 { color: #7aaaff; } .tip.r-rare h4 { color: #ffd040; } .tip.r-unique h4 { color: #e8a050; } .tip.r-legendary h4 { color: #ff7a3a; } .tip.r-unid h4 { color: #c8a0ff; }
.tip .sub { font-size: 12px; opacity: .75; margin-bottom: 4px; } .tip .big { font-weight: 700; } .tip .mod { color: #8ab8ff; } .tip .power { color: #ffb070; margin-top: 4px; }
.tip .lore { font-style: italic; color: #d8b880; margin-top: 4px; } .tip .req { margin-top: 6px; font-size: 12px; } .tip .bad { color: #ff6a5a; } .tip .unid { color: #c8a0ff; }
.tip .dur { font-size: 12px; opacity: .8; } .tip .cmp { margin-top: 6px; border-top: 1px solid #5a4a30; padding-top: 4px; font-size: 13px; } .tip .up { color: #6aff7a; } .tip .down { color: #ff7a6a; }
@media (max-width: 560px) {
  .sheet-ui { padding: 6px; place-items: start center; }
  .sheet-panel { overflow: hidden; padding: 8px 10px; }       /* no scroller inside the page on phones (game standards §1) */
  .sheet-panel h2 { font-size: 18px; } .sheet-panel header span { font-size: 13px; }
  .sheet-panel .cols { gap: 6px; margin: 6px 0; }
  .equip { gap: 4px; } .eq { font-size: 18px; } .swap { min-height: 32px; }
  .attrs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; } .attrs .xp, .attrs .pts, .attrs .nums { grid-column: 1 / -1; }
  .attrs .attr { padding: 0; font-size: 14px; } .attrs .attr button { min-height: 28px; }
  .nums { grid-template-columns: 1fr 1fr 1fr; font-size: 12px; }
  .bag { grid-template-rows: repeat(var(--h), 34px); aspect-ratio: auto; }
  .gold { margin-top: 4px; } .actions { margin-top: 4px; }
}
