*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #000011;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', Arial, sans-serif;
}

#game-wrapper {
    position: relative;
    user-select: none;
}

#gameCanvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 2px solid #00ff41;
    box-shadow: 0 0 30px rgba(0,255,65,0.3), 0 0 80px rgba(0,255,65,0.08);
}

#info-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(4, 6, 18, 0.97);
    border-top: 2px solid #00cc33;
    box-shadow: 0 -6px 40px rgba(0,200,50,0.2);
    padding: 14px 24px 10px;
    transform: translateY(100%);
    transition: transform 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-height: 210px;
    max-height: 320px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#info-panel.open { transform: translateY(0); }

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0,255,65,0.25);
    padding-bottom: 8px;
    flex-shrink: 0;
}
.panel-icon     { font-size: 16px; color: #ffe066; }
.panel-title    { font-size: 12px; font-weight: 700; letter-spacing: 4px; color: #ffe066; font-family: 'Courier New', monospace; }
.panel-progress { margin-left: auto; font-size: 10px; color: rgba(255,255,100,0.5); font-family: 'Courier New', monospace; }

/* scorrevole — tutte le sezioni accumulate devono potersi leggere */
.panel-body {
    font-size: 13px;
    line-height: 1.65;
    color: #d8d8d8;
    overflow-y: auto;
    flex: 1;
    padding-bottom: 22px; /* spazio per il footer fisso */
    padding-right: 4px;
}

.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
.panel-body::-webkit-scrollbar-thumb { background: #00aa33; border-radius: 2px; }

.section-divider {
    border: none;
    border-top: 1px solid rgba(0,255,65,0.18);
    margin: 14px 0 10px;
}
.section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #ffe066;
    font-family: 'Courier New', monospace;
    margin-bottom: 8px;
}

.intro-name    { font-size: 26px; font-weight: 800; color: #ffffff; letter-spacing: 1px; margin-bottom: 4px; }
.intro-job     { font-size: 14px; color: #ffe066; font-weight: 600; margin-bottom: 8px; letter-spacing: 0.5px; }
.intro-summary { font-size: 13px; color: #b0c8ff; font-style: italic; }

.cv-list { display: flex; flex-direction: column; gap: 10px; }

.cv-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 8px;
    border-left: 2px solid rgba(0,255,65,0.3);
}

.cv-period {
    font-size: 10px;
    color: #ffe066;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

.cv-main strong { font-size: 14px; color: #ffffff; font-weight: 700; display: block; margin-bottom: 2px; }
.cv-main small  { font-size: 12px; color: #7ec8ff; display: block; margin-bottom: 2px; }
.cv-main em     { font-size: 11px; color: #aaaaaa; font-style: normal; display: block; }

.skills-cols { display: flex; gap: 36px; }
.skills-col h4 { font-size: 10px; letter-spacing: 3px; color: #ffe066; margin-bottom: 8px; font-family: 'Courier New', monospace; }

.skill-row { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.skill-name { font-size: 12px; min-width: 110px; color: #d8d8d8; }

.skill-bar {
    width: 90px; height: 7px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(0,255,65,0.25);
    border-radius: 2px;
    overflow: hidden;
}
.skill-fill {
    height: 100%;
    background: linear-gradient(90deg, #00cc33, #00ff80);
    box-shadow: 0 0 5px #00ff41;
    border-radius: 2px;
    transition: width 0.7s ease;
}

.lang-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.lang-tag  { font-size: 11px; border: 1px solid rgba(0,255,65,0.35); padding: 2px 8px; color: #b0ffb8; border-radius: 3px; }

.skills-section-title { font-size: 10px; letter-spacing: 3px; color: #ffe066; margin-bottom: 8px; font-family: 'Courier New', monospace; }

.skill-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.skill-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 64px;
    padding: 6px 4px 5px;
    background: rgba(0,255,65,0.05);
    border: 1px solid rgba(0,255,65,0.3);
    border-radius: 3px;
    transition: background 0.15s, border-color 0.15s;
}
.skill-badge:hover {
    background: rgba(0,255,65,0.12);
    border-color: #00ff41;
}
.badge-abbr {
    font-size: 16px;
    font-weight: 800;
    color: #00ff41;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 8px rgba(0,255,65,0.5);
    line-height: 1;
}
.badge-name {
    font-size: 8px;
    color: #777;
    text-align: center;
    margin-top: 3px;
    line-height: 1.2;
}
.badge-dots {
    font-size: 8px;
    color: #00cc33;
    margin-top: 3px;
    letter-spacing: 1px;
    text-shadow: 0 0 4px rgba(0,200,50,0.4);
}

.skills-bottom { display: flex; gap: 28px; }
.skills-bottom-col { flex: 1; }

.soft-list { display: flex; flex-direction: column; gap: 5px; }
.soft-item { font-size: 12px; color: #d8d8d8; padding-left: 8px; border-left: 2px solid rgba(0,255,65,0.3); }

.extras-list { display: flex; flex-direction: column; gap: 6px; }
.extra-item { font-size: 12px; color: #b0c8ff; padding-left: 8px; border-left: 2px solid rgba(100,160,255,0.4); font-style: italic; }

.contact-grid { display: flex; flex-wrap: wrap; gap: 14px 28px; padding-top: 4px; }
.contact-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #d8d8d8; text-decoration: none; }
.contact-item:hover { color: #ffffff; }
.contact-icon { color: #ffe066; font-style: normal; font-size: 14px; width: 18px; text-align: center; }

.panel-footer {
    position: absolute;
    bottom: 7px; right: 18px;
    font-size: 10px; color: rgba(0,255,65,0.4);
    font-family: 'Courier New', monospace; letter-spacing: 1px;
    cursor: pointer;
}
.panel-footer:hover { color: rgba(0,255,65,0.8); }
.blink { animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

#cv-toggle-btn {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,40,8,0.88);
    border: 1.5px solid #00cc33;
    color: #ffe066;
    font: bold 10px 'Courier New', monospace;
    letter-spacing: 2px;
    padding: 5px 18px;
    cursor: pointer;
    border-radius: 3px;
    z-index: 5;
    display: none;
    box-shadow: 0 0 10px rgba(0,200,50,0.25);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
#cv-toggle-btn.visible { display: block; }
#cv-toggle-btn:hover {
    background: rgba(0,100,20,0.95);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(0,255,65,0.4);
}

#btn-mute {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,40,8,0.88);
    border: 1.5px solid #00cc33;
    font-size: 18px;
    line-height: 1;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    z-index: 5;
    box-shadow: 0 0 10px rgba(0,200,50,0.25);
    transition: background 0.15s, box-shadow 0.15s;
}
#btn-mute:hover {
    background: rgba(0,100,20,0.95);
    box-shadow: 0 0 16px rgba(0,255,65,0.4);
}
#btn-mute.muted {
    border-color: #444;
    box-shadow: none;
    opacity: 0.55;
}

#info-panel.fullread {
    max-height: 520px;
}

#game-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(to bottom, transparent 0px, transparent 2px, rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px);
    pointer-events: none;
    z-index: 10;
}

/* --- controlli touch --- */
#touch-controls {
    display: none;
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    padding: 0 14px;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 20;
    pointer-events: none;
}

#touch-dpad, #touch-actions {
    display: flex;
    gap: 10px;
    pointer-events: none;
}

.touch-btn {
    pointer-events: all;
    width: 58px;
    height: 58px;
    background: rgba(0, 30, 6, 0.78);
    border: 2px solid #00cc33;
    color: #00ff41;
    font-size: 22px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.touch-btn:active {
    background: rgba(0, 110, 22, 0.92);
    color: #ffffff;
    border-color: #00ff41;
}

.touch-btn-jump {
    width: 72px;
    height: 72px;
    font-size: 28px;
    border-color: #ffe066;
    color: #ffe066;
}

.touch-btn-jump:active {
    background: rgba(80, 60, 0, 0.92);
    border-color: #fff;
    color: #fff;
}

#touch-controls.hidden {
    display: none !important;
}

@media (hover: none) and (pointer: coarse) {
    #touch-controls {
        display: flex;
    }
}

/* --- overlay ruota dispositivo --- */
#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000011;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    color: #00ff41;
    font-family: 'Courier New', monospace;
    text-align: center;
    padding: 32px;
}

#rotate-overlay .rotate-icon {
    font-size: 64px;
    animation: rotatePhone 1.8s ease-in-out infinite;
}

#rotate-overlay p {
    font-size: 16px;
    line-height: 1.6;
    color: #ffe066;
}

@keyframes rotatePhone {
    0%   { transform: rotate(0deg); }
    40%  { transform: rotate(90deg); }
    60%  { transform: rotate(90deg); }
    100% { transform: rotate(0deg); }
}

@media (orientation: portrait) and (max-width: 768px) {
    #rotate-overlay {
        display: flex;
    }
}
