:root {
  --bg: #121418;
  --panel: #191c22;
  --panel2: #20242b;
  --line: #2b3039;
  --text: #eceff5;
  --dim: #8b93a3;
  --accent: #3b82f6;
  --gold: #fbbf24;
  --good: #4ade80;
  --bad: #f87171;
  --cs: 46px;
  --gap: 3px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3a3c41; color: var(--text); font-family: var(--font); user-select: none; -webkit-user-select: none; }
canvas#c { position: fixed; inset: 0; display: block; cursor: crosshair; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.hidden { display: none !important; }
.ic { display: inline-block; vertical-align: middle; flex: none; }
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto;
  background: rgba(12, 13, 17, .72); backdrop-filter: blur(6px); z-index: 10; animation: fadeIn .25s ease-out; }
#inv { z-index: 20; background: rgba(8, 9, 12, .8); }
#pause { z-index: 15; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; font: 600 14px/1 var(--font); letter-spacing: .04em; color: #fff; background: var(--accent);
  border: 1px solid transparent; border-radius: 10px; padding: 13px 22px; cursor: pointer; transition: transform .12s ease, background .15s, box-shadow .2s, border-color .15s; position: relative; overflow: hidden; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(59,130,246,.35); background: #4b8ff8; }
.btn:active { transform: translateY(1px) scale(.98); box-shadow: none; }
.btn.alt { background: var(--panel2); border-color: var(--line); color: var(--text); }
.btn.alt:hover { background: #272c35; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.btn.gold { background: var(--gold); color: #1c1400; }
.btn.gold:hover { background: #fcc946; box-shadow: 0 6px 22px rgba(251,191,36,.35); }
.btn.small { font-size: 12px; padding: 9px 13px; border-radius: 8px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%); transform: translateX(-120%); }
.btn:hover::after { transform: translateX(120%); transition: transform .55s ease; }

/* ---------- menu ---------- */
.card { text-align: center; padding: 34px 44px; animation: rise .5s cubic-bezier(.2,.8,.2,1); }
.logo { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 4px; }
.logo h1 { margin: 0; font-size: 60px; letter-spacing: .22em; font-weight: 800; padding-left: .22em; }
.mark { position: relative; width: 58px; height: 58px; animation: bob 3.2s ease-in-out infinite; }
.mark .sq { position: absolute; inset: 0; background: #3b82f6; border: 4px solid #1e3a8a; border-radius: 3px; box-shadow: 0 0 40px rgba(59,130,246,.45); }
.mark .bar { position: absolute; left: 50%; top: 50%; width: 66px; height: 16px; margin-top: -8px; margin-top: -7px; background: #9097a3; border: 3px solid #5d636e; border-left: 0; transform-origin: 0 50%; animation: aim 6s ease-in-out infinite; z-index: -1; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes aim { 0% { transform: rotate(-30deg); } 50% { transform: rotate(35deg); } 100% { transform: rotate(-30deg); } }
.sub { color: var(--dim); margin: 0 0 30px; letter-spacing: .18em; font-size: 12px; font-weight: 500; }
.menu-btns { display: flex; flex-direction: column; gap: 10px; width: 260px; margin: 0 auto; }
.badge { display: inline-block; min-width: 20px; padding: 2px 7px; border-radius: 99px; background: var(--gold); color: #1c1400; font-size: 11px; font-weight: 700; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(251,191,36,.5); } 50% { box-shadow: 0 0 0 6px rgba(251,191,36,0); } }
/* start-wave picker */
.picker { display: flex; align-items: stretch; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.picker .pk { width: 46px; border: 0; background: transparent; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.picker .pk:hover:not([disabled]) { background: #2b313b; }
.picker .pk[disabled] { opacity: .25; cursor: default; }
.picker .pv { flex: 1; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.picker .pv small { font-size: 9.5px; letter-spacing: .16em; color: var(--dim); font-weight: 600; }
.picker .pv b { font-size: 17px; font-weight: 700; }
.picker.single .pk { visibility: hidden; }
.hint { color: var(--dim); font-size: 12.5px; margin-top: 26px; line-height: 1.9; }

/* ---------- enemy index ---------- */
#index { z-index: 25; background: rgba(8, 9, 12, .85); }
.idx-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; align-content: start; }
.idx-body::-webkit-scrollbar { width: 8px; }
.idx-body::-webkit-scrollbar-thumb { background: #2f343d; border-radius: 6px; }
.ecard { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; transition: border-color .2s, transform .15s; }
.ecard:hover { transform: translateY(-2px); border-color: #3b4350; }
.ecard.boss { border-left: 3px solid var(--bc); }
.ecard.unseen .eprev { opacity: .45; filter: grayscale(.7); }
.ecard.unseen .en { color: #aeb4c0; }
.eprev { flex: none; align-self: flex-start; background: #3a3c41; border-radius: 10px; width: 72px; height: 72px; }
.ecard.boss .eprev { width: 96px; height: 96px; }
.idx-body.bosses { grid-template-columns: repeat(auto-fill, minmax(470px, 1fr)); }
.einfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.en { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tier { font-size: 9.5px; letter-spacing: .1em; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: #2b313b; color: var(--dim); }
.tier.t1 { background: #4a2a1b; color: #ff9a5c; } .tier.t2 { background: #1b3a4a; color: #7fd8ff; } .tier.t3 { background: #1f4a1f; color: #86ff74; }
.tier.t4 { background: #36204f; color: #bf8cff; } .tier.t5 { background: #4a4417; color: #ffe14d; }
.ew { font-size: 11.5px; color: var(--dim); display: flex; align-items: center; gap: 5px; }
.ed { font-size: 12.5px; color: #c6ccda; line-height: 1.5; }
.es { display: flex; gap: 14px; font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.es b { color: var(--text); font-weight: 600; }
.phs { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.ph { font-size: 11.5px; color: var(--dim); line-height: 1.45; }
.ph b { color: var(--text); font-weight: 600; margin-right: 4px; }
.cnt2 { font-size: 11px; opacity: .7; font-weight: 500; margin-left: 2px; }
.tab.on .cnt2 { opacity: .9; }
@media (max-width: 760px) { .idx-body { grid-template-columns: 1fr; } }
.hint b { color: var(--text); font-weight: 600; }
.kbd { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; color: var(--text); font-size: 11.5px; font-weight: 600; }
.hint a { color: #5d6575; text-decoration: none; font-size: 11px; }
.hint a:hover { color: var(--bad); }

/* ---------- dead / pause card ---------- */
.dead-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px 40px; text-align: center; min-width: 400px; max-width: 94vw; animation: rise .45s cubic-bezier(.2,.8,.2,1); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.dead-card h2 { margin: 0 0 4px; font-size: 32px; letter-spacing: .26em; padding-left: .26em; color: var(--bad); font-weight: 800; animation: spread .9s cubic-bezier(.2,.8,.2,1); }
@keyframes spread { from { letter-spacing: -.05em; opacity: 0; } to { letter-spacing: .26em; opacity: 1; } }
.dead-sub { color: var(--dim); font-size: 13px; }
.dead-stats { display: flex; justify-content: center; gap: 30px; margin: 20px 0; color: var(--dim); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.dead-stats b { display: block; color: var(--text); font-size: 26px; font-weight: 700; letter-spacing: 0; margin-bottom: 2px; }
.crate-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0 22px; min-height: 38px; }
.chip { display: flex; align-items: center; gap: 9px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 13px; font-weight: 600; font-size: 13px; animation: pop .4s cubic-bezier(.2,1.4,.4,1) backwards; }
.chip i { width: 16px; height: 13px; border-radius: 3px; background: var(--cc); box-shadow: 0 0 12px var(--cc); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- inventory ---------- */
.panel { width: min(1120px, 97vw); height: min(780px, 95vh); background: var(--bg); border: 1px solid var(--line); border-radius: 18px;
  display: flex; flex-direction: column; box-shadow: 0 30px 90px rgba(0,0,0,.65); overflow: hidden; animation: rise .3s cubic-bezier(.2,.8,.2,1); }
.p-head { display: flex; align-items: center; gap: 6px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 8px; font: 600 13px var(--font); letter-spacing: .06em; color: var(--dim); background: transparent; border: 0; padding: 10px 16px; border-radius: 9px; cursor: pointer; transition: background .15s, color .15s; }
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.on { color: #fff; background: var(--accent); }
.grow { flex: 1; }
.coins { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--gold); margin-right: 8px; }
.coins.bump { animation: bump .35s ease-out; }
@keyframes bump { 50% { transform: scale(1.25); } }
.x { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; transition: background .15s, transform .15s; }
.x:hover { background: var(--bad); border-color: var(--bad); transform: rotate(90deg); }
.p-body { flex: 1; min-height: 0; display: flex; }
.lo-left { width: 520px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; border-right: 1px solid var(--line); overflow-y: auto; }
.lo-right { flex: 1; min-width: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.h { margin: 0; font-size: 11px; letter-spacing: .16em; color: var(--dim); font-weight: 600; text-transform: uppercase; }
.helptxt { font-size: 12.5px; color: var(--dim); line-height: 1.6; }
.helptxt b { color: var(--text); font-weight: 600; }
.helptxt .ic { margin: -3px 1px 0; }

.board { position: relative; display: grid; grid-template-columns: repeat(9, var(--cs)); grid-auto-rows: var(--cs); gap: var(--gap); padding: 8px; background: #0e1013; border: 1px solid var(--line); border-radius: 14px; width: max-content; align-self: center; }
.cell { border-radius: 7px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; transition: background .15s, border-color .15s, color .15s; }
.cell.u { background: #252a32; border: 1px solid #323843; }
.cell.l { background: transparent; border: 1px solid #181b20; }
.cell.b { background: transparent; border: 1px dashed #3a414d; cursor: pointer; color: var(--dim); }
.cell.b:hover { border-color: var(--gold); color: var(--gold); background: rgba(251,191,36,.07); transform: scale(1.04); }
.cell.b.poor { cursor: not-allowed; }
.cell.b.poor:hover { border-color: #3a414d; color: var(--dim); background: transparent; transform: none; }
.cell.b small { font-size: 10px; font-weight: 700; margin-top: 1px; }
.cell.pv-ok { background: rgba(74,222,128,.22) !important; border-color: var(--good) !important; }
.cell.pv-bad { background: rgba(248,113,113,.2) !important; border-color: var(--bad) !important; }
.cell.flash::after { content: ""; position: absolute; inset: -2px; border-radius: 9px; border: 2px solid var(--gold); animation: flashRing .6s ease-out forwards; }
@keyframes flashRing { from { opacity: 1; transform: scale(.8); } to { opacity: 0; transform: scale(1.9); } }
.mods { position: absolute; left: 8px; top: 8px; width: 0; height: 0; }
.ptile { position: absolute; pointer-events: auto; cursor: grab; }
.ptile.pop { animation: place .4s cubic-bezier(.2,1.5,.4,1); }
@keyframes place { 0% { transform: scale(1.5); filter: brightness(2.2); } 100% { transform: scale(1); filter: none; } }

/* module tiles */
.mt { position: relative; width: 100%; height: 100%; border-radius: 8px; background: #1f2329; border: 2px solid var(--rc);
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--rc) 22%, transparent); display: flex; align-items: center; justify-content: center; overflow: hidden; transition: filter .15s; color: var(--rc); }
.mt .ic { width: 52%; height: 52%; max-width: 34px; max-height: 34px; }
.mt.big .ic { max-width: 44px; max-height: 44px; }
.mt .mult { position: absolute; right: 3px; bottom: 1px; font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; }
.mt .cnt { position: absolute; left: 3px; top: 1px; font-size: 10px; font-weight: 700; color: var(--gold); text-shadow: 0 1px 2px #000; }
.mt .sz { position: absolute; left: 3px; bottom: 1px; font-size: 9px; font-weight: 600; color: #ffffff99; }
.mt.r3 { animation: glow3 2.6s ease-in-out infinite; }
.mt.r4 { animation: glow4 2.2s ease-in-out infinite; }
.mt.r4::after, .mt.r3::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.28) 50%, transparent 62%); transform: translateX(-130%); animation: sheen 3.4s ease-in-out infinite; pointer-events: none; }
@keyframes glow3 { 50% { box-shadow: inset 0 0 14px color-mix(in srgb, var(--rc) 22%, transparent), 0 0 12px color-mix(in srgb, var(--rc) 45%, transparent); } }
@keyframes glow4 { 50% { box-shadow: inset 0 0 18px color-mix(in srgb, var(--rc) 35%, transparent), 0 0 18px color-mix(in srgb, var(--rc) 65%, transparent); } }
@keyframes sheen { 0%, 55% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }

.stats { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; font-size: 12.5px; }
.stats div { display: flex; justify-content: space-between; align-items: center; color: var(--dim); gap: 8px; }
.stats div span { display: inline-flex; align-items: center; gap: 7px; }
.stats b { color: var(--text); font-weight: 600; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fbtn { font: 600 12px var(--font); letter-spacing: .05em; color: var(--dim); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 13px; cursor: pointer; transition: all .15s; }
.fbtn:hover { color: var(--text); }
.fbtn.on { color: #fff; background: var(--panel2); border-color: var(--accent); }
.search { flex: 1; min-width: 120px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 8px 11px; font: 13px var(--font); user-select: text; outline: none; transition: border-color .15s; }
.search:focus { border-color: var(--accent); }
.mlist { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, 52px); grid-auto-rows: 52px; gap: 7px; align-content: start; padding: 4px 4px 4px 0; }
.mlist .item { cursor: grab; border-radius: 8px; transition: transform .12s; }
.mlist .item:hover { transform: translateY(-3px); }
.mlist .item:hover .mt { filter: brightness(1.25); }
.empty { color: var(--dim); padding: 30px 10px; text-align: center; grid-column: 1 / -1; line-height: 1.7; font-size: 13px; }
.mlist::-webkit-scrollbar, .lo-left::-webkit-scrollbar, .crates-wrap::-webkit-scrollbar { width: 8px; }
.mlist::-webkit-scrollbar-thumb, .lo-left::-webkit-scrollbar-thumb, .crates-wrap::-webkit-scrollbar-thumb { background: #2f343d; border-radius: 6px; }

/* ---------- crates tab ---------- */
.crates-wrap { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.crates-wrap > * { flex-shrink: 0; }
.crate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.ccard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 14px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; transition: transform .15s, border-color .2s; animation: pop .35s cubic-bezier(.2,1.3,.4,1) backwards; }
.ccard:hover { transform: translateY(-3px); border-color: var(--cc); }
.ccard .nm { font-weight: 600; font-size: 14px; }
.ccard .ct { color: var(--dim); font-weight: 600; font-size: 12px; }
.ccard .rowb { display: flex; gap: 6px; }
.crate-art { width: 74px; height: 62px; border-radius: 8px; position: relative; background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 78%, #fff) 0 24%, var(--cc) 24% 100%);
  box-shadow: inset 0 -10px 0 rgba(0,0,0,.22), 0 6px 22px color-mix(in srgb, var(--cc) 40%, transparent); transition: transform .2s; }
.crate-art::before { content: ""; position: absolute; left: 0; right: 0; top: 24%; height: 3px; background: rgba(0,0,0,.3); }
.crate-art::after { content: ""; position: absolute; left: 50%; top: 24%; width: 11px; height: 15px; margin-left: -5.5px; background: rgba(255,255,255,.8); border-radius: 0 0 4px 4px; }
.ccard:hover .crate-art { transform: translateY(-3px) rotate(-3deg); }
.crate-art.shake { animation: shake .65s ease-in-out; }
@keyframes shake { 0%,100% { transform: rotate(0) scale(1); } 15% { transform: rotate(-9deg) scale(1.08); } 30% { transform: rotate(9deg) scale(1.12); } 45% { transform: rotate(-12deg) scale(1.16); } 60% { transform: rotate(12deg) scale(1.2); } 85% { transform: rotate(-5deg) scale(1.3); filter: brightness(2.4); } }
.reveal { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; animation: pop .4s cubic-bezier(.2,1.4,.4,1); overflow: hidden; }
.reveal .big { width: 88px; height: 88px; flex: none; animation: drop .6s cubic-bezier(.2,1.4,.4,1); }
@keyframes drop { from { transform: scale(.2) rotate(-25deg); opacity: 0; filter: brightness(3); } to { transform: none; opacity: 1; filter: none; } }
.reveal .info { min-width: 240px; flex: 1; }
.reveal-list { display: flex; flex-wrap: wrap; gap: 8px; }
.reveal-list .item { width: 52px; height: 52px; animation: pop .35s cubic-bezier(.2,1.4,.4,1) backwards; }
.newtag { color: var(--good); font-weight: 700; font-size: 11px; letter-spacing: .14em; margin-bottom: 2px; }
.collect { color: var(--dim); font-size: 12.5px; }
.cindex { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 6px; font-size: 12px; color: var(--dim); }
.cindex div { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; }
.cindex i { width: 11px; height: 9px; border-radius: 2px; background: var(--cc); flex: none; }
.cindex .lk { opacity: .45; }

/* crate-open burst */
.burst { position: absolute; left: 62px; top: 62px; width: 0; height: 0; pointer-events: none; }
.burst .rays { position: absolute; width: 380px; height: 380px; margin: -190px 0 0 -190px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--bc) 55%, transparent) 0 6deg, transparent 6deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 68%); mask: radial-gradient(circle, #000 0, transparent 68%); animation: rays 1s ease-out forwards; }
.burst .ring { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 3px solid var(--bc); animation: ringOut .8s ease-out forwards; }
.burst .ring.r2 { animation-delay: .12s; }
.burst i { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--bc); box-shadow: 0 0 8px var(--bc); animation: fly .9s cubic-bezier(.1,.7,.3,1) forwards; }
@keyframes rays { from { opacity: 1; transform: rotate(0) scale(.2); } to { opacity: 0; transform: rotate(50deg) scale(1.1); } }
@keyframes ringOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(14); } }
@keyframes fly { from { opacity: 1; transform: translate(0,0) scale(1); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.2); } }
.reveal.glow { box-shadow: 0 0 40px color-mix(in srgb, var(--bc) 30%, transparent); border-color: color-mix(in srgb, var(--bc) 60%, var(--line)); }

/* ---------- tooltip / ghost / toast ---------- */
#tip { position: fixed; z-index: 100; pointer-events: none; width: 280px; background: rgba(14,16,20,.97); border: 1px solid #353b46; border-radius: 12px; padding: 13px 15px; box-shadow: 0 14px 40px rgba(0,0,0,.6); animation: tipIn .14s ease-out; }
@keyframes tipIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.t-name { font-weight: 700; font-size: 15.5px; margin-bottom: 2px; }
.t-sub { font-size: 11.5px; color: var(--dim); margin-bottom: 9px; }
.t-desc { font-size: 12.5px; line-height: 1.5; color: #c6ccda; margin-bottom: 9px; }
.t-stats { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.t-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--dim); gap: 12px; }
.t-row > span { display: inline-flex; align-items: center; gap: 6px; }
.t-row b { color: var(--text); font-weight: 600; text-align: right; }
.t-row b.pos { color: var(--good); }
.t-row b.neg { color: var(--bad); }
.t-row b.perk { color: #fcd98a; }
#ghost { position: fixed; z-index: 90; pointer-events: none; opacity: .9; filter: drop-shadow(0 8px 14px rgba(0,0,0,.5)); }
#toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 200; pointer-events: none; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: rgba(14,16,20,.97); border: 1px solid #353b46; color: var(--text); padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 500; animation: rise .22s ease-out; box-shadow: 0 8px 24px rgba(0,0,0,.5); }

@media (max-width: 900px) {
  .p-body { flex-direction: column; overflow-y: auto; }
  .lo-left { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .lo-right { min-height: 320px; }
  :root { --cs: 36px; }
}

/* ---------- test mode + crate prices ---------- */
.testchip { display: inline-block; margin: -12px 0 18px; padding: 5px 12px; border-radius: 99px; background: rgba(251,191,36,.14); border: 1px solid rgba(251,191,36,.45); color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.cprice { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--gold); }
.cprice.poor { color: var(--bad); }
.btn.poor { opacity: .55; }

/* ---------- v4: player model, upgrades, vertical index ---------- */
.mt .lv { position: absolute; right: 2px; top: 1px; font-size: 9.5px; font-weight: 800; color: #1c1400; background: var(--gold); border-radius: 4px; padding: 0 3px; line-height: 13px; }
.t-label { font-size: 10px; letter-spacing: .14em; font-weight: 700; color: var(--accent); text-transform: uppercase; margin-bottom: 4px; }
.model-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: none; }
.model-card .mh { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mhint { font-size: 11.5px; color: var(--dim); text-align: right; }
#model { width: 100%; height: 215px; display: block; border-radius: 9px; cursor: help; }
.lo-right { overflow-y: auto; }
.lo-right .mlist { min-height: 190px; flex: 1 0 190px; }

.up-left { width: 46%; min-width: 300px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; border-right: 1px solid var(--line); min-height: 0; }
.up-right { flex: 1; min-width: 0; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.up-right.up-flash { animation: upflash .7s ease-out; }
@keyframes upflash { 0% { background: rgba(251,191,36,.18); } 100% { background: transparent; } }
.mlist .item.sel .mt { box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(59,130,246,.45); }
.ud-head { display: flex; gap: 16px; align-items: center; }
.ud-tile { width: 76px; height: 76px; flex: none; }
.lvrow { display: flex; align-items: center; gap: 12px; }
.lvrow b { font-size: 13px; }
.pips { display: flex; gap: 4px; flex: 1; }
.pips i { flex: 1; height: 8px; border-radius: 4px; background: #2b313b; }
.pips i.on { background: var(--gold); box-shadow: 0 0 8px rgba(251,191,36,.5); }
.ustats { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; display: flex; flex-direction: column; }
.ur { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; font-size: 13px; color: var(--dim); border-bottom: 1px solid #22262d; }
.ur:last-child { border-bottom: 0; }
.uv { display: inline-flex; align-items: center; gap: 8px; }
.uv b { color: var(--text); font-weight: 600; }
.uv b.pos { color: var(--good); }
.uv .arrow { color: var(--dim); display: inline-flex; }
.ubuy { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ucost { display: flex; align-items: center; gap: 8px; font-size: 20px; color: var(--gold); font-weight: 700; }
.ucost.poor { color: var(--bad); }
.maxed { display: flex; align-items: center; gap: 10px; color: var(--gold); font-weight: 700; letter-spacing: .12em; }

/* index: one vertical scrolling list */
.idx-search { display: flex; align-items: center; gap: 10px; margin: 14px 18px 0; padding: 0 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--dim); transition: border-color .15s; }
.idx-search:focus-within { border-color: var(--accent); }
.idx-search input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--text); font: 14px var(--font); padding: 13px 0; user-select: text; }
.idx-count { font-size: 12px; white-space: nowrap; }
.idx-body, .idx-body.bosses { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 18px; overflow-y: auto; flex: 1; min-height: 0; grid-template-columns: none; }
.erow { display: flex; gap: 16px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; flex: none; transition: border-color .2s; }
.erow:hover { border-color: #3b4350; }
.erow.boss { border-left: 3px solid var(--bc); }
.erow.unseen .eprev { opacity: .62; filter: grayscale(.55); }
.erow .einfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.erow .en { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip2 { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; background: #262b33; color: #b9c0cd; }
.seen { margin-left: auto; font-size: 11.5px; font-weight: 500; color: var(--dim); display: inline-flex; align-items: center; gap: 5px; }
.seen.yes { color: var(--good); }
.facts { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: #aab2c0; line-height: 1.5; }
.facts li::marker { color: var(--accent); }
.erow .es { display: flex; gap: 18px; flex-wrap: wrap; font-size: 11.5px; color: var(--dim); padding-top: 4px; border-top: 1px solid #22262d; }
.erow .phs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.erow .ph { background: #14171c; border: 1px solid #22262d; border-radius: 10px; padding: 9px 11px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.erow .ph b { color: var(--text); font-size: 12px; }
.phat { font-size: 10.5px; color: var(--dim); margin-top: -4px; }
.atks { display: flex; flex-wrap: wrap; gap: 5px; }
.atk { font-size: 11px; background: #262b33; color: #cfd5e2; border-radius: 6px; padding: 3px 7px; line-height: 1.3; }
.atk em { font-style: normal; color: var(--gold); font-weight: 600; }
@media (max-width: 900px) { .erow .phs { grid-template-columns: 1fr; } .up-left { width: 100%; border-right: 0; } }

/* ---------- wave picker, multi-boss rows ---------- */
#wavepick { z-index: 30; background: rgba(8, 9, 12, .82); }
.panel.wp { width: min(820px, 96vw); height: min(640px, 92vh); }
.wp-note { padding: 12px 18px 0; font-size: 12.5px; color: var(--dim); line-height: 1.55; }
.wv-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; align-content: start; }
.wv { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 62px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font: inherit; transition: transform .12s, border-color .15s, background .15s; }
.wv b { font-size: 17px; font-weight: 700; }
.wv small { font-size: 9px; letter-spacing: .12em; font-weight: 700; color: var(--dim); }
.wv:hover:not([disabled]) { transform: translateY(-2px); border-color: var(--accent); background: #1f2430; }
.wv.boss { border-color: #4a2f35; }
.wv.boss small { color: #ff8da1; }
.wv.cur { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(59,130,246,.45); background: #1c2536; }
.wv.lock { opacity: .38; cursor: not-allowed; }
.wv .wl { position: absolute; right: 5px; top: 5px; color: var(--dim); display: inline-flex; }
.tier.multi { background: #4a2a37; color: #ff9db3; }
.picker .pv { cursor: pointer; transition: background .15s; }
.picker .pv:hover { background: #2b313b; }
.erow .mem { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid #22262d; border-left: 3px solid var(--bc); border-radius: 10px; background: #14171c; }
.erow .mname { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; flex-wrap: wrap; }
.wv-grid::-webkit-scrollbar { width: 8px; }
.wv-grid::-webkit-scrollbar-thumb { background: #2f343d; border-radius: 6px; }

/* ---------- story dialogue, Titan choice, challenges ---------- */
#dialog { position: fixed; left: 0; right: 0; bottom: 28px; z-index: 40; display: flex; justify-content: center; pointer-events: none; }
.dlg { pointer-events: auto; cursor: pointer; width: min(780px, 94vw); display: flex; gap: 16px; align-items: flex-start; background: rgba(12,14,20,.94); border: 1px solid #3b4658; border-radius: 16px; padding: 18px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(127,233,255,.12); animation: rise .35s ease-out; }
.dav { width: 54px; height: 54px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #7fe9ff; background: #0b1016; border: 1px solid #2c5a66; box-shadow: inset 0 0 14px rgba(127,233,255,.25); }
.dbody { flex: 1; min-width: 0; }
.dname { font-size: 11.5px; letter-spacing: .16em; font-weight: 700; color: #7fe9ff; text-transform: uppercase; margin-bottom: 6px; }
.dtext { font-size: 16.5px; line-height: 1.55; color: #eef2f9; min-height: 52px; }
.dnext { margin-top: 8px; font-size: 11px; color: var(--dim); text-align: right; animation: pulseText 1.6s ease-in-out infinite; }
@keyframes pulseText { 50% { opacity: .35; } }

#choice { z-index: 35; background: rgba(5,8,16,.78); }
.choice-card { width: min(1080px, 96vw); max-height: 94vh; overflow-y: auto; text-align: center; padding: 26px 28px; background: rgba(15,18,26,.96); border: 1px solid #2f3a4d; border-radius: 20px; animation: rise .45s cubic-bezier(.2,.8,.2,1); box-shadow: 0 30px 90px rgba(0,0,0,.65); }
.choice-card h2 { margin: 0 0 6px; font-size: 28px; letter-spacing: .22em; padding-left: .22em; color: #cfe3ff; }
.pips2 { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 14px 0 18px; font-size: 12px; color: var(--dim); }
.pips2 i { width: 34px; height: 8px; border-radius: 4px; background: #2b313b; }
.pips2 i.on { background: var(--good); box-shadow: 0 0 10px rgba(74,222,128,.5); }
.pips2 span { margin-left: 8px; }
.tgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.tcard { font: inherit; color: var(--text); text-align: center; background: #151a24; border: 1px solid #2c3546; border-radius: 14px; padding: 16px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 7px; transition: transform .15s, border-color .2s, box-shadow .2s; animation: pop .4s cubic-bezier(.2,1.3,.4,1) backwards; }
.tcard:nth-child(2) { animation-delay: .06s; } .tcard:nth-child(3) { animation-delay: .12s; } .tcard:nth-child(4) { animation-delay: .18s; } .tcard:nth-child(5) { animation-delay: .24s; }
.tcard:hover:not([disabled]) { transform: translateY(-4px); border-color: var(--tc); box-shadow: 0 10px 34px color-mix(in srgb, var(--tc) 35%, transparent); }
.tcard[disabled] { opacity: .45; cursor: default; }
.tcard canvas { width: 96px; height: 96px; }
.tn { font-weight: 800; font-size: 16px; letter-spacing: .04em; color: var(--tc); }
.tb { font-size: 11px; color: var(--dim); letter-spacing: .04em; }
.td { font-size: 12px; color: #b8c0cf; line-height: 1.5; min-height: 78px; }
.ts { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: #cfe3ff; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; background: #202838; }
.tcard.dead .ts { color: var(--good); }
@media (max-width: 900px) { .tgrid { grid-template-columns: 1fr 1fr; } }

#chal { z-index: 26; background: rgba(8,9,12,.85); }
.crow { display: flex; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--sc); border-radius: 14px; padding: 14px 16px; flex: none; transition: border-color .2s, transform .15s; }
.crow:hover:not(.lock) { transform: translateY(-2px); }
.crow.lock { opacity: .5; }
.crow.done { background: #151d19; }
.cstar { width: 64px; flex: none; display: flex; flex-direction: column; align-items: center; color: var(--sc); gap: 2px; }
.cstar svg { width: 30px; height: 30px; filter: drop-shadow(0 0 8px var(--sc)); }
.cstar b { font-size: 20px; font-weight: 800; color: var(--text); }
.cinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cgo { flex: none; min-width: 110px; text-align: right; }
.clk { font-size: 12px; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }

/* bulk upgrade buttons */
.upgrow { display: flex; gap: 8px; flex-wrap: wrap; }
.ubtn { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 86px; padding: 9px 12px; border-radius: 9px; border: 1px solid #5a4a1a; background: linear-gradient(#2a2412, #211d10); color: var(--gold); cursor: pointer; font: inherit; transition: transform .12s, border-color .12s, background .12s; }
.ubtn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--gold); background: linear-gradient(#383015, #2a2412); }
.ubtn .ul { display: flex; align-items: center; gap: 5px; font-weight: 800; font-size: 14px; letter-spacing: .04em; }
.ubtn .ul i { font-style: normal; font-weight: 600; font-size: 11px; color: var(--dim); }
.ubtn .uc { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; opacity: .9; }
.ubtn.poor, .ubtn:disabled { color: var(--bad); border-color: #4a2a2e; background: #1d1719; cursor: not-allowed; }
.uneeds { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 13px; padding: 10px 12px; border: 1px dashed var(--line, #333a46); border-radius: 9px; }
/* admin panel (test mode) */
#admin { position: fixed; right: 10px; top: 128px; bottom: 10px; width: 272px; z-index: 40; display: flex; flex-direction: column; background: rgba(17,19,25,.93); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.5); font-size: 12.5px; color: var(--text); backdrop-filter: blur(6px); }
#admin.collapsed { bottom: auto; width: 190px; }
#admin.collapsed .ad-body { display: none; }
#admin.collapsed .ad-x { transform: rotate(180deg); }
#admin.idle .ad-body { opacity: .55; }
.ad-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 13px; border-bottom: 1px solid var(--line); }
.ad-head b { letter-spacing: .18em; font-size: 11px; color: var(--gold); }
.ad-head small { flex: 1; color: var(--dim); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-x { background: transparent; border: 0; color: var(--dim); cursor: pointer; padding: 3px; display: flex; border-radius: 6px; transition: transform .2s; }
.ad-x:hover { color: var(--text); background: var(--panel2); }
.ad-body { flex: 1; overflow-y: auto; padding: 4px 8px 10px; user-select: none; }
.ad-body::-webkit-scrollbar { width: 6px; } .ad-body::-webkit-scrollbar-thumb { background: #353b46; border-radius: 3px; }
#admin details { border-bottom: 1px solid #22262d; padding: 2px 0 8px; }
#admin summary { cursor: pointer; padding: 8px 4px; font-weight: 700; letter-spacing: .06em; font-size: 11px; color: var(--dim); text-transform: uppercase; list-style: none; }
#admin summary::-webkit-details-marker { display: none; }
#admin summary::before { content: "+"; display: inline-block; width: 14px; color: var(--accent); }
#admin details[open] > summary::before { content: "-"; }
#admin details[open] > summary { color: var(--text); }
.ad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.ad-row { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.ad-row > span { color: var(--dim); font-size: 11px; width: 44px; flex: none; }
.ad-row b { min-width: 52px; text-align: right; font-size: 11px; color: var(--gold); }
.ad-sub { margin: 8px 2px 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.ad-b, .ad-c { font: 600 12px/1 var(--font); color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 8px 6px; cursor: pointer; transition: background .12s, border-color .12s, transform .1s; }
.ad-c { padding: 6px 8px; font-size: 11px; }
.ad-b:hover, .ad-c:hover { background: #2a303a; border-color: #3a4250; }
.ad-b:active, .ad-c:active { transform: scale(.97); }
.ad-b.bad { border-color: #5a2c31; color: #ffb4b4; }
.ad-b.bad:hover { background: #3a1f23; }
.ad-b.on, .ad-c.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#admin input[type=number], #admin input.ad-s, #admin select { flex: 1; min-width: 0; background: #0f1115; color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px; font: 12px var(--font); outline: none; user-select: text; }
#admin input:focus, #admin select:focus { border-color: var(--accent); }
#admin input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.ad-list { max-height: 210px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; margin-top: 6px; padding-right: 3px; }
.ad-list::-webkit-scrollbar { width: 6px; } .ad-list::-webkit-scrollbar-thumb { background: #353b46; border-radius: 3px; }
.ad-item { display: flex; align-items: center; gap: 8px; text-align: left; font: 500 12px var(--font); color: var(--text); background: #14171c; border: 1px solid #22262d; border-radius: 6px; padding: 6px 8px; cursor: pointer; }
.ad-item:hover { background: #1d2128; border-color: var(--accent); }
.ad-item i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ad-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-item small { color: var(--dim); font-size: 10px; flex: none; }
.ad-none { color: var(--dim); padding: 8px; font-size: 12px; }
/* fusion tab */
.mt.r5 { animation: glow5 2.4s ease-in-out infinite; background: linear-gradient(135deg, #2a1f33, #1c2a33); }
.mt.r5::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 36%, rgba(255,255,255,.34) 50%, transparent 64%); transform: translateX(-130%); animation: sheen 3s ease-in-out infinite; pointer-events: none; }
@keyframes glow5 { 50% { box-shadow: inset 0 0 18px color-mix(in srgb, var(--rc) 40%, transparent), 0 0 20px color-mix(in srgb, var(--rc) 70%, transparent), 0 0 34px rgba(110,220,255,.25); } }
.fz-slots { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.fz-slot { flex: 1 1 110px; min-width: 104px; max-width: 150px; background: var(--panel); border: 1px dashed #3a4250; border-radius: 12px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 128px; cursor: default; }
.fz-slot.full { border-style: solid; border-color: var(--line); cursor: pointer; }
.fz-slot.full:hover:not(.res) { border-color: var(--bad); }
.fz-slot.res.full { border-color: #ff6bd6; box-shadow: 0 0 18px rgba(255,107,214,.18); cursor: default; }
.fz-tile { width: 62px; height: 62px; }
.fz-nm { font-size: 11.5px; font-weight: 700; text-align: center; line-height: 1.25; word-break: break-word; }
.fz-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.fz-op { display: flex; align-items: center; color: var(--dim); font-size: 22px; font-weight: 700; }
.fz-res { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.fz-buy { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fz-have { color: var(--dim); font-size: 12px; flex: 1; min-width: 100px; }
.fz-why { color: var(--bad); font-size: 12.5px; }
.fz-done { display: flex; align-items: center; gap: 10px; background: #1d2a22; border: 1px solid #2f5a40; color: #9ef0b8; padding: 10px 14px; border-radius: 10px; font-size: 13px; animation: fadeIn .3s ease-out; }
/* touch controls + small screens */
#touch { position: fixed; inset: 0; pointer-events: none; z-index: 8; }
#touch .joy { position: absolute; width: calc(124px * var(--ts, 1)); height: calc(124px * var(--ts, 1)); margin: calc(-62px * var(--ts, 1)) 0 0 calc(-62px * var(--ts, 1)); border-radius: 50%; border: 2px solid rgba(255,255,255,.3); background: rgba(255,255,255,.05); opacity: calc(.45 * var(--to, 1)); transition: opacity .15s; }
#touch .joy.on { opacity: calc(.95 * var(--to, 1)); border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.09); }
#touch .joy i { position: absolute; left: 50%; top: 50%; width: calc(56px * var(--ts, 1)); height: calc(56px * var(--ts, 1)); margin: calc(-28px * var(--ts, 1)) 0 0 calc(-28px * var(--ts, 1)); border-radius: 50%; background: rgba(255,255,255,.22); border: 2px solid rgba(255,255,255,.6); }
#touch .joy span { position: absolute; left: 0; right: 0; bottom: -20px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .16em; color: rgba(255,255,255,.55); }
#touch .joy.on span { opacity: 0; }
#tpause { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); margin-left: -22px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(20,22,28,.6); color: #fff; display: flex; align-items: center; justify-content: center; pointer-events: auto; padding: 0; }
#c { touch-action: none; }
html.touch body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
@media (max-width: 700px), (max-height: 520px) {
  .card { padding: 18px 16px; }
  .logo h1 { font-size: 40px; }
  .menu-btns { width: min(260px, 82vw); }
  .panel { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .p-head { flex-wrap: wrap; gap: 4px; padding: 8px 10px; }
  .p-head .tab { padding: 8px 10px; font-size: 11px; letter-spacing: .02em; }
  .fz-slot { min-width: 92px; padding: 8px 4px; }
  .fz-slots { gap: 4px; }
  #admin { width: min(260px, 62vw); top: 108px; }
  .choice-card { padding: 16px 12px; }
  .tgrid { grid-template-columns: 1fr 1fr; }
}
/* settings + import/export + perf switches */
html.noanim .mt, html.noanim .mt::after, html.noanim .badge { animation: none !important; }
html.noblur .screen, html.noblur #admin, html.noblur #tip { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
html.noblur .screen { background: rgba(12, 13, 17, .92); }
#settings { z-index: 30; } #io { z-index: 35; }
.panel.st { width: min(780px, 96vw); }
.panel.io { width: min(1000px, 97vw); }
.st-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 24px 26px; }
.st-body::-webkit-scrollbar, .io-body::-webkit-scrollbar { width: 8px; }
.st-body::-webkit-scrollbar-thumb, .io-body::-webkit-scrollbar-thumb { background: #2f343d; border-radius: 6px; }
.st-h { margin: 26px 0 6px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.st-n { color: var(--dim); font-size: 12.5px; line-height: 1.55; margin-bottom: 8px; }
.st-n b { color: var(--text); font-weight: 600; }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 11px 0; border-bottom: 1px solid #1f232a; }
.st-l { min-width: 0; flex: 1; }
.st-t { font-weight: 600; font-size: 13.5px; }
.st-d { color: var(--dim); font-size: 12px; line-height: 1.45; margin-top: 2px; }
.st-c { flex: none; display: flex; align-items: center; justify-content: flex-end; max-width: 52%; }
.seg { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { font: 600 12px var(--font); color: var(--dim); background: transparent; border: 0; border-radius: 6px; padding: 7px 11px; cursor: pointer; transition: background .12s, color .12s; }
.seg button:hover { color: var(--text); background: #272c35; }
.seg button.on { background: var(--accent); color: #fff; }
.sw { width: 46px; height: 26px; border-radius: 99px; background: #2a2f38; border: 1px solid var(--line); position: relative; cursor: pointer; padding: 0; transition: background .15s; }
.sw i { position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #9aa3b4; transition: transform .15s, background .15s; }
.sw.on { background: var(--accent); border-color: var(--accent); }
.sw.on i { transform: translateX(20px); background: #fff; }
.rng { display: flex; align-items: center; gap: 12px; }
.rng input { width: 170px; accent-color: var(--accent); }
.rng b { width: 44px; text-align: right; font-size: 12.5px; color: var(--text); }
.st-data { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.io-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 24px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-content: start; }
.io-body section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.io-body textarea { width: 100%; box-sizing: border-box; resize: vertical; background: #0f1115; color: #b8d4ff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 11.5px/1.45 ui-monospace, Consolas, monospace; outline: none; user-select: text; -webkit-user-select: text; word-break: break-all; }
.io-body textarea:focus { border-color: var(--accent); }
.io-row { display: flex; gap: 8px; flex-wrap: wrap; }
.io-sum, .io-status { font-size: 12.5px; line-height: 1.6; color: var(--dim); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.io-sum b, .io-status b { color: var(--text); }
.io-status.ok { color: #9ef0b8; border-color: #2f5a40; background: #15201a; }
.io-status.bad { color: #ffb4b4; border-color: #5a2c31; background: #221619; }
#fps { position: fixed; left: 10px; bottom: 8px; z-index: 50; font: 700 11px/1 ui-monospace, Consolas, monospace; color: #9ef0b8; background: rgba(0,0,0,.5); padding: 4px 7px; border-radius: 6px; pointer-events: none; }
@media (max-width: 760px) {
  .io-body { grid-template-columns: 1fr; }
  .st-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .st-c { max-width: 100%; justify-content: flex-start; }
  .seg { justify-content: flex-start; }
  .rng input { width: 56vw; }
  .st-body { padding: 4px 14px 26px; }
}
/* reset-progress warning */
.panel.rs { width: min(560px, 96vw); height: auto; max-height: 94vh; }
.rs-body { padding: 18px 24px 24px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.rs-warn { display: flex; gap: 14px; align-items: flex-start; background: #2a1518; border: 1px solid #6b2a31; color: #ffc9c9; border-radius: 12px; padding: 14px 16px; font-size: 13.5px; line-height: 1.55; }
.rs-warn .ic { flex: none; color: var(--bad); margin-top: 2px; }
.rs-warn b { color: #fff; }
.rs-opt { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 13px; cursor: pointer; }
.rs-in { background: #0f1115; color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; font: 600 15px var(--font); letter-spacing: .2em; outline: none; user-select: text; -webkit-user-select: text; text-transform: uppercase; }
.rs-in:focus { border-color: var(--bad); }