/* SudoMurder Daily Case - Sleek Glassmorphic Dark Style */

:root {
    --bg-dark: #0B0F17;
    --card-bg: rgba(18, 24, 36, 0.85);
    --glass-border: rgba(255, 255, 255, 0.12);
    --text-primary: #F8FAFC;
    --text-muted: #94A3B8;
    --neon-cyan: #00F2FE;
    --gold: #FFD700;
    --emerald: #00E676;
    --rose: #FF2D55;
    --accent-blue: #3B82F6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* ANTI-THEFT PROTECTED IMAGES */
img.protected-img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* 1. CABECERA */
.app-header {
    width: 100%;
    max-width: 650px;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(11, 15, 23, 0.95);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
}

.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.brand-text h1 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #FFFFFF; /* "Sudo" in pure white */
}

.brand-text h1 span {
    background: linear-gradient(135deg, #00F2FE 0%, #4FACFE 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; /* "Murder" in neon cyan gradient */
}

.brand-text p {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* SELECTOR DE IDIOMA FIJO EN LA ESQUINA SUPERIOR DERECHA */
.lang-select {
    position: absolute;
    top: 10px;
    right: 16px;
    z-index: 105;
    background: #1E293B;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.timer-badge {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--neon-cyan);
    padding: 6px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--neon-cyan);
}

.lang-select {
    background: #1E293B;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* MAIN CONTENT CONTAINER */
.game-container {
    width: 100%;
    max-width: 650px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.banner-completed {
    width: 100%;
    background: rgba(0, 230, 118, 0.15);
    border: 1px solid var(--emerald);
    color: var(--emerald);
    padding: 10px 16px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    display: none;
}

/* 2. MAPA / TABLERO */
.board-wrapper {
    position: relative;
    padding: 8px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 100%;
    display: flex;
    justify-content: center;
}

.board-grid {
    display: grid;
    gap: 2px;
    background: #475569; /* Dark grey grid lines */
    border-radius: 8px;
    overflow: hidden;
    width: min(92vw, 480px);
    height: min(92vw, 480px);
}

.grid-cell {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #0F172A;
    background-repeat: repeat;
    background-size: 48px 48px;
    background-position: center;
    background-blend-mode: overlay; /* Seamlessly blends pattern PNG textures with zone floor colors */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: visible;
    transition: background 0.15s ease;
}

.grid-cell:hover {
    filter: brightness(1.2);
}

.grid-cell.non-placeable {
    cursor: not-allowed !important;
}

.grid-cell.non-placeable:hover {
    filter: none !important;
}

/* FLOATING ZONES OVERLAY LAYER (DECOUPLED FROM GRID CELLS, Z-INDEX 20) */
.zones-overlay-layer {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 480px);
    height: min(92vw, 480px);
    pointer-events: none;
    z-index: 20;
}

.floating-zone-label {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: clamp(0.48rem, 1.7vw, 0.68rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.1;
    white-space: nowrap;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 20;
}

/* ZONE BORDERS (BLACK SEPARATORS MAINTAINING 2PX THICKNESS) */
.grid-cell.zone-border-top { border-top: 2px solid #000000 !important; }
.grid-cell.zone-border-bottom { border-bottom: 2px solid #000000 !important; }
.grid-cell.zone-border-left { border-left: 2px solid #000000 !important; }
.grid-cell.zone-border-right { border-right: 2px solid #000000 !important; }

/* OBSTACLE RENDERING - STAY BEHIND IN BACKGROUND & MULTI-CELL SPANNING */
.obstacle-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 88%;
    height: 88%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 1;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.obstacle-container.multi-cell {
    top: 0;
    left: 0;
    transform: none;
    padding: 2px;
}

.obstacle-container.multi-cell .obstacle-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: fill;
}

/* When object or any spanned cell has content, dim obstacle in background */
.obstacle-container.dimmed,
.grid-cell.has-content .obstacle-container {
    opacity: 0.3;
}

.obstacle-badge {
    font-size: clamp(1rem, 4vw, 1.8rem);
    pointer-events: none;
}

.obstacle-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    pointer-events: none;
}

/* CONTENT LAYER ON TOP (Z-INDEX 2) */
.cell-content-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 2;
}

/* CHARACTER PLACED - TRANSLUCENT BACKGROUND (~20% ALPHA) ON TOP */
.char-placed {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 82%;
    height: 82%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: clamp(0.8rem, 3.5vw, 1.2rem);
    color: #FFF;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 2;
    overflow: hidden;
    backdrop-filter: blur(2px);
}

.char-placed img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* NOTES & CROSSES - ON TOP OF OBSTACLE */
.cell-cross {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--rose);
    font-size: clamp(1.2rem, 5vw, 2.2rem);
    font-weight: 900;
    pointer-events: none;
    z-index: 2;
    text-shadow: 0 0 6px rgba(0,0,0,0.9);
}

.cell-notes {
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    padding: 2px;
    pointer-events: none;
    z-index: 2;
}

.note-num {
    font-size: clamp(0.55rem, 2.2vw, 0.85rem);
    color: #000000;
    font-weight: 900;
    text-align: center;
    text-shadow:
        -1px -1px 0 #FFFFFF,
         1px -1px 0 #FFFFFF,
        -1px  1px 0 #FFFFFF,
         1px  1px 0 #FFFFFF,
         0    0   4px #FFFFFF;
}

/* 3. LISTA DE PERSONAJES (SIN SCROLL LATERAL, WRAP EN FILAS ABAJO) */
.suspects-card {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
}

.suspects-bar {
    display: flex;
    flex-wrap: wrap; /* NO SCROLL! WRAPS NATURALLY TO NEW ROWS BELOW */
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.suspect-chip {
    flex: 0 0 auto;
    width: 54px;
    height: 64px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suspect-chip.selected {
    border-color: var(--gold);
    transform: scale(1.06);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.suspect-chip.placed {
    opacity: 0.35;
}

.suspect-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #FFF;
    overflow: hidden;
}

.suspect-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.suspect-name {
    font-size: 0.65rem;
    color: var(--text-primary);
    margin-top: 2px;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 4. OPERACIONES (COLOCAR, NOTAS, CRUCES, BORRAR) */
.toolbar-card {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
}

.tool-selector {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    background: rgba(0,0,0,0.4);
    padding: 6px;
    border-radius: 8px;
}

.tool-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.2s ease;
}

.tool-btn.active {
    background: rgba(0, 242, 254, 0.2);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 242, 254, 0.4);
}

/* 5. PISTAS Y EXPEDIENTE */
.dossier-card {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dossier-header {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gold);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ACTIONS BAR BUTTONS */
.action-btn {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-undo {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-verify {
    background: linear-gradient(135deg, #00F2FE 0%, #4FACFE 100%);
    color: #000;
}

.btn-verify:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.5);
}

.btn-share {
    background: linear-gradient(135deg, #00E676 0%, #00B0FF 100%);
    color: #000;
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #121824;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--gold);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dossier-victim-card {
    background: rgba(255, 45, 85, 0.1);
    border: 1px solid var(--rose);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.clues-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suspect-clues-item {
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid var(--neon-cyan);
    padding: 8px 12px;
    border-radius: 4px;
}

.suspect-clues-item h4 {
    font-size: 0.85rem;
    color: var(--neon-cyan);
    margin-bottom: 4px;
}

.suspect-clues-item ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.suspect-clues-item li {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* RESPONSIVE MOBILE HEADER LAYOUT */
@media (max-width: 600px) {
    .app-header {
        padding: 8px 12px;
        gap: 8px;
    }

    .brand-text p {
        display: none; /* Hide subtitle on small screens to prevent overlapping */
    }

    .brand-text h1 {
        font-size: 1rem;
    }

    .lang-select {
        top: 8px;
        right: 12px;
        padding: 4px 6px;
        font-size: 0.75rem;
    }

    .header-controls {
        gap: 4px;
    }

    .timer-badge {
        padding: 4px 8px;
        font-size: 0.78rem;
    }

    .icon-btn {
        padding: 4px 8px;
        font-size: 0.78rem;
    }
}

    .timer-badge {
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    .icon-btn {
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    .lang-select {
        padding: 4px;
        font-size: 0.75rem;
    }
}
