/* Premium Aesthetics: Dark mode, Vibrant Colors, Glassmorphism, Animations */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Roboto+Mono&display=swap');

:root {
    --bg-main: #0B0F19;
    --bg-glass: rgba(25, 30, 45, 0.6);
    --border-glass: rgba(255, 255, 255, 0.1);
    --accent-red: #ff3b30;
    --accent-green: #34c759;
    --accent-blue: #0A84FF;
    --text-primary: #f2f2f7;
    --text-secondary: #aeaeb2;
}

body {
    background-color: var(--bg-main);
    background-image: radial-gradient(circle at 15% 50%, rgba(10, 132, 255, 0.15), transparent 40%),
                      radial-gradient(circle at 85% 30%, rgba(255, 59, 48, 0.1), transparent 40%);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: black;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Base App Layout */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(90deg, #fff, #aeaeb2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.5s ease;
    margin-bottom: 2rem;
}

.stat-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.loss-value {
    color: var(--accent-red);
    font-family: 'Roboto Mono', monospace;
}

/* Board Display */
.board-container {
    text-align: center;
    margin-bottom: 2rem;
}

.section-label {
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    display: block;
}

.cards {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.playing-card {
    width: 60px;
    height: 84px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    color: #000;
    transition: transform 0.2s ease;
}
.playing-card:hover {  transform: translateY(-5px); }
.playing-card.spade { color: #1c1c1e; }
.playing-card.heart { color: #ff3b30; }
.playing-card.club { color: #16a34a; }
.playing-card.diamond { color: #0ea5e9; }

/* Situation Graphics */
.situation {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
}
.player-seat {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}
.player-seat.active { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.player-seat.folded { background: transparent; color: rgba(255,255,255,0.3); }
.player-seat.pushed { background: rgba(255, 59, 48, 0.2); color: #ff453a; border: 1px solid rgba(255, 59, 48, 0.4); }
.player-seat.target { background: var(--accent-blue); color: #fff; box-shadow: 0 0 15px rgba(10, 132, 255, 0.4); }

/* Controls */
.controls-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 1rem;
    margin-top: 2rem;
}
.btn {
    border: none;
    border-radius: 12px;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    color: white;
}
.btn-push { background: linear-gradient(135deg, #ff453a, #ff3b30); box-shadow: 0 4px 15px rgba(255, 59, 48, 0.4); }
.btn-push:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 25px rgba(255, 59, 48, 0.6); }

.btn-fold { background: linear-gradient(135deg, #30d158, #34c759); box-shadow: 0 4px 15px rgba(52, 199, 89, 0.4); }
.btn-fold:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 25px rgba(52, 199, 89, 0.6); }

button.btn-delay { background: linear-gradient(135deg, #5e5ce6, #5856d6); box-shadow: 0 4px 15px rgba(94, 92, 230, 0.4); padding: 0 0.5rem; aspect-ratio: 1 / 1; height: auto; width: auto; display: flex; flex-direction: column; justify-content: center; align-items: center; flex: 0 0 auto !important; color: white; }
button.btn-delay:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 25px rgba(94, 92, 230, 0.6); }
button.btn-delay:disabled { background: #444; box-shadow: none; color: #888; cursor: not-allowed; }

.btn-next { background: linear-gradient(135deg, #0A84FF, #007AFF); margin-top: 1.5rem; width: 100%; box-shadow: 0 4px 15px rgba(10, 132, 255, 0.4); }
.btn-next:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(10, 132, 255, 0.6); }

/* Feedback */
.feedback-box {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.feedback-box.correct { background: rgba(52, 199, 89, 0.15); border: 1px solid var(--accent-green); }
.feedback-box.wrong { background: rgba(255, 59, 48, 0.15); border: 1px solid var(--accent-red); }

.feedback-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.feedback-detail { font-size: 1.1rem; color: var(--text-secondary); font-family: 'Roboto Mono', monospace;}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top:0; left:0; width:100%; height:100%;
    background: #000 url('images/loading.jpg') center/cover no-repeat;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 1000;
}
.loading-screen::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.loading-content { position: relative; z-index: 1; text-align: center; }
.loading-content h1 { font-size: 4rem; text-shadow: 0 4px 20px rgba(0,0,0,0.8); background: linear-gradient(90deg, #fff, #aeaeb2); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
.loader { width: 48px; height: 48px; border: 4px solid var(--accent-blue); border-bottom-color: transparent; border-radius: 50%; display: inline-block; box-sizing: border-box; animation: rotation 1s linear infinite; margin-top: 2rem; }

/* Result Screen */
.final-result { text-align: center; }
.final-rank { font-size: 6rem; font-weight: 800; background: linear-gradient(135deg, #FFD700, #FDB931); -webkit-background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5)); animation: pulse 2s infinite; }

/* Animations */
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes rotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse { 0% { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5)); } 50% { filter: drop-shadow(0 0 40px rgba(255, 215, 0, 0.8)); transform: scale(1.05); } 100% { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5)); } }

/* SMPTE Leader Animation */
.smpte-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 4rem);
    min-height: 500px;
    max-width: 800px; /* match app-container */
    margin: 2rem auto;
    background-color: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    overflow: hidden;
    animation: smpteGlitch 0.2s infinite;
}

.smpte-circle {
    position: relative;
    width: 300px;
    height: 300px;
    border: 4px solid #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.smpte-crosshair-h {
    position: absolute;
    width: 400px;
    height: 2px;
    background: #fff;
    top: 50%;
    left: -50px;
    transform: translateY(-50%);
}

.smpte-crosshair-v {
    position: absolute;
    width: 2px;
    height: 400px;
    background: #fff;
    left: 50%;
    top: -50px;
    transform: translateX(-50%);
}

.smpte-number {
    position: relative;
    font-size: 10rem;
    font-family: inherit;
    font-weight: 800;
    color: #fff;
    z-index: 10;
    background: #111;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
}

.smpte-sweep {
    position: absolute;
    width: 150px;
    height: 4px;
    background: #fff;
    top: 50%;
    left: 50%;
    transform-origin: 0 50%;
    animation: smpteSweepAnim 1s linear infinite;
    z-index: 5;
    border-radius: 2px;
}

.smpte-beeps {
    animation: smpteFlash 1s step-end infinite;
}

@keyframes smpteSweepAnim {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

@keyframes smpteGlitch {
    0% { filter: contrast(1) brightness(1); transform: translate(0px, 0px); }
    30% { filter: contrast(1.1) brightness(1.1); transform: translate(1px, -1px); }
    60% { filter: contrast(0.9) brightness(0.9); transform: translate(-1px, 1px); }
    100% { filter: contrast(1) brightness(1); transform: translate(0px, 0px); }
}

@keyframes smpteFlash {
    0%, 80% { }
    85%, 95% { background-color: #333; }
}

/* Mobile Responsive Layout */
@media (max-width: 768px) {
    .app-container {
        padding: 0.5rem 0.5rem 2rem 0.5rem;
    }
    .glass-card {
        padding: 0.8rem;
        border-radius: 12px;
    }
    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.2rem;
    }
    .header p {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }
    .playing-card {
        width: 40px;
        height: 56px;
        font-size: 1rem;
        border-radius: 4px;
    }
    .situation {
        gap: 0.3rem;
        padding: 0.5rem;
    }
    .player-seat {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
    .controls-container {
        flex-direction: row;
        gap: 0.5rem;
    }
    .btn {
        padding: 0.8rem 0.5rem;
        font-size: 0.9rem;
        flex: 1;
        box-sizing: border-box;
        margin-top: 0.5rem;
    }
    .section-label {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
        margin-top: 0.5rem;
    }
    .board-container {
        margin-bottom: 0.5rem;
    }
    .stat-bar {
        margin-bottom: 0.5rem;
        font-size: 0.75rem;
        flex-wrap: wrap;
    }
    .stat-row {
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }
    .feedback-box {
        padding: 0.5rem;
        margin: 0.5rem 0;
        font-size: 0.9rem;
    }
    .smpte-circle {
        transform: scale(0.6);
    }
}