/* Fixed, non-zoomable frame: the page never scrolls, only the inner lists do. */
html, body { position: fixed; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; margin: 0;
  overscroll-behavior: none; touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; -webkit-touch-callout: none;
  background: #0b1020; color: #e9e6f5; font: 15px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
#root { position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
h1 { font-size: 26px; margin: 0; letter-spacing: 0.04em; background: linear-gradient(90deg, #c084fc, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { margin: 0 0 8px; } h3 { margin: 14px 0 6px; font-size: 16px; }
.muted { color: #9a95b3; } .tiny { font-size: 12px; } .error { color: #fb7185; min-height: 1.2em; margin: 4px 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input { background: #171a2e; border: 1px solid #2d3252; color: #fff; border-radius: 10px; padding: 11px 12px; font-size: 15px; width: 100%; }
input:focus { outline: 2px solid #7c3aed55; border-color: #a78bfa; }
.btn { background: #232746; color: #fff; border: 1px solid #3a3f66; border-radius: 12px; padding: 11px 16px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn.primary { background: linear-gradient(135deg, #7c3aed, #0891b2); border-color: transparent; }
.btn.big { width: 100%; padding: 16px; font-size: 18px; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; }
.link { background: none; border: none; color: #a78bfa; font-size: 13px; cursor: pointer; padding: 6px; }

/* auth */
#auth { align-items: center; justify-content: center; padding: 20px; }
.panel { width: 100%; max-width: 440px; background: #12152a; border: 1px solid #23274a; border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.vessel-pick { display: flex; gap: 10px; }
.vessel-pick label { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border-radius: 12px; border: 1px solid #2d3252; cursor: pointer; }
.vessel-pick label.on, .vessel-pick label:has(input:checked) { border-color: #a78bfa; background: #1b1737; }
.vessel-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.vessel-pick svg { width: 64px; height: 64px; }

/* home */
#home header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; }
#home main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 12px 12px; overscroll-behavior: contain; }
#tabs { display: flex; border-top: 1px solid #23274a; background: #0f1226; padding-bottom: env(safe-area-inset-bottom); }
#tabs button { flex: 1; background: none; border: none; color: #8f8aab; padding: 12px 4px; font-size: 13px; font-weight: 600; }
#tabs button.active { color: #fff; border-top: 2px solid #a78bfa; margin-top: -1px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.item { position: relative; background: #12152a; border: 1px solid #23274a; border-radius: 14px; padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #ddd; cursor: pointer; }
.item .nm { font-size: 11px; line-height: 1.2; text-align: center; min-height: 2.4em; }
.item .qty { position: absolute; top: 6px; right: 8px; font-size: 11px; color: #c4b5fd; font-weight: 700; }
.item .eq { position: absolute; top: 6px; left: 8px; font-size: 10px; color: #67e8f9; }
.item.t2 { border-color: #7c3aed88; } .item.t3 { border-color: #f59e0b99; box-shadow: 0 0 12px #f59e0b33; }
.detail-card.t2 { border-color: #7c3aed; } .detail-card.t3 { border-color: #f59e0b; }
.fslots { display: flex; gap: 10px; justify-content: center; margin: 6px 0; }
.fslot { width: 100px; height: 112px; border: 2px dashed #3a3f66; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; text-align: center; padding: 4px; }
.fslot.filled { border-style: solid; border-color: #a78bfa; background: #1b1737; }
.fslot.picking { border-color: #67e8f9; box-shadow: 0 0 0 3px #67e8f944; }
.fslot .ph { font-size: 28px; color: #3a3f66; }
#detail { position: absolute; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; padding: 20px; }
.detail-card { background: #12152a; border: 1px solid #23274a; border-radius: 18px; padding: 20px; max-width: 380px; width: 100%; text-align: center; }
.detail-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; text-align: left; margin: 12px 0; }
.detail-card dt { color: #9a95b3; } .detail-card .tier { color: #c4b5fd; font-size: 13px; margin: 2px 0 6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; } td, th { padding: 6px 4px; text-align: left; border-bottom: 1px solid #23274a; } th { color: #9a95b3; font-weight: 600; }
#toast { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%); background: #2d1b69; color: #fff; padding: 10px 16px; border-radius: 12px; max-width: 90%; z-index: 20; box-shadow: 0 6px 20px #0008; }

/* battle */
#battle { background: #05070f; }
.hud { display: flex; align-items: center; gap: 8px; padding: 6px 12px; height: 40px; }
.hud .name { font-weight: 700; min-width: 60px; font-size: 13px; }
.hud .hp { font-variant-numeric: tabular-nums; width: 34px; text-align: right; font-size: 13px; }
.bar { flex: 1; height: 12px; background: #1b1e33; border-radius: 6px; overflow: hidden; }
.bar div { height: 100%; width: 100%; transition: width 0.15s; }
.bar.opp div { background: linear-gradient(90deg, #f43f5e, #fb923c); } .bar.me div { background: linear-gradient(90deg, #22d3ee, #a3e635); }
.arena-wrap { flex: 1; position: relative; min-height: 0; display: flex; justify-content: center; }
#arena { height: 100%; width: 100%; touch-action: none; display: block; }
#arena.hit { animation: shake 0.18s; }
@keyframes shake { 25% { transform: translateX(4px); } 75% { transform: translateX(-4px); } }
.mid { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; opacity: 0.55; }
#timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
#battle-status { position: absolute; inset: auto 16px 40% 16px; text-align: center; background: #12152acc; padding: 12px; border-radius: 12px; }
#slots { display: flex; gap: 6px; padding: 6px 8px 4px; }
/* the movement slider: drag anywhere on the bar, the thumb is your vessel's x */
#stick { padding: 4px 10px calc(8px + env(safe-area-inset-bottom)); touch-action: none; user-select: none; }
#stick .track { position: relative; height: 54px; border-radius: 27px; background: linear-gradient(90deg, #1b1e33, #23274a, #1b1e33); border: 1px solid #3a3f66; }
#stick .thumb { position: absolute; top: 3px; width: 46px; height: 46px; margin-left: -23px; border-radius: 50%; background: linear-gradient(135deg, #a78bfa, #22d3ee); box-shadow: 0 0 14px #a78bfa88; pointer-events: none; }
#stick .track::before, #stick .track::after { content: ''; position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 3px solid #3a3f66; border-width: 3px 0 0 3px; }
#stick .track::before { left: 16px; transform: rotate(-45deg); } #stick .track::after { right: 16px; transform: rotate(135deg); }
.slot { flex: 1; position: relative; height: 66px; background: #12152a; border: 2px solid #23274a; border-radius: 12px; padding: 4px; overflow: hidden; color: #bbb; display: flex; flex-direction: column; align-items: center; }
.slot.active { border-color: #a78bfa; background: #1b1737; }
.slot svg { width: 34px; height: 34px; } .slot .n { font-size: 9px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.slot .cd { position: absolute; left: 0; right: 0; bottom: 0; background: #0009; height: 0; pointer-events: none; }
#result { align-items: center; justify-content: center; padding: 20px; text-align: center; }
.drop { background: #1b1737; border: 1px solid #7c3aed; border-radius: 14px; padding: 12px; margin: 8px 0; }
.drop h3 { margin: 6px 0 2px; }

.chk { display: flex; gap: 10px; align-items: center; padding: 6px 0; } .chk input { width: 20px; height: 20px; }

/* 3D mode: the health bars and timer are meshes in the scene */
#battle.gl .bar, #battle.gl .mid { display: none; }
#battle.gl { background: #020617; }
.seg { display: flex; gap: 8px; } .seg .btn { flex: 1; } .seg .btn.on { border-color: #a78bfa; background: #1b1737; }
