/* Struttura di navigazione: barra icone, HUD, menu Livelli, pannelli a richiesta, menu per smartphone. */
:root { --shell-glass: rgba(15, 23, 42, 0.84); --shell-line: rgba(255, 255, 255, 0.11); --shell-gold: #fbbf24; --shell-text: #e2e8f0; --shell-dim: #94a3b8; }

/* --- barra icone (desktop) --- */
#rail { position: fixed; z-index: 130; left: 12px; top: 12px; bottom: 12px; width: 56px; display: none; flex-direction: column; align-items: center; gap: 6px;
        padding: 10px 6px; background: var(--shell-glass); backdrop-filter: blur(14px); border: 1px solid var(--shell-line); border-radius: 18px; box-shadow: 0 10px 34px rgba(0,0,0,0.4); }
body.shell-on #rail { display: flex; }
#rail .rail-logo { width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(251,191,36,0.5); margin-bottom: 6px; display: block; }
#rail .rail-sep { width: 28px; height: 1px; background: var(--shell-line); margin: 6px 0; }
#rail .rail-spacer { flex: 1; }
.rail-btn { position: relative; width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--shell-dim); font-size: 20px;
            display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; text-decoration: none; transition: background .15s, color .15s; }
.rail-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.rail-btn.active { background: rgba(251,191,36,0.14); color: var(--shell-gold); border-color: rgba(251,191,36,0.35); }
.rail-btn[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 54px; top: 50%; transform: translateY(-50%); white-space: nowrap; pointer-events: none;
            background: rgba(2,6,23,0.95); color: #fff; font: 600 12px 'Outfit', sans-serif; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--shell-line); z-index: 5; }

/* pannelli a richiesta: di base chiusi, la mappa resta libera */
body.shell-on .ui-overlay { display: none; top: 64px; bottom: 12px; }
body.shell-on .ui-overlay.shell-open { display: flex; }
body.shell-on .ui-overlay.shell-left { left: 82px; }
body.shell-on .ui-overlay.shell-right { right: 12px; }

/* --- HUD in alto --- */
#hud { position: fixed; z-index: 120; top: 12px; left: 82px; display: none; gap: 8px; align-items: center; pointer-events: none; }
body.shell-on #hud { display: flex; }
.hud-chip { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; background: var(--shell-glass); backdrop-filter: blur(12px); border: 1px solid var(--shell-line);
            border-radius: 12px; color: var(--shell-text); font: 600 13px 'Outfit', sans-serif; white-space: nowrap; }
.hud-chip i { color: var(--shell-gold); font-size: 14px; }
.hud-chip b { font-weight: 700; color: #fff; }
@media (max-width: 1250px) { .hud-chip.hud-opt { display: none; } }

/* --- menu Livelli --- */
#levels-pop { position: fixed; z-index: 140; left: 82px; top: 64px; width: 292px; display: none; flex-direction: column; gap: 2px; padding: 12px;
              background: rgba(10,16,32,0.96); backdrop-filter: blur(16px); border: 1px solid var(--shell-line); border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,0.5); color: var(--shell-text); font-family: 'Outfit', sans-serif; }
#levels-pop.open { display: flex; }
.lv-title { font: 800 11px 'Outfit', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--shell-dim); padding: 4px 6px 8px; }
.lv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 0 10px; border-radius: 12px; cursor: pointer; background: none; border: 0; color: inherit; width: 100%; text-align: left; font-size: 14px; font-weight: 600; }
.lv-row:hover { background: rgba(255,255,255,0.06); }
.lv-row small { display: block; font-size: 11px; font-weight: 500; color: var(--shell-dim); margin-top: 1px; }
.lv-row.disabled { opacity: .4; pointer-events: none; }
.lv-switch { flex: 0 0 auto; position: relative; width: 40px; height: 22px; border-radius: 12px; background: rgba(255,255,255,0.16); transition: background .15s; }
.lv-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.lv-row.on .lv-switch { background: var(--shell-gold); }
.lv-row.on .lv-switch::after { transform: translateX(18px); }
.lv-seg { display: flex; gap: 4px; padding: 6px 6px 8px; }
.lv-seg button { flex: 1; height: 38px; border-radius: 10px; border: 1px solid var(--shell-line); background: rgba(255,255,255,0.04); color: var(--shell-text); font: 600 12px 'Outfit', sans-serif; cursor: pointer; }
.lv-seg button.on { background: rgba(251,191,36,0.16); border-color: rgba(251,191,36,0.5); color: var(--shell-gold); }

/* il vecchio blocco di pulsanti nel pannello: ora c'è la barra */
.shell-legacy { display: none !important; }

/* --- smartphone: barra in basso + fogli che salgono dal basso --- */
#sheet-backdrop { position: fixed; inset: 0; z-index: 10550; background: rgba(2,6,23,0.55); display: none; }
#sheet-backdrop.open { display: block; }
#sheet { position: fixed; z-index: 10600; left: 0; right: 0; bottom: 0; max-height: 78vh; overflow-y: auto; transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
         background: rgba(10,16,32,0.98); border-top: 1px solid var(--shell-line); border-radius: 22px 22px 0 0; padding: 8px 14px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -14px 44px rgba(0,0,0,0.5); color: var(--shell-text); font-family: 'Outfit', sans-serif; }
#sheet.open { transform: none; }
#sheet .sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.25); margin: 6px auto 12px; touch-action: none; }
#sheet .lv-row { min-height: 54px; font-size: 15px; }
.sheet-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 2px; }
.sheet-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; border-radius: 16px; background: rgba(255,255,255,0.05); border: 1px solid var(--shell-line); color: var(--shell-text); text-decoration: none; font: 600 13px 'Outfit', sans-serif; }
.sheet-link i { font-size: 24px; color: var(--shell-gold); }
@media (max-width: 768px) { #rail, #hud, #levels-pop { display: none !important; } }
@media (min-width: 769px) { #sheet, #sheet-backdrop { display: none !important; } }

/* il cielo si sposta in alto a destra e le notifiche si regolano dal menu Livelli */
body.shell-on #sky-widget { left: auto; right: 12px; top: 12px; width: 200px; height: 70px; }
body.shell-on .ui-overlay.shell-right { top: 92px; }
body.shell-on #notif-toggle { display: none !important; }
@media (max-width: 768px) { #notif-toggle { display: none !important; } }

body.shell-on #world3d-controls { bottom: 100px; }
