body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2vmin;
    margin: 0;
    height: 100vh;
    box-sizing: border-box;
}
* { box-sizing: border-box; }

body::before {
    content: ''; position: fixed; inset: 0;
    background: radial-gradient(ellipse 60% 40% at 50% 50%, oklch(from var(--color-primary) l c h / 0.06) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}

body::after {
    content: ''; position: fixed; inset: 0;
    background-image: radial-gradient(circle, oklch(from var(--color-text) l c h / 0.04) 1px, transparent 1px);
    background-size: 32px 32px; pointer-events: none; z-index: 0;
}

.container {
    width: 100%; max-width: 1200px; height: 100%; min-height: 0; z-index: 1;
    display: flex; flex-direction: column; gap: 2vmin; margin-top: 1vmin;
}

.header { text-align: center; margin-bottom: 1vmin; }
.header-title { font-size: var(--text-2xl); font-weight: 700; color: var(--color-text-muted); line-height: 1.2; padding-top: 0.1em; }
.header-subtitle { font-size: var(--text-lg); font-weight: 400; color: var(--color-text-faint); margin-top: var(--space-2); }

.box { padding: 3vmin; }

.time-box {
    position: relative;
    display: flex; flex-direction: row; align-items: center; justify-content: center;
    padding: 3vmin; flex-shrink: 1; transition: all 0.4s ease; gap: 4vmin;
}
.time-box-left { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.time-box-right { 
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; 
    border-left: 1px solid var(--color-border); padding-left: 4vmin; min-height: 120px;
}

#pairing-active { display: flex; align-items: center; gap: 3vmin; justify-content: center; width: 100%; }
.pairing-code-display { display: flex; flex-direction: column; align-items: flex-start; }
.pairing-label { font-size: var(--text-sm); color: var(--color-text-faint); text-transform: uppercase; font-weight: bold; letter-spacing: 1px; }
#pairing-code { font-size: var(--text-3xl); font-family: var(--font-display); letter-spacing: 4px; color: var(--color-primary); }
.pairing-qr-wrap img { width: 120px; height: 120px; border-radius: var(--radius-md); border: 4px solid white; }
#pair-tv-btn { font-size: var(--text-xl); padding: var(--space-4) var(--space-8); }

#connected-clients-banner {
    width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    padding: 1.5vmin 3vmin;
    background: oklch(from var(--color-primary) l c h / 0.1);
    border: 1px solid oklch(from var(--color-primary) l c h / 0.3);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    font-size: var(--text-lg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
#connected-clients-banner strong { color: var(--color-primary); margin-right: 1vmin; }
#pair-tv-btn { font-size: var(--text-xl); padding: var(--space-4) var(--space-8); }
.connected-user { font-size: var(--text-xl); font-weight: bold; color: var(--color-text); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.connected-count { font-size: var(--text-sm); color: var(--color-success); font-weight: bold; text-transform: uppercase; margin-bottom: 1vmin; }

.time-box.overlay-mode {
    position: fixed; top: var(--space-6); left: var(--space-6); z-index: 101;
    background: rgba(17, 20, 22, 0.8); backdrop-filter: blur(10px);
    transform: scale(0.6); transform-origin: top left;
}

.clock-display {
    font-family: var(--font-display); font-size: var(--text-hero);
    font-weight: 300; line-height: 1; text-shadow: 0 0 60px oklch(from var(--color-primary) l c h / 0.25);
}
.clock-display .separator { color: var(--color-primary); opacity: 0.7; animation: blink 1s step-end infinite; }
@keyframes blink { 0%, 100% { opacity: 0.7; } 50% { opacity: 0.1; } }

.seconds-bar-wrap { width: min(480px, 90vw); display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-4); }
.seconds-label { font-family: var(--font-display); font-size: var(--text-sm); color: var(--color-text-faint); min-width: 2ch; }
.seconds-bar-track { flex: 1; height: 2px; background: var(--color-border); border-radius: 99px; overflow: hidden; }
.seconds-bar-fill { height: 100%; background: var(--color-primary); width: 0%; transition: width 0.9s linear; }

.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2vmin; flex: 1; min-height: 0; }
.left-col { display: flex; flex-direction: column; gap: 2vmin; min-height: 0; }

.date-box { font-size: var(--text-xl); font-weight: 400; color: var(--color-text-muted); text-align: left; flex-shrink: 0; }
.date-box .day-name { color: var(--color-primary); font-weight: 500; }

.schedule-box {
    display: flex; flex-direction: column; justify-content: center; position: relative;
    overflow: hidden; flex: 1; container-type: inline-size;
}
.schedule-box::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--schedule-accent, var(--color-primary)); transition: background 0.6s ease;
}
.schedule-label {
    font-size: var(--text-sm); font-weight: 700; color: var(--color-text-faint);
    margin-bottom: var(--space-2); text-transform: uppercase; letter-spacing: 0.05em;
}
.schedule-period { display: none; }
.schedule-text { font-size: clamp(1.2rem, 8cqw, 3.5rem); font-weight: 500; color: var(--color-text); line-height: 1.1; }
.schedule-sub { display: none; }
.next-schedule-box { opacity: 0.7; }

.photo-box {
    padding: 0; width: 100%; height: 100%; min-height: 0; overflow: hidden; display: flex;
    align-items: center; justify-content: center; background: #000; position: relative;
    transition: all 0.4s ease;
    border-radius: var(--radius-lg);
}

.photo-box.fullscreen {
    position: fixed; inset: 0; width: 100vw; height: 100vh;
    max-width: none; border: none; border-radius: 0; z-index: 100;
}

#media-fallback { color: var(--color-text-muted); font-size: var(--text-lg); text-align: center; }
#youtube-player, #vdo-player { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

.footer { margin-top: auto; padding: var(--space-6) 0; text-align: center; color: var(--color-text-faint); font-size: var(--text-sm); z-index: 1; }



#blackout-overlay {
    position: fixed; inset: 0; z-index: 105; background: #000; display: none;
}

#toast-container {
    position: fixed; bottom: var(--space-8); left: 50%; transform: translateX(-50%);
    z-index: 110; display: flex; flex-direction: column; gap: var(--space-2); pointer-events: none;
}
.toast {
    background: var(--color-primary); color: var(--color-bg);
    padding: var(--space-4) var(--space-6); border-radius: var(--radius-lg);
    font-weight: bold; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.toast.error { background: var(--color-danger); color: white; }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 768px) {
    .bottom-grid { grid-template-columns: 1fr; }
    .header-title { font-size: var(--text-xl); }
}
