/* ===== CUSTOM FONTS ===== */
@font-face {
    font-family: 'SVN-Gotham';
    src: url('font/SVN-Gotham_Bold.ttf') format('truetype');
    font-weight: bold;
}

@font-face {
    font-family: 'ZalandoSans';
    src: url('font/ZalandoSansExpanded-ExtraBold.ttf') format('truetype');
    font-weight: 800;
}

/* ===== VARIABLES & THEME ===== */
:root {
    /* Premium Palette inspired by Corporate Gala (Gold/Red/Deep Blue) */
    --primary-hue: 220;
    /* Deep Blue base */
    --gold-hue: 45;
    /* Gold base */

    --c-primary: #0f172a;
    /* Deep Slate Blue */
    --c-accent: #d4af37;
    /* Metallic Gold */
    --c-accent-light: #f3e5ab;
    /* Light Gold */
    --c-accent-dark: #aa8c2c;
    /* Dark Gold */

    --c-bg-overlay: rgba(15, 23, 42, 0.75);
    /* Dark overlay */
    --c-glass: rgba(255, 255, 255, 0.1);
    --c-glass-border: rgba(255, 255, 255, 0.2);

    --c-text-light: #ffffff;
    --c-text-dim: #94a3b8;
    --c-danger: #ef4444;
    --c-success: #10b981;

    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;

    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --anim-speed: 0.3s;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Responsive base scale tailored for 5376x1664px LED screen */
    font-size: min(calc(100vh / 42), calc(100vw / 135));
}

body {
    font-family: var(--font-body);
    color: var(--c-text-light);
    background-color: var(--c-primary);
    overflow: hidden;
    /* Prevent scrolling during show */
    height: 100vh;
    width: 100vw;
}

/* ===== BACKGROUND ===== */
.bg-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.9) 100%);
    backdrop-filter: blur(2px);
    /* Slight blur to make text pop */
}

/* ===== HEADER ===== */
.stage-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: fixed;
    /* Fixed to ensure it stays on top even if scroll happens */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    /* Increased z-index */
    /* background: rgba(15, 23, 42, 0.85); */
    /* Much darker background for visibility */
    /* border-bottom: 1px solid rgba(255, 255, 255, 0.1); */
    /* backdrop-filter: blur(10px); */
    /* box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); */
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 200px;
}

.logo-img {
    height: 50px;
    object-fit: contain;
}

.title-area {
    text-align: center;
    flex: 1;
}

.main-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(to right, var(--c-accent-light), var(--c-accent), var(--c-accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    white-space: nowrap;
}

.subtitle {
    font-size: 0.8rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--c-text-dim);
    margin-top: -2px;
}

.header-controls {
    display: flex;
    gap: 1rem;
    /* More space */
    min-width: 200px;
    justify-content: flex-end;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    /* Semi-transparent white bg */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    height: 44px;
    padding: 0 1.2rem;
    /* Wider button */
    border-radius: 8px;
    /* Rounded rect instead of circle */
    cursor: pointer;
    transition: var(--anim-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    /* Space for icon and text */
    font-weight: 600;
    font-size: 0.9rem;
    font-family: var(--font-body);
}

.icon-btn i {
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: var(--c-accent);
    color: #000;
    border-color: var(--c-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

/* Specific style for Settings button to make it pop */
#settingsBtn {
    /* background: var(--c-primary);
    border-color: var(--c-accent);
    color: var(--c-accent); */
}

#settingsBtn:hover {
    background: var(--c-accent);
    color: #000;
}

/* ===== MAIN STAGE LAYOUT ===== */
/* ===== MAIN STAGE LAYOUT ===== */
.stage-container {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    overflow: hidden;
}

/* Left Panel - Hidden by default, positioned as overlay */
.stage-panel-left {
    display: none;
    flex-direction: column;
    gap: 1rem;
    position: absolute;
    left: 2rem;
    top: 100px;
    width: 350px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    z-index: 100;
}

.stage-panel-left.show {
    display: flex;
}

/* Right Panel - Centered on LED Stage */
.stage-panel-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    position: relative;
    padding-top: 25vh;
    /* Căn vị trí khung số chuẩn xác vào khoảng trời xanh của KV */
    max-width: none;
}

.stage-spacer {
    /* Empty space - not used in centered layout */
    display: none;
}

.recent-winners-floating {
    width: 100%;
    padding: 1rem;
    border-top: 3px solid var(--c-success);
}

.recent-list-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #fff;
}

.recent-list-inline span {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Glass Cards */
.glass-card {
    background: var(--c-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--c-glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-glass);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: var(--anim-speed);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

/* Left Column */
.stage-left {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.round-card {
    text-align: center;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(212, 175, 55, 0.05) 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.card-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--c-accent);
    margin-bottom: 0.5rem;
}

.card-value {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.stats-mini {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-val {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-lbl {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--c-text-dim);
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: var(--c-glass-border);
}

.recent-winners h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--c-glass-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    color: var(--c-accent);
}

.recent-list {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9rem;
}

.recent-item {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.5s ease;
}

/* Cleaned up old layout classes */
/* .stage-left, .stage-center, .stage-right replaced by stage-panel-left/right */

/* === NUMBER DISPLAY (Replacement for Wheel) === */

.number-display-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 0;
}

/* Number Display Box - Shows 7-digit rolling number */
.number-display-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 0;
}

/* === SLOT MACHINE DISPLAY (Golden 3D Beveled Frame) === */

.slot-machine-window {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.85rem 1.15rem;
    /* Outer Golden Bevel Frame with Cream/Ivory Plate */
    background:
        linear-gradient(180deg, #fffdf2 0%, #faecd0 50%, #fdf5df 100%) padding-box,
        linear-gradient(180deg, #ffe868 0%, #fec82e 20%, #f5a616 60%, #c47600 100%) border-box;
    border: 0.35rem solid transparent;
    border-radius: 2rem;
    box-shadow:
        0 0 0 2px #d48a00,
        0 14px 35px rgba(0, 0, 0, 0.28),
        0 4px 10px rgba(180, 110, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.9),
        inset 0 -2px 4px rgba(150, 85, 0, 0.35);
    position: relative;
    margin-bottom: 0;
    max-width: 100%;
}

/* Main window for each digit column */
.slot-col {
    width: 7.2rem;
    height: 8rem;
    overflow: hidden;
    position: relative;
    background: #ffffff;
    border-radius: 1.1rem;
    border: 0.22rem solid #f6be32;
    box-shadow:
        0 0 0 2px #d68700,
        0 3px 6px rgba(160, 95, 0, 0.22),
        inset 0 9px 12px rgba(160, 90, 0, 0.45),
        inset 0 -4px 6px rgba(255, 240, 140, 0.75),
        inset 4px 0 6px rgba(170, 95, 0, 0.22),
        inset -4px 0 6px rgba(170, 95, 0, 0.22);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 3D Cylinder & Recessed Window Shading Overlay */
.slot-col::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
    background: linear-gradient(to bottom,
            rgba(160, 90, 0, 0.22) 0%,
            rgba(180, 110, 0, 0.05) 15%,
            transparent 30%,
            transparent 70%,
            rgba(255, 235, 150, 0.15) 88%,
            rgba(255, 215, 80, 0.35) 100%);
    border-radius: 0.8rem;
    box-shadow: inset 0 2px 4px rgba(140, 75, 0, 0.2);
}

/* The moving strip */
.slot-strip {
    display: flex;
    flex-direction: column;
    will-change: transform;
}

/* Individual number cells */
.slot-cell {
    height: 8rem;
    /* Exactly matches slot-col height */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5.2rem;
    font-weight: 800;
    font-family: 'ZalandoSans', 'SVN-Gotham', 'Montserrat', sans-serif;
    color: #e31d1c;
    /* VNPay / Lucky Jackpot Red */
    background-color: transparent;
    text-shadow: 0 2px 4px rgba(227, 29, 28, 0.15);
    user-select: none;
    border-bottom: none;
}

.slot-cell:nth-child(even) {
    background-color: transparent;
}

.slot-col:nth-child(even) .slot-cell:nth-child(odd) {
    background-color: transparent;
}

.slot-col:nth-child(even) .slot-cell:nth-child(even) {
    background-color: transparent;
}

/* Highlight effect for the winner */
.slot-col.winner-highlight {
    border-color: #ffd700;
    box-shadow:
        0 0 0 2px #ffc107,
        0 0 30px rgba(255, 215, 0, 0.85),
        inset 0 0 15px rgba(255, 215, 0, 0.45);
    z-index: 10;
    transform: scale(1.05);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-label {
    font-weight: 700;
    font-size: 0.75rem;
    text-align: center;
    min-height: 1.8rem;
    color: #ffffff;
    background: rgba(15, 23, 42, 0.7);
    padding: 0.35rem 1.6rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 1px;
}

/* Large Spin Button (Center) - Luxurious 3D Gold */
.btn-spin-glitch-center {
    width: 4.4rem;
    height: 4.4rem;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fffbe6 0%, #ffd700 40%, #e6a817 75%, #b37400 100%);
    border: 0.15rem solid #fff3a8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: #683800;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(255, 215, 0, 0.4),
        inset 0 3px 6px rgba(255, 255, 255, 0.9),
        inset 0 -4px 8px rgba(140, 75, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 1rem;
}

.btn-spin-glitch-center:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.5),
        0 0 35px rgba(255, 215, 0, 0.7),
        inset 0 4px 8px rgba(255, 255, 255, 1),
        inset 0 -5px 10px rgba(140, 75, 0, 0.6);
}

.btn-spin-glitch-center:active:not(:disabled) {
    transform: scale(0.96);
}

.btn-spin-glitch-center:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spin-text {
    display: block;
    font-family: var(--font-body);
    font-weight: 900;
    letter-spacing: 2px;
}

.control-area {
    position: absolute;
    bottom: 3.5vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.78);
    padding: 0.5rem 2rem;
    border-radius: 50px;
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 215, 0, 0.35);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    margin-top: 0;
    z-index: 20;
    white-space: nowrap;
}

.winner-count-control {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
}

.winner-count-control input {
    width: 3.2rem;
    padding: 0.25rem 0.4rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: #ffd700;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 8px;
    text-align: center;
    outline: none;
    transition: all 0.2s;
    -moz-appearance: textfield;
}

.winner-count-control input::-webkit-inner-spin-button,
.winner-count-control input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.winner-count-control input:focus {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.btn-spin-glitch {
    position: relative;
    padding: 1rem 3rem;
    background: linear-gradient(90deg, var(--c-accent-dark), var(--c-accent), var(--c-accent-dark));
    color: #000;
    font-weight: 800;
    font-size: 1.2rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    transition: 0.3s;
}

.btn-spin-glitch:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.6);
}

.btn-spin-glitch:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-reset-small {
    background: transparent;
    border: 1px solid var(--c-glass-border);
    color: var(--c-text-dim);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
}

.btn-reset-small:hover {
    color: var(--c-text-light);
    border-color: var(--c-text-light);
}

/* Right Column - Results */
.stage-right {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Force full height of the grid cell */
    overflow: hidden;
    /* Ensure nothing grows beyond grid */
}

.results-panel-glass {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* for flex scroll */
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--c-glass-border);
}



.results-content h2 {
    color: var(--c-accent);
    font-size: 1.4rem;
    /* Reduced from 1.8 */
    letter-spacing: 2px;
    font-family: var(--font-heading);
    margin: 0 0 0.5rem 0;
    /* Reduced margin */
}

/* Compact Stats Row - Single Line */
.stats-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
    /* Align all items vertically */
    justify-content: space-between;
    /* Space out */
}

.stats-row .glass-card {
    padding: 0.3rem 0.8rem !important;
    /* Even more compact */
    min-height: auto !important;
    display: flex;
    /* Flex required for row layout inside card */
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0 !important;
    width: auto !important;
    /* Allow auto width */
    flex: 0 1 auto !important;
    /* Don't stretch */
}

.card-label {
    font-size: 0.9rem;
    /* Slightly larger for readability */
    color: var(--c-text-dim);
    margin-right: 0.5rem;
    display: inline-block;
    /* Ensure inline behavior */
}

.card-value {
    font-size: 1.1rem !important;
    /* Smaller value text matching line height */
    font-weight: 700;
    color: #fff;
    margin: 0;
    display: inline-block;
}

/* Stats Mini Container - also in row now */
.stats-mini {
    display: flex;
    flex-direction: row !important;
    /* Force row */
    gap: 0.8rem !important;
}

.stats-mini .stat-item {
    display: flex;
    flex-direction: row;
    /* Row layout: Label Value */
    align-items: center;
    gap: 0.3rem;
}

.stat-val {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.stat-lbl {
    font-size: 0.7rem;
    color: var(--c-text-dim);
    text-transform: none;
    /* Normal case looks cleaner inline */
}

/* Hide divider in this layout */
.stat-divider {
    display: none;
}

/* Filter integrated into header or separate? User wants it inline with stats */
/* We will move the select into stats-row in HTML next */

.round-filter select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--c-glass-border);
    color: #fff;
    padding: 0.1rem 0.5rem;
    /* Compact padding */
    border-radius: 4px;
    font-size: 0.8rem;
}

.winners-scroll {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.winners-scroll .winner-card-mini {
    width: 250px;
    /* Fixed width for consistent look */
    flex: 0 0 auto;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.winner-card-mini {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--c-accent);
    animation: popIn 0.5s backwards;
    border: 1px solid var(--c-accent);
}

.winner-info-mini {
    display: flex;
    flex-direction: column;
}

.w-name {
    font-weight: 600;
}

.w-detail {
    font-size: 0.8rem;
    color: var(--c-text-dim);
}

.w-seq {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.1);
    font-weight: 800;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--c-text-dim);
    gap: 1rem;
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.5;
}

.panel-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--c-glass-border);
    text-align: center;
}

.footer-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.btn-glass-sm {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.3s;
}

.btn-glass-sm:hover:not(:disabled) {
    background: var(--c-accent);
    color: #000;
}

/* ===== SETTINGS MODAL ===== */
.modal-settings {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: 0.3s;
}

.modal-settings.active {
    visibility: visible;
    opacity: 1;
}

.settings-content {
    background: #1e293b;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    height: 75vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--c-glass-border);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    color: #fff;
}

.settings-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    border-radius: 12px 12px 0 0;
}

.settings-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.settings-tabs {
    display: flex;
    background: #0f172a;
    padding: 0 1.5rem;
}

.s-tab {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--c-text-dim);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
}

.s-tab.active {
    color: var(--c-accent);
    border-bottom-color: var(--c-accent);
}

.s-content {
    display: none;
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

.s-content.active {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Settings Form Elements */
.input-group label,
.form-row label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--c-text-dim);
}

textarea {
    width: 100%;
    height: 150px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 1rem;
    border-radius: 8px;
    resize: vertical;
    font-family: monospace;
}

.input-actions-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-action {
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    border: none;
    background: var(--c-accent);
    color: #000;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.2s;
}

.btn-action.secondary {
    background: #334155;
    color: #fff;
}

.btn-action.danger {
    background: var(--c-danger);
    color: #fff;
}

.btn-action.warning {
    background: #f59e0b;
    color: #000;
}

.btn-action.outline {
    background: transparent;
    border: 1px solid var(--c-text-dim);
    color: var(--c-text-dim);
}

.preview-mini {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--c-text-dim);
}

.stat-badge {
    background: #0f172a;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.list-preview-box {
    flex: 1;
    background: #0f172a;
    border-radius: 8px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}

/* ===== WINNER MODAL (The Big Reveal) ===== */
.winner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* background-image removed, handled by ::before for blur effect */
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: 0.5s;
    perspective: 1000px;
    overflow: hidden;
    /* Ensure blur doesn't leak */
}

/* Dark Blurred Background Overlay */
.winner-modal::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("LED_hpfest.png") no-repeat center center;
    background-size: cover;
    filter: blur(5px) brightness(0.2);
    /* "Blur đen" effect */
    z-index: -1;
    transform: scale(1.1);
    /* Prevent blur edges from showing */

}

.winner-modal.active {
    visibility: visible;
    opacity: 1;
}

.winner-content {
    text-align: center;
    z-index: 301;
    transform: scale(0.8);
    transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 95vw;
    max-width: 5200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.winner-modal.active .winner-content {
    transform: scale(1);
}

.congrats-text {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--c-accent);
    letter-spacing: 5px;
    margin-bottom: 0.8rem;
    animation: glow 2s infinite alternate;
}

.winner-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 75vh;
    overflow-y: auto;
    padding: 0.8rem 1rem;
    width: 100%;
}

/* If single winner, make it huge */
.single-winner-mode .winner-name-big {
    font-size: 5rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    text-shadow: 0 0 20px var(--c-accent);
    margin: 1rem 0;
}

.single-winner-mode .winner-id-big {
    font-size: 2rem;
    color: var(--c-text-dim);
}

.winner-prize {
    font-size: 1.5rem;
    color: var(--c-accent);
    font-weight: 700;
    letter-spacing: 2px;
    margin-top: 0.8rem;
    text-transform: uppercase;
}

/* If multiple winners, use dynamic responsive grid */
.multi-winner-grid {
    display: grid;
    grid-template-columns: repeat(var(--winner-cols, 5), minmax(0, 1fr));
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    max-width: 100%;
}

.winner-card-pop {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
    border: 1.5px solid var(--c-accent);
    padding: 0.65rem 0.5rem;
    border-radius: 10px;
    animation: popIn 0.5s backwards;
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
}

.winner-card-name {
    font-weight: 800;
    font-size: 1.15rem;
    line-height: 1.25;
    margin-bottom: 0.35rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    width: 100%;
}

.winner-card-id {
    font-size: 0.85rem;
    color: var(--c-accent-light);
    font-weight: 600;
    letter-spacing: 1px;
}

.btn-close-winner {
    margin-top: 1.8rem;
    padding: 0.8rem 2.5rem;
    font-size: 1.1rem;
    border: 2px solid #fff;
    background: transparent;
    color: #fff;
    border-radius: 50px;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-close-winner:hover {
    background: #fff;
    color: #000;
}

#confettiCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 300;
}

/* Animations */
@keyframes glow {
    from {
        text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    }

    to {
        text-shadow: 0 0 20px rgba(212, 175, 55, 1), 0 0 30px var(--c-accent);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== NOTIFICATIONS & MODALS (CUSTOM) ===== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    /* Ensure it is on top of everything */
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
}

.notification-toast {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--c-glass-border);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 320px;
    max-width: 450px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid var(--c-accent);
    pointer-events: auto;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-toast.success {
    border-left-color: var(--c-success);
}

.notification-toast.error {
    border-left-color: var(--c-danger);
}

.notification-toast.warning {
    border-left-color: #f59e0b;
}

.notification-icon {
    font-size: 1.2rem;
}

.notification-toast.success .notification-icon {
    color: var(--c-success);
}

.notification-toast.error .notification-icon {
    color: var(--c-danger);
}

.notification-toast.warning .notification-icon {
    color: #f59e0b;
}

.notification-content {
    flex: 1;
    font-size: 0.95rem;
}

/* Custom Confirm Modal */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s;
}

.confirm-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.confirm-box {
    background: #1e293b;
    border: 1px solid var(--c-glass-border);
    padding: 2.5rem;
    border-radius: 16px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.confirm-modal-overlay.active .confirm-box {
    transform: scale(1);
}

.confirm-icon {
    font-size: 3rem;
    color: var(--c-accent);
    margin-bottom: 1rem;
}

.confirm-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

.confirm-mesage {
    color: var(--c-text-dim);
    margin-bottom: 2rem;
    line-height: 1.5;
}

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

/* ===== RESULTS TOGGLE BUTTON ===== */
.results-toggle-area {
    padding: 1rem 0;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

/* Floating Toggle Button */
.btn-toggle-results-floating {
    position: fixed;
    left: 20px;
    top: 100px;
    background: linear-gradient(135deg, var(--c-accent) 0%, #ffd700 100%);
    color: #000;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    font-family: var(--font-body);
    z-index: 350;
}

.btn-toggle-results-floating:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    letter-spacing: 0.5px;
}

.btn-toggle-results-floating:active {
    transform: translateY(0);
}

.btn-toggle-results-floating i {
    transition: transform 0.3s ease;
}

.btn-toggle-results-floating.active i {
    transform: rotate(180deg);
}

.btn-toggle-results {
    background: linear-gradient(135deg, var(--c-accent) 0%, #ffd700 100%);
    color: #000;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    font-family: var(--font-body);
}

.btn-toggle-results:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    letter-spacing: 0.5px;
}

.btn-toggle-results:active {
    transform: translateY(0);
}

.btn-toggle-results i {
    transition: transform 0.3s ease;
}

.btn-toggle-results.active i {
    transform: rotate(180deg);
}

/* Results Container - Modal Overlay Style (Like Winner Modal) */
.results-container {
    visibility: hidden;
    z-index: 250;
}

.results-container.show {
    visibility: visible;
}

.results-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    text-align: center;
    z-index: 301;
    transform: scale(0.8);
    transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    padding: 2rem;
    box-sizing: border-box;
}

.results-container.show .results-content {
    transform: scale(1);
}


/* Main Round Selector Dropdown */
.round-selector-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--c-text-dim);
    font-size: 0.75rem;
}

.main-round-select {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--c-glass-border);
    color: #fff;
    /* Highlight color for prize name */
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    min-width: 9rem;
    outline: none;
    transition: all 0.2s;
    text-transform: uppercase;
}

.main-round-select:hover {
    border-color: var(--c-accent);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

.main-round-select option {
    background: #0f172a;
    color: #fff;
    padding: 10px;
}