/* ===== DESKTOP ===== */
.hsl-desktop {
    position: relative;
    width: 100%;
    max-width: 1100px;
    height: 640px;
    font-size: 14px;
    margin: 20px auto;
    border-radius: 10px;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    border: 1px solid #30363d;
    user-select: none;
}

.hsl-desktop-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(30, 60, 120, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(20, 80, 60, 0.25) 0%, transparent 45%),
        linear-gradient(160deg, #0a0e17 0%, #0d1117 40%, #111827 100%);
    z-index: 0;
}

.hsl-desktop-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(56, 139, 253, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 139, 253, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* ===== ICONE DESKTOP ===== */
.hsl-icons {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hsl-icon {
    width: 72px;
    text-align: center;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 8px;
    transition: background 0.15s;
}

.hsl-icon:hover {
    background: rgba(56, 139, 253, 0.15);
}

.hsl-icon:active {
    background: rgba(56, 139, 253, 0.3);
}

.hsl-icon-img {
    font-size: 28px;
    line-height: 1.3;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.hsl-icon span {
    display: block;
    font-size: 11px;
    color: #e6edf3;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    margin-top: 2px;
    word-break: break-word;
}

/* ===== FINESTRE ===== */
.hsl-window {
    position: absolute;
    z-index: 20;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 280px;
    min-height: 160px;
}

.hsl-window.active {
    z-index: 30;
    border-color: #388bfd;
    box-shadow: 0 8px 32px rgba(56, 139, 253, 0.2), 0 8px 32px rgba(0,0,0,0.55);
}

.hsl-win-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #161b22;
    padding: 6px 10px;
    cursor: grab;
    border-bottom: 1px solid #21262d;
    flex-shrink: 0;
}

.hsl-win-titlebar:active {
    cursor: grabbing;
}

.hsl-win-title {
    font-size: 12px;
    color: #8b949e;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hsl-window.active .hsl-win-title {
    color: #c9d1d9;
}

.hsl-win-controls {
    display: flex;
    gap: 4px;
}

.hsl-win-controls button {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #8b949e;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hsl-win-controls button:hover {
    background: #30363d;
    color: #e6edf3;
}

.hsl-win-close:hover {
    background: #da3633 !important;
    color: #fff !important;
}

.hsl-win-body {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* Dimensioni e posizioni default */
#win-terminal {
    top: 30px;
    left: 110px;
    width: 620px;
    height: 380px;
}

#win-mission {
    top: 50px;
    right: 30px;
    width: 320px;
    height: 220px;
}

#win-tools {
    top: 80px;
    left: 160px;
    width: 480px;
    height: 340px;
}

#win-notes {
    top: 100px;
    left: 200px;
    width: 360px;
    height: 280px;
}

#win-score {
    top: 120px;
    right: 40px;
    width: 260px;
    height: 260px;
}

#win-network {
    top: 60px;
    left: 180px;
    width: 520px;
    height: 300px;
}

/* ===== TERMINAL ===== */
.hsl-terminal {
    background: #010409;
    padding: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: 'Courier New', 'Consolas', monospace;
    box-sizing: border-box;
}

.hsl-terminal-header {
    color: #3fb950;
    margin-bottom: 6px;
    font-size: 12px;
    flex-shrink: 0;
}

.hsl-output {
    flex: 1;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 13px;
    color: #ffffff;
    line-height: 1.5;
    margin-bottom: 8px;
}

.hsl-input-line {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.hsl-input-line .prompt {
    color: #3fb950;
    margin-right: 8px;
    font-size: 13px;
}

#hsl-cmd {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

/* ===== MISSIONE ===== */
.hsl-story-box {
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.65;
    color: #c9d1d9;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.hsl-story-box code {
    background: #21262d;
    padding: 1px 6px;
    border-radius: 3px;
    color: #79c0ff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.hsl-story-box strong {
    color: #58a6ff;
}

/* ===== TOOLS GRID ===== */
.hsl-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 14px;
}

.hsl-tool-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}

.hsl-tool-card:hover {
    border-color: #388bfd;
    background: #1c2128;
    transform: translateY(-2px);
}

.hsl-tool-card .tool-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 6px;
}

.hsl-tool-card strong {
    display: block;
    font-size: 17px;
    color: #e6edf3;
    margin-bottom: 2px;
}

.hsl-tool-card small {
    font-size: 12px;
    color: #8b949e;
}

/* ===== NOTES ===== */
.hsl-notes-area {
    width: 100%;
    height: 100%;
    background: #0d1117;
    border: none;
    color: #c9d1d9;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    padding: 12px;
    resize: none;
    outline: none;
    line-height: 1.5;
    box-sizing: border-box;
}

/* ===== SCORE ===== */
.hsl-score-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hsl-score-big {
    text-align: center;
    padding: 16px;
    background: linear-gradient(135deg, #161b22, #1c2128);
    border-radius: 8px;
    border: 1px solid #30363d;
}

.hsl-score-big .label {
    display: block;
    font-size: 16px;
    color: #8b949e;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.hsl-score-big .value {
    font-size: 36px;
    font-weight: 700;
    color: #3fb950;
    font-family: 'Courier New', monospace;
}

.hsl-score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #161b22;
    border-radius: 6px;
    font-size: 16px;
    color: #8b949e;
}

.hsl-score-row strong {
    color: #c9d1d9;
    font-family: 'Courier New', monospace;
}

/* ===== NETWORK MAP ===== */
.hsl-network-map {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 30px 20px;
    flex-wrap: wrap;
}

.net-node {
    text-align: center;
    min-width: 90px;
}

.net-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin: 0 auto 8px;
    box-shadow: 0 0 12px currentColor;
}

.net-dot.you {
    background: #3fb950;
    color: #3fb950;
}

.net-dot.gateway {
    background: #d29922;
    color: #d29922;
}

.net-dot.target {
    background: #f85149;
    color: #f85149;
}

.net-dot.admin {
    background: #a371f7;
    color: #a371f7;
}

.net-node span {
    font-size: 16px;
    color: #c9d1d9;
    line-height: 1.3;
}

.net-node small {
    color: #8b949e;
    font-size: 12px;
}

.net-line {
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #30363d, #58a6ff, #30363d);
    margin: 0 4px;
    margin-bottom: 30px;
    flex-shrink: 0;
}

.net-line.dim {
    background: linear-gradient(90deg, #30363d, #484f58, #30363d);
}

/* ===== TASKBAR ===== */
.hsl-taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(13, 17, 23, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid #30363d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    z-index: 50;
}

.hsl-taskbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hsl-start-btn {
    background: #21262d;
    border: 1px solid #30363d;
    color: #58a6ff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.hsl-start-btn:hover {
    background: #30363d;
}

.hsl-task-items {
    display: flex;
    gap: 2px;
    margin-left: 6px;
}

.hsl-task-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #8b949e;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.hsl-task-btn:hover,
.hsl-task-btn.active {
    background: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
}

.hsl-taskbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: #8b949e;
    font-family: 'Courier New', monospace;
    padding-right: 6px;
}

.hsl-tray-score {
    color: #3fb950;
}

/* ===== START MENU ===== */
.hsl-start-menu {
    position: absolute;
    bottom: 44px;
    left: 8px;
    width: 200px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 60;
    padding: 6px;
    overflow: hidden;
}

.hsl-start-item {
    padding: 8px 12px;
    font-size: 16px;
    color: #c9d1d9;
    border-radius: 5px;
    cursor: pointer;
}

.hsl-start-item:hover {
    background: #21262d;
}

.hsl-start-sep {
    height: 1px;
    background: #30363d;
    margin: 4px 8px;
}

/* ===== END OVERLAY ===== */
.hsl-end-overlay {
    position: absolute;
    inset: 0;
    background: rgba(1, 4, 9, 0.85);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.hsl-end-box {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 36px 40px;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
    max-width: 380px;
}

.hsl-end-box h2 {
    margin: 0 0 16px;
    color: #3fb950;
    font-size: 1.4rem;
}

.hsl-end-box p {
    color: #8b949e;
    margin: 6px 0;
    font-size: 17px;
}

.hsl-end-box strong {
    color: #c9d1d9;
}

.hsl-end-box input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin: 18px 0 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    color: #c9d1d9;
    border-radius: 6px;
    font-size: 17px;
    box-sizing: border-box;
    outline: none;
}

.hsl-end-box input:focus {
    border-color: #388bfd;
}

.hsl-end-box button {
    background: #238636;
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 6px;
    font-size: 17px;
    cursor: pointer;
    font-weight: 600;
}

.hsl-end-box button:hover {
    background: #2ea043;
}

/* ===== LEADERBOARD (pagina pubblica) ===== */
.hsl-leaderboard {
    max-width: 800px;
    margin: 30px auto;
    font-family: system-ui, -apple-system, sans-serif;
}

.hsl-leaderboard h2 {
    color: #58a6ff;
    text-align: center;
}

.hsl-leaderboard table {
    width: 100%;
    border-collapse: collapse;
    background: #0d1117;
    color: #c9d1d9;
}

.hsl-leaderboard th,
.hsl-leaderboard td {
    padding: 12px;
    border: 1px solid #30363d;
    text-align: left;
}

.hsl-leaderboard th {
    background: #161b22;
}


/* ===== WIFI WINDOW ===== */
#win-wifi {
    top: 70px;
    left: 140px;
    width: 380px;
    height: 360px;
}

.hsl-wifi-body {
    padding: 14px;
}

.wifi-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #161b22;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 16px;
    color: #c9d1d9;
}

.wifi-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f85149;
}
.wifi-dot.on {
    background: #3fb950;
    box-shadow: 0 0 8px #3fb950;
}

.wifi-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.wifi-net {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    font-size: 13px;
    color: #c9d1d9;
    cursor: default;
}

.wifi-net.connected {
    border-color: #3fb950;
    background: rgba(63, 185, 80, 0.1);
}

.wifi-signal {
    font-size: 16px;
    color: #58a6ff;
    font-family: monospace;
}

.wifi-ssid {
    flex: 1;
    font-weight: 500;
}

.wifi-lock {
    font-size: 16px;
    color: #8b949e;
}

.wifi-hint {
    font-size: 17px;
    color: #8b949e;
    line-height: 1.5;
    margin: 0;
}

.wifi-hint strong {
    color: #f85149;
}

.wifi-ok {
    margin-top: 10px;
    padding: 12px;
    background: rgba(63, 185, 80, 0.12);
    border: 1px solid #3fb950;
    border-radius: 6px;
    color: #3fb950;
    font-size: 16px;
    line-height: 1.5;
}

/* ===== MAIL WINDOW ===== */
#win-mail {
    top: 50px;
    left: 160px;
    width: 560px;
    height: 360px;
}

.hsl-mail-body {
    display: flex;
    height: 100%;
}

.mail-sidebar {
    width: 180px;
    border-right: 1px solid #30363d;
    background: #0d1117;
    overflow-y: auto;
    flex-shrink: 0;
}

.mail-item {
    padding: 12px;
    border-bottom: 1px solid #21262d;
    cursor: pointer;
    font-size: 17px;
}

.mail-item:hover {
    background: #161b22;
}

.mail-item.unread {
    background: rgba(56, 139, 253, 0.08);
}

.mail-item.unread strong {
    color: #58a6ff;
}

.mail-item strong {
    display: block;
    color: #c9d1d9;
    margin-bottom: 3px;
}

.mail-item span {
    color: #8b949e;
    font-size: 16px;
}

.mail-empty {
    padding: 20px 12px;
    color: #8b949e;
    font-size: 17px;
    text-align: center;
}

.mail-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-size: 13px;
    color: #c9d1d9;
    line-height: 1.6;
}

.mail-placeholder {
    color: #8b949e;
    text-align: center;
    margin-top: 40px;
}

.mail-content h3 {
    margin: 0 0 8px;
    color: #58a6ff;
    font-size: 18px;
}

.mail-content .mail-meta {
    font-size: 16px;
    color: #8b949e;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #21262d;
}

.mail-content code {
    background: #21262d;
    padding: 1px 5px;
    border-radius: 3px;
    color: #79c0ff;
    font-size: 17px;
}

/* Badge su icona mail */
.hsl-icon {
    position: relative;
}
.hsl-badge {
    position: absolute;
    top: 2px;
    right: 12px;
    background: #f85149;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    line-height: 16px;
    text-align: center;
}


/* ===== COPYABLE COMMANDS IN MISSION ===== */
.hsl-story-box .cmd-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
    padding: 8px 10px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
}
.hsl-story-box .cmd-row .cmd-text {
    flex: 1;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 18px;
    color: #79c0ff;
    word-break: break-all;
    line-height: 1.4;
    user-select: all;
}
.hsl-story-box .cmd-row .cmd-copy-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #21262d;
    color: #c9d1d9;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
}
.hsl-story-box .cmd-row .cmd-copy-btn:hover {
    border-color: #58a6ff;
    background: #30363d;
    color: #58a6ff;
}
.hsl-story-box .cmd-row .cmd-copy-btn.copied {
    border-color: #3fb950;
    color: #3fb950;
    background: rgba(63, 185, 80, 0.12);
}
.hsl-story-box code.cmd-inline {
    cursor: pointer;
    border-bottom: 1px dashed #58a6ff;
    padding-right: 2px;
}
.hsl-story-box code.cmd-inline:hover {
    background: #30363d;
}


/* ===== FULLSCREEN ===== */
.hsl-fs-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #30363d;
    background: #21262d;
    color: #c9d1d9;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-right: 6px;
    line-height: 1;
}
.hsl-fs-btn:hover {
    border-color: #58a6ff;
    color: #58a6ff;
    background: #30363d;
}
.hsl-desktop.hsl-is-fs {
    position: fixed !important;
    inset: 0;
    max-width: none;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0;
    border-radius: 0;
    border: none;
    z-index: 99999;
    box-shadow: none;
}
.hsl-desktop.hsl-is-fs #win-terminal {
    width: min(900px, 70vw);
    height: min(520px, 70vh);
}
.hsl-desktop.hsl-is-fs #win-mission {
    width: min(420px, 28vw);
    height: min(320px, 40vh);
}

/* ===== MUSIC PLAYER ===== */
.hsl-music {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}
.hsl-music-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #30363d;
    background: #21262d;
    color: #58a6ff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}
.hsl-music-btn:hover {
    background: #30363d;
    border-color: #58a6ff;
}
.hsl-music-btn.playing {
    color: #3fb950;
    border-color: #3fb950;
}
.hsl-music-label {
    font-size: 16px;
    color: #8b949e;
}

/* iframe YT nascosto ma attivo per audio */
#hsl-yt-wrap {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    bottom: 0;
    left: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .hsl-desktop {
        height: 560px;
    }
    #win-terminal {
        width: calc(100% - 100px);
        left: 90px;
        height: 300px;
    }
    #win-mission {
        width: 260px;
    }
    .hsl-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

