:root {
  --cyan: #38d6ff;
  --cyan-d: #0f8fb3;
  --gold: #ffd166;
  --red: #ff4d6d;
  --green: #4dff88;
  --bg: #050b12;
  --panel: rgba(8, 20, 32, 0.86);
  --panel-b: rgba(56, 214, 255, 0.35);
  --text: #e6f4ff;
  --dim: #8aa6bb;
  --f-en: 'Orbitron', 'Noto Sans KR', sans-serif;
  --f-kr: 'Black Han Sans', 'Noto Sans KR', sans-serif;
  --f-body: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--f-body); user-select: none; -webkit-user-select: none; }
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }
small { font-size: 0.7em; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; margin: 1px; border: 1px solid rgba(255,255,255,0.35); border-bottom-width: 3px; border-radius: 5px; font-family: var(--f-en); font-size: 11px; text-align: center; background: rgba(255,255,255,0.06); }
.c-cyan { color: var(--cyan); } .c-gold { color: var(--gold); } .c-green { color: var(--green); } .c-yellow { color: #ffe14d; }

.scanlines { position: fixed; inset: 0; pointer-events: none; z-index: 100; background: repeating-linear-gradient(0deg, rgba(0,0,0,0.07) 0 1px, transparent 1px 3px); mix-blend-mode: multiply; }

/* ---------- Generic UI ---------- */
.panel {
  position: relative;
  background: linear-gradient(160deg, rgba(14, 32, 48, 0.92), rgba(6, 14, 24, 0.92));
  border: 1px solid var(--panel-b);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}
.panel::before, .panel::after {
  content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid var(--cyan); pointer-events: none;
}
.panel::before { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 10px 0 0 0; }
.panel::after { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 10px 0; }

.btn {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 180px; padding: 12px 26px; border-radius: 8px;
  background: linear-gradient(180deg, rgba(30, 60, 84, 0.95), rgba(12, 28, 42, 0.95));
  border: 1px solid rgba(56, 214, 255, 0.45);
  font-family: var(--f-kr); font-size: 20px; letter-spacing: 1px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s, background 0.12s;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.btn small { font-family: var(--f-en); font-size: 10px; letter-spacing: 3px; color: var(--dim); margin-top: 2px; }
.btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--cyan); background: linear-gradient(180deg, rgba(40, 90, 120, 0.95), rgba(14, 40, 60, 0.95)); box-shadow: 0 6px 0 rgba(0,0,0,0.45), 0 0 24px rgba(56,214,255,0.25); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.45); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #2bc4f0, #0b7ea6); border-color: #9ff0ff; color: #02131c; }
.btn.primary small { color: rgba(2, 19, 28, 0.7); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #5fd9ff, #1597c4); }
.btn.danger { background: linear-gradient(180deg, #a3263d, #5c1020); border-color: #ff7b93; }
.btn.ghost { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.2); }
.btn.small { min-width: 120px; padding: 8px 16px; font-size: 16px; }
.btn.big { min-width: 280px; padding: 16px 40px; font-size: 26px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(0,0,0,0.45); border: 1px solid rgba(255,255,255,0.15); font-family: var(--f-en); font-size: 12px; letter-spacing: 1px; }
.chip.gold { color: var(--gold); border-color: rgba(255,209,102,0.5); }
.chip.big { font-size: 18px; padding: 8px 18px; }
.chip.dim { color: var(--dim); }

.pips { display: flex; gap: 3px; justify-content: center; }
.pips i { width: 10px; height: 6px; border-radius: 2px; background: rgba(255,255,255,0.15); }
.pips i.on { background: var(--c, var(--cyan)); box-shadow: 0 0 6px var(--c, var(--cyan)); }
.pips i.next { background: #fff; animation: pipBlink 0.6s infinite alternate; }
@keyframes pipBlink { to { background: var(--c, var(--cyan)); } }

/* ---------- Screens ---------- */
#screens { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.screen { position: absolute; inset: 0; display: none; pointer-events: auto; overflow-y: auto; overscroll-behavior: contain; }
#scr-title > *, .screen.modal > *, #scr-result > * { margin-block: auto; }
.screen.active { display: flex; animation: fadeIn 0.25s ease-out; }
.screen.modal { z-index: 40; align-items: center; justify-content: center; background: rgba(2, 6, 12, 0.72); backdrop-filter: blur(3px); }
#scr-settings { z-index: 60; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.scr-head { position: relative; flex: none; display: flex; align-items: center; gap: 18px; padding: 14px 28px; background: linear-gradient(180deg, rgba(3,8,14,0.95), rgba(3,8,14,0)); }
.scr-head h2 { flex: 1; font-family: var(--f-kr); font-size: 30px; font-weight: 400; letter-spacing: 1px; }
.scr-head h2 small { font-family: var(--f-en); font-size: 12px; letter-spacing: 3px; color: var(--cyan); margin-left: 10px; }
.back { font-family: var(--f-kr); font-size: 18px; padding: 8px 16px; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; background: rgba(0,0,0,0.4); }
.back:hover { border-color: var(--cyan); color: var(--cyan); }
.scr-foot { position: relative; flex: none; margin-top: auto; display: flex; justify-content: center; gap: 14px; padding: 14px; background: linear-gradient(0deg, rgba(3,8,14,0.95), rgba(3,8,14,0)); }

/* ---------- Title ---------- */
#scr-title { align-items: center; justify-content: center; }
.title-wrap { display: flex; flex-direction: column; align-items: center; text-align: center; }
.title-badge { display: flex; align-items: center; gap: 8px; font-family: var(--f-en); font-size: 12px; letter-spacing: 4px; color: var(--cyan); padding: 6px 14px; border: 1px solid rgba(56,214,255,0.35); border-radius: 999px; background: rgba(0,0,0,0.4); }
.title-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.logo { margin-top: 16px; line-height: 0.92; font-family: var(--f-en); font-weight: 900; }
.logo span { display: block; }
.logo-a { font-size: clamp(48px, 9vw, 108px); letter-spacing: 0.18em; color: #fff; text-shadow: 0 0 30px rgba(56,214,255,0.6), 0 6px 0 #0b5a75; }
.logo-b { font-size: clamp(30px, 5.3vw, 64px); letter-spacing: 0.42em; margin-left: 0.42em; background: linear-gradient(180deg, #ffe7a3, #ffb13d); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #7a4a10); }
.logo-kr { font-family: var(--f-kr); font-size: 28px; letter-spacing: 0.5em; margin: 10px 0 0 0.5em; color: #cfe9f7; }
#titleDrone { width: 420px; height: 230px; max-width: 90vw; object-fit: contain; }
.menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 6px; }
.menu .btn { min-width: 150px; }
.menu .btn.primary { grid-column: span 3; font-size: 26px; padding: 16px; }
.title-foot { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }

/* ---------- Select ---------- */
#scr-select { flex-direction: column; }
.select-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 22px; padding: 4px 28px 8px; overflow: auto; }
.af-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.af-card { position: relative; display: flex; flex-direction: column; align-items: center; padding: 10px 8px 12px; border-radius: 10px; background: rgba(8,20,32,0.85); border: 2px solid rgba(255,255,255,0.1); transition: all 0.15s; }
.af-card canvas { width: min(150px, 20vh); height: min(110px, 14.6vh); }
.af-card:hover { border-color: var(--c); transform: translateY(-2px); }
.af-card.selected { border-color: var(--c); background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(8,20,32,0.9)); box-shadow: 0 0 24px color-mix(in srgb, var(--c) 40%, transparent), inset 0 0 20px color-mix(in srgb, var(--c) 20%, transparent); }
.af-card-name { font-family: var(--f-kr); font-size: 19px; }
.af-card-role { font-size: 12px; color: var(--c); letter-spacing: 2px; }
.af-key { position: absolute; top: 6px; left: 8px; font-family: var(--f-en); font-size: 11px; color: var(--dim); }
.af-detail { padding: 20px 24px; --c: var(--cyan); align-self: start; }
.detail-top { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
#afPreview { width: min(300px, 36vh); height: min(240px, 28.8vh); background: radial-gradient(circle, color-mix(in srgb, var(--c) 18%, transparent), transparent 70%); border-radius: 50%; }
.detail-info { flex: 1; min-width: 260px; }
.detail-en { font-family: var(--f-en); font-size: 12px; letter-spacing: 4px; color: var(--c); }
.detail-name { font-family: var(--f-kr); font-size: 40px; line-height: 1.1; }
.detail-role { display: inline-block; margin: 4px 0 10px; padding: 2px 10px; border-radius: 4px; background: var(--c); color: #02131c; font-weight: 900; font-size: 13px; }
.detail-desc { color: #c4d8e6; line-height: 1.6; margin-bottom: 10px; }
.detail-perk, .detail-weapon { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 8px; border-radius: 8px; background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.08); font-size: 14px; line-height: 1.5; }
.detail-weapon img { width: 48px; height: 48px; }
.detail-weapon small { color: var(--dim); }
.tag { display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 4px; background: rgba(255,255,255,0.1); font-size: 11px; color: var(--dim); }
.evo-path-title { margin: 18px 0 10px; font-family: var(--f-kr); font-size: 18px; }
.evo-path-title small { font-family: var(--f-en); color: var(--c); letter-spacing: 3px; margin-left: 8px; font-size: 10px; }
.evo-path { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; padding-bottom: 6px; }
.evo-step { flex: 1; min-width: 120px; display: flex; flex-direction: column; align-items: center; padding: 8px 6px; border-radius: 8px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.08); text-align: center; }
.evo-step canvas { width: min(120px, 14vh); height: min(100px, 11.7vh); }
.evo-lv { font-family: var(--f-en); font-size: 11px; color: var(--c); letter-spacing: 2px; }
.evo-name { font-family: var(--f-kr); font-size: 15px; margin: 2px 0; }
.evo-desc { font-size: 11px; color: var(--dim); line-height: 1.4; }
.evo-arrow { display: flex; align-items: center; font-size: 26px; color: var(--c); opacity: 0.7; }

/* ---------- Hangar ---------- */
#scr-hangar { flex-direction: column; }
.hangar-grid { flex: 0 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; padding: 4px 28px 8px; overflow: hidden; align-content: start; }
.hg-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.hg-card img { width: 56px; height: 56px; }
.hg-info { flex: 1; }
.hg-name { font-family: var(--f-kr); font-size: 18px; }
.hg-desc { font-size: 12px; color: var(--dim); margin-bottom: 6px; }
.hg-card .pips { justify-content: flex-start; }
.hg-card .pips i { width: 16px; height: 7px; }
.hg-card.maxed { border-color: rgba(255,209,102,0.6); }
.hg-card.maxed .buy { color: var(--gold); }
.hg-card.poor .buy { opacity: 0.55; }
.hg-card .buy { min-width: 96px; font-family: var(--f-en); font-size: 13px; color: var(--gold); }
.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Howto ---------- */
#scr-howto { flex-direction: column; }
.howto-tabs { flex: none; display: flex; gap: 8px; padding: 0 28px; }
.tab { padding: 8px 18px; border-radius: 6px 6px 0 0; font-family: var(--f-kr); font-size: 16px; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.12); border-bottom: none; color: var(--dim); }
.tab.active { color: #02131c; background: var(--cyan); border-color: var(--cyan); }
.howto-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 28px 12px; overflow: auto; border-top: 1px solid rgba(56,214,255,0.35); }
.tabpane { display: none; }
.tabpane.active { display: flex; flex-direction: column; flex: 1; min-height: 0; animation: fadeIn 0.2s; }
.tabpane > :first-child { flex: 0 1 auto; min-height: 0; overflow: hidden; padding: 2px; }
.howto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.howto-card { padding: 16px 18px; }
.howto-card h3 { font-family: var(--f-kr); font-weight: 400; font-size: 20px; color: var(--cyan); margin-bottom: 6px; }
.howto-card p { line-height: 1.7; color: #c4d8e6; font-size: 14px; }
.evo-table { display: flex; flex-direction: column; gap: 10px; }
.evo-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
.evo-item { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.evo-item img { width: 48px; height: 48px; }
.evo-item b { display: block; font-size: 15px; }
.evo-item small { color: var(--dim); font-size: 11px; }
.evo-item.gold { flex: 1; } .evo-item.gold b { color: var(--gold); }
.evo-op { font-size: 22px; color: var(--cyan); }
.bestiary { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.beast { display: flex; flex-direction: column; align-items: center; padding: 10px; text-align: center; }
.beast canvas { width: 120px; height: 100px; }
.beast-name { font-family: var(--f-kr); font-size: 18px; }
.beast-en { font-family: var(--f-en); font-size: 10px; color: var(--dim); letter-spacing: 2px; }
.beast-tag { margin: 6px 0 4px; padding: 1px 8px; border-radius: 4px; font-size: 11px; background: rgba(77,255,136,0.15); color: var(--green); }
.beast.phen .beast-tag { background: rgba(56,214,255,0.15); color: var(--cyan); }
.beast.boss { border-color: rgba(255,77,109,0.6); }
.beast.boss .beast-tag { background: rgba(255,77,109,0.2); color: var(--red); }
.beast-stats { font-size: 11px; color: var(--dim); line-height: 1.5; }
.hz-ico { width: 120px; height: 100px; display: flex; align-items: center; justify-content: center; font-size: 54px; color: var(--cyan); text-shadow: 0 0 20px var(--cyan); }

/* ---------- Modal panels ---------- */
.modal-panel { padding: 26px 30px; display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow: auto; }
.modal-panel.narrow { width: min(380px, 92vw); }
.modal-panel.wide { width: min(980px, 94vw); }
.modal-title { font-family: var(--f-kr); font-weight: 400; font-size: 30px; }
.modal-title small { font-family: var(--f-en); font-size: 11px; color: var(--cyan); letter-spacing: 3px; margin-left: 8px; }
.toggle { display: flex; align-items: center; gap: 12px; font-size: 16px; cursor: pointer; }
.toggle input { display: none; }
.tg { position: relative; width: 46px; height: 24px; border-radius: 12px; background: rgba(255,255,255,0.15); transition: 0.2s; }
.tg::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: 0.2s; }
.toggle input:checked + .tg { background: var(--cyan); }
.toggle input:checked + .tg::after { left: 25px; }
.row-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Level up ---------- */
.lv-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 20px; max-width: 1200px; width: 100%; }
.lv-head { text-align: center; }
.lv-title { font-family: var(--f-en); font-weight: 900; font-size: clamp(40px, 6vw, 64px); letter-spacing: 0.2em; background: linear-gradient(180deg, #fff6c9, #ffb13d); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #7a4a10) drop-shadow(0 0 20px rgba(255,177,61,0.5)); animation: popIn 0.35s cubic-bezier(.2,1.6,.4,1); }
.lv-sub { font-size: 15px; color: #c4d8e6; }
.lv-sub b { color: var(--gold); font-family: var(--f-en); }
@keyframes popIn { from { transform: scale(0.4); opacity: 0; } }
.lv-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.lv-card {
  position: relative; width: 230px; min-height: 330px; padding: 18px 16px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  background: linear-gradient(170deg, rgba(20, 40, 58, 0.97), rgba(6, 14, 24, 0.97));
  border: 2px solid color-mix(in srgb, var(--c) 60%, transparent); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5), inset 0 0 30px color-mix(in srgb, var(--c) 12%, transparent);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  animation: cardIn 0.35s backwards cubic-bezier(.2,1.3,.5,1);
}
@keyframes cardIn { from { transform: translateY(40px) scale(0.9); opacity: 0; } }
.lv-card:hover { transform: translateY(-8px); border-color: var(--c); box-shadow: 0 18px 40px rgba(0,0,0,0.6), 0 0 30px color-mix(in srgb, var(--c) 45%, transparent), inset 0 0 40px color-mix(in srgb, var(--c) 18%, transparent); }
.lv-card.is-new::before { content: ''; position: absolute; inset: -2px; border-radius: 12px; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%); background-size: 250% 100%; animation: shine 2.2s infinite; pointer-events: none; }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.lv-key { position: absolute; top: 8px; left: 10px; width: 24px; height: 24px; border-radius: 6px; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.25); font-family: var(--f-en); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.lv-type { position: absolute; top: 9px; right: 10px; font-size: 11px; padding: 2px 8px; border-radius: 4px; background: color-mix(in srgb, var(--c) 25%, transparent); color: var(--c); font-weight: 700; }
.lv-icon { width: 84px; height: 84px; margin-top: 14px; filter: drop-shadow(0 0 12px color-mix(in srgb, var(--c) 60%, transparent)); }
.lv-name { font-family: var(--f-kr); font-size: 22px; line-height: 1.15; }
.lv-en { font-family: var(--f-en); font-size: 9px; color: var(--dim); letter-spacing: 3px; }
.lv-level { font-family: var(--f-en); font-size: 13px; color: #c4d8e6; min-height: 18px; }
.lv-level b { color: var(--c); }
.lv-level .new { color: #02131c; background: var(--gold); padding: 1px 8px; border-radius: 4px; font-weight: 900; animation: blink 0.8s infinite; }
.lv-text { font-size: 14px; line-height: 1.55; color: #e6f4ff; flex: 1; display: flex; align-items: center; }
.lv-hint { font-size: 11px; color: var(--dim); padding-top: 8px; border-top: 1px dashed rgba(255,255,255,0.15); width: 100%; line-height: 1.5; }
.lv-hint .ok { color: var(--gold); font-weight: 700; }
.lv-actions { display: flex; gap: 12px; }

/* ---------- Chest ---------- */
.chest-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(560px, 92vw); }
.chest-art { position: relative; width: 160px; height: 130px; }
.chest-box { position: absolute; bottom: 0; left: 15px; width: 130px; height: 74px; background: linear-gradient(180deg, #8a5a2a, #5a3614); border: 4px solid #ffd166; border-radius: 6px; }
.chest-box::after { content: ''; position: absolute; left: 50%; top: 10px; width: 20px; height: 26px; margin-left: -10px; background: #ffd166; border-radius: 3px; }
.chest-lid { position: absolute; bottom: 70px; left: 10px; width: 140px; height: 38px; background: linear-gradient(180deg, #a06a32, #6b4018); border: 4px solid #ffd166; border-radius: 30px 30px 4px 4px; transform-origin: 10% 100%; z-index: 2; }
.chest-rays { position: absolute; left: 50%; bottom: 60px; width: 10px; height: 10px; border-radius: 50%; opacity: 0; box-shadow: 0 0 60px 40px rgba(255, 220, 120, 0.9); }
.chest-art.open .chest-lid { animation: lidOpen 0.6s 0.25s forwards cubic-bezier(.3,1.6,.5,1); }
.chest-art.open .chest-rays { animation: rays 0.8s 0.4s forwards; }
.chest-art.open { animation: chestShake 0.3s; }
@keyframes lidOpen { to { transform: rotate(-38deg) translateY(-10px); } }
@keyframes rays { to { opacity: 1; } }
@keyframes chestShake { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.chest-title { font-family: var(--f-kr); font-size: 34px; }
.gold-text { background: linear-gradient(180deg, #fff6c9, #ffb13d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chest-items { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.chest-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; background: rgba(8,20,32,0.92); border: 1px solid rgba(255,209,102,0.4); animation: itemIn 0.4s backwards cubic-bezier(.2,1.4,.5,1); }
.chest-item img { width: 52px; height: 52px; }
.chest-item img.big { width: 72px; height: 72px; }
.chest-item b { display: block; font-size: 17px; }
.chest-item em { font-style: normal; color: var(--gold); font-family: var(--f-en); font-size: 12px; }
.chest-item small { color: var(--dim); font-size: 12px; }
.chest-item.evo { border-color: var(--gold); box-shadow: 0 0 30px rgba(255,209,102,0.35); }
.chest-item .arrow { color: var(--gold); font-size: 22px; }
@keyframes itemIn { from { transform: scale(0.6); opacity: 0; } }
.chest-gold { font-family: var(--f-en); color: var(--gold); font-size: 18px; }

/* ---------- Evolve ---------- */
#scr-evolve { --c: var(--cyan); background: radial-gradient(circle, color-mix(in srgb, var(--c) 25%, rgba(2,6,12,0.75)), rgba(2,6,12,0.92) 65%); }
.evolve-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.evolve-badge { font-family: var(--f-en); font-size: 13px; letter-spacing: 6px; color: var(--c); padding: 5px 14px; border: 1px solid var(--c); border-radius: 999px; }
.evolve-title { font-family: var(--f-kr); font-size: clamp(40px, 6vw, 60px); text-shadow: 0 0 30px var(--c); animation: popIn 0.4s cubic-bezier(.2,1.6,.4,1); }
.evolve-stage { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.evolve-side { display: flex; flex-direction: column; align-items: center; opacity: 0.6; }
.evolve-side.main { opacity: 1; }
.evolve-side.main canvas { filter: drop-shadow(0 0 24px var(--c)); animation: popIn 0.6s 0.2s backwards cubic-bezier(.2,1.6,.4,1); }
.evolve-name { font-family: var(--f-kr); font-size: 18px; }
.evolve-name.big { font-size: 30px; color: #fff; }
.evolve-name small { display: block; font-family: var(--f-en); font-size: 11px; color: var(--c); letter-spacing: 4px; }
.evolve-arrow { font-size: 40px; color: var(--c); animation: arrowPulse 0.8s infinite alternate; }
@keyframes arrowPulse { to { transform: translateX(8px); } }
.evolve-bonus { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 4px 0 10px; }
.evolve-bonus span { padding: 6px 12px; border-radius: 6px; background: rgba(0,0,0,0.5); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); font-size: 14px; }
.evolve-bonus span.heal { border-color: var(--green); color: var(--green); }

/* ---------- Pause ---------- */
.pause-body { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.pause-col h4 { font-family: var(--f-kr); font-weight: 400; font-size: 17px; color: var(--cyan); margin: 6px 0 8px; }
.inv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.inv-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,0.3); }
.inv-item img { width: 40px; height: 40px; }
.inv-item b { font-size: 14px; }
.inv-item em { font-style: normal; font-family: var(--f-en); font-size: 11px; color: var(--gold); }
.inv-item small { display: block; color: var(--dim); font-size: 11px; }
.empty { color: var(--dim); font-size: 13px; }
.statlist { display: flex; flex-direction: column; gap: 2px; }
.statlist div { display: flex; justify-content: space-between; padding: 5px 10px; border-radius: 4px; font-size: 14px; }
.statlist div:nth-child(odd) { background: rgba(255,255,255,0.04); }
.statlist span { color: var(--dim); }
.statlist b { font-family: var(--f-en); font-size: 13px; }

/* ---------- Result ---------- */
#scr-result { align-items: center; justify-content: center; background: radial-gradient(circle, rgba(60,0,10,0.55), rgba(2,6,12,0.92) 70%); }
#scr-result.win { background: radial-gradient(circle, rgba(10,60,80,0.55), rgba(2,6,12,0.92) 70%); }
.result-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(1000px, 94vw); max-height: 96vh; overflow: auto; padding: 10px; }
.result-title { font-family: var(--f-en); font-weight: 900; font-size: clamp(36px, min(6vw, 8vh), 66px); letter-spacing: 0.14em; color: var(--red); text-shadow: 0 0 30px rgba(255,77,109,0.6), 0 5px 0 #5c1020; animation: popIn 0.5s cubic-bezier(.2,1.6,.4,1); text-align: center; }
#scr-result.win .result-title { color: var(--gold); text-shadow: 0 0 30px rgba(255,209,102,0.6), 0 5px 0 #7a4a10; }
.result-sub { color: #c4d8e6; letter-spacing: 2px; }
.result-wrap > * { flex-shrink: 0; }
.res-gold { text-align: right; font-size: 12px; color: var(--dim); padding: 2px 4px 0; }
.result-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; width: 100%; }
.result-summary { padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.result-summary canvas { align-self: center; width: min(220px, 20vh); height: min(160px, 14.5vh); }
.res-row { display: flex; justify-content: space-between; padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.res-row span { color: var(--dim); }
.res-row b { font-family: var(--f-en); font-size: 15px; }
.result-table-wrap { padding: 14px 18px; overflow: auto; }
.result-table-wrap h4 { font-family: var(--f-kr); font-weight: 400; font-size: 18px; margin-bottom: 8px; }
.result-table-wrap h4 small { font-family: var(--f-en); font-size: 10px; letter-spacing: 3px; color: var(--cyan); margin-left: 6px; }
.result-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.result-table th { text-align: left; color: var(--dim); font-weight: 500; font-size: 12px; padding: 6px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.result-table td { padding: 6px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.result-table td:nth-child(n+3) { font-family: var(--f-en); font-size: 13px; }
.result-table img { width: 34px; height: 34px; display: block; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.xpbar { position: absolute; top: 0; left: 0; right: 0; height: 22px; background: rgba(0,0,0,0.75); border-bottom: 2px solid rgba(56,214,255,0.5); overflow: hidden; }
.xpfill { height: 100%; width: 0; background: linear-gradient(180deg, #7ff0ff, #1aa6d6 60%, #0b6f94); box-shadow: 0 0 14px rgba(56,214,255,0.8); transition: width 0.15s; }
.xpshine { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.25), transparent 50%); }
.xplv { position: absolute; right: 12px; top: 0; height: 100%; display: flex; align-items: center; font-family: var(--f-en); font-weight: 900; font-size: 14px; letter-spacing: 2px; text-shadow: 0 1px 3px #000; }

.hud-tl { position: absolute; top: 30px; left: 12px; display: flex; flex-direction: column; gap: 4px; }
.slots { display: flex; gap: 4px; }
.slot { position: relative; width: 44px; height: 50px; border-radius: 6px; background: rgba(0,0,0,0.55); border: 1px solid rgba(56,214,255,0.35); display: flex; flex-direction: column; align-items: center; padding-top: 2px; }
.slots.passive .slot { width: 36px; height: 42px; border-color: rgba(77,255,136,0.3); }
.slot img { width: 36px; height: 36px; }
.slots.passive .slot img { width: 28px; height: 28px; }
.slot.empty { background: rgba(0,0,0,0.25); border-style: dashed; border-color: rgba(255,255,255,0.12); }
.slot.evo { border-color: var(--gold); box-shadow: 0 0 10px rgba(255,209,102,0.5); }
.slot.max { border-color: rgba(255,209,102,0.7); }
.spips { display: flex; gap: 1px; margin-top: 2px; }
.spips i { width: 4px; height: 4px; border-radius: 1px; background: rgba(255,255,255,0.15); }
.spips i.on { background: var(--cyan); }
.slots.passive .spips i.on { background: var(--green); }
.spips b { font-family: var(--f-en); font-size: 8px; color: var(--gold); line-height: 8px; }

.hud-tc { position: absolute; top: 28px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(560px, 60vw); }
.timer { font-family: var(--f-en); font-weight: 900; font-size: 34px; letter-spacing: 3px; text-shadow: 0 2px 0 #000, 0 0 16px rgba(56,214,255,0.5); }
.bossbar { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; animation: fadeIn 0.4s; }
.bossname { font-family: var(--f-kr); font-size: 16px; color: #ff9fb0; text-shadow: 0 2px 0 #000; letter-spacing: 1px; }
.bosstrack { width: 100%; height: 14px; border-radius: 3px; background: rgba(0,0,0,0.7); border: 1px solid rgba(255,77,109,0.7); overflow: hidden; }
.bossfill { height: 100%; width: 100%; background: linear-gradient(180deg, #ff8095, #c01a3a); box-shadow: 0 0 12px rgba(255,77,109,0.8); transition: width 0.2s; }
.alerts { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.alert { display: flex; align-items: center; gap: 10px; padding: 8px 20px; border-radius: 6px; font-family: var(--f-kr); font-size: 18px; background: linear-gradient(90deg, transparent, rgba(80,50,0,0.85) 15%, rgba(80,50,0,0.85) 85%, transparent); color: #ffe7a3; text-shadow: 0 2px 0 #000; animation: alertIn 0.35s cubic-bezier(.2,1.4,.5,1); transition: opacity 0.5s, transform 0.5s; white-space: nowrap; }
.alert.boss { font-size: 24px; color: #fff; background: linear-gradient(90deg, transparent, rgba(140,10,30,0.9) 15%, rgba(140,10,30,0.9) 85%, transparent); animation: alertIn 0.35s cubic-bezier(.2,1.4,.5,1), bossPulse 0.6s 0.35s 4 alternate; }
.alert.good { color: #c9ffd9; background: linear-gradient(90deg, transparent, rgba(0,70,30,0.85) 15%, rgba(0,70,30,0.85) 85%, transparent); }
.alert.info { color: #cdf4ff; background: linear-gradient(90deg, transparent, rgba(0,50,80,0.85) 15%, rgba(0,50,80,0.85) 85%, transparent); }
.alert.out { opacity: 0; transform: translateY(-10px); }
.alert-ico { font-size: 0.95em; }
@keyframes alertIn { from { transform: scaleX(0.2); opacity: 0; } }
@keyframes bossPulse { to { filter: brightness(1.5); } }

.hud-tr { position: absolute; top: 30px; right: 12px; display: flex; align-items: center; gap: 8px; }
.stat { display: flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 6px; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.12); font-family: var(--f-en); font-weight: 700; font-size: 16px; }
.stat .ico { font-size: 14px; color: #cfd8dc; }
.stat.gold { color: var(--gold); } .stat.gold .ico { color: var(--gold); }
.pausebtn { pointer-events: auto; width: 36px; height: 34px; border-radius: 6px; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.2); font-family: var(--f-en); font-weight: 900; }
.pausebtn:hover { border-color: var(--cyan); color: var(--cyan); }

.panel-hud { background: rgba(4, 12, 20, 0.72); border: 1px solid rgba(56,214,255,0.3); border-radius: 8px; padding: 8px 12px; }
.hud-bl { position: absolute; bottom: 12px; left: 12px; width: 250px; }
.af-label { font-family: var(--f-en); font-size: 10px; letter-spacing: 3px; color: var(--cyan); }
.af-name { font-family: var(--f-en); font-weight: 900; font-size: 17px; letter-spacing: 2px; margin: 1px 0 5px; }
.af-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; }
.af-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--gold)); transition: width 0.2s; }
.af-next { font-size: 11px; color: var(--dim); margin-top: 4px; }
.hud-br { position: absolute; bottom: 12px; right: 12px; display: grid; grid-template-columns: auto auto; gap: 1px 14px; font-family: var(--f-en); font-size: 11px; min-width: 230px; }
.hud-br div { display: flex; justify-content: space-between; gap: 8px; }
.hud-br span { color: var(--dim); letter-spacing: 1px; }
.hud-br b { font-weight: 700; font-family: var(--f-en), var(--f-body); }
.hud-br .ok { color: var(--green); } .hud-br .warn { color: var(--gold); } .hud-br .bad { color: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .select-body { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .pause-body { grid-template-columns: 1fr; }
  .hud-br { display: none; }
  .hud-bl { width: 190px; }
  .lv-card { width: 46vw; min-height: 280px; }
  .timer { font-size: 26px; }
  .slot { width: 34px; height: 40px; } .slot img { width: 28px; height: 28px; }
  .slots.passive .slot { width: 30px; height: 36px; } .slots.passive .slot img { width: 22px; height: 22px; }
}
@media (max-height: 640px) {
  .lv-card { min-height: 260px; }
  .lv-icon { width: 64px; height: 64px; }
  #titleDrone { height: 150px; }
}
@media (max-height: 480px) {
  .title-wrap { padding: 6px 0; }
  .title-badge { font-size: 10px; padding: 4px 10px; }
  .logo { margin-top: 6px; }
  .logo-a { font-size: 44px; }
  .logo-b { font-size: 28px; }
  .logo-kr { font-size: 18px; margin-top: 4px; }
  #titleDrone { height: 80px; }
  .menu { gap: 8px; }
  .menu .btn { min-width: 120px; padding: 6px 10px; }
  .menu .btn.primary { font-size: 20px; padding: 8px; }
  .title-foot { margin-top: 10px; }
  .scr-head { padding: 8px 16px; }
  .scr-head h2 { font-size: 22px; }
  .scr-foot { padding: 8px; }
  .scr-foot .btn, .scr-foot .btn.big { padding: 6px 28px; font-size: 18px; }
  .select-body { grid-template-columns: 250px 1fr; gap: 12px; padding: 0 14px 6px; }
  .af-grid { gap: 8px; }
  .af-card { padding: 4px 4px 6px; }
  .af-card canvas { width: 96px; height: 60px; }
  .af-card-name { font-size: 14px; }
  .af-card-role { font-size: 10px; }
  .af-detail { padding: 12px 14px; }
  .detail-top { gap: 10px; }
  #afPreview { width: 140px; height: 110px; }
  .detail-info { min-width: 200px; }
  .detail-name { font-size: 24px; }
  .detail-desc { font-size: 12px; line-height: 1.45; }
  .detail-perk, .detail-weapon { padding: 6px 8px; font-size: 12px; }
  .detail-weapon img { width: 34px; height: 34px; }
  .evo-step { min-width: 90px; }
  .evo-step canvas { width: 80px; height: 60px; }
  .hangar-grid { padding: 0 14px 6px; gap: 8px; }
  .lv-wrap { gap: 8px; padding: 8px; }
  .lv-title { font-size: 30px; }
  .lv-sub { font-size: 12px; }
  .lv-cards { flex-wrap: nowrap; gap: 8px; }
  .lv-card { width: 31vw; min-height: 0; padding: 30px 8px 8px; gap: 3px; }
  .lv-icon { width: 40px; height: 40px; margin-top: 0; }
  .lv-name { font-size: 16px; }
  .lv-en { display: none; }
  .lv-text { font-size: 12px; line-height: 1.4; }
  .lv-hint { font-size: 10px; padding-top: 4px; }
  .lv-actions .btn { padding: 4px 14px; }
  .modal-panel { padding: 12px 16px; gap: 8px; max-height: 96vh; }
  .pause-body { grid-template-columns: 1.3fr 1fr; gap: 12px; }
  .pause-col h4 { font-size: 14px; margin: 2px 0 4px; }
  .modal-title { font-size: 22px; }
  .statlist > * { padding-top: 2px; padding-bottom: 2px; font-size: 12px; }
  .modal-panel > .row-btns .btn { padding: 6px 18px; }
  .result-wrap { gap: 6px; }
  .result-title { font-size: 30px; }
  .result-sub { font-size: 12px; }
  .result-grid { grid-template-columns: 230px 1fr; gap: 10px; }
  .result-summary { padding: 8px 12px; }
  .result-title { font-size: 26px; }
  .result-summary canvas { width: 80px; height: 50px; object-fit: contain; }
  .res-row { padding: 2px; font-size: 12px; }
  .res-row b { font-size: 13px; }
  .result-table-wrap { padding: 8px 12px; }
  .result-table { font-size: 12px; }
  .result-table td { padding: 3px 6px; }
  .result-table img { width: 24px; height: 24px; }
  .row-btns .btn { padding: 6px 18px; }
  .hud-bl { width: 170px; }
  .af-name { font-size: 13px; }
}
@media (max-height: 480px), (max-width: 480px) {
  .modal-panel > .row-btns { position: sticky; bottom: -12px; margin: 0 -16px -12px; padding: 8px 16px; background: rgba(6, 16, 26, 0.97); border-top: 1px solid rgba(255,255,255,0.08); justify-content: center; flex-wrap: nowrap; gap: 8px; }
  .modal-panel > .row-btns .btn { flex: 0 1 180px; min-width: 0; padding: 6px 8px; }
  .row-btns { flex-wrap: nowrap; gap: 8px; }
  .row-btns .btn { min-width: 0; }
}
@media (max-width: 480px) {
  .title-badge { font-size: 9px; letter-spacing: 2px; padding: 4px 10px; }
  .logo-a { font-size: 52px; }
  .logo-b { font-size: 30px; }
  .logo-kr { font-size: 20px; letter-spacing: 0.3em; }
  #titleDrone { height: 170px; }
  .menu { width: 92vw; gap: 8px; }
  .menu .btn { min-width: 0; padding: 8px 4px; }
  .menu .btn small { font-size: 8px; letter-spacing: 1px; }
  .title-foot { gap: 6px; }
  .scr-head { padding: 10px 12px; gap: 10px; }
  .scr-head h2 { font-size: 20px; }
  .scr-head h2 small { display: none; }
  .select-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 8px; padding: 0 10px 6px; }
  .af-grid { gap: 8px; }
  .af-card { padding: 4px 4px 8px; }
  .af-card canvas { width: 110px; height: 70px; }
  .af-card-name { font-size: 15px; }
  .af-detail { padding: 12px; }
  #afPreview { width: 120px; height: 100px; }
  .detail-info { min-width: 0; }
  .detail-name { font-size: 24px; }
  .detail-desc { font-size: 13px; }
  .evo-step { min-width: 96px; }
  .evo-step canvas { width: 84px; height: 64px; }
  .hangar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 10px 6px; gap: 6px; }
  .lv-wrap { gap: 10px; padding: 12px 10px; }
  .lv-title { font-size: 34px; }
  .lv-cards { flex-direction: column; align-items: center; gap: 8px; }
  .lv-card { width: min(380px, 92vw); min-height: 0; padding: 30px 12px 10px; }
  .lv-icon { width: 48px; height: 48px; margin-top: 0; }
  .lv-en { display: none; }
  .lv-text { font-size: 13px; }
  .modal-panel { padding: 12px 16px; }
  .hud-tc { top: 112px; width: 92vw; }
  /* six weapon slots reach x=236; stack the counters so they never sit on slots 5-6 */
  .hud-tr { flex-direction: column; align-items: flex-end; gap: 4px; right: 8px; }
  .hud-tr .stat { padding: 3px 8px; font-size: 13px; }
  .hud-tr .pausebtn { order: -1; }
  .timer { font-size: 24px; }
  .alert { font-size: 14px; padding: 6px 14px; white-space: normal; text-align: center; }
  .hud-bl { width: 160px; }
  .af-name { font-size: 12px; }
  .result-title { font-size: 28px; }
}

/* =====================================================================
   Online: pilot nickname / server sync / leaderboard  (v1.2, net.js)
   ===================================================================== */
.menu { grid-template-columns: repeat(4, 1fr); }
.menu .btn.primary { grid-column: 1 / -1; }

.pilot-chip { cursor: pointer; color: var(--text); font-family: var(--f-body); font-weight: 700; letter-spacing: 0.5px; }
.pilot-chip:hover { border-color: var(--cyan); color: var(--cyan); }
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: #5b6b78; flex: none; }
[data-net="on"] .net-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
[data-net="warn"] .net-dot { background: var(--gold); box-shadow: 0 0 8px var(--gold); }

#scr-nick { z-index: 70; }
.nick-desc { color: #c4d8e6; font-size: 14px; line-height: 1.6; }
.nick-desc small { color: var(--dim); }
.nick-input, .net-code input {
  width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--panel-b); background: rgba(0,0,0,0.45);
  color: var(--text); font-family: var(--f-body); font-size: 18px; font-weight: 700; outline: none; user-select: text; -webkit-user-select: text;
}
.nick-input:focus, .net-code input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(56,214,255,0.18); }
.net-msg { min-height: 18px; font-size: 13px; color: var(--gold); }
.nick-panel .row-btns { flex-wrap: nowrap; }
.nick-panel .row-btns .btn { flex: 1; min-width: 0; padding-left: 10px; padding-right: 10px; }

.net-settings { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.1); }
.net-row { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.net-row > span { color: var(--dim); }
.net-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-row .btn.small { min-width: 0; padding: 4px 14px; font-size: 14px; }
.net-status { font-size: 12px; color: var(--dim); }
.net-status[data-net="on"] { color: var(--green); }
.net-transfer summary { cursor: pointer; font-size: 13px; color: var(--cyan); }
.net-transfer p { font-size: 12px; color: var(--dim); line-height: 1.5; margin: 6px 0; }
.net-code { display: flex; gap: 6px; margin-top: 6px; }
.net-code input { flex: 1; min-width: 0; padding: 6px 10px; font-size: 12px; font-family: var(--f-en); font-weight: 500; }
.net-code .btn.small { min-width: 0; padding: 4px 12px; font-size: 14px; }

.res-online { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; min-height: 0; }
.res-online:empty { display: none; }
.res-online > span { padding: 5px 14px; border-radius: 999px; background: rgba(0,0,0,0.45); border: 1px solid rgba(56,214,255,0.35); font-size: 14px; }
.res-online b { color: var(--cyan); font-family: var(--f-en); }
.res-join { padding: 5px 14px; border-radius: 999px; background: rgba(56,214,255,0.14); border: 1px solid var(--cyan); color: var(--cyan); font-size: 14px; cursor: pointer; }
.res-join:hover { background: rgba(56,214,255,0.28); }
.res-online .dim { color: var(--dim); border-color: rgba(255,255,255,0.15); }
.res-online .nb { color: #02131c; background: linear-gradient(180deg, #ffe7a3, #ffb13d); border-color: #ffe7a3; font-family: var(--f-en); font-weight: 900; letter-spacing: 2px; animation: pipBlink 0.6s infinite alternate; }

#scr-leaderboard { flex-direction: column; background: rgba(2, 6, 12, 0.45); }
.lb-body { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 4px 20px 16px; overflow: auto; }
.lb-panel { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; width: min(860px, 100%); padding: 8px 14px; }
.lb-list { flex: 0 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.lb-body > :not(.lb-panel) { flex: none; }
.lb-row { display: grid; grid-template-columns: 44px minmax(0, 1.6fr) 1fr 0.8fr 0.5fr 1fr; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 15px; }
.lb-row > span:nth-child(n+3) { text-align: right; font-family: var(--f-en); font-size: 13px; }
.lb-row .lb-af { font-family: var(--f-body); font-size: 13px; color: var(--dim); }
.lb-headrow { font-size: 11px; color: var(--dim); letter-spacing: 1px; border-bottom-color: rgba(56,214,255,0.35); }
.lb-headrow > span:nth-child(n+3) { font-size: 11px; }
.lb-rank { font-family: var(--f-en); font-weight: 900; text-align: center; color: var(--dim); }
.lb-nick { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 700; }
.lb-nick > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-nick em { font-style: normal; font-family: var(--f-en); font-size: 9px; letter-spacing: 1px; color: var(--green); border: 1px solid rgba(77,255,136,0.5); border-radius: 4px; padding: 1px 4px; vertical-align: middle; flex: none; }
.lb-row .lb-score { color: var(--cyan); font-weight: 700; font-size: 15px; }
.lb-row.top1 .lb-rank { color: #ffd166; text-shadow: 0 0 10px rgba(255,209,102,0.7); }
.lb-row.top2 .lb-rank { color: #d7e3ec; }
.lb-row.top3 .lb-rank { color: #e0a070; }
.lb-row.me { background: linear-gradient(90deg, rgba(56,214,255,0.22), rgba(56,214,255,0.04)); border-radius: 6px; box-shadow: inset 3px 0 0 var(--cyan); }
.lb-me { width: min(860px, 100%); display: flex; justify-content: center; }
.lb-me:empty { display: none; }
.lb-me .lb-row { border-bottom: none; }
.lb-empty { padding: 30px 10px; text-align: center; color: var(--dim); }
.lb-note { font-size: 11px; color: var(--dim); text-align: center; }

@media (max-width: 480px) {
  .menu { grid-template-columns: repeat(2, 1fr); }
  .lb-body { padding: 0 8px 10px; }
  .lb-panel { padding: 4px 6px; }
  .lb-row { grid-template-columns: 30px minmax(0, 1fr) 72px 50px 30px; gap: 6px; padding: 8px 4px; font-size: 14px; }
  .lb-row .lb-af { display: none; }
  .lb-row > span:nth-child(n+3) { font-size: 12px; }
  .lb-row .lb-score { font-size: 13px; }
}
@media (max-height: 480px) {
  .lb-body { padding: 0 14px 6px; gap: 6px; }
  .lb-row { padding: 5px 6px; font-size: 13px; }
  .res-online > span { padding: 2px 10px; font-size: 12px; }
  .nick-input { padding: 8px 12px; font-size: 16px; }
}

/* =====================================================================
   v1.5 polish: phone HUD hierarchy, hangar footer, result and title touches
   ===================================================================== */
#titleBest.has-best { color: var(--gold); border-color: rgba(255,209,102,0.45); }
.hg-card:not(.poor):not(.maxed) .buy { box-shadow: 0 0 0 1px rgba(255,209,102,0.55), 0 0 14px rgba(255,209,102,0.18); }
.res-online > span:first-child { font-size: 16px; padding: 6px 16px; }
@media (max-width: 480px) {
  /* Keep the play field clear: at most two short banners, the newest two. */
  .alerts { gap: 4px; }
  .alerts .alert:nth-last-child(n+3) { display: none; }
  .alert { font-size: 13px; padding: 4px 12px; gap: 6px; }
  .alert.boss { font-size: 17px; }
  /* The footer is a solid bar, so the last cards are never hidden under a floating button. */
  .scr-foot { padding: 8px 10px; background: rgba(4, 10, 18, 0.97); border-top: 1px solid rgba(56,214,255,0.18); }
  .scr-foot .btn, .scr-foot .btn.big { padding: 6px 22px; }
  .scr-foot .btn small { display: none; }
  .result-summary canvas { width: 132px; height: 96px; }
  .result-summary { padding: 10px 14px; }
}

/* =====================================================================
   v1.6 stage mode: mode choice on the title, stage select, in-stage goal
   ===================================================================== */
.menu .btn.primary { grid-column: span 2; }
.menu .btn.primary.alt { background: linear-gradient(180deg, #24405c, #14283c); color: #dff4ff; border-color: rgba(56,214,255,0.55); }
.menu .btn.primary.alt small { color: #9fd8ee; }
.menu .btn.primary small b { font-weight: 700; color: inherit; }
#scr-stages { flex-direction: column; }
.stages-body { flex: 1; min-height: 0; overflow: auto; padding: 4px 28px 16px; display: flex; flex-direction: column; gap: 14px; }
.floor-tabs { display: flex; gap: 8px; border-bottom: 1px solid rgba(56,214,255,0.35); }
.floor-tabs .tab small { font-family: var(--f-en); font-size: 11px; letter-spacing: 1px; margin-left: 4px; opacity: 0.8; }
.floor-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; border-bottom: 1px solid rgba(56,214,255,0.25); padding-bottom: 6px; }
.floor-head b { font-family: var(--f-kr); font-size: 26px; color: #fff; }
.floor-head span { font-family: var(--f-kr); font-size: 18px; color: var(--cyan); }
.floor-head small { margin-left: auto; font-family: var(--f-en); font-size: 11px; letter-spacing: 2px; color: var(--dim); }
.floor.soon .floor-head b, .floor.soon .floor-head span { color: var(--dim); }
.stage-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stage-card { position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px 14px; min-height: 172px; border-radius: 10px; color: #e8f4fb; font: inherit;
  background: linear-gradient(180deg, rgba(14,34,52,0.95), rgba(6,16,26,0.95)); border: 1px solid rgba(56,214,255,0.4); cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.stage-card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--cyan); }
.st-code { font-family: var(--f-en); font-weight: 900; font-size: 26px; color: var(--cyan); letter-spacing: 2px; }
.st-name { font-family: var(--f-kr); font-size: 20px; }
.st-goal { font-size: 13px; font-weight: 700; color: #ffe7a3; }
.st-desc { font-size: 12px; color: var(--dim); line-height: 1.4; flex: 1; }
.st-reward { font-family: var(--f-en); font-size: 13px; color: var(--gold); }
.st-reward i { font-style: normal; font-family: var(--f-body, inherit); font-size: 11px; color: #c9b27a; }
.st-state { font-family: var(--f-en); font-size: 10px; letter-spacing: 1.5px; color: var(--cyan); padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.08); }
.stage-card.clear { border-color: rgba(255,209,102,0.7); }
.stage-card.clear .st-code, .stage-card.clear .st-state { color: var(--gold); }
.stage-card.locked { cursor: default; opacity: 0.5; border-style: dashed; border-color: rgba(255,255,255,0.25); filter: saturate(0.3); }
.stage-card.locked .st-code, .stage-card.locked .st-state { color: var(--dim); }
.stage-card.soon { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: 16px; }
.stage-card.soon .st-state { border: 0; padding: 0; margin-left: auto; }
.stage-goal { margin-top: 2px; padding: 3px 14px; border-radius: 999px; font-family: var(--f-kr); font-size: 15px; color: #ffe7a3; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,209,102,0.45); white-space: nowrap; }
.stage-goal.hidden { display: none; }
.row-btns .btn.hidden { display: none; }
@media (max-width: 1000px) { .stage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) {
  .stages-body { padding: 0 10px 10px; gap: 10px; }
  .floor-head b { font-size: 20px; } .floor-head span { font-size: 14px; } .floor-head small { font-size: 9px; letter-spacing: 1px; }
  .stage-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stage-card { min-height: 0; padding: 10px 12px; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px; align-items: center; }
  .st-code { grid-row: 1 / span 2; font-size: 22px; }
  .st-name { font-size: 17px; }
  .st-goal { grid-column: 2; font-size: 12px; }
  .st-reward { grid-column: 3; grid-row: 1 / span 2; text-align: right; font-size: 12px; }
  .st-reward i { display: block; }
  .st-desc { display: none; }
  .st-state { grid-column: 1 / -1; padding-top: 4px; margin-top: 4px; }
  .stage-card.soon { display: flex; }
  .stage-goal { font-size: 12px; padding: 2px 10px; }
  .menu .btn.primary { grid-column: span 1; font-size: 22px; padding: 14px 4px; }
  .row-btns.stage { width: 100%; gap: 6px; }
  .row-btns.stage .btn { flex: 1 1 0; padding: 10px 2px; font-size: 14px; letter-spacing: 0; white-space: nowrap; }
  .row-btns.stage .btn small { display: none; }
}

/* =====================================================================
   v1.7 one screen: every menu fits the viewport with no scrolling.
   Long lists (hangar, field manual, leaderboard) page through ui.js fitPages().
   ===================================================================== */
.pg-off { display: none !important; }
.pager { flex: none; display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 8px; }
.pager button { min-width: 48px; height: 34px; border-radius: 6px; border: 1px solid rgba(56,214,255,0.45); background: rgba(0,0,0,0.45); color: var(--cyan); font-family: var(--f-en); font-size: 20px; line-height: 1; }
.pager button:hover:not(:disabled) { border-color: var(--cyan); background: rgba(56,214,255,0.15); }
.pager button:disabled { opacity: 0.3; cursor: default; }
.pager span { min-width: 64px; text-align: center; font-family: var(--f-en); font-size: 13px; letter-spacing: 2px; color: var(--dim); }
#scr-hangar .pager, #scr-leaderboard .pager { padding-bottom: 4px; }
#evoFrom { width: min(200px, 26vw, 24vh); height: min(200px, 26vw, 24vh); }
#evoTo { width: min(260px, 36vw, 32vh); height: min(260px, 36vw, 32vh); }
.evolve-stage { flex-wrap: nowrap; }

/* Phones in portrait and short landscape screens share the compact hangar card. */
@media (max-width: 480px), (max-height: 480px) {
  .hg-card { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "img name name" "img desc desc" "pips pips buy"; align-items: center; gap: 2px 8px; padding: 6px 8px; }
  .hg-info { display: contents; }
  .hg-card img { grid-area: img; width: 28px; height: 28px; }
  .hg-name { grid-area: name; font-size: 14px; line-height: 1.2; }
  .hg-desc { grid-area: desc; font-size: 11px; line-height: 1.3; margin: 0; }
  .hg-card .pips { grid-area: pips; gap: 2px; }
  .hg-card .pips i { width: 9px; height: 5px; }
  .hg-card .buy { grid-area: buy; min-width: 0; padding: 5px 10px; font-size: 11px; }
  .howto-tabs { padding: 0 10px; gap: 4px; }
  .tab { padding: 6px 12px; font-size: 14px; }
  .howto-body { padding: 8px 10px; }
  .howto-grid { gap: 8px; }
  .howto-card { padding: 10px 12px; }
  .howto-card h3 { font-size: 16px; margin-bottom: 2px; }
  .howto-card p { font-size: 12.5px; line-height: 1.5; }
  .evo-table { gap: 6px; }
  .evo-row { flex-wrap: nowrap; gap: 6px; padding: 6px 10px; }
  .evo-item { min-width: 0; gap: 6px; }
  .evo-item img { width: 32px; height: 32px; flex: none; }
  .evo-item b { font-size: 12px; line-height: 1.25; }
  .evo-item small { font-size: 10px; line-height: 1.3; }
  .evo-op { font-size: 15px; }
  .beast { padding: 6px 4px; }
  .beast canvas, .hz-ico { width: 72px; height: 60px; }
  .hz-ico { font-size: 34px; }
  .beast-name { font-size: 14px; }
  .beast-en { display: none; }
  .beast-tag { margin: 3px 0 2px; font-size: 10px; }
  .beast-stats { font-size: 10px; line-height: 1.35; }
  .statlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; }
  .statlist div:nth-child(odd) { background: none; }
  .statlist div:nth-child(4n+1), .statlist div:nth-child(4n+2) { background: rgba(255,255,255,0.04); }
  .statlist div { padding: 3px 8px; font-size: 12px; }
  .statlist b { font-size: 11px; }
}

@media (max-width: 480px) {
  .scr-head { padding: 8px 10px; }
  .back { padding: 6px 12px; font-size: 16px; }
  .chip.big { font-size: 15px; padding: 6px 12px; }
  /* Stage select: one floor per tab, five rows. */
  .floor-head { margin-bottom: 6px; }
  /* Airframe select: four airframes in one row, compact detail. */
  .af-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .af-card { padding: 4px 2px 6px; }
  .af-card canvas { width: 72px; height: 52px; }
  .af-card-name { font-size: 13px; white-space: nowrap; }
  .af-card-role { font-size: 10px; letter-spacing: 1px; }
  .af-key { top: 3px; left: 5px; font-size: 9px; }
  .af-detail { padding: 10px 12px; }
  .detail-top { flex-wrap: nowrap; align-items: flex-start; gap: 10px; }
  #afPreview { width: 96px; height: 80px; flex: none; }
  .detail-en { font-size: 9px; letter-spacing: 2px; }
  .detail-name { font-size: 22px; }
  .detail-role { margin: 2px 0 6px; font-size: 11px; }
  .detail-desc { font-size: 12px; line-height: 1.45; margin-bottom: 2px; }
  .detail-perk, .detail-weapon { gap: 8px; padding: 6px 8px; margin-top: 6px; font-size: 12px; line-height: 1.4; }
  .detail-weapon img { width: 32px; height: 32px; }
  .evo-path-title { margin: 10px 0 6px; font-size: 15px; }
  .evo-path-title small { display: none; }
  .evo-path { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; overflow: visible; padding: 0; }
  .evo-arrow { display: none; }
  .evo-step { min-width: 0; padding: 4px 2px; }
  .evo-step canvas { width: 52px; height: 44px; }
  .evo-lv { font-size: 9px; letter-spacing: 1px; }
  .evo-name { font-size: 11px; line-height: 1.2; }
  .evo-desc { display: none; }
  /* Field manual */
  .howto-grid { grid-template-columns: minmax(0, 1fr); }
  .evo-item:not(.gold) { flex: none; width: 62px; flex-direction: column; gap: 2px; text-align: center; }
  .evo-item.gold { flex: 1; }
  .bestiary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  /* Level up: one row per card, icon on the left. */
  .lv-wrap { gap: 8px; padding: 8px 10px; }
  .lv-title { font-size: 30px; }
  .lv-cards { gap: 6px; }
  .lv-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; align-items: center; justify-items: start; text-align: left; padding: 10px 12px; }
  .lv-card > * { grid-column: 2; }
  .lv-icon { grid-column: 1; grid-row: 1 / span 6; width: 48px; height: 48px; align-self: center; }
  .lv-key { display: none; }
  .lv-name { font-size: 18px; padding-right: 48px; }
  .lv-level { min-height: 0; font-size: 12px; }
  .lv-text { font-size: 12.5px; line-height: 1.4; }
  .lv-hint { font-size: 10.5px; padding-top: 3px; }
  /* Pause: icon tiles for the loadout, stats in two columns. */
  .modal-panel.wide { padding: 12px 16px; gap: 8px; }
  .pause-body { gap: 4px; }
  .pause-col h4 { font-size: 14px; margin: 2px 0 4px; }
  .inv { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .inv-item { flex-direction: column; gap: 0; padding: 4px 2px; text-align: center; }
  .inv-item img { width: 30px; height: 30px; }
  .inv-item b, .inv-item small { display: none; }
  .inv-item em { font-size: 9px; }
  /* Result */
  .result-wrap { gap: 6px; padding: 6px 4px; }
  .result-sub { font-size: 12px; letter-spacing: 1px; text-align: center; }
  .res-online > span, .res-online > span:first-child, .res-join { padding: 3px 10px; font-size: 12px; }
  .result-grid { gap: 8px; }
  .result-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; row-gap: 0; padding: 8px 12px; }
  .result-summary canvas { display: none; }
  .res-row { padding: 3px 2px; font-size: 12px; }
  .res-row b { font-size: 12px; text-align: right; }
  .res-gold { grid-column: 1 / -1; }
  .result-table-wrap { padding: 8px 10px; }
  .result-table-wrap h4 { font-size: 15px; margin-bottom: 4px; }
  .result-table { font-size: 12px; }
  .result-table th { padding: 3px 4px; font-size: 11px; }
  .result-table td { padding: 2px 4px; }
  .result-table td:nth-child(n+3) { font-size: 11px; }
  .result-table img { width: 24px; height: 24px; }
  .chest-wrap { gap: 8px; }
  .chest-title { font-size: 26px; }
  .chest-item { padding: 6px 10px; }
  .chest-item img { width: 40px; height: 40px; }
  .chest-item img.big { width: 56px; height: 56px; }
}
/* Taller phones have room for the drone pictures and tier bonuses. */
@media (max-width: 480px) and (min-height: 760px) {
  .evo-desc { display: block; font-size: 9.5px; line-height: 1.3; }
  .evo-step canvas { width: 60px; height: 50px; }
  #afPreview { width: 120px; height: 100px; }
  .result-summary canvas { display: block; grid-column: 1 / -1; width: 132px; height: 96px; }
  .inv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-item { flex-direction: row; gap: 8px; text-align: left; padding: 4px 8px; }
  .inv-item img { width: 28px; height: 28px; }
  .inv-item b { display: inline; font-size: 12px; }
}

@media (max-height: 480px) {
  .scr-head { padding: 6px 16px; }
  .back { padding: 4px 12px; font-size: 15px; }
  .chip.big { font-size: 14px; padding: 4px 12px; }
  .hangar-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .stages-body { padding: 0 14px 8px; gap: 8px; }
  .floor-head { margin-bottom: 6px; padding-bottom: 4px; }
  .floor-head b { font-size: 18px; } .floor-head span { font-size: 14px; }
  .tab { padding: 4px 12px; font-size: 14px; }
  .pager { padding-top: 4px; }
  .pager button { height: 28px; }
  .af-detail { padding: 8px 12px; }
  #afPreview { width: 120px; height: 96px; }
  .detail-role { margin: 2px 0 6px; }
  .evo-path-title { margin: 8px 0 6px; font-size: 15px; }
  .evo-path { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; overflow: visible; padding: 0; }
  .evo-arrow { display: none; }
  .evo-step { min-width: 0; padding: 4px; }
  .evo-step canvas { width: 64px; height: 44px; }
  .evo-desc { font-size: 9.5px; }
  .howto-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .bestiary { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
  .beast canvas, .hz-ico { width: 64px; height: 50px; }
  .lv-cards { width: 100%; }
  .lv-card { width: auto; flex: 1 1 0; max-width: 260px; min-width: 0; }
  .modal-panel.wide { gap: 6px; }
  .inv { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .inv-item { flex-direction: column; gap: 0; padding: 3px 2px; text-align: center; }
  .inv-item img { width: 30px; height: 30px; }
  .inv-item b, .inv-item small { display: none; }
  .inv-item em { font-size: 9px; }
  #scr-settings .modal-panel { width: min(560px, 94vw); }
  #scr-settings .toggle { display: inline-flex; margin-right: 14px; font-size: 14px; }
  #scr-settings .modal-panel { flex-flow: row wrap; align-items: center; column-gap: 0; }
  #scr-settings .modal-panel > :not(.toggle) { flex-basis: 100%; }
  .net-transfer p { margin: 4px 0; }
  .result-summary canvas { display: none; }
  .result-table td { padding: 2px 6px; }
  .result-table img { width: 20px; height: 20px; }
  .chest-wrap { display: grid; grid-template-columns: 170px minmax(0, 1fr); grid-template-areas: "art items" "title items" "gold items" "btn items"; align-items: center; justify-items: center; column-gap: 20px; row-gap: 6px; width: min(760px, 94vw); }
  .chest-art { grid-area: art; }
  .chest-title { grid-area: title; font-size: 24px; text-align: center; }
  .chest-items { grid-area: items; }
  .chest-gold { grid-area: gold; }
  #btnChest { grid-area: btn; }
  .chest-item { padding: 6px 10px; }
  .chest-item img { width: 40px; height: 40px; }
  .chest-item img.big { width: 56px; height: 56px; }
  .evolve-wrap { gap: 4px; }
  .evolve-title { font-size: 32px; }
  .evolve-bonus { margin: 2px 0 4px; }
  /* Airframe detail: perk and weapon side by side, tier pictures smaller. */
  .af-detail { padding: 8px 12px; }
  .detail-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; align-items: stretch; }
  .detail-info > * { grid-column: 1 / -1; }
  .detail-info > .detail-perk, .detail-info > .detail-weapon { grid-column: auto; margin-top: 4px; }
  .detail-role { justify-self: start; }
  .detail-name { font-size: 24px; }
  .detail-desc { font-size: 12px; line-height: 1.45; margin-bottom: 0; }
  .detail-weapon br, .detail-weapon small { display: none; }
  .evo-path-title { margin: 6px 0 4px; }
  .evo-path-title small { display: none; }
  .evo-step canvas { width: 56px; height: 36px; }
  .evo-desc { display: none; }
  .evo-lv { font-size: 9px; }
  .evo-name { font-size: 12px; white-space: nowrap; }
  .detail-role { margin: 2px 0 4px; }
  .result-title { font-size: 30px; }
  .result-wrap { gap: 4px; }
  .res-row { padding-top: 2px; padding-bottom: 2px; }
  .result-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .res-online > span, .res-online > span:first-child, .res-join { padding: 2px 12px; font-size: 13px; }
  .result-table-wrap { padding-top: 6px; padding-bottom: 6px; }
  .result-table-wrap h4 { margin-bottom: 0; font-size: 14px; }
  .result-table th { padding-top: 2px; padding-bottom: 2px; }
  .result-table img { width: 18px; height: 18px; }
}
/* Short desktop windows: tighter stat rows in the pause panel. */
@media (min-width: 481px) and (min-height: 481px) and (max-height: 820px) {
  .statlist div { padding-top: 3px; padding-bottom: 3px; }
}

/* Landscape phones: one row of five stages. Short narrow phones keep the single-column list. */
@media (max-height: 480px) and (min-width: 481px) {
  .stage-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .stage-card { min-height: 0; padding: 8px 10px; }
  .st-code { font-size: 20px; }
  .st-name { font-size: 16px; }
  .st-desc { display: none; }
}
