/* =============================================================================
   Jose Page - Custom Card Tracking
   ============================================================================= */

.jose-page {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--venue-bg, radial-gradient(circle at 50% 30%, #e8d5b5 0%, #dcc098 60%, #c4a47c 100%));
    color: var(--venue-text, #5c3a21);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.jose-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--venue-text, #5c3a21) 60%, transparent) 0%, color-mix(in srgb, var(--venue-text, #5c3a21) 30%, transparent) 100%);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.jose-header .header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jose-header .header-logo {
    height: 36px;
    width: auto;
}

.jose-header .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.jose-header .connection-status {
    display: flex;
    align-items: center;
}

.jose-header .status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
}

.jose-header .status-dot.connected {
    background: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.3);
}

.jose-header .status-dot.disconnected {
    background: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
}

.jose-header .lang-dropdown {
    padding: 0.5rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(139, 69, 19, 0.3);
    background: rgba(255, 255, 255, 0.6);
    color: var(--venue-text, #5c3a21);
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Last Ball Display with Goal Indicator */
.jose-last-ball-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    background: rgba(139, 69, 19, 0.1);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.jose-ball-slot {
    width: clamp(68px, 20vw, 88px);
    height: clamp(68px, 20vw, 88px);
    flex-shrink: 0;
}

.jose-goal-display {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #d4a017 0%, #F1C40F 40%, #c9a80a 100%);
    padding: 0.4rem 1.2rem;
    border-radius: 8px;
    transition: background 0.5s ease;
}

.jose-goal-display.goal-for-bingo {
    background: linear-gradient(135deg, #1e8449 0%, #2ECC71 40%, #1fa855 100%);
}

.jose-goal-display.goal-for-bingo:has(.won) {
    background: linear-gradient(135deg, #6b7b6e 0%, #95a5a6 40%, #7f8c8d 100%);
}

.jose-goal-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #000;
    font-weight: 700;
}

.jose-goal-text {
    font-size: clamp(1.6rem, 8vw, 2.4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    transition: all 0.5s ease;
}

.jose-goal-text.won {
    color: #95a5a6;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}

.jose-goal-text.won::before {
    content: "\2713\00a0";
}

.jose-ball {
    width: clamp(68px, 20vw, 88px);
    height: clamp(68px, 20vw, 88px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 30%, #fff 0%, #FFD700 50%, #000 150%);
    box-shadow: inset -8px -8px 16px rgba(0,0,0,0.4),
                inset 4px 4px 8px rgba(255,255,255,0.3),
                0 4px 12px rgba(0,0,0,0.3);
}

.jose-ball-number {
    font-size: clamp(1.5rem, 8vw, 2.2rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

/* Ball colors by range (1-18, 19-36, 37-54, 55-72, 73-90) */
.jose-ball[data-range="1"] { background: radial-gradient(circle at 30% 30%, #fff 0%, #FFD700 50%, #000 150%); }
.jose-ball[data-range="2"] { background: radial-gradient(circle at 30% 30%, #fff 0%, #3b82f6 50%, #000 150%); }
.jose-ball[data-range="3"] { background: radial-gradient(circle at 30% 30%, #fff 0%, #ec4899 50%, #000 150%); }
.jose-ball[data-range="4"] { background: radial-gradient(circle at 30% 30%, #fff 0%, #22c55e 50%, #000 150%); }
.jose-ball[data-range="5"] { background: radial-gradient(circle at 30% 30%, #fff 0%, #a855f7 50%, #000 150%); }

.jose-main {
    padding: 1.25rem;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Cards Container */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cards-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.add-card-btn {
    background: var(--venue-primary, #c4843e);
    color: white;
    border: none;
    padding: 0.7rem 1.4rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    min-height: 44px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(196, 132, 62, 0.3);
}

.add-card-btn:hover {
    background: #a86f32;
}

.add-card-btn:active {
    transform: scale(0.98);
}

.cards-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cards-disclaimer {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--venue-text-muted, #8b7355);
    text-align: center;
    font-style: italic;
}

/* Custom Card */
.custom-card {
    background: rgba(255, 255, 255, 0.65);
    border-radius: 20px;
    padding: 6px;
    border: 1px solid rgba(139, 69, 19, 0.15);
    position: relative;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.card-title {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 0.9rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
    background: var(--venue-card, #27ae60);
    border: 3px solid var(--venue-card, #27ae60);
    border-radius: 4px;
    overflow: hidden;
    container-type: inline-size;
}

.card-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    min-width: 0;
    background: white;
    border-radius: 0;
    border: none;
    font-weight: 800;
    font-size: clamp(0.9rem, 9cqi, 1.6rem);
    color: var(--venue-card, #27ae60);
    transition: all 0.25s ease;
}

.card-cell-empty {
    background: var(--venue-card, #27ae60);
    border: none;
}

/* Line-specific marked colors */
.card-cell.marked.line-1 {
    background: #ff9800;
    color: white;
    border-color: #e68900;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

.card-cell.marked.line-2 {
    background: #00bcd4;
    color: white;
    border-color: #00a5bb;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.5);
}

.card-cell.marked.line-3 {
    background: #e91e63;
    color: white;
    border-color: #d01558;
    box-shadow: 0 0 10px rgba(233, 30, 99, 0.5);
}

/* Card win text (inline in title bar) */
.card-win-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff0000);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowCycle 1.5s linear infinite;
    z-index: 2;
    text-shadow: none;
}

@keyframes rainbowCycle {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* Hide non-winning cards during celebration */
.custom-card.win-hidden {
    display: none;
}

/* Screen flash for celebrations */
.screen-flash {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
}

.delete-btn {
    background: #e74c3c;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.delete-btn:hover {
    background: #c0392b;
}

/* Jose Collapsible Section */
.jose-collapsible {
    background: rgba(255, 255, 255, 0.55);
    border-radius: 20px;
    border: 1px solid rgba(139, 69, 19, 0.15);
    overflow: hidden;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.jose-collapsible-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.85rem 1.1rem;
    min-height: 48px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
    color: #5c3a21;
    text-align: left;
    border-radius: 20px;
    -webkit-tap-highlight-color: transparent;
}

/* Only apply hover effect on devices that support hover (not touch) */
@media (hover: hover) {
    .jose-collapsible-toggle:hover {
        background: rgba(139, 69, 19, 0.1);
    }
}

/* Brief tap feedback for touch devices */
.jose-collapsible-toggle:active {
    background: rgba(139, 69, 19, 0.15);
}

.jose-toggle-indicator {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
    opacity: 0.7;
}

.ball-status {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-left: auto;
    margin-right: 0.5rem;
}

.jose-collapsible.open .jose-toggle-indicator {
    transform: rotate(180deg);
}

.jose-collapsible-content {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid rgba(139, 69, 19, 0.15);
}

/* Share Section */
.jose-share-section {
}

.jose-share-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.jose-share-qr {
    background: #ffffff;
    padding: 12px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 180px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-hint {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: #8b4513;
    text-align: center;
}

/* Card Editor */
.card-editor {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 1rem;
    border: 1px solid rgba(139, 69, 19, 0.15);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.editor-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 0.5rem;
    margin: -0.25rem -0.25rem 0.75rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Editor preview: consistent cell height even when all cells in a row are empty */
#editor-preview-grid .card-cell {
    min-height: 2em;
}

/* Editor preview: line colors (scoped to prevent affecting saved cards) */
#editor-preview-grid .card-cell.line-1 { background: #ff9800; color: #fff; }
#editor-preview-grid .card-cell.line-2 { background: #00bcd4; color: #fff; }
#editor-preview-grid .card-cell.line-3 { background: #e91e63; color: #fff; }

.selection-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.selection-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 69, 19, 0.08);
    border-radius: 50%;
    border: 1px solid rgba(139, 69, 19, 0.1);
    font-size: clamp(1.4rem, 6vw, 1.8rem);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.selection-cell:hover {
    background: rgba(139, 69, 19, 0.18);
}

/* Line-specific selection colors */
.selection-cell.line-1 {
    background: #ff9800;
    color: white;
    border-color: #e68900;
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.45);
    transform: scale(1.08);
}

.selection-cell.line-2 {
    background: #00bcd4;
    color: white;
    border-color: #00a5bb;
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.45);
    transform: scale(1.08);
}

.selection-cell.line-3 {
    background: #e91e63;
    color: white;
    border-color: #d01558;
    box-shadow: 0 0 8px rgba(233, 30, 99, 0.45);
    transform: scale(1.08);
}

.editor-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: center;
}

.save-btn,
.cancel-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    min-height: 44px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.save-btn {
    background: #c4843e;
    color: white;
    box-shadow: 0 2px 8px rgba(196, 132, 62, 0.3);
}

.save-btn:hover:not(:disabled) {
    background: #a86f32;
}

.save-btn:disabled {
    background: #a0917e;
    cursor: not-allowed;
    opacity: 0.6;
}

.cancel-btn {
    background: #7f8c8d;
    color: white;
    box-shadow: 0 2px 8px rgba(127, 140, 141, 0.3);
}

.cancel-btn:hover {
    background: #6c7a7b;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.25rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.5;
    color: #7a5234;
}

/* Mini Grid */
.mini-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
}

.mini-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 69, 19, 0.08);
    border-radius: 50%;
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 700;
    transition: all 0.3s ease;
}

.mini-cell.called {
    background: radial-gradient(circle, var(--venue-primary, #ffaa00) 0%, color-mix(in srgb, var(--venue-primary, #ff8800) 85%, #000) 100%);
    color: var(--venue-called-text, #fff);
    font-weight: 800;
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
    transform: scale(1.05);
}

/* Responsive adjustments for Jose page */
@media (max-width: 400px) {
    .jose-main {
        padding: 0.75rem;
    }

    .card-editor {
        padding: 0.75rem;
    }

    .selection-grid {
        gap: 6px;
    }

    .card-grid {
        gap: 4px;
    }

    .jose-last-ball-section {
        padding: 0.75rem;
    }

    .jose-goal-text {
        font-size: clamp(1.4rem, 7vw, 2rem);
    }
}

/* =============================================================================
   LMS Mode — Jose overlay + card elimination
   ============================================================================= */

/* LMS Overlay - full-screen semi-transparent overlay on Jose page */
.lms-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: background-color 0.5s;
    pointer-events: none;
    padding: 20px;
}
.lms-overlay.pre-game {
    background: rgba(0, 0, 0, 0.7);
}
.lms-overlay.alive {
    background: rgba(0, 128, 0, 0.75);
}
.lms-overlay.eliminated {
    background: rgba(180, 0, 0, 0.85);
    pointer-events: auto;
}

.lms-overlay .lms-title {
    font-size: 2rem;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    margin: 0 0 12px;
}
.lms-overlay .lms-count {
    font-size: 1.5rem;
    color: #fff;
    margin: 0 0 8px;
}
.lms-overlay .lms-instruction {
    font-size: 1.8rem;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Card elimination animation */
.jose-page .custom-card.lms-eliminated {
    animation: cardEliminate 0.5s ease-in forwards;
}
@keyframes cardEliminate {
    to {
        opacity: 0;
        transform: scale(0.8);
        height: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
}
