/* Wardlight UI design system. Night navy panels, gold trim, amber wardlight accents. */
:root {
  --bg0: #090b16; --bg1: #121629; --bg2: #1a2040; --bg3: #252d57; --line: #343e73;
  --ink: #f3ecdd; --ink2: #b9bfd8; --ink3: #7f88ad;
  --gold: #e9bd62; --gold2: #b98632; --amber: #ffb347; --amber2: #ff8a2b; --teal: #3fe0c5;
  --green: #5fd38a; --green2: #2f9e5c; --red: #ef5a5f; --red2: #b3343c; --blue: #58a6ff; --blue2: #2f6fd0; --violet: #c77dff;
  --r: 14px; --r-s: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .55);
  --font: "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #05060c; color: var(--ink); font-family: var(--font); overflow: hidden; overscroll-behavior: none; }
body { display: flex; justify-content: center; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; }
#app { position: relative; height: 100dvh; width: min(100vw, calc(100dvh * .62)); min-width: min(100vw, 320px); overflow: hidden; background: var(--bg0); font-size: 14px; line-height: 1.3; container-type: inline-size; }
@media (max-aspect-ratio: 62/100) { #app { width: 100vw; } }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels, #hud, #layer-panels, #layer-top { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#labels { z-index: 2; } #hud { z-index: 5; } #layer-panels { z-index: 10; } #layer-top { z-index: 20; }
#hud > *, #layer-panels > *, #layer-top > .tut, #labels > .hit { pointer-events: auto; }
.hidden { display: none !important; }

/* ---------- icons */
.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; display: inline-block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
img.ic { object-fit: contain; }

/* ---------- typography */
.h1 { font-size: 20px; font-weight: 800; letter-spacing: .3px; }
.h2 { font-size: 16px; font-weight: 800; letter-spacing: .2px; }
.cap { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink3); }
.dim { color: var(--ink2); } .dim2 { color: var(--ink3); } .gold { color: var(--gold); } .good { color: var(--green); } .bad { color: var(--red); } .teal { color: var(--teal); }
.small { font-size: 12px; } .tiny { font-size: 11px; } .b { font-weight: 800; } .center { text-align: center; } .right { text-align: right; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.stroke { text-shadow: 0 1px 0 #000, 0 0 3px #000, 0 2px 4px rgba(0, 0, 0, .7); }

/* ---------- layout helpers */
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .row.tight { gap: 4px; } .row.spread { justify-content: space-between; } .row.mid { justify-content: center; }
.col { display: flex; flex-direction: column; gap: 8px; } .grow { flex: 1; min-width: 0; } .gap0 { gap: 0; } .gap4 { gap: 4px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; }
.grid { display: grid; gap: 8px; } .grid.c2 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(4, 1fr); } .grid.c5 { grid-template-columns: repeat(5, 1fr); }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- buttons */
.btn { --c1: #6f7bb5; --c2: #49538a; --c3: #2c3360; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 6px 16px; border: 0; border-radius: 12px; cursor: pointer;
  font-weight: 800; font-size: 14px; letter-spacing: .3px; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .55);
  background: linear-gradient(180deg, var(--c1), var(--c2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 0 rgba(0, 0, 0, .22), 0 3px 0 var(--c3), 0 5px 10px rgba(0, 0, 0, .45);
  transition: transform .06s, filter .12s; flex: none; }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 0 var(--c3), 0 2px 5px rgba(0, 0, 0, .4); filter: brightness(.94); }
.btn:disabled, .btn.off { filter: grayscale(.85) brightness(.7); cursor: default; }
.btn.primary, .btn.gold { --c1: #ffd77a; --c2: #f0a02e; --c3: #a3600f; color: #3b2203; text-shadow: 0 1px 0 rgba(255, 255, 255, .45); }
.btn.green { --c1: #86e6a4; --c2: #3db56a; --c3: #1f7541; color: #06311a; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
.btn.blue { --c1: #7fc0ff; --c2: #3b82e6; --c3: #1e4fa3; }
.btn.red { --c1: #ff8d8d; --c2: #de4750; --c3: #8f2530; }
.btn.violet { --c1: #dca4ff; --c2: #9a55e0; --c3: #5c2c96; }
.btn.ghost { background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink2); text-shadow: none; }
.btn.sm { min-height: 32px; padding: 3px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.lg { min-height: 52px; font-size: 17px; padding: 8px 22px; border-radius: 14px; }
.btn.wide { width: 100%; } .btn.two { flex-direction: column; gap: 0; line-height: 1.1; } .btn .sub { font-size: 11px; font-weight: 700; opacity: .9; display: flex; align-items: center; gap: 3px; }
.btn .dotn, .nav-b .dotn, .side-b .dotn { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: linear-gradient(#ff6b6b, #d92d3a); color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #1b1830, 0 2px 4px rgba(0, 0, 0, .5); text-shadow: none; }
.dotn:empty { min-width: 12px; height: 12px; padding: 0; }
.xbtn { width: 34px; height: 34px; border-radius: 10px; border: 0; cursor: pointer; background: linear-gradient(#ff8d8d, #d8404a); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 2px 0 #8f2530, 0 4px 8px rgba(0, 0, 0, .4); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 18px; }
.xbtn:active { transform: translateY(2px); }

/* ---------- panels / sheets */
.backdrop { position: absolute; inset: 0; background: rgba(4, 5, 12, .62); backdrop-filter: blur(2px); animation: fade .16s ease-out; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; display: flex; flex-direction: column; border-radius: 20px 20px 0 0; background: linear-gradient(180deg, #232b55 0%, #171c38 22%, #121629 100%);
  box-shadow: 0 -2px 0 var(--gold), 0 -3px 0 #7a5417, 0 -18px 40px rgba(0, 0, 0, .6); animation: slideup .22s cubic-bezier(.2, .9, .3, 1); padding-bottom: var(--safe-b); }
.sheet.full { top: calc(var(--safe-t) + 46px); max-height: none; }
.sheet.pop { left: 5%; right: 5%; bottom: auto; top: 50%; transform: translateY(-50%); max-height: 84%; border-radius: 18px; box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px #5e4012, var(--shadow); animation: popin .2s cubic-bezier(.2, 1.2, .4, 1); }
.sheet-head { position: relative; flex: none; display: flex; align-items: center; justify-content: center; min-height: 50px; padding: 8px 52px; border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, #3a4686, #262f61); border-bottom: 2px solid #0e1124; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22); }
.sheet.pop .sheet-head { border-radius: 16px 16px 0 0; }
.sheet-head .title { font-size: 17px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; color: #ffe9b8; text-shadow: 0 2px 0 rgba(0, 0, 0, .5); text-align: center; }
.sheet-head .xbtn { position: absolute; right: 9px; top: 8px; }
.sheet-head .backb { position: absolute; left: 9px; top: 8px; width: 34px; height: 34px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .1); display: grid; place-items: center; cursor: pointer; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: #3a4686 transparent; }
.sheet-foot { flex: none; padding: 10px 12px 12px; border-top: 1px solid rgba(255, 255, 255, .07); background: rgba(8, 10, 22, .55); display: flex; gap: 10px; align-items: center; justify-content: center; }
.sheet-foot:empty { display: none; }
@keyframes slideup { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popin { from { transform: translateY(-50%) scale(.86); opacity: 0; } to { transform: translateY(-50%) scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- cards, lists */
.card { background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03)); border: 1px solid rgba(255, 255, 255, .09); border-radius: var(--r); padding: 10px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.card.gold { border-color: rgba(233, 189, 98, .55); background: linear-gradient(180deg, rgba(233, 189, 98, .16), rgba(233, 189, 98, .04)); }
.card.dark { background: rgba(6, 8, 18, .5); }
.card.tap { cursor: pointer; } .card.tap:active { filter: brightness(1.2); }
.list { display: flex; flex-direction: column; gap: 8px; }
.sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 6px 0; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 2px; border-bottom: 1px dashed rgba(255, 255, 255, .08); font-size: 13px; }
.kv:last-child { border-bottom: 0; } .kv > :last-child { font-weight: 800; text-align: right; }
.kv .up { color: var(--green); margin-left: 4px; }
.empty { padding: 28px 12px; text-align: center; color: var(--ink3); }
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 8px; font-size: 11px; font-weight: 800; background: rgba(255, 255, 255, .1); color: var(--ink2); }
.badge.gold { background: linear-gradient(#ffd77a, #e09a2a); color: #3b2203; } .badge.red { background: var(--red2); color: #fff; } .badge.green { background: var(--green2); color: #fff; } .badge.teal { background: #14806f; color: #eafffb; }
.lvl { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 7px; background: linear-gradient(#ffd77a, #d98f22); color: #3b2203; font-weight: 900; font-size: 12px; box-shadow: 0 0 0 1.5px #5e4012, 0 2px 3px rgba(0, 0, 0, .5); }

/* ---------- tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(5, 7, 16, .6); border-radius: 12px; margin-bottom: 10px; flex: none; }
.tab { position: relative; flex: 1; min-height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--ink3); font-weight: 800; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 5px; }
.tab.on { background: linear-gradient(180deg, #4a58a6, #303a78); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 2px 5px rgba(0, 0, 0, .4); }
.tab .dotn { position: absolute; top: 2px; right: 4px; min-width: 8px; height: 8px; border-radius: 4px; background: var(--red); }

/* ---------- item tiles & chips */
.item { position: relative; width: 58px; height: 58px; border-radius: 12px; display: grid; place-items: center; flex: none; background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .22), rgba(255, 255, 255, .02) 70%), var(--rc2, #2a3156); box-shadow: inset 0 0 0 2px var(--rc, #55608f), inset 0 -8px 12px rgba(0, 0, 0, .28), 0 2px 5px rgba(0, 0, 0, .45); }
.item .ic { width: 36px; height: 36px; } .item img.art { width: 46px; height: 46px; object-fit: contain; }
.item .n { position: absolute; right: 4px; bottom: 2px; font-size: 11.5px; font-weight: 900; text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.item .tag { position: absolute; left: 3px; top: 2px; font-size: 9.5px; font-weight: 900; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000; letter-spacing: .2px; }
.item.sm { width: 44px; height: 44px; border-radius: 10px; } .item.sm .ic { width: 27px; height: 27px; } .item.sm img.art { width: 34px; height: 34px; }
.item.rC { --rc: #77839c; --rc2: #2c3348; } .item.rR { --rc: #58a6ff; --rc2: #1d3a66; } .item.rE { --rc: #c77dff; --rc2: #42216b; } .item.rL { --rc: #ffb84d; --rc2: #6b4310; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 5px; border-radius: 999px; background: rgba(6, 8, 18, .6); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); font-weight: 800; font-size: 12.5px; white-space: nowrap; }
.chip.lack { color: #ff8a8a; box-shadow: inset 0 0 0 1px rgba(239, 90, 95, .7); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- progress */
.bar { position: relative; height: 16px; border-radius: 8px; background: #0a0c18; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .08); overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 8px; background: linear-gradient(180deg, #ffe08a, #f29a1f); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55); transition: width .25s linear; }
.bar.green > i { background: linear-gradient(180deg, #9af0b5, #36ad64); } .bar.teal > i { background: linear-gradient(180deg, #8ff5e4, #1fa890); } .bar.red > i { background: linear-gradient(180deg, #ff9a9a, #d43d47); } .bar.blue > i { background: linear-gradient(180deg, #9fd0ff, #3b82e6); }
.bar > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.bar.thin { height: 8px; } .bar.thin > span { display: none; }

/* ---------- inputs */
.inp { width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 11px; border: 1.5px solid var(--line); background: #0b0e1d; color: var(--ink); font: inherit; outline: none; user-select: text; -webkit-user-select: text; }
.inp:focus { border-color: var(--gold); }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: 5px; background: #0a0c18; box-shadow: inset 0 1px 3px #000; outline: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c9, #f0a02e 60%, #a3600f); box-shadow: 0 2px 5px rgba(0, 0, 0, .6); cursor: pointer; }
.slider::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c9, #f0a02e 60%, #a3600f); }

/* ---------- toasts & reward fly */
.toasts { position: absolute; left: 0; right: 0; top: calc(var(--safe-t) + 92px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { max-width: 86%; padding: 8px 16px; border-radius: 12px; background: rgba(14, 17, 36, .94); box-shadow: 0 0 0 1.5px var(--line), var(--shadow); font-weight: 700; font-size: 13.5px; text-align: center; animation: toastin .25s cubic-bezier(.2, 1.3, .4, 1); }
.toast.good { box-shadow: 0 0 0 1.5px var(--green2), var(--shadow); color: #c9ffd9; } .toast.bad { box-shadow: 0 0 0 1.5px var(--red2), var(--shadow); color: #ffd0d0; } .toast.gold { box-shadow: 0 0 0 1.5px var(--gold2), var(--shadow); color: #ffe9b8; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .3s; }
@keyframes toastin { from { transform: translateY(10px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.fly { position: absolute; display: flex; align-items: center; gap: 4px; font-weight: 900; font-size: 15px; pointer-events: none; text-shadow: 0 1px 0 #000, 0 0 4px #000; animation: flyup 1.1s ease-out forwards; z-index: 30; }
@keyframes flyup { 0% { transform: translate(-50%, 0) scale(.6); opacity: 0; } 15% { transform: translate(-50%, -10px) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -70px) scale(1); opacity: 0; } }
.burst { animation: burst .35s cubic-bezier(.2, 1.4, .4, 1); } @keyframes burst { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pulse { animation: pulse 1.4s ease-in-out infinite; } @keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.glow { animation: glow 1.6s ease-in-out infinite; } @keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 196, 107, .0); } 50% { box-shadow: 0 0 0 5px rgba(255, 196, 107, .45); } }
.shake { animation: shake .3s; } @keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- boot / connection */
#boot { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 12px; overflow: hidden; padding: calc(var(--safe-t) + 11vh) 0 calc(var(--safe-b) + 7vh);
  background: radial-gradient(circle at 50% 38%, #3a2a55 0%, #151629 45%, #06070e 100%); transition: opacity .5s; }
#boot::before { content: ""; position: absolute; inset: 0; background: url(/assets/ui/keyart.webp) 50% 62% / cover no-repeat; filter: brightness(1.18) saturate(1.12); transform-origin: 50% 55%; animation: boot-art 9s ease-out both; }
#boot::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6, 7, 14, .62) 0%, rgba(6, 7, 14, .12) 30%, rgba(6, 7, 14, 0) 55%, rgba(6, 7, 14, .55) 80%, rgba(6, 7, 14, .95) 100%); }
#boot > * { position: relative; z-index: 1; }
@keyframes boot-art { from { transform: scale(1.09); opacity: 0; } 12% { opacity: 1; } to { transform: scale(1); opacity: 1; } }
#boot.done { opacity: 0; pointer-events: none; }
#boot .logo { font-size: 44px; font-weight: 900; letter-spacing: 3px; text-transform: uppercase; background: linear-gradient(180deg, #fff3c9 10%, #ffc46b 45%, #ff8a2b 90%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 22px rgba(255, 170, 60, .55)) drop-shadow(0 3px 0 rgba(0, 0, 0, .6)); }
#boot .tag { text-shadow: 0 1px 4px #000; color: var(--ink2); letter-spacing: 3px; text-transform: uppercase; font-size: 12px; font-weight: 700; }
#boot .bar { width: 62%; margin-top: auto; box-shadow: 0 0 18px rgba(255, 170, 60, .25); } #boot .msg { font-size: 12px; color: var(--ink2); min-height: 16px; text-shadow: 0 1px 3px #000; }
.netlost { position: absolute; left: 50%; top: calc(var(--safe-t) + 60px); transform: translateX(-50%); padding: 6px 14px; border-radius: 10px; background: var(--red2); font-weight: 800; font-size: 12.5px; z-index: 40; box-shadow: var(--shadow); }
