:root {
    --bg-gradient: linear-gradient(180deg, #dbeafe 0%, #ffffff 100%);
    --card-bg: #ffffff;
    --text-title: #0f172a;
    --text-label: #64748b;
    --clr-gold: #c29b40;
    --clr-val-1: #000000;
    /* Black for 可報名 */
    --clr-val-2: #1e3a8a;
    /* Navy for 已報名 */
    --clr-val-3: #991b1b;
    /* Dark Red for 可遞補 */
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Noto Sans TC', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    color: var(--text-title);
    height: 100dvh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Hard stop for scrolling */
}

.dashboard-container {
    display: grid;
    grid-template-rows: 15vh 73vh 12vh;
    /* Tweaked to give the marquee bottom row more height */
    height: 100dvh;
    width: 100vw;
    padding: 0 1.5vw;
}

header {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    /* Align to bottom of header row to control the gap to grid */
    align-items: center;
    height: 100%;
    padding-bottom: 2vh;
    /* This is the EXACT gap from Time to Grid */
}

#page-title {
    font-family: var(--font-body);
    font-size: clamp(24px, 6vh, 80px);
    /* Slightly larger */
    font-weight: 900;
    color: #0f172a;
    line-height: 1;
    margin-bottom: 2vh;
    /* This is the EXACT gap from Title to Time */
    white-space: nowrap;
    letter-spacing: 0.02em;
}

#current-time {
    font-family: var(--font-heading);
    font-size: clamp(16px, 4.6vh, 48px);
    /* Larger size */
    font-weight: 700;
    color: var(--clr-val-2);
    /* Changed to deep blue */
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    margin-bottom: 0;
    /* Margin is handled by header padding-bottom */
}

#time-digits {
    letter-spacing: 0.2em;
    /* Apply ONLY to numbers */
    margin-left: 2vh;
    /* This creates the gap from the label */
}

#current-time::before {
    content: "當前時間 : ";
}



/* Removed (時:分:秒) sub-label */

.grid-container {
    display: grid;
    grid-template-rows: repeat(5, 1fr);
    /* FORCED 5 ROWS */
    gap: 0.8vh;
    height: 100%;
    margin: 0.3vh 0;
}

.card {
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    border-radius: 2vh;
    padding: 1.5vh 3%;
    display: flex;
    flex-direction: row;
    /* Split into side-by-side */
    align-items: center;
    justify-content: space-between;
    height: 100%;
    margin: 0 1vw;
    transition: all 0.3s ease;
}



.card.current-slot .time-range {
    color: #ff0000;
}

.card.current-slot.expiring-soon .time-range {
    animation: flash-red-white 3s step-end infinite;
}

@keyframes flash-red-white {
    0% {
        color: #ff0000;
    }

    50% {
        color: #ffffff;
        text-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
    }
}


@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

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

.card-left-section {
    flex: 1.5;
    /* Increased to prevent time wrapping */
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.8vh;
    height: 100%;
}

.card-right-section {
    flex: 1;
    /* Slightly less for stats to favor time width */
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 2px dashed #cbd5e1;
    /* VERTICAL SEPARATOR */
    padding-left: 2vw;
    height: 80%;
    /* Don't stretch the full height for the line */
}

.card-time-row {
    margin-top: 0.2vh;
}

.time-range {
    font-family: var(--font-heading);
    font-size: 3.5vh;
    /* Slightly larger for better fills */
    font-weight: 900;
    color: #000;
    letter-spacing: 0.02em;
    white-space: nowrap;
    /* FORCE SINGLE LINE */
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1vw;
}

.card-title {
    font-size: clamp(16px, 3.2vh, 42px);
    font-weight: 900;
    white-space: nowrap;
}

.badge-circle {
    width: clamp(28px, 5vh, 70px);
    height: clamp(28px, 5vh, 70px);
    background: linear-gradient(135deg, #a5b4fc, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 900;
    font-size: clamp(14px, 2.5vh, 30px);
    font-family: var(--font-heading);
    flex-shrink: 0;
}

.stats-row {
    display: flex;
    gap: clamp(12px, 3.5vw, 50px);
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-label {
    font-size: clamp(10px, 2.2vh, 26px);
    /* Enlarged from 1.6vh */
    color: var(--text-label);
    margin-bottom: 0.4vh;
    white-space: nowrap;
    font-weight: 700;
}

.val {
    font-family: var(--font-heading);
    font-size: clamp(14px, 4.2vh, 60px);
    /* Enlarged from 3.2vh */
    font-weight: 900;
    line-height: 1;
}

.val.black {
    color: var(--clr-val-1);
}

.val.navy {
    color: var(--clr-val-2);
}

.val.dark-red {
    color: var(--clr-val-3);
}

/* Remove previous layout helpers if any */
.logo-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1vh 2vw;
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
    overflow: hidden;
}

.marquee-wrapper {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    margin-right: 2vw;
    height: 100%;
    display: flex;
    align-items: center;
}

.marquee-content {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    animation: marquee-scroll 20s linear infinite;
    padding-left: 100%;
}

@keyframes marquee-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

.marquee-gif {
    height: clamp(50px, 10vh, 150px);
    /* Enlarged GIF to match text size */
    margin-right: 1vw;
    flex-shrink: 0;
}

#marquee-text {
    font-size: clamp(24px, 5.5vh, 80px);
    /* Enlarged text */
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: 0.1em;
}

.logo-container img.logo {
    height: clamp(50px, 10vh, 150px);
    /* Enlarged logo to match GIF and text size */
    opacity: 0.6;
    flex-shrink: 0;
}

/* Exit Mode Adjustments */
body.exit-mode .card-right-section {
    display: none;
}

body.exit-mode .card {
    padding: 1.5vh 5vw;
    /* Increase horizontal padding */
}

body.exit-mode .card-header {
    margin-right: 0;
    gap: 2vw;
    /* Give badge and title more space */
}

body.exit-mode .card-left-section {
    flex-direction: row;
    /* Switch main axis to horizontal */
    align-items: center;
    justify-content: space-between;
    /* Space out the header and the time row */
    width: 100%;
    flex: 1;
}

body.exit-mode .card-time-row {
    margin-top: 0;
    flex-shrink: 0;
    /* Prevent the time from squishing */
}

body.exit-mode .card.current-slot .card-time-row .time-range,
body.exit-mode .card.current-slot.expiring-soon .card-time-row .time-range,
body.exit-mode .card-time-row .time-range {
    font-size: clamp(20px, 4.5vh, 60px);
    /* Reduced time in exit mode */
}

body.exit-mode .card-title {
    font-size: clamp(20px, 4vh, 50px);
    /* Reduced title in exit mode */
}

body.exit-mode .badge-circle {
    width: clamp(35px, 6vh, 80px);
    height: clamp(35px, 6vh, 80px);
    font-size: clamp(18px, 3vh, 40px);
}

.fade-in {
    animation: reveal 0.4s ease forwards;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

/* Mobile Specific Optimizations (360px - 480px) */
@media (max-width: 480px) {
    .dashboard-container {
        padding: 4px;
    }

    .card {
        padding: 0 4px;
        margin: 0.1vh 2px;
    }

    .card-header {
        gap: 4px;
    }

    .stats-row {
        gap: 4px;
    }

    #page-title {
        font-size: 16px;
    }

    #current-time {
        font-size: 10px;
    }

    .card-title {
        font-size: 10px;
    }

    .stat-label {
        font-size: 7px;
    }

    .val {
        font-size: 10px;
    }

    .badge-circle {
        width: 16px;
        height: 16px;
        font-size: 8px;
    }
}