@charset "UTF-8";

/* Game specific styles for "Dipendenza dalla Perfezione" */
:root {
    --primary: #9b51e0;
    --primary-light: #c384f7;
    --primary-dark: #6a1b9a;
    --secondary: #00bcd4;
    --danger: #ef5350;
    --success: #66bb6a;
    --bg-dark: #2d3748;
    --bg-panel: #1a202c;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --bg-gradient: linear-gradient(135deg, #1e1b4b, #312e81, #4338ca);
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    font-family: 'Fredoka', 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.screen {
    display: none;
    flex: 1;
    flex-direction: column;
    animation: fadeIn 0.4s ease-out;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#start-screen {
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(26, 32, 44, 0.8);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    margin-top: 2rem;
}

.game-title {
    font-size: 3.5rem;
    color: var(--secondary);
    text-shadow: 0 4px 15px rgba(0, 188, 212, 0.4);
    margin-bottom: 20px;
    font-family: 'JetBrains Mono', monospace;
}

.game-desc {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.6;
}

.mt-10 {
    margin-top: 2rem;
}

/* Button */
.btn {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 6px 0 var(--primary-dark), 0 10px 20px rgba(155, 81, 224, 0.4);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 var(--primary-dark), 0 15px 25px rgba(155, 81, 224, 0.6);
}

.btn.primary:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--primary-dark);
}

/* Forms Additions */
.input-field {
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 15px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--secondary);
    background: rgba(0, 0, 0, 0.4);
}

.input-field::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

select.input-field {
    cursor: pointer;
}

select.input-field option {
    background: var(--bg-panel);
    color: white;
}

/* Game Area */
.action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel);
    padding: 15px 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.2rem;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.mission-info {
    color: var(--secondary);
    font-weight: 700;
}

.mission-status {
    color: var(--text-muted);
    font-style: italic;
}

.game-area {
    display: flex;
    gap: 20px;
    height: 540px;
    /* Altezza fissa per impedire movimenti del container */
}

/* Feedback panel */
.feedback-panel {
    width: 300px;
    background: var(--bg-panel);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

.panel-header h3 {
    margin: 0;
    color: var(--primary-light);
    font-size: 1.2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 15px;
    font-family: 'Fredoka', sans-serif;
}

.feedback-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Custom Scrollbar for feedback */
.feedback-list::-webkit-scrollbar {
    width: 6px;
}

.feedback-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.feedback-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.feedback-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    font-size: 0.95rem;
    animation: slideIn 0.3s ease-out forwards;
    line-height: 1.4;
}

.feedback-item.error {
    border-left-color: var(--danger);
    background: rgba(239, 83, 80, 0.1);
}

.feedback-item.success {
    border-left-color: var(--success);
    background: rgba(102, 187, 106, 0.1);
}

.feedback-item.warning {
    border-left-color: #ffca28;
    background: rgba(255, 202, 40, 0.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Level Container */
.level-container {
    flex: 1;
    background: var(--bg-panel);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    overflow: hidden;
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.overlay.hidden {
    display: none !important;
}

.overlay-content {
    background: var(--bg-panel);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    border: 2px solid;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.overlay-content.success {
    border-color: var(--success);
}

.overlay-content.success h2 {
    color: var(--success);
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.overlay-content.super-success {
    border-color: var(--primary);
}

.overlay-content.super-success h2 {
    color: var(--primary-light);
    font-size: 3rem;
}

.overlay-content button {
    margin-top: 25px;
    padding: 12px 30px;
    font-size: 1.2rem;
}

/* ------------------------------- */
/* LEV 1 - BIGLIA E BUCHI           */
/* ------------------------------- */
#livello-1-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
}

.board-container {
    position: relative;
    width: 320px;
    height: 320px;
    background: #4ade80;
    /* Erba/Prato verde */
    border-radius: 50%;
    border: 12px solid #166534;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 10px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.hole {
    position: absolute;
    width: 44px;
    height: 44px;
    background: #111;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.8), 0 2px 5px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.hole:hover {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 255, 255, 0.6);
}

/* Disposizione 6 buchi base, le reali % vengono inserite via js/css in line per essere flessibili */

.ball {
    position: absolute;
    width: 34px;
    height: 34px;
    background: radial-gradient(circle at 30% 30%, #ff4b4b, #8a0000);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 10;
}

/* Generic Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .game-area {
        flex-direction: column-reverse;
        height: auto;
    }

    .feedback-panel {
        width: 100%;
        height: 250px;
        /* Altezza fissa su mobile per scorrere i log */
    }

    .level-container {
        height: 420px;
        /* Spazio sufficiente per la tavola di gioco mobile */
    }

    .board-container {
        width: 260px;
        height: 260px;
    }
}/* Certificate Attributes */
.certificate-box {
    background: #faf8f5;
    color: #333;
    padding: 25px;
    border-radius: 10px;
    border: 8px solid #d4af37;
    outline: 1px solid white;
    outline-offset: -5px;
    text-align: center;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.cert-icon {
    position: absolute;
    top: 10px;
    font-size: 2rem;
    opacity: 0.2;
}

.cert-icon.left {
    left: 10px;
}

.cert-icon.right {
    right: 10px;
}

.cert-title {
    color: #6a1b9a;
    font-size: 2.2rem;
    margin-bottom: 5px;
    font-family: 'Fredoka', cursive;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cert-subtitle {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.cert-name {
    color: #00bcd4;
    font-size: 1.8rem;
    display: block;
    margin-top: 5px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
}

.cert-comment {
    font-size: 1rem;
    font-style: italic;
    margin-bottom: 20px;
    color: #444;
    line-height: 1.3;
}

.cert-reflections-container {
    border-top: 2px dashed #d4af37;
    padding-top: 15px;
    text-align: left;
}

.cert-reflections-title {
    color: #6a1b9a;
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-align: center;
}

.cert-reflections-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.cert-footer {
    margin-top: 25px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #ccc;
    padding-top: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: #666;
    font-size: 0.9rem;
}

.cert-reflection-item {
    background: rgba(0,0,0,0.03);
    padding: 6px 8px;
    border-radius: 4px;
    border-left: 3px solid #00bcd4;
}

.cert-reflection-level {
    font-weight: bold;
    color: #6a1b9a;
    margin-bottom: 1px;
    font-size: 0.8rem;
}

.cert-reflection-moral {
    font-size: 0.7rem;
    color: #555;
    margin-bottom: 3px;
}

.cert-reflection-text {
    color: #333;
    font-size: 0.75rem;
}

/* ---------- Stampa dell'attestato ----------
   Al posto di html2canvas dal CDN si usa la stampa del browser: sulla
   pagina resta il solo attestato, e da lì si stampa o si salva in PDF. */
@media print {
    body * { visibility: hidden !important; }
    #certificate-box, #certificate-box * { visibility: visible !important; }
    #certificate-box {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
    }
    .site-header, .site-footer, .result-buttons, .btn-download, .btn-play { display: none !important; }
}
