body { 
    font-family: 'Inter', sans-serif; 
    background-color: #0f172a; 
    color: #f8fafc; 
    -webkit-tap-highlight-color: transparent; 
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.safe-padding {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.theme-p1 { background-color: rgba(13, 148, 136, 0.1); border-color: rgba(13, 148, 136, 0.3); }
.theme-p2 { background-color: rgba(249, 115, 22, 0.05); border-color: rgba(249, 115, 22, 0.15); }

.active-turn-p1 { border-color: rgba(20, 184, 166, 0.8); box-shadow: 0 0 20px rgba(20, 184, 166, 0.1) inset; }
.active-turn-p2 { border-color: rgba(249, 115, 22, 0.8); box-shadow: 0 0 20px rgba(249, 115, 22, 0.1) inset; }

.turn-flash { 
    animation: flash-glow-intense 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 50 !important;
    overflow: visible !important; 
}

@keyframes flash-glow-intense { 
    0% { transform: scale(1); filter: brightness(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
    30% { transform: scale(1.01); filter: brightness(1.5); box-shadow: 0 0 30px 10px rgba(255, 255, 255, 0.4); }
    100% { transform: scale(1); filter: brightness(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.stat-card { 
    background-color: rgba(30, 41, 59, 0.8); 
    border-radius: 0.75rem; 
    padding: 0.5rem; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    border: 1px solid rgba(255,255,255,0.05); 
    transition: all 0.3s ease;
}

.stat-flagged {
    background-color: rgba(220, 38, 38, 0.25) !important;
    border: 1px solid rgba(220, 38, 38, 0.6) !important;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.2);
}

.btn-stat { 
    width: 2.8rem;
    height: 2.6rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background-color: #334155; 
    border-radius: 0.5rem; 
    font-size: 1.2rem; 
    font-weight: bold; 
    color: white; 
    transition: all 0.1s; 
    touch-action: manipulation; 
    cursor: pointer;
    border: none;
}
.btn-stat:active { background-color: #475569; transform: scale(0.92); }

.judge-call-active::after {
    content: '';
    position: fixed;
    inset: 0;
    background-color: rgba(220, 38, 38, 0.3);
    pointer-events: none;
    z-index: 9999;
    animation: pulse-overlay 3s infinite ease-in-out;
}

@keyframes pulse-overlay {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.9; }
}

.flag-active { animation: pulse-red 2s infinite; background-color: #b91c1c !important; }
@keyframes pulse-red { 
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6); } 
    70% { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0); } 
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } 
}

.play-area { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.75rem; padding-bottom: 1rem; }
@media (min-width: 768px), (orientation: landscape) { 
    .play-area { flex-direction: row; align-items: stretch; } 
    .player-board { flex: 1; min-height: 400px; } 
}

.modal-overlay { background-color: rgba(0,0,0,0.85); backdrop-filter: blur(4px); }
.edit-input { background: #0f172a; border: 1px solid #14b8a6; border-radius: 4px; padding: 2px 8px; color: white; width: 120px; outline: none; }

.footer-log {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2rem;
    background-color: #020617;
    border-top: 1px solid #1e293b;
    color: #64748b;
    font-size: 10px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    z-index: 45;
    pointer-events: none;
}

.infraction-dot {
    width: 6px;
    height: 6px;
    background-color: #ef4444;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 4px #ef4444;
}

.infraction-square {
    width: 6px;
    height: 6px;
    background-color: #eab308; /* Giallo */
    display: inline-block;
    box-shadow: 0 0 4px #eab308;
}

.infraction-triangle {
    width: 0;
    height: 0;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-bottom: 6px solid #f8fafc; /* Bianco */
    display: inline-block;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.6));
    transform: translateY(-1px);
}

.btn-shield {
    background-color: rgba(51, 65, 85, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.5rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-shield:active { transform: scale(0.9); background-color: rgba(51, 65, 85, 0.8); }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #334155; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #14b8a6; }
input:checked + .slider:before { transform: translateX(20px); }

.timer-container {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 1rem;
    margin: 0 0.75rem 4rem 0.75rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.timer-display {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 900;
    font-size: 2.5rem;
    color: #f8fafc;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255,255,255,0.1);
}

.text-energy-label { color: #cba6f7 !important; } 
.text-power-label { color: #cba6f7 !important; }  

.input-tbl-inline {
    background: transparent;
    border: none;
    color: inherit;
    min-width: 1.5ch;
    max-width: 4ch;
    font-weight: inherit;
    font-size: inherit;
    text-align: center;
    outline: none;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1;
}
.input-tbl-inline::-webkit-inner-spin-button, 
.input-tbl-inline::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}

/* --- COLORBLIND MODE OVERRIDES --- */
body.colorblind-mode .bg-teal-600 { background-color: #2563eb !important; } /* Blue for primary actions */
body.colorblind-mode .hover\:bg-teal-500:hover { background-color: #3b82f6 !important; }
body.colorblind-mode .text-teal-400, body.colorblind-mode .text-teal-300 { color: #60a5fa !important; }
body.colorblind-mode input:checked + .slider { background-color: #2563eb !important; }
body.colorblind-mode .edit-input { border-color: #2563eb !important; }

body.colorblind-mode .bg-red-600 { background-color: #d946ef !important; } /* Magenta for alerts/cancels */
body.colorblind-mode .text-red-400 { color: #f472b6 !important; }
body.colorblind-mode .bg-red-900\/50 { background-color: rgba(192, 38, 211, 0.3) !important; border-color: rgba(192, 38, 211, 0.6) !important;}
body.colorblind-mode .text-red-200 { color: #fdf4ff !important; }
body.colorblind-mode .hover\:bg-red-800:hover { background-color: rgba(192, 38, 211, 0.5) !important; }

body.colorblind-mode .infraction-dot { background-color: #d946ef !important; box-shadow: 0 0 4px #d946ef !important; }
body.colorblind-mode .infraction-square { background-color: #0ea5e9 !important; box-shadow: 0 0 4px #0ea5e9 !important; }

body.colorblind-mode .judge-call-active::after {
    background-color: rgba(217, 70, 239, 0.3) !important;
}
body.colorblind-mode .flag-active { 
    background-color: #c026d3 !important; 
    animation: pulse-cb 2s infinite !important; 
}

body.colorblind-mode #btn-timer-toggle { 
    background-color: #fbbf24 !important; 
    color: #0f172a !important; 
}

body.colorblind-mode #btn-timer-reset { 
    background-color: #f8fafc !important; 
    color: #0f172a !important; 
}

@keyframes pulse-cb { 
    0% { box-shadow: 0 0 0 0 rgba(217, 70, 239, 0.6); } 
    70% { box-shadow: 0 0 0 12px rgba(217, 70, 239, 0); } 
    100% { box-shadow: 0 0 0 0 rgba(217, 70, 239, 0); } 
}

body.colorblind-mode .active-turn-p1 { 
    border-color: rgba(59, 130, 246, 0.8) !important; 
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1) inset !important; 
}
