/* Dream Bandits UI — pure CSS, no image assets. */
:root {
  --bg: #07060f;
  --panel: rgba(16, 12, 34, 0.82);
  --panel-solid: #110d24;
  --line: rgba(199, 125, 255, 0.28);
  --gold: #ffd27a;
  --violet: #c77dff;
  --cyan: #7af0ff;
  --text: #e9e4ff;
  --muted: #9a92c4;
  --red: #ff4d6d;
  --green: #7cff6b;
  --serif: 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  --sans: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; user-select: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui .screen, #ui .modal, #ui button, #ui input, #ui select, #ui .interactive { pointer-events: auto; }
.hidden { display: none !important; }

button {
  font-family: var(--serif); font-size: 16px; letter-spacing: 0.08em; color: var(--text);
  background: linear-gradient(180deg, rgba(60, 40, 110, 0.9), rgba(30, 20, 60, 0.9));
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 22px; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4) inset, 0 4px 18px rgba(0,0,0,0.35); transition: all .15s;
}
button:hover:not(:disabled) { border-color: var(--gold); color: #fff; box-shadow: 0 0 18px rgba(255, 210, 122, 0.35); transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: linear-gradient(180deg, #ffd27a, #c8902f); color: #1b1030; border-color: #ffe7b0; font-weight: 700; }
button.primary:hover:not(:disabled) { color: #000; box-shadow: 0 0 26px rgba(255, 210, 122, 0.6); }
button.small { padding: 6px 12px; font-size: 13px; }
input, select {
  font-family: var(--sans); font-size: 15px; color: var(--text); background: rgba(10, 8, 24, 0.85);
  border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; outline: none;
}
input:focus, select:focus { border-color: var(--violet); }
input[type=range] { padding: 0; width: 160px; accent-color: var(--violet); }

/* ------------------------------------------------------------------ screens */
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: block; }
#screen-loading { display: none; align-items: center; justify-content: center; flex-direction: column; background: radial-gradient(ellipse at center, #1a1040, #05040b); }
#screen-loading.active { display: flex; }
.loading-text { color: var(--muted); margin-top: 18px; letter-spacing: .3em; font-size: 13px; animation: pulse 1.6s infinite; }

.logo {
  font-family: var(--serif); font-size: clamp(30px, 6vw, 92px); letter-spacing: 0.14em; text-align: center; line-height: 1.1; font-weight: 700;
  background: linear-gradient(180deg, #fff6dc 10%, #ffd27a 45%, #c77dff 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(199, 125, 255, 0.55)) drop-shadow(0 0 4px rgba(255, 210, 122, 0.6));
}
.tagline { font-family: var(--serif); color: var(--muted); letter-spacing: .4em; font-size: 14px; text-transform: uppercase; }

#screen-title { background: radial-gradient(ellipse at 70% 40%, transparent 20%, rgba(5, 4, 12, 0.75) 75%); }
.title-wrap { position: absolute; left: 7vw; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 14px; }
.title-wrap .menu { display: flex; flex-direction: column; gap: 10px; margin-top: 30px; width: 280px; }
.title-wrap .menu button { text-align: left; font-size: 18px; padding: 14px 22px; }
.title-foot { position: absolute; bottom: 18px; left: 7vw; color: var(--muted); font-size: 12px; letter-spacing: .1em; }

/* --------------------------------------------------------------------- hub */
#screen-hub { background: linear-gradient(90deg, rgba(5, 4, 12, 0.92) 0%, rgba(5,4,12,0.2) 32%, rgba(5,4,12,0.15) 55%, rgba(5, 4, 12, 0.92) 70%); }
.hub-top { position: absolute; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: linear-gradient(180deg, rgba(5,4,12,.9), transparent); }
.hub-top .brand { font-family: var(--serif); letter-spacing: .3em; font-size: 22px; color: var(--gold); }
.hub-top .right { display: flex; gap: 14px; align-items: center; }
.currency { font-family: var(--serif); font-size: 18px; display: flex; gap: 6px; align-items: center; padding: 6px 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.currency .gem { color: #ff6ad5; text-shadow: 0 0 10px #ff6ad5; }
.hub-left { position: absolute; left: 28px; top: 84px; bottom: 100px; width: 340px; display: flex; flex-direction: column; gap: 12px; }
.char-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 0 0 auto; }
.char-card { padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; transition: all .15s; position: relative; overflow: hidden; }
.char-card:hover { border-color: rgba(255,210,122,.6); }
.char-card.sel { border-color: var(--gold); box-shadow: 0 0 22px rgba(255,210,122,.25) inset, 0 0 18px rgba(255,210,122,.2); }
.char-card .nm { font-family: var(--serif); font-size: 19px; letter-spacing: .06em; }
.char-card .ti { color: var(--muted); font-size: 12px; white-space: nowrap; }
.char-card .lv { position: absolute; right: 10px; top: 11px; font-family: var(--serif); font-size: 13px; color: var(--gold); }
.char-card .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.char-detail { margin-top: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 14px; line-height: 1.45; overflow-y: auto; }
.char-detail h3 { font-family: var(--serif); margin: 0 0 6px; letter-spacing: .06em; }
.ability { display: grid; grid-template-columns: 54px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.ability .k { font-size: 11px; color: var(--gold); letter-spacing: .1em; padding-top: 2px; }
.ability .n { font-weight: 600; }
.ability .d { color: var(--muted); font-size: 12.5px; }
.diff { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px; }

.hub-right { position: absolute; right: 28px; top: 84px; bottom: 100px; width: min(560px, 42vw); display: flex; flex-direction: column; }
.tabs { display: flex; gap: 6px; }
.tab { padding: 9px 16px; border: 1px solid var(--line); border-bottom: none; border-radius: 8px 8px 0 0; background: rgba(16,12,34,.6); cursor: pointer; font-family: var(--serif); letter-spacing: .08em; color: var(--muted); }
.tab.sel { background: var(--panel); color: var(--gold); }
.tab-body { flex: 1; border: 1px solid var(--line); border-radius: 0 10px 10px 10px; background: var(--panel); padding: 18px; overflow-y: auto; position: relative; }

.hub-bottom { position: absolute; bottom: 26px; left: 0; right: 0; display: flex; justify-content: center; gap: 14px; }
.hub-bottom button { font-size: 19px; padding: 14px 34px; }

/* skill tree */
.tree-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.xpbar { height: 8px; width: 220px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.xpbar > div { height: 100%; background: linear-gradient(90deg, var(--violet), var(--gold)); }
.tree { position: relative; height: 430px; }
.tree svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tree .branch { position: absolute; top: 0; font-family: var(--serif); color: var(--muted); letter-spacing: .15em; text-transform: uppercase; font-size: 12px; transform: translateX(-50%); }
.node { position: absolute; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); background: radial-gradient(circle at 35% 30%, #2a2050, #0c0a1a); display: flex; align-items: center; justify-content: center; cursor: pointer; font-family: var(--serif); font-size: 20px; color: var(--muted); transition: all .15s; }
.node.avail { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 14px rgba(255,210,122,.35); animation: glowp 2s infinite; }
.node.on { border-color: var(--violet); background: radial-gradient(circle at 35% 30%, #c77dff, #3d1a6e); color: #fff; box-shadow: 0 0 18px rgba(199,125,255,.6); }
.node .cost { position: absolute; bottom: -8px; right: -6px; font-size: 11px; background: #000; border: 1px solid var(--line); border-radius: 8px; padding: 0 5px; color: var(--gold); font-family: var(--sans); }
.tooltip { position: fixed; z-index: 50; max-width: 280px; padding: 10px 12px; background: rgba(8, 6, 20, 0.96); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; line-height: 1.4; pointer-events: none; box-shadow: 0 6px 30px rgba(0,0,0,.6); }
.tooltip .tt-n { font-family: var(--serif); font-size: 16px; margin-bottom: 3px; }
.tooltip .tt-r { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; }

/* sanctum */
.sanct { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sanct .n { font-family: var(--serif); font-size: 17px; }
.sanct .d { color: var(--muted); font-size: 13px; }
.pips { display: flex; gap: 4px; margin-top: 5px; }
.pips span { width: 18px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.1); }
.pips span.on { background: linear-gradient(90deg, #ff6ad5, var(--gold)); box-shadow: 0 0 6px #ff6ad5; }

/* ---------------------------------------------------------------------- hud */
#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-player { position: absolute; left: 22px; top: 18px; width: 330px; }
.hud-name { font-family: var(--serif); font-size: 18px; letter-spacing: .08em; display: flex; justify-content: space-between; text-shadow: 0 2px 6px #000; }
.bar { position: relative; height: 18px; margin-top: 5px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.18); border-radius: 4px; overflow: hidden; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; transition: width .15s; }
.bar .ghost { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.45); transition: width .6s .2s; }
.bar .hp { background: linear-gradient(180deg, #ff6b81, #c2183c); }
.bar .sh { background: linear-gradient(180deg, rgba(160,220,255,.85), rgba(80,160,255,.85)); }
.bar .txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; text-shadow: 0 1px 2px #000; }
.hud-res { display: flex; gap: 16px; margin-top: 8px; font-family: var(--serif); font-size: 16px; text-shadow: 0 2px 6px #000; }
.hud-res .g { color: var(--gold); }
.hud-res .s { color: #ff8be0; }
.allies { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.ally { font-size: 12px; }
.ally .bar { height: 9px; margin-top: 2px; }

.hud-floor { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 8px #000; }
.hud-floor .fn { font-family: var(--serif); letter-spacing: .2em; font-size: 15px; color: var(--gold); text-transform: uppercase; }
.pipsrow { display: flex; gap: 5px; justify-content: center; margin-top: 6px; }
.rpip { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.5); font-size: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.rpip.done { background: rgba(199,125,255,.35); border-color: var(--violet); color: #fff; }
.rpip.cur { border-color: var(--gold); box-shadow: 0 0 8px var(--gold); color: var(--gold); }
.bossbar { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); width: min(720px, 60vw); text-align: center; }
.bossbar .bn { font-family: var(--serif); font-size: 20px; letter-spacing: .14em; text-shadow: 0 0 12px rgba(255,77,109,.7), 0 2px 4px #000; }
.bossbar .bar { height: 14px; }
.bossbar .bar .hp { background: linear-gradient(180deg, #ff9a5a, #b3123b); }

.hud-boons { position: absolute; right: 18px; top: 16px; display: flex; flex-wrap: wrap; gap: 5px; max-width: 300px; justify-content: flex-end; pointer-events: auto; }
.boon-ic { width: 34px; height: 34px; border-radius: 7px; border: 2px solid; display: flex; align-items: center; justify-content: center; font-size: 15px; font-family: var(--serif); position: relative; background: rgba(8,6,20,.8); }
.boon-ic .lv { position: absolute; right: -4px; bottom: -4px; font-size: 10px; background: #000; border-radius: 6px; padding: 0 4px; border: 1px solid rgba(255,255,255,.3); font-family: var(--sans); }

.abilities { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: flex-end; }
.ab { position: relative; width: 62px; height: 62px; border-radius: 10px; border: 2px solid rgba(255,255,255,.22); background: radial-gradient(circle at 40% 30%, #2f2560, #0d0a1c); display: flex; align-items: center; justify-content: center; font-size: 26px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.ab .key { position: absolute; left: 4px; top: 2px; font-size: 10px; color: var(--gold); font-weight: 700; letter-spacing: .05em; }
.ab .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,.72) var(--p, 0%), transparent 0); }
.ab .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; text-shadow: 0 1px 3px #000; }
.ab.ult { width: 74px; height: 74px; border-color: var(--gold); }
.ab.ult .cdt { align-items: flex-end; font-size: 10px; padding-bottom: 12px; color: var(--gold); }
.ab.ult .fillu { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, rgba(255,210,122,.55), rgba(199,125,255,.35)); }
.ab.ult.ready { box-shadow: 0 0 22px var(--gold); animation: glowp 1.2s infinite; }
.ab .nm { position: absolute; bottom: -1px; left: 0; right: 0; font-size: 8.5px; text-align: center; color: var(--muted); background: rgba(0,0,0,.5); }

.banner { position: absolute; top: 28%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; animation: banner 2.6s ease forwards; }
.banner .b1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 64px); letter-spacing: .2em; color: #fff; text-shadow: 0 0 24px rgba(199,125,255,.8), 0 4px 10px #000; }
.banner .b2 { font-family: var(--serif); color: var(--gold); letter-spacing: .4em; font-size: 15px; text-transform: uppercase; margin-top: 6px; }
.banner.boss .b1 { color: #ffd6dc; text-shadow: 0 0 30px rgba(255,77,109,.9), 0 4px 10px #000; }

.prompt { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); padding: 8px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.prompt b { color: var(--gold); }

.netinfo { position: absolute; right: 14px; bottom: 10px; font-size: 11px; color: var(--muted); text-shadow: 0 1px 2px #000; }

/* --------------------------------------------------------------- world labels */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.wl { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; text-align: center; text-shadow: 0 2px 4px #000, 0 0 2px #000; }
.wl.door { font-family: var(--serif); font-size: 14px; letter-spacing: .1em; }
.wl.door .sub { font-family: var(--sans); font-size: 11px; color: var(--muted); }
.wl.item { font-size: 13px; padding: 4px 8px; background: rgba(8,6,20,.8); border: 1px solid var(--line); border-radius: 5px; }
.wl.item .price { color: var(--gold); font-weight: 700; }
.wl.item.sold { opacity: .45; }
.wl.pname { font-size: 11px; color: #fff; opacity: .85; }
.dmg { position: absolute; font-weight: 800; font-family: var(--sans); transform: translate(-50%, -50%); text-shadow: 0 2px 3px #000, 0 0 1px #000; animation: dmgfloat .8s ease-out forwards; }
.dmg.crit { color: #ffe45e; font-size: 22px; }
.dmg.player { color: #ff5d6d; }
.ftext { position: absolute; transform: translate(-50%, -50%); font-family: var(--serif); font-weight: 700; font-size: 16px; text-shadow: 0 2px 4px #000; animation: ftext 1.4s ease-out forwards; }

/* ---------------------------------------------------------------- modals */
#modal-root .modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4, 3, 10, 0.62); backdrop-filter: blur(2px); }
.panel { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; padding: 26px 30px; min-width: 380px; max-width: 92vw; box-shadow: 0 20px 80px rgba(0,0,0,.7), 0 0 40px rgba(199,125,255,.12); }
.panel h2 { font-family: var(--serif); letter-spacing: .14em; margin: 0 0 16px; color: var(--gold); font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.row label { width: 130px; color: var(--muted); font-size: 14px; }
.code { font-family: var(--serif); font-size: 46px; letter-spacing: .35em; color: var(--gold); text-align: center; text-shadow: 0 0 20px rgba(255,210,122,.5); margin: 6px 0 12px; }
.roster { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.roster .r { display: flex; justify-content: space-between; padding: 8px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; background: rgba(0,0,0,.3); }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--red); font-size: 13px; min-height: 18px; }

/* boon choice */
.choice-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.choice-title { font-family: var(--serif); font-size: 28px; letter-spacing: .2em; color: var(--gold); text-shadow: 0 0 18px rgba(255,210,122,.4); }
.cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.card { width: 230px; min-height: 300px; padding: 18px 16px; border-radius: 14px; border: 2px solid; background: linear-gradient(180deg, rgba(30,22,60,.96), rgba(10,8,22,.98)); cursor: pointer; display: flex; flex-direction: column; gap: 8px; position: relative; transition: transform .15s, box-shadow .15s; animation: cardin .35s ease both; }
.card:hover { transform: translateY(-8px) scale(1.03); }
.card .sigil { width: 70px; height: 70px; margin: 4px auto 6px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px; font-family: var(--serif); }
.card .cn { font-family: var(--serif); font-size: 20px; text-align: center; }
.card .cr { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; text-align: center; }
.card .cd { font-size: 14px; color: #d8d2f5; line-height: 1.45; text-align: center; flex: 1; }
.card .cl { font-size: 12px; text-align: center; color: var(--muted); }
.card .hk { position: absolute; top: 8px; left: 10px; font-size: 12px; color: var(--muted); }
.card .newtag { position: absolute; top: 8px; right: 10px; font-size: 10px; letter-spacing: .1em; color: var(--green); }

/* results */
.results h1 { font-family: var(--serif); letter-spacing: .25em; font-size: 46px; margin: 0; text-align: center; }
.results .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.results .st { text-align: center; padding: 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: rgba(0,0,0,.25); }
.results .st b { display: block; font-family: var(--serif); font-size: 24px; color: var(--gold); }

#toast-root { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 18px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 8px; animation: toast 3s ease forwards; font-size: 14px; }

@keyframes pulse { 50% { opacity: .4; } }
@keyframes glowp { 50% { box-shadow: 0 0 4px rgba(255,210,122,.15); } }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.96); letter-spacing: .5em; } 15% { opacity: 1; transform: translate(-50%, -50%); } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dmgfloat { 0% { opacity: 1; margin-top: 0; transform: translate(-50%, -50%) scale(1.3); } 20% { transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; margin-top: -46px; } }
@keyframes ftext { 0% { opacity: 0; margin-top: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; margin-top: -50px; } }
@keyframes cardin { from { opacity: 0; transform: translateY(30px); } }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

@media (max-width: 1100px) {
  .hub-left { width: 290px; }
  .hub-right { width: 46vw; }
}

/* ------------------------------------------------- accounts, tiers, ranked trees */
.acct { margin-top: 18px; font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; max-width: 520px; }
.acct b { color: var(--text); }
.char-card .role { font-family: var(--sans); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-left: 6px; }
.ability .kind { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin-left: 6px; font-weight: 400; }
.tree { height: 470px; }
.node { width: 54px; height: 54px; margin: -27px 0 0 -27px; font-size: 18px; }
.node.part { border-color: rgba(199,125,255,.7); background: radial-gradient(circle at 35% 30%, #6a3fa0, #1a1030); color: #e6d0ff; }
.node.key { border-radius: 12px; transform: rotate(45deg); }
.node.key > * , .node.key { }
.node.key .cost { transform: rotate(-45deg); }
.rowlv { position: absolute; left: -4px; transform: translateY(-50%); font-size: 10px; color: rgba(255,255,255,.25); letter-spacing: .05em; }
.rowlv.ok { color: rgba(255,210,122,.6); }
.nm-select { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); text-align: center; min-width: 230px; justify-content: space-between; }
.nm-label { font-family: var(--serif); font-size: 16px; color: #ff9db0; letter-spacing: .08em; }
.lvup { text-align: center; font-family: var(--serif); font-size: 20px; color: var(--gold); margin-bottom: 12px; }
.authform .row label { width: 110px; }

/* ----------------------------------------------------------------- UI polish pass */
#game canvas { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg fill='none' stroke='%23000' stroke-width='4' stroke-linecap='round'%3E%3Ccircle cx='16' cy='16' r='7'/%3E%3Cpath d='M16 2v7M16 23v7M2 16h7M23 16h7'/%3E%3C/g%3E%3Cg fill='none' stroke='%23ffe9b0' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='16' cy='16' r='7'/%3E%3Cpath d='M16 2v7M16 23v7M2 16h7M23 16h7'/%3E%3C/g%3E%3Ccircle cx='16' cy='16' r='1.6' fill='%23fff'/%3E%3C/svg%3E") 16 16, crosshair; }
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; }
.ab .ic { width: 30px; height: 30px; color: #efe6ff; filter: drop-shadow(0 0 6px rgba(199,125,255,.7)); transition: opacity .15s; }
.ab.ult .ic { width: 36px; height: 36px; color: var(--gold); filter: drop-shadow(0 0 8px rgba(255,210,122,.8)); }
.ab.cooling .ic { opacity: .35; }
.ab { border-radius: 12px; transition: border-color .2s; }
.ab:not(.cooling) { border-color: rgba(199,125,255,.55); }
.ab.pop { animation: abpop .35s ease-out; }
.ab .nm { font-size: 9px; padding: 1px 0; }
.boon-ic .ic { width: 18px; height: 18px; }
.card .sigil .ic { width: 38px; height: 38px; }
.chip { align-self: center; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; border: 1px solid; border-radius: 10px; padding: 2px 8px; }
.abic { display: inline-block; margin-right: 4px; font-size: 16px; }
.ability { grid-template-columns: 62px 1fr; }
.hud-player { padding: 10px 12px; background: linear-gradient(90deg, rgba(8,6,20,.72), rgba(8,6,20,0)); border-left: 3px solid var(--violet); border-radius: 4px; }
.hud-player .bar { height: 20px; background-image: repeating-linear-gradient(90deg, transparent 0 24px, rgba(0,0,0,.35) 24px 25px); }
.hud-player .bar .fill, .hud-player .bar .ghost { mix-blend-mode: normal; }
.hud-player.low .bar { animation: lowhp .7s infinite; border-color: #ff4d6d; }
.hint { position: absolute; bottom: 104px; left: 50%; transform: translateX(-50%); font-size: 13px; color: var(--muted); padding: 6px 14px; background: rgba(8,6,20,.7); border-radius: 16px; border: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
.hint b { color: var(--gold); }
.prompt { bottom: 140px; }
.sheet { display: grid; grid-template-columns: 240px minmax(280px, 420px); gap: 22px; }
.sheet h3 { font-family: var(--serif); margin: 0 0 8px; letter-spacing: .08em; color: var(--gold); font-weight: 600; }
.stat { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px; }
.stat span { color: var(--muted); }
.boonlist { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 6px; }
.bl { display: grid; grid-template-columns: 26px 1fr; gap: 8px; font-size: 13px; line-height: 1.35; }
.bl .bic { font-size: 20px; }
.card { backdrop-filter: blur(3px); }
.card:hover { box-shadow: 0 0 40px rgba(255,210,122,.35) !important; border-color: var(--gold) !important; }
.netinfo { font-variant-numeric: tabular-nums; }
::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-thumb { background: rgba(199,125,255,.35); border-radius: 4px; }
@keyframes abpop { 0% { transform: scale(1.18); box-shadow: 0 0 24px rgba(255,255,255,.9); } 100% { transform: scale(1); } }
@keyframes lowhp { 50% { box-shadow: 0 0 14px rgba(255,77,109,.9); } }
@media (max-height: 760px) { .tree { height: 420px; } .char-detail { font-size: 13px; } }

.link { color: var(--cyan); font-size: 13px; }
.sub { font-family: var(--serif); font-size: 15px; letter-spacing: .06em; margin: 14px 0 2px; color: var(--gold); font-weight: 600; }
.ok { color: var(--green); font-size: 13px; min-height: 16px; }
.acct button { margin-left: 4px; }

/* -------------------------------------------------------------------- tutorial */
.tut { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); min-width: 420px; max-width: 560px; padding: 12px 16px; background: rgba(12, 9, 28, 0.92); border: 1px solid var(--gold); border-radius: 12px; box-shadow: 0 0 30px rgba(255,210,122,.25); pointer-events: none; }
.tut-n { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.tut-main { display: flex; gap: 14px; align-items: center; }
.tut-main b { font-family: var(--serif); font-size: 18px; letter-spacing: .04em; }
.tut-t { color: #d8d2f5; font-size: 14px; line-height: 1.4; margin-top: 2px; }
.keycap { flex: none; min-width: 58px; text-align: center; padding: 9px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.35); border-bottom-width: 4px; background: linear-gradient(180deg, #3a2f6a, #1d1640); font-weight: 700; font-size: 15px; color: #fff; }
.tut button { position: absolute; right: 10px; top: 8px; padding: 2px 8px; font-size: 11px; opacity: .7; pointer-events: auto; }
.tut-pop { animation: cardin .3s ease both; }
.tut-on .hint { display: none; }
#hud .bossbar:not(.hidden) ~ .x { display: none; }

/* ------------------------------------------------------------- touch controls */
html, body { overscroll-behavior: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#game, #touch { touch-action: none; }
#touch { position: absolute; inset: 0; display: none; z-index: 2; pointer-events: none; }
#hud { z-index: 3; }
#modal-root, #toast-root, .tooltip { z-index: 6; }
#modal-root { position: absolute; inset: 0; pointer-events: none; }
body.touch #touch { display: block; }
#hud.hidden ~ #touch, body.touch #hud.hidden ~ #touch { display: none; }
.tz { position: absolute; top: 18%; bottom: 0; pointer-events: auto; }
.tz-move { left: 0; width: 45%; }
.tz-aim { right: 0; width: 55%; }
.stick { position: absolute; width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); background: rgba(255,255,255,.06); }
.stick i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(255,210,122,.55); box-shadow: 0 0 16px rgba(255,210,122,.6); }
.stick-aim i { background: rgba(199,125,255,.6); box-shadow: 0 0 16px rgba(199,125,255,.7); }
.tbtn { position: absolute; pointer-events: auto; border-radius: 50%; width: 46px; height: 46px; padding: 0; font: 700 12px var(--sans); background: rgba(16,12,34,.7); }
.t-pause { top: 10px; right: 10px; }
.t-use { right: calc(250px + env(safe-area-inset-right)); bottom: 22px; width: 58px; height: 58px; border-color: var(--gold); color: var(--gold); }
body.touch .abilities { left: auto; right: env(safe-area-inset-right); bottom: 0; transform: none; width: 320px; height: 300px; display: block; pointer-events: none; }
body.touch .ab { position: absolute; width: 66px; height: 66px; border-radius: 50%; pointer-events: auto; opacity: .92; }
body.touch .ab.held, .tbtn.held { transform: scale(.9); filter: brightness(1.5); }
body.touch .ab .key, body.touch .ab .nm { display: none; }
body.touch .ab[data-k=primary] { display: none; }
body.touch .ab[data-k=secondary] { right: 18px; bottom: 196px; }
body.touch .ab[data-k=skill] { right: 104px; bottom: 226px; }
body.touch .ab[data-k=dash] { right: 196px; bottom: 184px; }
body.touch .ab[data-k=ultimate] { right: 236px; bottom: 96px; width: 74px; height: 74px; }
body.touch .hint, body.touch #game canvas { cursor: none; }
body.touch .hint { display: none; }
body.touch .prompt { bottom: auto; top: 150px; }
#rotate { display: none; position: fixed; inset: 0; z-index: 20; background: #07060f; color: var(--gold); font-family: var(--serif); font-size: 22px; letter-spacing: .1em; align-items: center; justify-content: center; text-align: center; padding: 30px; }
@media (orientation: portrait) and (pointer: coarse) and (max-width: 820px) { #rotate { display: flex; } }

/* Small screens (phones in landscape, small laptop windows). */
@media (max-height: 560px) {
  .hud-player { transform: scale(.78); transform-origin: top left; left: 8px; top: 6px; }
  .hud-floor { transform: translateX(-50%) scale(.8); transform-origin: top center; top: 4px; }
  .hud-boons { transform: scale(.8); transform-origin: top right; right: 64px; top: 8px; max-width: 240px; }
  .bossbar { top: 50px; }
  .tut { top: 58px; transform: translateX(-50%) scale(.82); transform-origin: top center; }
  .card { width: 176px; min-height: 0; padding: 10px; gap: 4px; }
  .card .sigil { width: 44px; height: 44px; margin: 0 auto; }
  .card .sigil .ic { width: 24px; height: 24px; }
  .card .cn { font-size: 16px; } .card .cd { font-size: 12px; }
  .choice-title { font-size: 20px; } .choice-wrap { gap: 8px; }
  .hub-top { height: 44px; padding: 0 12px; } .hub-top .brand { font-size: 16px; }
  .hub-left { top: 50px; bottom: 62px; left: 10px; width: 250px; gap: 6px; overflow-y: auto; }
  .hub-right { top: 50px; bottom: 62px; right: 10px; width: 46vw; }
  .char-card { padding: 7px 8px 7px 12px; } .char-card .nm { font-size: 15px; letter-spacing: .02em; } .char-card .lv { font-size: 11px; right: 7px; }
  .hub-bottom { bottom: 8px; gap: 8px; } .hub-bottom button { font-size: 15px; padding: 9px 16px; }
  .nm-select { min-width: 190px; padding: 3px 8px; }
  .title-wrap .menu { margin-top: 10px; gap: 6px; } .title-wrap .menu button { padding: 9px 18px; font-size: 16px; }
  .panel { padding: 14px 18px; max-height: 94vh; overflow-y: auto; }
  .sheet { grid-template-columns: 200px 1fr; gap: 12px; } .boonlist { max-height: 150px; }
  .results h1 { font-size: 28px; } .results .stats { margin: 10px 0; gap: 6px; }
}
.tut { z-index: 4; }

.tut.tut-low { top: auto; bottom: 10px; }
.t-use { display: none; }
body.can-use .t-use { display: block; }
@media (max-height: 560px) {
  .hub-top .right { gap: 6px; }
  .hub-top .name { width: 110px; padding: 4px 8px; }
  .hub-top button, .currency { white-space: nowrap; padding: 4px 10px; font-size: 12px; }
  .currency .muted { display: none; }
  .char-card .ti { display: none; }
  .char-card .lv { top: 9px; }
  .tut.tut-low { transform: translateX(-50%) scale(.7); transform-origin: bottom center; bottom: 2px; }
}

/* ---------------------------------------------- accessibility + controller focus */
#hud, #modal-root, .screen { zoom: var(--ui, 1); }
.padfocus { outline: 3px solid var(--gold) !important; outline-offset: 3px; box-shadow: 0 0 22px rgba(255,210,122,.7) !important; }
.keybtn { min-width: 130px; text-align: center; }
.keybtn.listening { border-color: var(--gold); color: var(--gold); animation: pulse 1s infinite; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--violet); }
.reduce-flash .hud-player.low .bar, .reduce-flash .ab.pop, .reduce-flash .ab.ult.ready, .reduce-flash .node.avail { animation: none; }
.reduce-flash .banner { animation-name: toast; }

/* ---- P4: relics, feats, codex, pacts, daily ---- */
.tabs { flex-wrap: wrap; }
.tab { padding: 8px 12px; font-size: 14px; }
.tab .count { font-size: 11px; color: var(--muted); font-family: var(--sans, sans-serif); letter-spacing: 0; }
.sanct.locked .n, .sanct.locked .d { opacity: .55; }
.feat, .pact { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 9px 6px; border-bottom: 1px solid rgba(255,255,255,.06); }
.feat .n, .pact .n { font-family: var(--serif); font-size: 16px; }
.feat .d, .pact .d { color: var(--muted); font-size: 13px; }
.feat .mark, .pact .mark { text-align: center; color: var(--muted); }
.feat .pay, .pact .pay { color: #ff8be0; font-size: 13px; white-space: nowrap; }
.feat.done .n { color: var(--gold); } .feat.done .mark { color: #7cff6b; } .feat.done .pay { opacity: .5; }
.feat.new { background: rgba(255,210,122,.08); border-radius: 8px; } .feat.new .mark { color: var(--gold); } .feat.new .pay { opacity: 1; }
.relic-tag { color: #aef4ff; white-space: nowrap; }
.feat-list { max-height: 30vh; overflow-y: auto; margin-bottom: 12px; }
.pact { cursor: pointer; border: 1px solid transparent; border-radius: 8px; }
.pact:hover { background: rgba(255,255,255,.04); }
.pact.on { border-color: #ff8fa3; background: rgba(255,143,163,.08); } .pact.on .mark { color: #ff8fa3; }
.pact-btn.on { border-color: #ff8fa3; color: #ff8fa3; }
.hub-bottom .pact-btn { font-size: 15px; padding: 10px 16px; }
.cx-head { font-family: var(--serif); color: var(--gold); letter-spacing: .1em; margin: 14px 0 4px; }
.tab-body h4 { margin: 10px 0 6px; font-family: var(--serif); letter-spacing: .08em; }
.cx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.cx { padding: 7px 9px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(0,0,0,.25); }
.cx .n { font-family: var(--serif); font-size: 14px; } .cx .d { color: var(--muted); font-size: 12px; }
.cx.unseen { opacity: .45; border-style: dashed; }
.board { margin: 12px 0; max-height: 34vh; overflow-y: auto; }
.board table { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th { text-align: left; color: var(--muted); font-weight: normal; font-size: 12px; padding: 4px 6px; }
.board td { padding: 5px 6px; border-top: 1px solid rgba(255,255,255,.06); }
.board .num { text-align: right; } .board tr.me td { color: var(--gold); }
@media (max-height: 560px), (max-width: 900px) {
  .tab { padding: 6px 9px; font-size: 12px; }
  .hub-bottom { flex-wrap: wrap; } .hub-bottom .pact-btn { font-size: 13px; padding: 8px 10px; }
}

.regalia { font-size: 12px; color: var(--muted); margin-bottom: 8px; } .regalia b { color: var(--gold); }

/* ---- encounters ---- */
.event-text { max-width: 620px; margin: 0 auto 16px; text-align: center; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 17px; }
.event-card { border-color: #d9c8ff; box-shadow: 0 0 22px rgba(217,200,255,.18); min-height: 0; padding-top: 34px; }
.event-card .cn { color: #d9c8ff; margin-bottom: 8px; }
.event-card.off { opacity: .4; cursor: not-allowed; filter: grayscale(1); }

/* ---- story ---- */
.story { max-width: 560px; } .story h2 { text-align: center; }
.story p { font-family: var(--serif); font-size: 17px; line-height: 1.6; color: var(--text); margin: 0 0 14px; }
.note { padding: 9px 11px; margin-bottom: 6px; border-left: 3px solid var(--gold); background: rgba(0,0,0,.25); border-radius: 0 8px 8px 0; }
.note .n { font-family: var(--serif); font-size: 15px; color: var(--gold); } .note .d { font-size: 13px; color: var(--muted); line-height: 1.5; font-style: italic; }
.note.unseen { opacity: .45; border-left-style: dashed; } .note.unseen .d { font-style: normal; }

.report-row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.report-row select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }

/* ---- results breakdown and first-encounter cards ---- */
.breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0 0 14px; text-align: left; }
.breakdown h4 { margin: 0 0 6px; font-family: var(--serif); letter-spacing: .08em; color: var(--muted); font-weight: normal; }
.brk { display: grid; grid-template-columns: 130px 1fr 38px; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 3px; }
.brk span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .brk b { text-align: right; font-weight: normal; color: var(--muted); }
.brk-bar { height: 7px; background: rgba(255,255,255,.07); border-radius: 4px; overflow: hidden; } .brk-bar i { display: block; height: 100%; border-radius: 4px; }
.intro-card { max-width: 340px; margin-top: 8px; padding: 10px 14px; border-left: 3px solid var(--gold); border-radius: 0 10px 10px 0; background: rgba(12,9,26,.92); animation: toast 6.5s ease forwards; pointer-events: none; }
.intro-card .n { font-family: var(--serif); font-size: 17px; } .intro-card .d { font-size: 13px; color: var(--text); line-height: 1.4; }
@media (max-width: 900px) { .breakdown { grid-template-columns: 1fr; gap: 8px; } .intro-card { max-width: 260px; } }

.title-foot a { color: var(--muted); pointer-events: auto; } .title-foot a:hover { color: var(--gold); }

.bl.plain { grid-template-columns: 1fr; }
