/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0a0a1a;
    color: #e0e0e0;
}

/* === App Container === */
.prize-draw-app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Prize Draw Page === */
.prize-draw {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem 2rem;
    position: relative;
}

.prize-draw__header {
    text-align: center;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.prize-draw__title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00d4ff, #7b2ff7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.02em;
}

.prize-draw__status {
    margin-top: 0.5rem;
    font-size: 1.1rem;
    min-height: 1.6rem;
}

/* === Status Labels === */
.status {
    display: inline-block;
    padding: 0.25rem 1rem;
    border-radius: 999px;
    font-weight: 500;
}

.status--idle {
    color: #8892a0;
}

.status--shuffling {
    color: #00d4ff;
    animation: pulse-text 0.8s ease-in-out infinite alternate;
}

.status--slowing {
    color: #ff9f43;
    animation: pulse-text 1.2s ease-in-out infinite alternate;
}

.status--celebration {
    color: #ffd700;
}

@keyframes pulse-text {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* === Tile Grid === */
.tile-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(var(--columns, 5), 1fr);
    grid-template-rows: repeat(var(--rows, 5), minmax(0, 1fr));
    gap: 0.6rem;
    align-items: center;
    justify-items: center;
    padding: 0.5rem;
}

/* === Individual Tile === */
.tile {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 2;
    width: 100%;
    max-height: 100%;
    padding: 0.8rem 0.5rem;
    border-radius: 0.6rem;
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: all 0.08s ease-out;
    overflow: hidden;
}

.tile__name {
    font-size: 1.6rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* === No-Show Tile === */
.tile--noshow {
    opacity: 0.35;
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.03);
    box-shadow: none;
}

.tile--noshow .tile__name {
    text-decoration: line-through;
    color: #666;
}

/* === Confirmed Winner Tile === */
.tile--confirmed-winner {
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.tile--confirmed-winner .tile__name {
    color: #ffd700;
}

.tile--confirmed-winner::after {
    content: '\1F3C6';
    position: absolute;
    top: 0.3rem;
    right: 0.4rem;
    font-size: 1rem;
}

/* === Highlighted Tile === */
.tile--highlighted {
    background: linear-gradient(145deg, #0d3b66, #145374);
    border-color: #00d4ff;
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.4),
        0 0 30px rgba(0, 212, 255, 0.15),
        inset 0 0 15px rgba(0, 212, 255, 0.1);
    transform: scale(1.05);
    color: #ffffff;
}

/* === Winner Tile === */
.tile--winner {
    background: linear-gradient(145deg, #4a3000, #6b4500);
    border-color: #ffd700;
    box-shadow:
        0 0 20px rgba(255, 215, 0, 0.5),
        0 0 40px rgba(255, 215, 0, 0.2),
        inset 0 0 20px rgba(255, 215, 0, 0.15);
    transform: scale(1.08);
    color: #ffd700;
    animation: winner-glow 1.5s ease-in-out infinite alternate;
    z-index: 1;
}

@keyframes winner-glow {
    from {
        box-shadow:
            0 0 20px rgba(255, 215, 0, 0.5),
            0 0 40px rgba(255, 215, 0, 0.2);
    }
    to {
        box-shadow:
            0 0 30px rgba(255, 215, 0, 0.7),
            0 0 60px rgba(255, 215, 0, 0.3);
    }
}

/* === Winner Overlay === */
.winner-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    animation: overlay-fade-in 0.5s ease-out;
}

@keyframes overlay-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.winner-overlay__card {
    text-align: center;
    padding: 3rem 5rem;
    border-radius: 1.5rem;
    background: linear-gradient(145deg, #1a1a2e, #0a0a1a);
    border: 2px solid #ffd700;
    box-shadow:
        0 0 40px rgba(255, 215, 0, 0.4),
        0 0 80px rgba(255, 215, 0, 0.15);
    animation: card-pop-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes card-pop-in {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.winner-overlay__label {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
}

.winner-overlay__name {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === Blazor Error UI === */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    width: 100%;
    background: #721c24;
    color: #f8d7da;
    padding: 0.7rem 1.2rem;
    text-align: center;
    z-index: 1000;
}

#blazor-error-ui .reload, #blazor-error-ui .dismiss {
    color: #f8d7da;
    margin-left: 1rem;
    cursor: pointer;
}

/* === Login Page === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: #0a0a1a;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem 2.5rem;
    border-radius: 1.5rem;
    background: linear-gradient(145deg, #1a1a2e, #0a0a1a);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00d4ff, #7b2ff7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: #8892a0;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.login-error {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.4);
    color: #f87171;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.login-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 1.25rem;
}

.login-input:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15);
}

.login-button {
    width: 100%;
    padding: 0.85rem;
    border: none;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #00d4ff, #7b2ff7);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.login-button:hover {
    opacity: 0.9;
}
