/* BASE */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #ffffff 0%, #f4f4f4 40%, #dbeff8 100%);
    color: #1F4E66;
}

/* HEADER */
.header {
    margin-top: 10px;
    text-align: center;
}

.title {
    font-size: 28px;
    font-weight: bold;
}

/* CONTROLLI */
.controls {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.reset-btn {
    padding: 8px 16px;
    font-size: 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: #FFB46A;
    color: #1F4E66;
    font-weight: bold;
    box-shadow: 0 0 6px rgba(0,0,0,0.15);
}

.reset-btn:hover {
    filter: brightness(1.05);
}

.status {
    font-size: 14px;
    opacity: 0.8;
}

/* 3-COLUMN LAYOUT */
.page-grid {
    margin-top: 15px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
}

/* left column just as spacer */
.col-left {
    flex: 1;
}

/* center column with pyramid */
.col-center {
    flex: 0 0 520px; /* larghezza fissa per tenere la piramide sempre allineata */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* right column for info box */
.col-right {
    flex: 0 0 320px;
    display: flex;
    justify-content: flex-start;
    margin-left: 24px;
}

/* CURRENT PANEL */
.current-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.current-label {
    font-size: 16px;
    font-weight: bold;
}

.current-card {
    width: 350px;
    height: 210px;
    border-radius: 12px;
    border: 2px solid #FFB46A;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 8px rgba(0,0,0,0.1);
}

.current-image-wrapper {
    width: 100%;
    height: 100%;
    background: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
}

.current-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.current-name {
    text-align: center;
    font-size: 14px;
    padding: 4px 6px;
    color: #555;
}

.done-message {
    font-size: 14px;
    font-weight: bold;
}

/* PIRAMIDE */
.pyramid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    margin-top: 10px;
}

.row {
    display: flex;
    gap: 14px;
    justify-content: center;
}

.slot {
    width: 110px;
    height: 90px;
    perspective: 1000px;
}

/* original flip card structure */
.card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    cursor: pointer;
}

.card-inner {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    border: 2px solid #FFE27A;
    display: flex;
    align-items: center;
    justify-content: center;
}

.front {
    background: #ffffff;
    color: #1F4E66;
    font-size: 32px;
    font-weight: bold;
}

.back {
    transform: rotateY(180deg);
    background-size: cover;
    background-position: center;
    opacity: 0;
}

/* flip */
.slot.flipped .card-inner {
    transform: rotateY(180deg);
}

.slot.flipped .back {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* INFO BOX A DESTRA */
.info-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 0 8px rgba(0,0,0,0.08);
    padding: 14px 16px;
    font-size: 13px;
    max-width: 320px;
}

.info-title {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 16px;
    color: #1F4E66;
}

.info-box ul {
    margin-top: 4px;
    padding-left: 18px;
}

.info-footer {
    margin-top: 8px;
}

/* upload */
.upload-controls {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-btn {
    align-self: flex-start;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: #7CC6E8;
    color: #1F4E66;
    font-weight: bold;
    box-shadow: 0 0 6px rgba(0,0,0,0.12);
}

.upload-message {
    margin-top: 4px;
    font-size: 12px;
}

.upload-message.error { color: #E77A7A; }
.upload-message.success { color: #1F4E66; }

/* Responsive: sotto i 900px mettiamo piramide e info box una sotto l'altro */
@media (max-width: 900px) {
    .page-grid {
        flex-direction: column;
        align-items: center;
    }
    .col-left {
        display: none;
    }
    .col-center {
        flex: 0 0 auto;
    }
    .col-right {
        margin-left: 0;
        margin-top: 16px;
    }
}

/* === Tweaks per usare più spazio in altezza === */
.current-card {
    height: 230px; /* riquadro immagine più alto */
}

.pyramid {
    gap: 18px;         /* più spazio tra le righe */
    margin-top: 16px;
}

.slot {
    width: 130px;      /* caselle più larghe */
    height: 120px;     /* caselle più alte */
}

/* === Footer spacing === */
.page-footer {
    width: 100%;
    height: 80px; /* spazio desiderato */
}
