:root {
  --bg: #07080c;
  --cyan: #2ee6ff;
  --magenta: #ff3bd4;
  --green: #9dff3b;
  --red: #ff3b5c;
  --gold: #ffc400;
  --text: #e8f1ff;
  --muted: #8a97ad;
  --panel: rgba(9, 13, 21, 0.88);
  --line: rgba(46, 230, 255, 0.35);
  --head: 'Orbitron', 'DIN Condensed', 'Avenir Next Condensed', 'Arial Narrow', sans-serif;
  --body: 'Rajdhani', 'Avenir Next Condensed', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 17px; user-select: none; -webkit-user-select: none; }
.hidden { display: none !important; }
#view { position: fixed; inset: 0; }
#view canvas { display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 45%, rgba(0,0,0,0.55) 80%, rgba(0,0,0,0.85) 100%); }
#damage-flash { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(255,0,40,0) 40%, rgba(255,0,40,0.55) 100%); opacity: 0; transition: opacity 0.25s; }
#fx-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.ftext { position: absolute; font-family: var(--head); font-weight: 800; transform: translate(-50%, -50%); text-shadow: 0 0 8px currentColor, 0 2px 2px #000; white-space: nowrap; }
#qte { position: fixed; pointer-events: none; display: none; transform: translate(-50%, -50%); }
kbd { font-family: var(--head); font-size: 0.7em; padding: 1px 5px; border: 1px solid var(--line); border-radius: 3px; background: rgba(46,230,255,0.08); color: var(--cyan); }
button { font-family: var(--head); }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud-player { position: absolute; top: 18px; left: 18px; display: flex; gap: 12px; align-items: center; }
.portrait-wrap { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 3px solid #1c2a3a; box-shadow: 0 0 0 2px var(--cyan), 0 0 18px rgba(46,230,255,0.4); overflow: hidden; background: #111; }
.portrait-wrap img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
#hud-level { position: absolute; bottom: -2px; left: -2px; width: 28px; height: 28px; border-radius: 50%; background: #0a0d14; border: 2px solid var(--text); font-family: var(--head); font-size: 14px; display: grid; place-items: center; }
.bars { width: 300px; }
#hud-name { font-family: var(--head); font-size: 20px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 2px 4px #000; margin-bottom: 4px; }
.bar { position: relative; height: 18px; background: rgba(20, 26, 38, 0.85); border: 2px solid rgba(255,255,255,0.85); border-radius: 3px; overflow: hidden; transform: skewX(-12deg); margin-bottom: 6px; }
.bar > div { position: absolute; inset: 0; width: 100%; transition: width 0.15s; }
.bar.hp > div { background: linear-gradient(#45f08a, #19b85a); }
.bar.hp span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--head); font-size: 12px; font-weight: 800; transform: skewX(12deg); text-shadow: 0 1px 2px #000; }
.bar.xp { height: 11px; width: 78%; }
.bar.xp > div { background: linear-gradient(#ffe45c, #f0b400); }
#hud-o2 { position: absolute; top: 118px; left: 32px; display: flex; flex-direction: column; align-items: center; }
.o2-cap { width: 22px; height: 10px; background: #9aa6bb; border-radius: 2px 2px 0 0; }
.o2-bottle { position: relative; width: 44px; height: 120px; border-radius: 12px; border: 3px solid #cfe0ff; background: rgba(20, 30, 60, 0.7); overflow: hidden; box-shadow: 0 0 14px rgba(80, 140, 255, 0.4); }
#hud-o2-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; background: linear-gradient(#7aa7ff, #3a5dff); transition: height 0.3s; }
.o2-bottle span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--head); font-weight: 900; font-size: 18px; color: #fff; text-shadow: 0 1px 3px #000; }
#hud-o2-time { margin-top: 6px; font-family: var(--head); font-weight: 800; font-size: 18px; text-shadow: 0 2px 3px #000; }
#hud-o2.low .o2-bottle { border-color: var(--red); animation: pulse 0.6s infinite alternate; }
#hud-o2.low #hud-o2-time { color: var(--red); }
#hud-bottles { margin-top: 4px; display: flex; gap: 3px; }
#hud-bottles i { width: 9px; height: 18px; border-radius: 3px; background: #3a5dff; border: 1px solid #cfe0ff; display: block; }
#hud-bottles i.used { background: transparent; opacity: 0.4; }
@keyframes pulse { from { box-shadow: 0 0 6px rgba(255,59,92,0.4); } to { box-shadow: 0 0 22px rgba(255,59,92,1); } }
#hud-ore { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); padding: 8px 16px; clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%); }
.ore-item { display: flex; align-items: center; gap: 8px; font-family: var(--head); font-size: 15px; }
.ore-gem { width: 14px; height: 18px; clip-path: polygon(50% 0, 100% 35%, 50% 100%, 0 35%); box-shadow: 0 0 8px currentColor; }
.ore-item .run { color: #fff; font-weight: 800; }
.ore-item .bank { color: var(--muted); font-size: 12px; }
.ore-item.done .bank { color: var(--green); }
.ore-boss { font-family: var(--head); font-size: 13px; color: var(--muted); align-self: center; }
.ore-boss.done { color: var(--green); }
#hud-minimap { position: absolute; top: 16px; right: 16px; width: 208px; padding: 4px; background: var(--panel); border: 1px solid var(--line); }
#minimap { display: block; width: 200px; height: 200px; background: #000; }
#hud-mine-name { font-family: var(--head); font-size: 11px; letter-spacing: 1px; color: var(--cyan); text-align: center; padding-top: 4px; }
#hud-weapons { position: absolute; left: 18px; bottom: 18px; display: flex; gap: 10px; align-items: flex-end; }
.wslot { position: relative; width: 70px; height: 70px; border: 2px solid rgba(255,255,255,0.5); background: rgba(12,16,26,0.85); border-radius: 8px; display: grid; place-items: center; color: #dfe8f5; }
.wslot svg { width: 42px; height: 42px; }
.wslot kbd { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); background: #0a0d14; font-size: 9px; }
.wslot.active { border-color: var(--cyan); box-shadow: 0 0 14px rgba(46,230,255,0.6); color: var(--cyan); }
.wslot.special { width: 110px; overflow: hidden; font-family: var(--head); font-size: 10px; text-align: center; padding: 6px; border-color: var(--corp, var(--cyan)); color: var(--corp, var(--cyan)); }
.wslot.special .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); height: 0; }
.wslot.special.ready { box-shadow: 0 0 16px var(--corp, var(--cyan)); }
#hud-familiar { position: absolute; left: 18px; bottom: 110px; display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line); padding: 5px 10px 5px 5px; border-radius: 30px; }
#hud-familiar img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
#hud-familiar b { display: block; font-family: var(--head); font-size: 11px; }
#hud-familiar span { font-size: 13px; color: var(--muted); }
#hud-boss { position: absolute; top: 78px; left: 50%; transform: translateX(-50%); width: 520px; text-align: center; }
.boss-name { font-family: var(--head); font-size: 13px; letter-spacing: 2px; color: #39ff88; text-shadow: 0 0 10px #39ff88; margin-bottom: 4px; }
.bar.boss { height: 16px; }
.bar.boss > div { background: linear-gradient(#39ff88, #0f9f4a); }
#hud-prompt { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); padding: 8px 18px; font-family: var(--head); font-size: 14px; }
#hud-arrow { position: absolute; font-size: 26px; color: var(--gold); text-shadow: 0 0 10px var(--gold); transform: translate(-50%, -50%); }
#hud-banner { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font-family: var(--head); font-weight: 900; font-size: 44px; letter-spacing: 3px; opacity: 0; transition: opacity 0.4s; text-shadow: 0 0 20px currentColor, 0 4px 6px #000; }
#hud-banner small { display: block; font-size: 18px; letter-spacing: 2px; font-weight: 600; margin-top: 6px; }
#hud-toasts { position: absolute; right: 16px; top: 250px; width: 280px; display: flex; flex-direction: column; gap: 6px; }
.toast { background: var(--panel); border-left: 3px solid var(--cyan); padding: 8px 12px; font-size: 15px; animation: toastIn 0.3s; }
@keyframes toastIn { from { transform: translateX(40px); opacity: 0; } }
#hud-extract { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); width: 240px; text-align: center; font-family: var(--head); font-size: 14px; color: var(--cyan); }
#hud-extract .bar > div { background: var(--cyan); width: 0; transition: none; }

/* ---------------- SCREENS ---------------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg); overflow-y: auto; padding: 30px; }
.screen.overlay { background: rgba(3, 5, 10, 0.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.title-bg { position: absolute; inset: 0; background: url(../assets/title_bg.jpg) center 0% / cover no-repeat; filter: brightness(0.85) saturate(1.1); }
.title-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,8,12,0) 0%, rgba(7,8,12,0) 55%, rgba(7,8,12,0.92) 88%); }
.title-bg.end { background-image: url(../assets/cave_bg.jpg); background-position: center; filter: brightness(0.35) saturate(1.2); }
.title-content { position: absolute; left: 0; right: 0; bottom: 6vh; text-align: center; }
.logo-mines { width: 360px; mix-blend-mode: screen; filter: drop-shadow(0 0 20px rgba(46,230,255,0.6)); animation: flicker 5s infinite; }
.logo-mines.small { width: 200px; }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: 0.5; } 94% { opacity: 1; } 96% { opacity: 0.7; } }
.subtitle { font-family: var(--head); letter-spacing: 4px; font-size: 13px; color: var(--cyan); margin-top: -10px; text-shadow: 0 0 10px var(--cyan); }
.menu { margin-top: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.hint { margin-top: 20px; color: var(--muted); font-size: 15px; }
.by-picksels { position: absolute; bottom: 20px; right: 26px; display: flex; align-items: center; gap: 8px; font-family: var(--head); font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.by-picksels img { width: 90px; mix-blend-mode: screen; }
.btn { min-width: 240px; padding: 13px 26px; font-size: 15px; font-weight: 800; letter-spacing: 2px; color: var(--text); background: rgba(10, 16, 26, 0.85); border: 1px solid var(--line); cursor: pointer; clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%); transition: all 0.15s; }
.btn:hover { background: rgba(46,230,255,0.18); color: #fff; box-shadow: inset 0 0 20px rgba(46,230,255,0.3); }
.btn.primary { background: linear-gradient(90deg, rgba(46,230,255,0.25), rgba(255,59,212,0.25)); border-color: var(--cyan); }
.btn.primary:hover { background: linear-gradient(90deg, rgba(46,230,255,0.45), rgba(255,59,212,0.45)); }
.btn.small { min-width: 0; padding: 9px 16px; font-size: 11px; }
.btn.danger { border-color: rgba(255,59,92,0.5); }
.btn.danger:hover { background: rgba(255,59,92,0.2); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.back { position: absolute; left: 24px; top: 24px; }
.intro-box { max-width: 760px; }
.intro-box h1, .end-box h1 { font-family: var(--head); font-weight: 900; font-size: 42px; letter-spacing: 4px; color: var(--magenta); text-shadow: 0 0 20px var(--magenta); }
.intro-box p { font-size: 20px; line-height: 1.45; color: #cdd8ea; opacity: 0; animation: fadeUp 0.8s forwards; }
.intro-box p:nth-of-type(2) { animation-delay: 0.6s; } .intro-box p:nth-of-type(3) { animation-delay: 1.2s; } .intro-box p:nth-of-type(4) { animation-delay: 1.8s; }
.intro-box p.warn { color: var(--gold); }
.intro-box .btn { margin-top: 18px; opacity: 0; animation: fadeUp 0.8s 2.2s forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.screen-title { font-family: var(--head); font-weight: 900; font-size: 32px; letter-spacing: 4px; margin: 0 0 6px; text-shadow: 0 0 16px rgba(46,230,255,0.6); }
.screen-title.left { text-align: left; }
.screen-sub { color: var(--muted); font-size: 18px; margin-bottom: 26px; text-align: center; }
.cards { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; }
.card { width: 300px; background: var(--panel); border: 1px solid rgba(255,255,255,0.12); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; position: relative; }
.card:hover { transform: translateY(-6px); border-color: var(--cc, var(--cyan)); box-shadow: 0 0 30px color-mix(in srgb, var(--cc, var(--cyan)) 45%, transparent); }
.card .img { position: relative; height: 290px; overflow: hidden; }
.card .img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.card .img .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 44px; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.3); color: #fff; cursor: pointer; font-size: 16px; }
.card .img .nav.l { left: 6px; } .card .img .nav.r { right: 6px; }
.card .img .mname { position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 12px 8px; background: linear-gradient(transparent, rgba(0,0,0,0.85)); font-family: var(--head); font-size: 14px; letter-spacing: 1px; }
.card .body { padding: 14px 16px 18px; }
.card h3 { margin: 0; font-family: var(--head); font-weight: 900; font-size: 20px; letter-spacing: 2px; color: var(--cc); text-shadow: 0 0 12px var(--cc); }
.card .stat { font-family: var(--head); font-size: 11px; letter-spacing: 2px; color: var(--muted); margin: 3px 0 8px; }
.card p { margin: 0 0 10px; font-size: 16px; color: #c7d2e4; line-height: 1.3; }
.statbar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 3px 0; }
.statbar span { width: 64px; }
.statbar .pips { display: flex; gap: 3px; }
.statbar .pips i { width: 20px; height: 7px; background: rgba(255,255,255,0.12); transform: skewX(-20deg); display: block; }
.statbar .pips i.on { background: var(--cc); box-shadow: 0 0 6px var(--cc); }
.special-box { margin-top: 10px; padding: 8px 10px; border: 1px dashed color-mix(in srgb, var(--cc) 50%, transparent); font-size: 14px; color: #c7d2e4; }
.special-box b { font-family: var(--head); font-size: 11px; letter-spacing: 1px; color: var(--cc); display: block; }
.cards.fam .card { width: 210px; }
.cards.fam .card .img { height: 210px; }
.cards.fam h3 { font-size: 17px; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 18px 20px; }
.center-panel { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; min-width: 380px; }
.center-panel.wide { max-width: 640px; }
.center-panel h2 { font-family: var(--head); font-weight: 900; letter-spacing: 4px; font-size: 30px; margin: 0; }
.small-note { color: var(--muted); font-size: 14px; margin: 0; }
#result-sub { color: var(--muted); font-size: 18px; }
#result-body { width: 100%; }
.result-row { display: flex; justify-content: space-between; gap: 24px; padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 18px; }
.result-row b { font-family: var(--head); }
.result-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.result-buttons .btn { min-width: 200px; }
.bestiary .tag { font-family: var(--head); font-size: 11px; letter-spacing: 3px; color: var(--gold); }
.bestiary h2 { color: var(--magenta); text-shadow: 0 0 14px var(--magenta); }
#best-kind { font-family: var(--head); font-size: 12px; color: var(--muted); letter-spacing: 2px; }
#best-text { font-size: 19px; line-height: 1.4; margin: 4px 0; }

/* Hub */
.hub-bg { position: absolute; inset: 0; background: url(../assets/cave_bg.jpg) center / cover no-repeat; filter: brightness(0.28) saturate(1.2) blur(2px); }
.hub { position: relative; display: flex; gap: 30px; width: min(1180px, 100%); align-items: flex-start; }
.hub-left { width: 400px; flex-shrink: 0; display: flex; flex-direction: column; gap: 14px; }
.hub-right { flex: 1; }
#hub-miner { display: flex; gap: 14px; align-items: center; }
#hub-miner img.p { width: 96px; height: 96px; object-fit: cover; object-position: 50% 15%; border: 2px solid var(--cc); }
#hub-miner img.f { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); }
#hub-miner h3 { margin: 0; font-family: var(--head); font-size: 20px; }
#hub-miner .corp { font-family: var(--head); font-size: 12px; letter-spacing: 2px; color: var(--cc); }
#hub-miner .lvl { color: var(--muted); font-size: 15px; }
.hub-help h3 { margin: 0 0 8px; font-family: var(--head); font-size: 13px; letter-spacing: 2px; color: var(--cyan); }
.hub-help ul { margin: 0; padding-left: 18px; font-size: 15px; line-height: 1.7; }
.hub-help p { font-size: 15px; color: #b9c5d8; margin: 10px 0 0; line-height: 1.35; }
b.g { color: var(--green); } b.c { color: var(--cyan); }
.hub-buttons { display: flex; gap: 10px; }
.mine-card { position: relative; display: flex; gap: 18px; background: var(--panel); border: 1px solid rgba(255,255,255,0.12); padding: 18px; margin-bottom: 16px; }
.mine-card.open { border-color: var(--line); }
.mine-card.locked { opacity: 0.45; }
.mine-card.validated { border-color: rgba(157,255,59,0.5); }
.mine-card .depth { width: 90px; flex-shrink: 0; text-align: center; border-right: 1px solid rgba(255,255,255,0.1); padding-right: 14px; }
.mine-card .depth b { display: block; font-family: var(--head); font-size: 34px; font-weight: 900; color: var(--mc); text-shadow: 0 0 14px var(--mc); }
.mine-card .depth span { font-family: var(--head); font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.mine-card h3 { margin: 0; font-family: var(--head); font-size: 20px; letter-spacing: 2px; }
.mine-card .status { font-family: var(--head); font-size: 11px; letter-spacing: 2px; margin: 2px 0 6px; }
.mine-card .status.v { color: var(--green); } .mine-card .status.o { color: var(--cyan); } .mine-card .status.l { color: var(--muted); }
.mine-card p { margin: 0 0 8px; color: #b9c5d8; font-size: 15px; line-height: 1.3; }
.objectives { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; font-size: 15px; }
.objectives .ob { display: flex; align-items: center; gap: 6px; }
.progress { height: 6px; width: 90px; background: rgba(255,255,255,0.1); display: inline-block; vertical-align: middle; }
.progress i { display: block; height: 100%; }
.mine-actions { display: flex; align-items: center; gap: 14px; }
.mine-actions .btn { min-width: 200px; padding: 10px 20px; font-size: 13px; }
.bottles { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.bottles i { width: 10px; height: 20px; border-radius: 3px; background: #3a5dff; border: 1px solid #cfe0ff; display: block; }
.bottles i.used { background: transparent; opacity: 0.4; }
.end-box { position: relative; max-width: 760px; text-align: center; }
.end-box p { font-size: 19px; line-height: 1.45; color: #cdd8ea; }
.credits { margin: 24px 0; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.12); }
.credits h3 { font-family: var(--head); font-size: 13px; letter-spacing: 3px; color: var(--cyan); }
.credits p { font-size: 15px; margin: 4px 0; color: var(--muted); }
#end-stats { display: flex; justify-content: center; gap: 30px; font-family: var(--head); margin-top: 10px; }
#end-stats div b { display: block; font-size: 26px; color: var(--gold); }
#end-stats div span { font-size: 11px; letter-spacing: 2px; color: var(--muted); }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); font-family: var(--head); letter-spacing: 4px; color: var(--cyan); z-index: 100; }
.glitch { animation: glitch 3s infinite; }
@keyframes glitch { 0%, 90%, 100% { transform: none; } 91% { transform: translateX(-3px) skewX(10deg); } 93% { transform: translateX(3px); } 95% { transform: none; } }

/* ---------------- Control bar (always visible key hints) ---------------- */
#hud-controls { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 10px; align-items: stretch; }
.cslot { position: relative; min-width: 108px; padding: 8px 10px 10px; background: rgba(9, 13, 21, 0.9); border: 2px solid rgba(255,255,255,0.28); border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #dfe8f5; overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s; }
.cslot .cicon { width: 34px; height: 34px; }
.clabel { font-family: var(--head); font-size: 11px; letter-spacing: 1.5px; font-weight: 800; }
.key { font-family: var(--head); font-weight: 900; font-size: 12px; letter-spacing: 1px; padding: 4px 9px; border-radius: 6px; background: #f2f6ff; color: #0a0d14; box-shadow: 0 3px 0 #8a97ad; white-space: nowrap; }
.key.big { font-size: 28px; padding: 6px 16px; min-width: 52px; text-align: center; }
.key.sm { font-size: 10px; padding: 2px 6px; box-shadow: 0 2px 0 #8a97ad; }
.cslot.info { min-width: 235px; align-items: flex-start; justify-content: center; font-family: var(--head); font-size: 10px; letter-spacing: 1px; gap: 6px; color: var(--muted); }
.cslot.info div { display: flex; gap: 8px; align-items: center; }
.cslot.used { transform: scale(0.95); border-color: var(--cyan); box-shadow: 0 0 18px rgba(46,230,255,0.7); color: var(--cyan); }
.cslot.action { min-width: 150px; justify-content: center; opacity: 0.55; }
.cslot.action.ready { opacity: 1; border-color: #9dff3b; box-shadow: 0 0 22px rgba(157,255,59,0.55); animation: readyPulse 0.9s infinite alternate; }
.cslot.action.ready .clabel { color: #9dff3b; }
@keyframes readyPulse { from { box-shadow: 0 0 8px rgba(157,255,59,0.35); } to { box-shadow: 0 0 26px rgba(157,255,59,0.85); } }
.cslot.special { border-color: var(--corp, var(--cyan)); color: var(--corp, var(--cyan)); }
.cslot.special .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.72); height: 0; z-index: 1; pointer-events: none; }
.cslot.special.ready { box-shadow: 0 0 18px var(--corp, var(--cyan)); }
.cslot.tut { animation: tutPulse 0.7s infinite alternate; }
@keyframes tutPulse { from { box-shadow: 0 0 4px #ffe45c; border-color: #ffe45c; } to { box-shadow: 0 0 28px #ffe45c; border-color: #ffe45c; } }
#hud-prompt { bottom: 128px !important; font-size: 15px !important; }
#hud-familiar { bottom: 18px !important; }
#hud-bubble { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; animation: bob 0.8s infinite alternate ease-in-out; }
#hud-bubble span { font-family: var(--head); font-weight: 900; font-size: 13px; letter-spacing: 2px; color: #fff; text-shadow: 0 0 8px #000, 0 2px 3px #000; }
#hud-bubble .key.big { box-shadow: 0 3px 0 #8a97ad, 0 0 20px rgba(157,255,59,0.9); }
@keyframes bob { from { margin-top: 0; } to { margin-top: -8px; } }
#hud-tutorial { position: absolute; right: 16px; top: 256px; width: 300px; background: var(--panel); border: 1px solid #ffe45c; padding: 10px 14px; }
#hud-tutorial h4 { margin: 0 0 6px; font-family: var(--head); font-size: 13px; letter-spacing: 2px; color: #ffe45c; }
#hud-tutorial ul { list-style: none; margin: 0; padding: 0; }
#hud-tutorial li { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 15px; color: var(--muted); }
#hud-tutorial li .chk { width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 3px; flex-shrink: 0; display: grid; place-items: center; font-size: 12px; }
#hud-tutorial li.cur { color: #fff; font-weight: 700; }
#hud-tutorial li.cur .chk { border-color: #ffe45c; }
#hud-tutorial li.done { color: #9dff3b; text-decoration: line-through; opacity: 0.7; }
#hud-tutorial li.done .chk { border-color: #9dff3b; background: #9dff3b; color: #000; }
#hud-toasts { top: 250px; }
#hud-tutorial:not(.hidden) ~ #hud-toasts { top: 520px; }
/* gamepad focus */
.pad-focus { outline: 3px solid #ffe45c !important; outline-offset: 3px; box-shadow: 0 0 24px rgba(255,228,92,0.6) !important; }

.controls-list li { margin-bottom: 2px; }
.pad-note { list-style: none; margin-left: -18px; margin-top: 6px; color: var(--muted); font-size: 14px; }
.sliders { display: flex; flex-direction: column; gap: 10px; width: 100%; margin: 4px 0; }
.sliders label { display: flex; justify-content: space-between; align-items: center; gap: 14px; font-family: var(--head); font-size: 12px; letter-spacing: 2px; }
.sliders input[type=range] { width: 200px; accent-color: var(--cyan); }

/* hub activities */
.hub-activities { display: flex; gap: 10px; }
.btn.act { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 14px; clip-path: none; border-radius: 8px; }
.btn.act img, .btn.act svg { width: 40px; height: 40px; mix-blend-mode: screen; color: var(--cyan); flex-shrink: 0; }
.btn.act span { font-family: var(--body); font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--muted); display: flex; flex-direction: column; }
.btn.act b { font-family: var(--head); font-size: 13px; letter-spacing: 2px; color: var(--text); }
.card .img img.model { position: absolute; right: -6px; bottom: 16px; width: 120px; height: 120px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(0,0,0,0.9)); }
/* quiz */
.quiz-panel { width: min(760px, 100%); display: flex; flex-direction: column; gap: 12px; }
.quiz-head { display: flex; gap: 16px; align-items: center; }
.quiz-head img { width: 76px; height: 76px; mix-blend-mode: screen; filter: drop-shadow(0 0 8px var(--magenta)); }
.quiz-head h2 { margin: 0; font-family: var(--head); letter-spacing: 3px; color: var(--magenta); text-shadow: 0 0 12px var(--magenta); }
.quiz-head > div:nth-child(2) { flex: 1; }
#quiz-reward { margin-top: 4px; color: var(--gold); font-size: 15px; }
.quiz-score { display: flex; gap: 16px; text-align: center; font-family: var(--head); }
.quiz-score b { display: block; font-size: 26px; color: var(--cyan); }
.quiz-score span { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
#quiz-q { font-size: 23px; font-weight: 700; line-height: 1.3; margin-top: 6px; }
#quiz-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.quiz-a { min-width: 0; text-align: left; font-family: var(--body); font-size: 17px; font-weight: 700; letter-spacing: 0; clip-path: none; border-radius: 6px; padding: 12px 14px; }
.btn.quiz-a.ok { border-color: #9dff3b; background: rgba(157,255,59,0.2); color: #fff; opacity: 1; }
.btn.quiz-a.ko { border-color: var(--red); background: rgba(255,59,92,0.25); opacity: 1; }
#quiz-feedback { font-family: var(--head); font-size: 16px; letter-spacing: 1px; min-height: 20px; }
#quiz-feedback.ok { color: #9dff3b; } #quiz-feedback.ko { color: var(--red); }
#quiz-expl { color: #c7d2e4; font-size: 17px; line-height: 1.4; }
/* bestiary list */
.best-wrap { position: relative; width: min(1180px, 100%); }
#best-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.best-card { display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line); padding: 12px; }
.best-img { width: 120px; height: 120px; flex-shrink: 0; background: radial-gradient(circle, rgba(46,230,255,0.12), transparent 70%); }
.best-img img { width: 100%; height: 100%; object-fit: contain; }
.best-card.unknown .best-img img { filter: brightness(0) drop-shadow(0 0 2px rgba(255,255,255,0.4)); }
.best-card.unknown { border-color: rgba(255,255,255,0.1); }
.best-card h3 { margin: 0; font-family: var(--head); font-size: 16px; letter-spacing: 1px; color: var(--magenta); }
.best-card .kind { font-family: var(--head); font-size: 10px; letter-spacing: 1.5px; color: var(--muted); margin: 2px 0 6px; }
.best-card p { margin: 0 0 8px; font-size: 15px; line-height: 1.3; color: #c7d2e4; }
.best-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--gold); font-family: var(--head); letter-spacing: 1px; }

.best-wrap .btn.back { position: static; margin-bottom: 14px; }
.card .img img.model { width: 150px; height: 150px; right: -14px; bottom: 10px; }

/* weapon slots & shield */
.cslot.weapon { min-width: 128px; }
.cslot .cicon svg { width: 34px; height: 34px; display: block; }
.cslot.weapon .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,0.55); pointer-events: none; }
.cslot .swap { position: absolute; top: 4px; right: 6px; display: flex; gap: 3px; }
.cslot .swap i { font-style: normal; font-family: var(--head); font-size: 9px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 3px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.3); color: var(--muted); }
.cslot .swap i.on { background: #ffe45c; color: #000; border-color: #ffe45c; }
.cslot .swap i.lock { opacity: 0.35; }
.cslot.shield { color: #7ff6ff; border-color: rgba(127,246,255,0.35); min-width: 120px; }
.cslot.shield .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(0deg, rgba(127,246,255,0.35), rgba(127,246,255,0.1)); pointer-events: none; transition: height 0.2s; }
.cslot.shield > *:not(.fill) { position: relative; }
.cslot.shield.ready { border-color: #7ff6ff; animation: shieldPulse 0.8s infinite alternate; }
.cslot.shield.active { border-color: #fff; box-shadow: 0 0 22px rgba(127,246,255,0.9); }
@keyframes shieldPulse { from { box-shadow: 0 0 6px rgba(127,246,255,0.4); } to { box-shadow: 0 0 26px rgba(127,246,255,1); } }
.cslot .key { position: relative; }
/* arsenal in hub */
.arsenal { display: flex; gap: 8px; margin-top: 10px; }
.arsenal .wp { flex: 1; text-align: center; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.12); padding: 6px 4px; color: var(--cyan); font-family: var(--head); font-size: 8.5px; letter-spacing: 0.5px; }
.arsenal .wp svg { width: 28px; height: 28px; display: block; margin: 0 auto 3px; }
.arsenal .wp.lock { color: var(--muted); opacity: 0.55; }
.arsenal .wp small { display: block; color: var(--muted); font-size: 8px; margin-top: 2px; }

#hub-miner { flex-wrap: wrap; }
#hub-miner .arsenal { width: 100%; }
#screen-hub, #screen-bestiary-list { justify-content: flex-start; }
.hub { margin: auto 0; }
.hub-help ul { line-height: 1.45; font-size: 14px; }
.hub-help li { margin-bottom: 3px; }
#hud-familiar { bottom: 128px !important; }

#sound-toggle { position: fixed; top: 16px; right: 238px; z-index: 50; display: flex; align-items: center; gap: 6px; padding: 7px 11px; background: rgba(9,13,21,0.88); border: 1px solid var(--line); border-radius: 20px; color: var(--cyan); cursor: pointer; font-family: var(--head); font-size: 10px; letter-spacing: 1px; }
#sound-toggle svg { width: 20px; height: 20px; }
#sound-toggle:hover { background: rgba(46,230,255,0.2); color: #fff; }
#sound-toggle.off { color: var(--red); border-color: rgba(255,59,92,0.5); }
body:not(.in-game) #sound-toggle { right: 16px; }

/* ======================= TOUCH CONTROLS ======================= */
#touch-ui { display: none; }
body.touch.in-game #touch-ui { display: block; }
body.touch #hud-controls, body.touch #hud-familiar { display: none; }
#joy-zone { position: fixed; left: 0; top: 30%; width: 48%; bottom: 0; touch-action: none; z-index: 20; }
#joy-base { position: fixed; width: 128px; height: 128px; margin: -64px 0 0 -64px; border-radius: 50%; border: 2px solid rgba(46,230,255,0.45); background: radial-gradient(circle, rgba(46,230,255,0.12), rgba(9,13,21,0.35)); pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 21; left: 110px; top: calc(100% - 110px); }
#joy-base.on { opacity: 1; }
body.touch.in-game #joy-base:not(.on) { opacity: 0.35; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; border-radius: 50%; background: rgba(46,230,255,0.55); box-shadow: 0 0 16px rgba(46,230,255,0.6); transform: translate(-50%,-50%); }
#tbtns { position: fixed; right: calc(10px + env(safe-area-inset-right)); bottom: 10px; width: 290px; height: 250px; z-index: 22; }
.tb { position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); background: rgba(9,13,21,0.72); color: #e8f1ff; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-family: var(--head); font-size: 8px; letter-spacing: 1px; overflow: hidden; padding: 0; }
.tb svg { width: 26px; height: 26px; }
.tb.down { transform: scale(0.92); background: rgba(46,230,255,0.35); border-color: var(--cyan); }
.tb.big { width: 92px; height: 92px; }
.tb.big svg { width: 38px; height: 38px; }
#tb-shoot { right: 0; bottom: 0; border-color: rgba(46,230,255,0.7); color: var(--cyan); }
#tb-melee { right: 100px; bottom: 6px; border-color: rgba(255,228,92,0.7); color: #ffe45c; }
#tb-use { right: 104px; bottom: 108px; width: 74px; height: 74px; opacity: 0.6; }
#tb-use b { font-size: 22px; color: #0a0d14; background: #f2f6ff; border-radius: 6px; padding: 0 8px; }
#tb-use.ready { opacity: 1; border-color: #9dff3b; box-shadow: 0 0 20px rgba(157,255,59,0.8); animation: readyPulse 0.9s infinite alternate; }
#tb-special { right: 6px; bottom: 104px; width: 70px; height: 70px; color: var(--corp, var(--cyan)); border-color: var(--corp, var(--cyan)); }
#tb-special .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,0.7); }
#tb-special.ready { box-shadow: 0 0 16px var(--corp, var(--cyan)); }
#tb-shield { right: 196px; bottom: 96px; width: 64px; height: 64px; color: #7ff6ff; }
#tb-shield .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(127,246,255,0.3); }
#tb-shield.ready { border-color: #7ff6ff; animation: shieldPulse 0.8s infinite alternate; }
#tb-shield > *:not(.fill), #tb-special > *:not(.cd) { position: relative; }
.tb.sm { width: 40px; height: 40px; font-size: 16px; }
#tb-swap1 { right: 196px; bottom: 30px; }
#tb-swap2 { right: 20px; bottom: 190px; }
#tb-pause { position: fixed; left: calc(12px + env(safe-area-inset-left)); bottom: 12px; z-index: 22; font-size: 14px; }
#rotate-hint { display: none; }
@media (orientation: portrait) {
  body.touch.in-game #rotate-hint { display: flex; position: fixed; inset: 0; z-index: 200; background: rgba(7,8,12,0.96); flex-direction: column; align-items: center; justify-content: center; text-align: center; font-family: var(--head); font-size: 18px; letter-spacing: 2px; color: var(--cyan); gap: 10px; }
  #rotate-hint div { font-size: 64px; animation: spin 2s infinite ease-in-out; }
  #rotate-hint small { font-family: var(--body); letter-spacing: 0; color: var(--muted); font-size: 14px; }
}
@keyframes spin { 0%, 30% { transform: rotate(0); } 70%, 100% { transform: rotate(90deg); } }

/* compact HUD on phones / small screens */
@media (max-height: 560px), (max-width: 820px) {
  #hud-player, #hud-o2, #hud-ore, #hud-minimap, #hud-tutorial, #hud-boss, #hud-toasts, #hud-familiar { zoom: 0.62; }
  #hud-controls { zoom: 0.7; }
  #hud-banner { font-size: 26px; }
  #hud-banner small { font-size: 13px; }
  #hud-prompt { zoom: 0.75; }
  #sound-toggle { zoom: 0.8; }
  body.in-game #sound-toggle { right: 150px; }
  #qte { zoom: 0.85; }
}
body.touch #hud-prompt { bottom: 16px !important; }
body.touch #hud-tutorial li:not(.cur) { display: none; }
body.touch #hud-tutorial { top: 190px; }

/* ======================= RESPONSIVE MENUS ======================= */
@media (max-height: 560px), (max-width: 820px) {
  .screen { padding: 12px 12px 18px; justify-content: flex-start; }
  .screen-title { font-size: 20px; letter-spacing: 2px; }
  .screen-sub { font-size: 13px; margin-bottom: 10px; }
  .btn { min-width: 180px; padding: 10px 18px; font-size: 12px; }
  .title-content { bottom: 3vh; }
  .by-picksels { bottom: 8px; right: 10px; }
  .by-picksels img { width: 60px; }
  .intro-box h1 { font-size: 22px; margin: 4px 0; }
  .intro-box p { font-size: 14px; margin: 6px 0; }
  .cards { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; width: 100%; padding: 4px 4px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .card { flex: 0 0 auto; width: 240px; scroll-snap-align: center; }
  .card:hover { transform: none; }
  .card .img { height: 140px; }
  .card .img img.model { width: 100px; height: 100px; }
  .card .body { padding: 8px 10px 10px; }
  .card h3 { font-size: 15px; }
  .card p { font-size: 13px; margin-bottom: 6px; }
  .statbar { font-size: 11px; margin: 1px 0; }
  .statbar .pips i { width: 14px; height: 5px; }
  .special-box { font-size: 12px; padding: 5px 7px; margin-top: 6px; }
  .cards.fam .card { width: 150px; }
  .cards.fam .card .img { height: 110px; }
  .btn.back { position: static; margin-bottom: 8px; }
  .hub { flex-direction: column; gap: 12px; }
  .hub-left { width: 100%; }
  .hub-help ul { display: none; }
  .hub-help p { margin-top: 0; font-size: 13px; }
  .mine-card { padding: 10px; gap: 10px; margin-bottom: 10px; }
  .mine-card .depth { width: 60px; padding-right: 8px; }
  .mine-card .depth b { font-size: 24px; }
  .mine-card h3 { font-size: 15px; }
  .mine-card p { font-size: 13px; }
  .objectives { font-size: 13px; gap: 8px; }
  .mine-actions { flex-wrap: wrap; gap: 8px; }
  .mine-actions .btn { min-width: 160px; }
  .center-panel { min-width: 0; width: min(560px, 94vw); max-height: 92vh; overflow-y: auto; padding: 12px; gap: 8px; }
  .center-panel h2 { font-size: 20px; }
  .result-row { font-size: 14px; padding: 4px 2px; }
  .quiz-panel { width: 94vw; max-height: 94vh; overflow-y: auto; padding: 12px; gap: 8px; }
  .quiz-head img { width: 48px; height: 48px; }
  .quiz-head h2 { font-size: 18px; }
  #quiz-q { font-size: 16px; }
  .btn.quiz-a { font-size: 13px; padding: 8px 10px; }
  #quiz-expl { font-size: 14px; }
  #best-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .best-img { width: 80px; height: 80px; }
  .best-card p { font-size: 12px; }
  .end-box h1 { font-size: 22px; }
  .end-box p { font-size: 14px; }
  .logo-mines.small { width: 120px; }
}
@media (max-width: 560px) {
  #best-grid { grid-template-columns: 1fr; }
  #quiz-answers { grid-template-columns: 1fr; }
  .hub-activities { flex-direction: column; }
}
body.touch .hub-help::before { content: 'On mobile: left thumb = joystick, right thumb = ATTACK / SHOOT / USE buttons. Your miner aims automatically at the nearest enemy.'; display: block; font-size: 13px; color: var(--cyan); margin-bottom: 8px; }
html, body { overscroll-behavior: none; }
#view canvas { touch-action: none; }
.screen { z-index: 30; }
body.touch #hud-tutorial { top: 64px; right: auto; left: 50%; transform: translateX(-50%); width: 420px; }
@media (max-height: 560px), (max-width: 820px) {
  .hub-right { order: -1; width: 100%; }
  .hub .screen-title.left { display: none; }
  #hub-miner img.p { width: 64px; height: 64px; }
  .arsenal .wp { padding: 4px 2px; }
}
#install-hint { position: fixed; inset: 0; z-index: 120; background: rgba(3,5,10,0.82); display: flex; align-items: center; justify-content: center; padding: 14px; }
#install-hint.hidden { display: none; }
.ih-box { max-width: 460px; background: var(--panel); border: 1px solid var(--cyan); padding: 16px 18px; font-size: 14px; line-height: 1.4; }
.ih-box b { font-family: var(--head); letter-spacing: 1px; color: var(--cyan); }
.ih-box p { margin: 8px 0; color: #c7d2e4; }
.ih-box ol { margin: 6px 0 12px; padding-left: 20px; }
.ih-box ol b { font-family: var(--body); letter-spacing: 0; color: #fff; }
.ih-ico { display: inline-block; border: 1px solid #fff; border-radius: 4px; padding: 0 4px; font-size: 12px; }
.ih-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ih-btns .btn { min-width: 0; flex: 1; }
#hud-player, #hud-o2 { margin-left: env(safe-area-inset-left); }
#hud-minimap, #hud-tutorial { margin-right: env(safe-area-inset-right); }
#joy-zone { left: env(safe-area-inset-left); }

/* ======================= PORTRAIT PLAY ON PHONES ======================= */
@media (orientation: portrait) {
  body.touch #tbtns { zoom: 0.82; bottom: calc(8px + env(safe-area-inset-bottom)); }
  body.touch #joy-zone { top: 45%; width: 50%; }
  body.touch #hud-minimap { zoom: 0.5; }
  body.touch #hud-ore { top: 64px; }
  body.touch #hud-tutorial { top: 120px; width: 340px; }
  body.touch.in-game #sound-toggle { right: 120px; top: 12px; }
  body.touch #hud-o2 { top: 96px; }
  body.touch #hud-boss { top: 150px; width: 90vw; }
}
.intro-box h1 { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .intro-box h1 { font-size: 20px; letter-spacing: 2px; }
  .title-content .hint { font-size: 11px; }
  .by-picksels { bottom: 2px; }
  #hud-banner { font-size: 20px; }
}
body.touch #hud-prompt { display: none !important; }
@media (max-height: 560px), (max-width: 820px) { #hud-bubble { zoom: 0.7; } }
@media (orientation: portrait) {
  body.touch #hud-ore { top: 118px; left: auto; right: 6px; transform: none; zoom: 0.55; }
  body.touch #hud-minimap { top: 12px; right: 6px; }
  body.touch.in-game #sound-toggle { top: auto; right: auto; left: 10px; bottom: 64px; padding: 7px; }
  body.touch.in-game #sound-toggle span { display: none; }
  body.touch #hud-tutorial { top: 330px; width: 330px; }
  body.touch #hud-toasts { top: 420px; }
}
/* keep every menu out of the iPhone notch / Dynamic Island area (landscape) */
.screen { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.title-content { left: env(safe-area-inset-left); right: env(safe-area-inset-right); }
#sound-toggle { margin-right: env(safe-area-inset-right); }
@media (max-height: 560px), (max-width: 820px) {
  .intro-box { text-align: center; }
  .intro-box .btn { margin: 10px auto 0; display: block; }
}

/* no browser zoom / scroll / selection on phones */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body.touch { position: fixed; inset: 0; overflow: hidden; }
body.touch.in-game #view, body.touch.in-game #view *, body.touch.in-game #touch-ui, body.touch.in-game #touch-ui *, body.touch.in-game #hud, body.touch.in-game #hud * { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tb, #joy-zone, #hud-bubble { -webkit-touch-callout: none; }

#qte { zoom: 1 !important; }
#qte { z-index: 25; }
