/* public/css/inchide-cutia.css */

/* ===== BODY & WRAPPER ===== */
.inchide-cutia-body {
    background-color: #0a4d25;
    background-image: radial-gradient(circle at 50% 50%, #177a3d 0%, #0a4d25 70%, #063318 100%);
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    min-height: 100vh;
}

body.dark-theme.inchide-cutia-body {
    background-color: #02140a;
    background-image: radial-gradient(circle at 50% 50%, #0a3018 0%, #02140a 100%);
}

.ict-wrapper {
    padding-top: 120px !important;
}

/* ===== MODAL FIX (body color: #fff inherits into modal) ===== */
.inchide-cutia-body .modal-content {
    color: #212529;
}

/* ===== GLASS PANEL ===== */
.glass-panel {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

/* ===== SETUP SCREEN ===== */
#setup-screen .form-select {
    background-color: #1a1d21;
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.player-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.player-row input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 8px;
    padding: 6px 12px;
    flex: 1;
}

.player-row .form-check-input {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ===== THE BOX ===== */
.box-container {
    background: linear-gradient(180deg, #5c3a1e 0%, #3d2412 100%);
    border: 4px solid #8B5E3C;
    border-radius: 16px;
    padding: 20px 16px;
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.5), 0 8px 30px rgba(0, 0, 0, 0.4);
}

.flaps-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== FLAP ===== */
.flap {
    width: 60px;
    height: 85px;
    perspective: 400px;
    cursor: pointer;
    user-select: none;
}

.flap-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.flap.closed .flap-inner {
    transform: rotateX(180deg);
}

.flap-front,
.flap-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px 10px 4px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
}

.flap-front {
    background: linear-gradient(180deg, #C9A66B 0%, #A67C52 80%, #8B5E3C 100%);
    color: #3d2412;
    border: 2px solid #8B5E3C;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.flap-back {
    background: linear-gradient(180deg, #2a1508 0%, #3d2412 100%);
    color: rgba(255, 255, 255, 0.15);
    border: 2px solid #5c3a1e;
    transform: rotateX(180deg);
    font-size: 1.2rem;
}

/* Flap States */
.flap:not(.closed):not(.disabled):hover .flap-front {
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
}

.flap.selected .flap-front {
    border-color: #f39c12 !important;
    box-shadow: 0 0 18px rgba(243, 156, 18, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(180deg, #f0d078 0%, #C9A66B 80%, #A67C52 100%);
}

.flap.disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* Clickable flaps glow when it's selection phase */
.flap.clickable {
    cursor: pointer;
    animation: flapGlow 1.5s ease-in-out infinite alternate;
}

.flap.clickable .flap-front {
    border-color: #2ecc71;
}

@keyframes flapGlow {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.15); }
}

/* 12-flap sizing */
.flaps-12 .flap {
    width: 48px;
    height: 72px;
}

.flaps-12 .flap-front,
.flaps-12 .flap-back {
    font-size: 1.2rem;
}

/* ===== SIMPLE 2D DICE ===== */
.simple-die {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #fdfaf1 0%, #e8e0cc 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
}

.die-dots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
}

.die-dots span {
    display: flex;
    align-items: center;
    justify-content: center;
}

.die-dot {
    width: 13px;
    height: 13px;
    background: #333;
    border-radius: 50%;
    display: block;
}

/* Roll animation */
.simple-die.rolling {
    animation: diceShake 0.6s ease;
}

@keyframes diceShake {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10% { transform: rotate(-15deg) scale(1.1); }
    20% { transform: rotate(12deg) scale(0.95); }
    30% { transform: rotate(-10deg) scale(1.05); }
    40% { transform: rotate(8deg) scale(0.98); }
    50% { transform: rotate(-5deg) scale(1.02); }
    60% { transform: rotate(3deg); }
    70% { transform: rotate(-2deg); }
    80% { transform: rotate(1deg); }
}

body.dark-theme .simple-die {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
}

body.dark-theme .die-dot {
    background: #ecf0f1;
}

/* ===== SCOREBOARD ===== */
#scores-table {
    font-size: 0.85rem;
}

#scores-table th,
#scores-table td {
    vertical-align: middle;
    padding: 6px 10px;
}

#scores-table .current-player {
    background: rgba(243, 156, 18, 0.25) !important;
}

#scores-total td,
#scores-total th {
    font-weight: 800;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

/* ===== SHUT THE BOX CELEBRATION ===== */
.box-container.shut-celebration {
    animation: shutPulse 0.6s ease;
    border-color: #f39c12;
    box-shadow: 0 0 30px rgba(243, 156, 18, 0.5), inset 0 4px 20px rgba(0, 0, 0, 0.5);
}

@keyframes shutPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); box-shadow: 0 0 40px rgba(243, 156, 18, 0.7); }
    100% { transform: scale(1); }
}

/* ===== RESPONSIVE: TABLET ===== */
@media (max-width: 768px) {
    .ict-wrapper {
        padding-top: 100px !important;
    }

    .flap {
        width: 50px;
        height: 72px;
    }

    .flap-front, .flap-back {
        font-size: 1.25rem;
    }

    .flaps-12 .flap {
        width: 40px;
        height: 60px;
    }

    .flaps-12 .flap-front,
    .flaps-12 .flap-back {
        font-size: 1rem;
    }

    .simple-die {
        width: 60px;
        height: 60px;
    }

    .die-dot {
        width: 11px;
        height: 11px;
    }

    .flaps-row {
        gap: 6px;
    }
}

/* ===== RESPONSIVE: MOBILE ===== */
@media (max-width: 480px) {
    .ict-wrapper {
        padding-top: 85px !important;
    }

    .flap {
        width: 42px;
        height: 62px;
    }

    .flap-front, .flap-back {
        font-size: 1.05rem;
        border-radius: 8px 8px 3px 3px;
    }

    .flaps-12 .flap {
        width: 34px;
        height: 52px;
    }

    .flaps-12 .flap-front,
    .flaps-12 .flap-back {
        font-size: 0.85rem;
    }

    .simple-die {
        width: 52px;
        height: 52px;
    }

    .die-dot {
        width: 9px;
        height: 9px;
    }

    .flaps-row {
        gap: 4px;
    }

    .box-container {
        padding: 14px 10px;
    }

    #scoreboard {
        font-size: 0.75rem;
    }

    #game-status {
        font-size: 0.75rem !important;
        white-space: normal;
        word-break: break-word;
        max-width: 100%;
    }
}
