/*
 * Q Clock — Apple-Level Design System
 *
 * Light-first, calm, spatial. Inter + SF Mono typography.
 * Floating overlay panel with labeled icon tabs.
 * Minimal chrome, maximum timer visibility.
 *
 * © 2024-2026 Jolly Grid, LLC. All rights reserved.
 */

/* ============================================
   DESIGN TOKENS — Light-first Apple palette
   ============================================ */
:root {
    --st-topbar-h: 60px;
    --st-panel-w: 420px;

    /* Surfaces — layered */
    --st-bg: #ffffff;
    --st-bg-surface: #f3f3f6;
    --st-bg-elevated: #ffffff;
    --st-bg-input: #ffffff;
    --st-bg-hover: #eaeaef;
    --st-bg-active: #e0e0e8;
    --st-bg-btn: #eeeef3;

    /* Borders */
    --st-border: rgba(0, 0, 0, 0.10);
    --st-border-strong: rgba(0, 0, 0, 0.18);

    /* Text */
    --st-text: #1a1a2e;
    --st-text-secondary: #3d3d50;
    --st-text-muted: #5c5c70;
    --st-text-dim: #8888a0;

    /* Accent — Indigo (matches dark mode identity) */
    --st-primary: #5b5ef6;
    --st-primary-hover: #4f46e5;
    --st-primary-glow: rgba(91, 94, 246, 0.12);
    --st-primary-glow-strong: rgba(91, 94, 246, 0.22);

    /* Semantic */
    --st-success: #16a34a;
    --st-success-glow: rgba(22, 163, 74, 0.12);
    --st-warning: #d97706;
    --st-warning-glow: rgba(217, 119, 6, 0.12);
    --st-danger: #dc2626;
    --st-danger-glow: rgba(220, 38, 38, 0.10);

    /* Shape */
    --st-radius: 14px;
    --st-radius-sm: 10px;
    --st-radius-xs: 8px;
    --st-radius-lg: 16px;
    --st-radius-pill: 100px;

    /* Solid accent */
    --st-primary-solid: #5b5ef6;

    /* Typography */
    --st-font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
    --st-font-mono: 'Roboto Mono', 'SF Mono', ui-monospace, monospace;

    /* Motion */
    --st-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --st-transition: 0.2s var(--st-ease);
    --st-transition-slow: 0.3s var(--st-ease);

    /* Glass */
    --st-glass-blur: 40px;
    --st-glass-bg: rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] {
    --st-bg: #12121a;
    --st-bg-surface: #1a1a24;
    --st-bg-elevated: #222230;
    --st-bg-input: #1e1e2a;
    --st-bg-hover: rgba(255, 255, 255, 0.08);
    --st-bg-active: rgba(255, 255, 255, 0.12);
    --st-bg-btn: #2a2a36;
    --st-border: rgba(255, 255, 255, 0.10);
    --st-border-strong: rgba(255, 255, 255, 0.18);
    --st-text: #f0f0f5;
    --st-text-secondary: #a0a0b0;
    --st-text-muted: #707080;
    --st-text-dim: #505060;
    --st-primary: #6366f1;
    --st-primary-hover: #818cf8;
    --st-primary-solid: #6366f1;
    --st-primary-glow: rgba(99, 102, 241, 0.15);
    --st-primary-glow-strong: rgba(99, 102, 241, 0.25);
    --st-glass-bg: rgba(18, 18, 28, 0.95);
}

/* ============================================
   GLOBAL RESETS
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

.st-app :focus-visible {
    outline: 2px solid var(--st-primary);
    outline-offset: 2px;
}

.st-app button:focus:not(:focus-visible),
.st-app input:focus:not(:focus-visible),
.st-app select:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   APP SHELL
   ============================================ */
.st-app {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: var(--st-font-ui);
    color: var(--st-text);
    background: var(--st-bg);
}

/* Selective user-select: disable on interactive chrome, allow on content */
.st-app button,
.st-app .st-pill,
.st-app .st-tab,
.st-app .st-quick-msg,
.st-app .st-segment-row__drag,
.st-app .st-mode-pills {
    -webkit-user-select: none;
    user-select: none;
}

.st-main {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Stage shrinks when panel is open */
.st-stage {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
    background: var(--st-bg);
    transition: flex 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.st-stage #timerDisplay {
    width: 100%;
    height: 100%;
}

/* ============================================
   SKIP LINK
   ============================================ */
.st-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--st-primary);
    color: #fff;
    padding: 8px 16px;
    z-index: 100000;
    font-size: 14px;
    border-radius: 0 0 var(--st-radius-sm) var(--st-radius-sm);
    transition: top 0.2s;
}

.st-skip-link:focus {
    top: 0;
}

/* ============================================
   TOPBAR — Frosted Glass Command Bar
   ============================================ */
.st-topbar {
    display: flex;
    align-items: center;
    height: var(--st-topbar-h);
    padding: 0 20px;
    background: var(--st-glass-bg);
    -webkit-backdrop-filter: blur(var(--st-glass-blur)) saturate(1.3);
    backdrop-filter: blur(var(--st-glass-blur)) saturate(1.3);
    border-bottom: 1px solid var(--st-border);
    gap: 10px;
    flex-shrink: 0;
    z-index: 100;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
}

/* Accent line at bottom — animated shimmer */
.st-topbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent,
            rgba(129, 140, 248, 0.12) 25%,
            rgba(129, 140, 248, 0.25) 50%,
            rgba(129, 140, 248, 0.12) 75%,
            transparent);
    background-size: 200% 100%;
    animation: st-topbar-shimmer 8s linear infinite;
}

@keyframes st-topbar-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.st-topbar__left,
.st-topbar__center,
.st-topbar__right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.st-topbar__left {
    flex-shrink: 0;
    gap: 10px;
}

.st-topbar__center {
    flex: 1;
    justify-content: center;
    gap: 8px;
}

.st-topbar__right {
    flex-shrink: 0;
    gap: 6px;
}

.st-topbar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--st-text);
    font-weight: 800;
    font-size: 0.92rem;
    letter-spacing: -0.02em;
    padding: 6px 10px;
    border-radius: var(--st-radius-sm);
    transition: all var(--st-transition);
}

.st-topbar__brand:hover {
    background: var(--st-bg-hover);
}

.st-topbar__logo {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.st-topbar__brand-text {
    white-space: nowrap;
}

.st-topbar__brand-badge {
    font-size: 0.46rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    padding: 2px 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c084fc 100%);
    background-size: 200% 200%;
    animation: st-badge-gradient 4s ease infinite;
    color: #fff;
    line-height: 1.3;
    box-shadow: 0 1px 4px rgba(129, 140, 248, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

@keyframes st-badge-gradient {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.st-topbar__sep {
    width: 1px;
    height: 24px;
    background: var(--st-border);
    margin: 0 2px;
    flex-shrink: 0;
}

.st-topbar__time {
    font-family: var(--st-font-mono);
    font-size: 0.84rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--st-text);
    min-width: 60px;
    text-align: center;
    padding: 8px 14px;
    background: var(--st-bg-btn);
    border-radius: var(--st-radius-xs);
    border: 1px solid var(--st-border);
    line-height: 1;
}

/* Status badge with live dot */
.st-topbar__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: var(--st-radius-pill);
    font-size: 0.70rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all var(--st-transition);
}

.st-topbar__status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.st-topbar__status[data-status="idle"] {
    background: rgba(113, 113, 122, 0.1);
    color: var(--st-text-muted);
}

.st-topbar__status[data-status="idle"]::before {
    background: var(--st-text-dim);
}

.st-topbar__status[data-status="running"] {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
}

.st-topbar__status[data-status="running"]::before {
    background: #34d399;
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
    animation: st-status-pulse 2s ease-in-out infinite;
}

.st-topbar__status[data-status="paused"] {
    background: rgba(251, 191, 36, 0.12);
    color: #d97706;
}

[data-theme="dark"] .st-topbar__status[data-status="paused"] {
    color: #fbbf24;
}

.st-topbar__status[data-status="paused"]::before {
    background: #fbbf24;
    animation: st-status-pulse 1.5s ease-in-out infinite;
}

.st-topbar__status[data-status="finished"] {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
}

.st-topbar__status[data-status="finished"]::before {
    background: #f87171;
    box-shadow: 0 0 6px rgba(248, 113, 113, 0.5);
}

@keyframes st-status-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.st-topbar__remote {
    display: inline-flex;
    align-items: center;
}

.st-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--st-text-dim);
    transition: all 0.3s var(--st-ease);
}

.st-dot[data-connected="true"] {
    background: #34d399;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

/* ============================================
   MODE PILLS — Segmented Control (in topbar)
   ============================================ */
.st-mode-pills {
    display: flex;
    gap: 2px;
    background: var(--st-bg-btn);
    padding: 3px;
    border-radius: var(--st-radius-sm);
    border: 1px solid var(--st-border);
    height: 38px;
    align-items: center;
}

.st-mode-pills--sm {
    gap: 2px;
    padding: 2px;
}

.st-mode-pills--sm .st-pill {
    font-size: 0.72rem;
    padding: 5px 10px;
}

.st-pill {
    padding: 0 10px;
    height: 30px;
    border: none;
    border-radius: var(--st-radius-xs);
    background: transparent;
    color: var(--st-text-muted);
    font-family: var(--st-font-ui);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--st-transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.st-pill .material-icons-round {
    font-size: 20px;
}

.st-pill:hover {
    color: var(--st-text);
    background: var(--st-bg-hover);
}

.st-pill.active {
    background: var(--st-primary-solid);
    color: #fff;
    box-shadow: 0 1px 4px var(--st-primary-glow);
    transition: all 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

/* ============================================
   TOOLTIPS — CSS-only, instant, no JS
   ============================================ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    padding: 4px 10px;
    font-family: var(--st-font-ui);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    color: #fff;
    background: #1a1a2e;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] [data-tooltip]::after {
    background: #f0f0f5;
    color: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Hide tooltip on mobile — touch users don't hover */
@media (max-width: 768px) {
    [data-tooltip]::after {
        display: none;
    }
}

/* ============================================
   BUTTONS
   ============================================ */
.st-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: none;
    border-radius: var(--st-radius-sm);
    cursor: pointer;
    font-family: var(--st-font-ui);
    font-weight: 700;
    font-size: 0.8rem;
    transition: all var(--st-transition);
    white-space: nowrap;
    line-height: 1;
    position: relative;
}

.st-btn:active {
    transform: scale(0.95);
    transition-duration: 0.08s;
}

.st-btn--icon {
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--st-bg-btn);
    color: var(--st-text-secondary);
    border-radius: var(--st-radius-xs);
    border: 1px solid var(--st-border);
}

.st-btn--icon:hover {
    background: var(--st-bg-hover);
    border-color: var(--st-border-strong);
    color: var(--st-text);
}

/* Settings panel toggle — primary action, stands out */
.st-btn--panel-toggle {
    background: var(--st-primary-glow);
    color: var(--st-primary);
    border-color: var(--st-primary-glow);
}

.st-btn--panel-toggle:hover {
    background: var(--st-primary-glow-strong);
    border-color: var(--st-primary);
    color: var(--st-primary);
}

.st-btn--locked {
    color: var(--st-danger) !important;
    border-color: var(--st-danger) !important;
    background: rgba(220, 38, 38, 0.08) !important;
}

/* Disabled transport buttons (when locked) */
.st-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Topbar locked state — dims transport controls visually */
.st-topbar--locked .st-topbar__center {
    opacity: 0.4;
}

.st-topbar--locked .st-mode-pills {
    opacity: 0.4;
    pointer-events: none;
}

/* Locked status badge */
.st-topbar__status[data-status="locked"] {
    background: rgba(220, 38, 38, 0.12);
    color: var(--st-danger);
}

.st-topbar__status[data-status="locked"]::before {
    background: var(--st-danger);
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.5);
}

.st-btn--transport {
    height: 38px;
    padding: 0 14px;
    background: var(--st-bg-btn);
    color: var(--st-text-secondary);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-xs);
}

.st-btn--transport:hover {
    background: var(--st-bg-hover);
    border-color: var(--st-border-strong);
    color: var(--st-text);
}

.st-btn--sm {
    height: 38px;
    padding: 0 16px;
    font-size: 0.8rem;
}

/* Play — hero glow */
.st-btn--play {
    height: 38px;
    padding: 0 22px;
    background: linear-gradient(135deg, #34d399, #22c55e);
    color: #fff;
    box-shadow: 0 2px 10px rgba(52, 211, 153, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
    font-size: 0.82rem;
    border-radius: var(--st-radius-xs);
}

.st-btn--play:hover {
    background: linear-gradient(135deg, #2dd4a1, #16a34a);
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.st-btn--play:active {
    transform: translateY(0) scale(0.97);
}

/* Play button breath glow when idle */
@keyframes st-play-glow {

    0%,
    100% {
        box-shadow: 0 2px 10px rgba(52, 211, 153, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }

    50% {
        box-shadow: 0 2px 20px rgba(52, 211, 153, 0.5), 0 0 30px rgba(52, 211, 153, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

.st-topbar__status[data-status="idle"]~.st-topbar__right .st-btn--play,
.st-app .st-btn--play {
    animation: st-play-glow 3s ease-in-out infinite;
}

.st-app .st-btn--play:hover {
    animation: none;
}

/* Pause */
.st-btn--pause {
    height: 38px;
    padding: 0 22px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #18181b;
    box-shadow: 0 2px 10px rgba(251, 191, 36, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-size: 0.82rem;
    border-radius: var(--st-radius-xs);
}

.st-btn--pause:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
}

.st-btn--primary {
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--st-primary), var(--st-primary-solid));
    color: #fff;
    box-shadow: 0 2px 8px var(--st-primary-glow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.st-btn--primary:hover {
    box-shadow: 0 4px 16px var(--st-primary-glow-strong);
    transform: translateY(-1px);
}

.st-btn--primary:active {
    transform: translateY(0) scale(0.97);
}

.st-btn--secondary {
    padding: 10px 18px;
    background: var(--st-bg-btn);
    color: var(--st-text);
    border: 1px solid var(--st-border);
}

.st-btn--secondary:hover {
    background: var(--st-bg-hover);
    border-color: var(--st-primary);
    color: var(--st-primary);
}

.st-btn--block {
    width: 100%;
    justify-content: center;
}

.st-btn--block+.st-btn--block {
    margin-top: 8px;
}

/* Block button after an action row */
.st-rundown-actions+.st-btn--block,
.st-schedule-actions+.st-btn--block,
.st-adjust-row+.st-btn--block,
.st-sharing-card+.st-btn--block {
    margin-top: 12px;
}

.st-icon--sm {
    font-size: 18px;
}

.st-btn--adjust {
    height: 38px;
    padding: 0 12px;
    font-size: 0.78rem;
    background: var(--st-bg-btn);
    color: var(--st-text-secondary);
    border: 1px solid var(--st-border);
}

.st-btn--adjust .material-icons-round {
    font-size: 15px;
}

.st-btn--adjust:hover {
    background: var(--st-bg-hover);
    border-color: var(--st-border-strong);
    color: var(--st-text);
}

.st-btn--reset {
    padding: 10px 18px;
    background: var(--st-bg-btn);
    color: var(--st-text-muted);
    border: 1px solid var(--st-border);
}

.st-btn--reset:hover {
    background: var(--st-bg-hover);
    border-color: var(--st-border-strong);
    color: var(--st-text);
}

.st-btn--add {
    display: flex;
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--st-primary);
    border: 1.5px dashed var(--st-border);
    border-radius: var(--st-radius-sm);
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    transition: all var(--st-transition);
}

.st-btn--add:hover {
    border-color: var(--st-primary);
    background: var(--st-primary-glow);
}

/* ============================================
   DOCKED PANEL — Right Sidebar
   ============================================ */
.st-panel {
    width: var(--st-panel-w);
    flex-shrink: 0;
    background: var(--st-bg-surface);
    border-left: 1px solid var(--st-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    transition: margin-right 0.35s cubic-bezier(0.32, 0.72, 0, 1),
        opacity 0.25s var(--st-ease);
}

[data-theme="dark"] .st-panel {
    background: var(--st-bg-surface);
    border-left-color: var(--st-border);
}

.st-panel--hidden {
    margin-right: calc(-1 * var(--st-panel-w));
    opacity: 0;
    pointer-events: none;
}

.st-panel--visible {
    margin-right: 0;
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   PANEL TAB BAR
   ============================================ */
.st-panel__tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--st-border);
    flex-shrink: 0;
    background: transparent;
}

[data-theme="light"] .st-panel__tabs {
    background: transparent;
}

.st-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 4px;
    padding: 10px 6px 12px;
    border: none;
    border-radius: var(--st-radius-xs);
    background: transparent;
    color: var(--st-text-muted);
    cursor: pointer;
    transition: all var(--st-transition);
    position: relative;
}

.st-tab .material-icons-round {
    font-size: 20px;
}

.st-tab:hover {
    color: var(--st-text);
    background: var(--st-bg-hover);
}

.st-tab.active {
    color: var(--st-primary);
    background: var(--st-primary-glow);
}

.st-tab__label {
    font-size: 0.66rem;
    font-weight: 700;
    font-family: var(--st-font-ui);
    letter-spacing: 0.02em;
    display: block;
    margin-top: 2px;
}

/* Active indicator line */
.st-tab.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 25%;
    right: 25%;
    height: 2.5px;
    background: var(--st-primary);
    border-radius: 1.5px;
    box-shadow: 0 0 8px var(--st-primary-glow);
    animation: st-tab-indicator 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes st-tab-indicator {
    from {
        transform: scaleX(0);
        opacity: 0;
    }

    to {
        transform: scaleX(1);
        opacity: 1;
    }
}

/* ============================================
   PANEL SCROLL + TAB PANES
   ============================================ */
.st-panel__scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

[data-theme="light"] .st-panel__scroll {
    scrollbar-color: rgba(0, 0, 0, 0.08) transparent;
}

.st-panel__scroll::-webkit-scrollbar {
    width: 4px;
}

.st-panel__scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

[data-theme="light"] .st-panel__scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

/* Tab pane visibility */
.st-tab-pane {
    display: none;
    padding: 22px 22px 28px;
    animation: st-pane-open 0.2s var(--st-ease);
}

.st-tab-pane.active {
    display: block;
}

@keyframes st-pane-open {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.99);
    }

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

/* Pane sections with divider lines */
.st-pane-section {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--st-border);
}

.st-pane-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.st-adjust-row {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.st-adjust-row .st-btn {
    flex: 1;
    justify-content: center;
}

.st-pane-label {
    display: block;
    font-size: 0.73rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--st-text-secondary);
    margin-bottom: 14px;
}

/* ============================================
   PRESET SEARCH
   ============================================ */
.st-preset-search {
    position: relative;
}

.st-preset-search__list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--st-bg-elevated);
    border: 1px solid var(--st-border-strong);
    border-radius: var(--st-radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    margin-top: 4px;
    scrollbar-width: thin;
}

[data-theme="dark"] .st-preset-search__list {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.st-preset-search__list--open {
    display: block;
}

.st-preset-search__category {
    padding: 8px 14px 4px;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--st-text-dim);
    position: sticky;
    top: 0;
    background: var(--st-bg-elevated);
    z-index: 1;
}

.st-preset-search__item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--st-text);
    font-family: var(--st-font-ui);
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background var(--st-transition);
}

.st-preset-search__item:hover {
    background: var(--st-bg-hover);
    color: var(--st-primary);
}

.st-preset-search__item--highlighted {
    background: var(--st-bg-hover);
    color: var(--st-primary);
}

/* ============================================
   FORM CONTROLS
   ============================================ */
.st-input {
    width: 100%;
    padding: 11px 14px;
    background: var(--st-bg-input);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-sm);
    color: var(--st-text);
    font-family: var(--st-font-ui);
    font-size: 0.86rem;
    outline: none;
    transition: all var(--st-transition);
}

.st-input:hover {
    border-color: var(--st-border-strong);
}

.st-input:focus {
    border-color: var(--st-primary);
    box-shadow: 0 0 0 2px var(--st-primary-glow);
}

.st-input::placeholder {
    color: var(--st-text-dim);
}

.st-input--time {
    width: 54px;
    text-align: center;
    font-family: var(--st-font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    padding: 9px 6px;
}

.st-select {
    width: 100%;
    padding: 11px 14px;
    background: var(--st-bg-input);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-sm);
    color: var(--st-text);
    font-family: var(--st-font-ui);
    font-size: 0.86rem;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    transition: all var(--st-transition);
}

.st-select:hover {
    border-color: var(--st-border-strong);
}

.st-select:focus {
    border-color: var(--st-primary);
    box-shadow: 0 0 0 2px var(--st-primary-glow);
}

.st-select option {
    background: var(--st-bg-elevated);
    color: var(--st-text);
}

.st-range {
    width: 100%;
    accent-color: var(--st-primary);
    height: 6px;
    border-radius: 3px;
}

.st-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--st-text-secondary);
}

.st-hint {
    font-size: 0.80rem;
    color: var(--st-text-dim);
    margin: 0 0 12px;
    line-height: 1.5;
}

.st-field {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.st-time-inputs {
    display: flex;
    align-items: center;
    gap: 5px;
}

.st-time-sep {
    font-weight: 700;
    font-size: 0.82em;
    color: var(--st-text-muted);
    min-width: 14px;
    text-align: center;
}

.st-interval-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.st-interval-row label {
    min-width: 54px;
    font-size: 0.82rem;
    color: var(--st-text-secondary);
    font-weight: 600;
}

/* Toggle switch */
.st-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: var(--st-radius-xs);
    transition: background var(--st-transition);
}

.st-toggle-row:hover {
    background: var(--st-bg-hover);
}

.st-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.st-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.st-switch__slider {
    position: absolute;
    inset: 0;
    background: var(--st-bg-input);
    border: 1px solid var(--st-border-strong);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s var(--st-ease);
}

.st-switch__slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s var(--st-ease);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.st-switch input:checked+.st-switch__slider {
    background: var(--st-primary-solid);
    border-color: var(--st-primary-solid);
}

.st-switch input:checked+.st-switch__slider::before {
    transform: translateX(18px);
}

.st-switch:hover .st-switch__slider {
    border-color: var(--st-border-strong);
}

.st-switch:focus-within .st-switch__slider {
    box-shadow: 0 0 0 2px var(--st-primary-glow);
}

/* ============================================
   MESSAGE CONTROLS
   ============================================ */
.st-msg-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    align-items: stretch;
}

.st-msg-row .st-input {
    flex: 1;
    min-width: 0;
}

.st-msg-row .st-btn {
    flex-shrink: 0;
    height: auto;
}

.st-msg-options {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}

.st-msg-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.st-quick-messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 2px;
}

.st-quick-msg-group-label {
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--st-text-muted);
    padding: 0 2px;
}

.st-quick-msg-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.st-quick-msg {
    padding: 9px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--st-radius-sm);
    border: 1px solid var(--st-border);
    background: var(--st-bg-btn);
    color: var(--st-text);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s var(--st-ease);
    font-family: var(--st-font-ui);
    letter-spacing: -0.005em;
}

.st-quick-msg:hover {
    background: var(--st-bg-hover);
    border-color: var(--st-primary);
    color: var(--st-primary);
    transform: translateY(-1px);
}

[data-theme="dark"] .st-quick-msg:hover {
    background: var(--st-bg-hover);
    border-color: var(--st-primary);
    color: var(--st-primary);
}

.st-quick-msg:active {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.08s;
}

/* ============================================
   SEGMENT LIST
   ============================================ */
.st-segment-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}

.st-segment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--st-bg-input);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-xs);
    transition: all var(--st-transition);
}

.st-segment-row:hover {
    background: var(--st-bg-hover);
    border-color: var(--st-border-strong);
}

.st-segment-row--active {
    border-color: var(--st-primary);
    background: var(--st-primary-glow);
    box-shadow: 0 0 0 1px var(--st-primary-glow);
}

.st-segment-row__drag {
    cursor: grab;
    color: var(--st-text-dim);
    font-size: 14px;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity var(--st-transition);
}

.st-segment-row:hover .st-segment-row__drag {
    opacity: 1;
}

.st-segment-row__drag:active {
    cursor: grabbing;
}

.st-segment-row__name {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--st-text);
    font-family: var(--st-font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    transition: border-color var(--st-transition);
}

.st-segment-row__name:focus {
    border-bottom-color: var(--st-primary);
}

.st-segment-row__duration {
    width: 54px;
    padding: 4px 6px;
    background: var(--st-bg-input);
    border: 1px solid var(--st-border);
    border-radius: 4px;
    color: var(--st-text);
    font-family: var(--st-font-mono);
    font-size: 0.74rem;
    text-align: center;
    outline: none;
    flex-shrink: 0;
    transition: border-color var(--st-transition);
}

.st-segment-row__duration:focus {
    border-color: var(--st-primary);
}

.st-segment-row__auto {
    width: 14px;
    height: 14px;
    accent-color: var(--st-primary);
    flex-shrink: 0;
    cursor: pointer;
}

.st-segment-row__delete {
    background: none;
    border: none;
    color: var(--st-text-dim);
    cursor: pointer;
    padding: 2px;
    font-size: 15px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all var(--st-transition);
    opacity: 0;
}

.st-segment-row__duplicate {
    background: none;
    border: none;
    color: var(--st-text-dim);
    cursor: pointer;
    padding: 2px;
    font-size: 14px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all var(--st-transition);
    opacity: 0;
}

.st-segment-row:hover .st-segment-row__delete,
.st-segment-row:hover .st-segment-row__duplicate {
    opacity: 1;
}

.st-segment-row__delete:hover {
    color: var(--st-danger);
}

.st-segment-row__duplicate:hover {
    color: var(--st-primary);
}

.st-show-totals {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 0.78rem;
    font-family: var(--st-font-mono);
    color: var(--st-text-muted);
}

.st-show-totals__sep {
    color: var(--st-border);
}

/* ============================================
   COLOR GRID
   ============================================ */
.st-color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.st-color-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--st-text);
    font-weight: 600;
    padding: 8px 10px;
    background: var(--st-bg-input);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-xs);
}

.st-color-item input[type="color"] {
    width: 32px;
    height: 28px;
    border: 1px solid var(--st-border);
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
    background: none;
    flex-shrink: 0;
    transition: all var(--st-transition);
}

.st-color-item input[type="color"]:hover {
    border-color: var(--st-primary);
    transform: scale(1.1);
}

.st-color-item input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.st-color-item input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.st-color-item--action {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.st-color-item--action .st-btn {
    width: 100%;
    justify-content: center;
}

/* ============================================
   REMOTE SHARING CARD
   ============================================ */
.st-sharing-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--st-bg-input);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    margin-top: 14px;
}

.st-sharing-card__qr {
    padding: 8px;
    background: #fff;
    border-radius: var(--st-radius-xs);
    line-height: 0;
}

[data-theme="dark"] .st-sharing-card__qr {
    background: var(--st-bg-surface);
}

.st-sharing-card__qr canvas {
    display: block;
    border-radius: 4px;
}

.st-sharing-card__code {
    font-family: var(--st-font-mono);
    font-size: 1.5rem;
    font-weight: 900;
    text-align: center;
    color: var(--st-primary);
    letter-spacing: 0.25em;
    text-shadow: 0 0 16px var(--st-primary-glow);
    animation: st-code-glow 2s ease-in-out infinite alternate;
}

@keyframes st-code-glow {
    from {
        text-shadow: 0 0 12px var(--st-primary-glow);
    }

    to {
        text-shadow: 0 0 24px var(--st-primary-glow-strong), 0 0 48px var(--st-primary-glow);
    }
}

.st-sharing-card__url {
    font-family: var(--st-font-mono);
    font-size: 0.7rem;
    color: var(--st-text-muted);
    text-align: center;
    word-break: break-all;
}

.st-sharing-card__actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.st-sharing-card__actions .st-btn {
    flex: 1;
}

/* ============================================
   SHORTCUTS
   ============================================ */
.st-shortcuts {
    display: grid;
    gap: 4px;
}

.st-shortcut {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 10px;
    border-radius: var(--st-radius-xs);
    font-size: 0.78rem;
    color: var(--st-text-secondary);
    background: var(--st-bg-btn);
    border: 1px solid var(--st-border);
    transition: all var(--st-transition);
}

.st-shortcut:hover {
    border-color: var(--st-border-strong);
    background: var(--st-bg-hover);
}

.st-shortcut:last-child {
    /* No special treatment — all cards are equal */
}

.st-shortcut kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 4px 8px;
    font-size: 0.70rem;
    font-family: var(--st-font-mono);
    font-weight: 700;
    background: var(--st-bg-elevated);
    border: 1px solid var(--st-border-strong);
    border-bottom-width: 2px;
    border-radius: 6px;
    color: var(--st-text);
    flex-shrink: 0;
}

/* ============================================
   DISPLAY CONTAINER
   ============================================ */
.st-display {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 300px;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    font-family: var(--st-font-mono);
    transition: background-color 0.6s ease, color 0.4s ease;
    animation: st-display-enter 0.6s cubic-bezier(0.32, 0.72, 0, 1) 0.1s both;
}

@keyframes st-display-enter {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.st-display__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 0;
    isolation: isolate;
}

/* ============================================
   PHASE-REACTIVE AMBIENT GLOW
   Smooth color environment that responds to timer state.
   Uses box-shadow on the digits element instead of
   ::before + radial-gradient + filter:blur which produces
   banding / concentric ring artifacts on many GPUs.
   ============================================ */
.st-display[data-theme="dark"] {
    background-color: #0e0e16;
    color: #ffffff;
}

.st-display[data-theme="light"] {
    background-color: #f5f5f8;
    color: #1a1a2e;
}

.st-display[data-layout="overlay"] {
    background: transparent !important;
}

/* ============================================
   OBS TRANSPARENT OVERLAY
   White text with dark outline — visible on ANY background.
   Applied via ?transparent=1 URL param on display pages.
   ============================================ */
.st-transparent .st-display {
    background: transparent !important;
}

/* OBS overlay: stroke + shadow for visibility on any background.
   Color is NOT forced — user's custom color (inline style) wins.
   Only fallback to white when no custom color is set. */
.st-transparent .st-display__digits {
    color: #ffffff;
    -webkit-text-stroke: 2px rgba(0, 0, 0, 0.5);
    paint-order: stroke fill;
    text-shadow:
        0 0 4px rgba(0, 0, 0, 0.6),
        0 0 12px rgba(0, 0, 0, 0.3);
}

.st-transparent .st-display__meridiem {
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.4);
}

.st-transparent .st-display__title,
.st-transparent .st-display__phase,
.st-transparent .st-display__round,
.st-transparent .st-display__next-up,
.st-transparent .st-display__clock,
.st-transparent .st-display__over-under,
.st-transparent .st-display__finish-overlay {
    color: #ffffff;
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.4);
    paint-order: stroke fill;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.st-transparent .st-display__progress {
    background: rgba(255, 255, 255, 0.15) !important;
}

.st-transparent .st-display__progress-fill {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3) !important;
}

.st-transparent .st-display__message {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: #ffffff !important;
}

.st-transparent .st-display__sidebar {
    background: rgba(0, 0, 0, 0.5) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

/* Connection lost indicator — pulsing border + dim overlay */
.st-display--disconnected {
    position: relative;
}

.st-display--disconnected::after {
    content: 'CONNECTION LOST';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 18px;
    font-family: var(--st-font-ui);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #ef4444;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    z-index: 100;
    animation: st-disconnect-pulse 1.5s ease-in-out infinite;
}

@keyframes st-disconnect-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ============================================
   OBS POSITION & SIZE PRESETS
   Use URL params: ?position=top|bottom|center&size=small|medium|large
   ============================================ */

/* Position: align timer to top/bottom/center of the OBS source */
.st-obs-top .st-display__main {
    justify-content: flex-start;
    padding-top: 2vh;
}

.st-obs-bottom .st-display__main {
    justify-content: flex-end;
    padding-bottom: 2vh;
}

.st-obs-center .st-display__main {
    justify-content: center;
}

/* Size: scale the digit font size for different overlay uses */
.st-obs-size-small .st-display__digits {
    font-size: clamp(2rem, 8vw, 6rem) !important;
}

.st-obs-size-medium .st-display__digits {
    font-size: clamp(3rem, 14vw, 12rem) !important;
}

.st-obs-size-large .st-display__digits {
    font-size: clamp(4rem, 22vw, 28rem) !important;
}

/* Hide non-essential elements in small/medium overlay size */
.st-obs-size-small .st-display__title,
.st-obs-size-small .st-display__phase,
.st-obs-size-small .st-display__round,
.st-obs-size-small .st-display__next-up,
.st-obs-size-small .st-display__over-under,
.st-obs-size-small .st-display__clock,
.st-obs-size-small .st-display__sidebar,
.st-obs-size-small .st-display__show-progress,
.st-obs-size-small .st-display__show-progress-text {
    display: none !important;
}

.st-obs-size-medium .st-display__sidebar,
.st-obs-size-medium .st-display__show-progress-text {
    display: none !important;
}

/* ============================================
   TIMER DIGITS — Refined Typography
   ============================================ */
.st-display__digits {
    font-size: clamp(4rem, 22vw, 28rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
    text-align: center;
    transition: color 0.6s ease, opacity 0.3s ease, text-shadow 0.8s ease;
    z-index: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow: visible;
    white-space: nowrap;
}

/* AM/PM suffix — proportionally smaller, vertically aligned */
.st-display__meridiem {
    font-size: 0.22em;
    font-weight: 600;
    letter-spacing: 0.06em;
    vertical-align: super;
    margin-left: 0.08em;
    opacity: 0.7;
}

/* ── Digit Tick — micro-scale on second change ── */
.st-display__digits--tick {
    animation: st-digit-tick 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes st-digit-tick {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.006);
    }

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

.st-display[data-status="paused"] .st-display__digits {
    animation: st-pulse 1.8s ease-in-out infinite;
}

.st-display[data-status="idle"] .st-display__digits {
    opacity: 0.85;
    transition: opacity 0.5s ease;
}

.st-display[data-status="running"] .st-display__digits,
.st-display[data-status="paused"] .st-display__digits,
.st-display[data-status="finished"] .st-display__digits {
    opacity: 1;
    transition: opacity 0.3s ease;
}

@keyframes st-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.62;
    }
}

/* White glow baseline — default for modes without colour phases.
   Clock and stopwatch use this as their primary running color. */
.st-display[data-status="running"] .st-display__digits,
.st-display[data-status="paused"] .st-display__digits {
    color: #e8e8ff;
    text-shadow:
        0 0 1px rgba(200, 200, 255, 0.9),
        0 0 4px rgba(160, 165, 255, 0.3),
        0 0 14px rgba(99, 102, 241, 0.12);
}

/* ============================================
   COLOR PHASES — with glow
   ============================================ */
.st-display[data-phase="safe"] .st-display__digits {
    color: #34d399;
    text-shadow:
        0 0 1px rgba(52, 211, 153, 0.9),
        0 0 4px rgba(52, 211, 153, 0.4),
        0 0 14px rgba(34, 197, 94, 0.15);
}

.st-display[data-phase="warning"] .st-display__digits {
    color: #fbbf24;
    text-shadow:
        0 0 1px rgba(251, 191, 36, 0.9),
        0 0 4px rgba(251, 191, 36, 0.4),
        0 0 14px rgba(245, 158, 11, 0.15);
}

.st-display[data-phase="critical"] .st-display__digits {
    color: #ef4444;
    /* text-shadow handled by st-text-pulse animation */
}

.st-display[data-phase="finished"] .st-display__digits {
    color: #34d399;
    text-shadow:
        0 0 1px rgba(52, 211, 153, 0.9),
        0 0 5px rgba(52, 211, 153, 0.45),
        0 0 16px rgba(34, 197, 94, 0.18);
}

.st-display[data-theme="light"][data-phase="safe"] .st-display__digits {
    color: #16a34a;
    text-shadow: none;
}

.st-display[data-theme="light"][data-phase="warning"] .st-display__digits {
    color: #d97706;
    text-shadow: none;
}

.st-display[data-theme="light"][data-phase="critical"] .st-display__digits,
.st-display[data-theme="light"][data-phase="finished"] .st-display__digits {
    color: #dc2626;
    text-shadow: none;
}

/* Light display — suppress glow on all digits */
.st-display[data-theme="light"] .st-display__digits {
    text-shadow: none;
}

/* Light theme — running/paused without a colour phase would inherit
   color:#ffffff from the running rule (white on light bg = invisible).
   Override to a legible dark value. */
.st-display[data-theme="light"][data-status="running"] .st-display__digits,
.st-display[data-theme="light"][data-status="paused"] .st-display__digits {
    color: #1a1a2e;
    text-shadow: none;
}

.st-display--flash {
    animation: st-finish-breathe 1.5s ease-in-out infinite;
}

.st-display--flash .st-display__digits {
    color: #ffffff !important;
    text-shadow:
        0 0 2px rgba(52, 211, 153, 0.9),
        0 0 8px rgba(52, 211, 153, 0.3) !important;
}

/* Light theme: use light green tint instead of dark */
.st-display[data-theme="light"].st-display--flash {
    animation: st-finish-breathe-light 1.5s ease-in-out infinite;
}

.st-display[data-theme="light"].st-display--flash .st-display__digits {
    color: #065f46 !important;
    text-shadow: none !important;
}

@keyframes st-finish-breathe {

    0%,
    100% {
        background-color: #0e0e16;
        box-shadow: inset 0 0 80px rgba(52, 211, 153, 0.04);
    }

    50% {
        background-color: #0e1a18;
        box-shadow: inset 0 0 120px rgba(52, 211, 153, 0.08);
    }
}

@keyframes st-finish-breathe-light {

    0%,
    100% {
        background-color: #f5f5f8;
        box-shadow: inset 0 0 80px rgba(52, 211, 153, 0.06);
    }

    50% {
        background-color: #ecfdf5;
        box-shadow: inset 0 0 120px rgba(52, 211, 153, 0.12);
    }
}

/* ============================================
   TITLE / PHASE / ROUND
   ============================================ */
.st-display__title {
    font-size: clamp(1rem, 2.5vw, 2.5rem);
    font-weight: 600;
    font-family: var(--st-font-ui);
    opacity: 0.6;
    margin-bottom: 0.5em;
    text-align: center;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.st-display__phase {
    font-size: clamp(1.2rem, 3.5vw, 3rem);
    font-weight: 700;
    font-family: var(--st-font-ui);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.3em;
}

.st-display__phase[data-work="true"] {
    color: #34d399;
}

.st-display__phase[data-work="false"] {
    color: var(--st-primary);
}

.st-display__round {
    font-size: clamp(0.8rem, 2vw, 2rem);
    font-family: var(--st-font-ui);
    opacity: 0.5;
    margin-top: 0.5em;
}

/* ============================================
   NEXT UP & OVER/UNDER
   ============================================ */
.st-display__next-up {
    font-size: clamp(0.9rem, 2vw, 2rem);
    font-family: var(--st-font-ui);
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.6em;
    font-weight: 600;
}

.st-display[data-theme="light"] .st-display__next-up {
    color: rgba(0, 0, 0, 0.4);
}

.st-display__over-under {
    font-size: clamp(0.8rem, 1.5vw, 1.5rem);
    font-family: var(--st-font-mono);
    font-weight: 700;
    margin-top: 0.4em;
    padding: 4px 16px;
    border-radius: var(--st-radius-pill);
}

.st-display__over-under[data-status="over"] {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.st-display__over-under[data-status="under"] {
    background: rgba(52, 211, 153, 0.08);
    color: rgba(255, 255, 255, 0.5);
}

.st-display__over-under[data-status="on-time"] {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
}

/* ============================================
   CLOCK (corner)
   ============================================ */
.st-display__clock {
    position: absolute;
    bottom: 3vh;
    right: 3vw;
    font-size: clamp(0.8rem, 1.5vw, 1.5rem);
    opacity: 0.4;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   PROGRESS BARS — Refined
   ============================================ */
.st-display__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.st-display[data-theme="light"] .st-display__progress {
    background: rgba(0, 0, 0, 0.06);
}

.st-display__progress-fill {
    height: 100%;
    transition: width 0.3s linear;
    border-radius: 0 3px 3px 0;
    position: relative;
}

/* Bright leading edge glow on progress fill */
.st-display__progress-fill::after {
    content: '';
    position: absolute;
    right: -2px;
    top: -4px;
    width: 12px;
    height: 14px;
    border-radius: 50%;
    filter: blur(6px);
    opacity: 0.9;
    background: inherit;
}

.st-display[data-phase="safe"] .st-display__progress-fill {
    background: #34d399;
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.4), 0 0 4px rgba(52, 211, 153, 0.6);
}

.st-display[data-phase="warning"] .st-display__progress-fill {
    background: #fbbf24;
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.4), 0 0 4px rgba(251, 191, 36, 0.6);
}

.st-display[data-phase="critical"] .st-display__progress-fill,
.st-display[data-phase="finished"] .st-display__progress-fill {
    background: #f87171;
    box-shadow: 0 0 12px rgba(248, 113, 113, 0.4), 0 0 4px rgba(248, 113, 113, 0.6);
}

/* Light theme: suppress glow, use solid bars */
.st-display[data-theme="light"] .st-display__progress-fill {
    box-shadow: none;
}

.st-display[data-theme="light"] .st-display__progress-fill::after {
    display: none;
}

.st-display__show-progress {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.st-display__show-progress-fill {
    height: 100%;
    background: var(--st-primary);
    transition: width 0.5s linear;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px var(--st-primary-glow);
}

.st-display__show-progress-text {
    position: absolute;
    bottom: 8px;
    left: 2vw;
    font-size: 0.7rem;
    font-family: var(--st-font-mono);
    opacity: 0.35;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   MESSAGE OVERLAY — Refined
   ============================================ */
.st-display__message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: clamp(0.75rem, 2.5vh, 2.5rem) clamp(1rem, 3vw, 3rem);
    text-align: center;
    font-family: var(--st-font-ui);
    font-size: clamp(1rem, 3vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    transform: translateY(-100%);
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 10;
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    backdrop-filter: blur(20px) saturate(1.5);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.st-display__message-close {
    position: absolute;
    right: clamp(0.5rem, 2vw, 2rem);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5em;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 4px 8px;
    line-height: 1;
}

.st-display__message-close:hover {
    opacity: 1;
}

/* ============================================
   FINISH OVERLAY — "TIME'S UP"
   ============================================ */
.st-display__finish-overlay {
    position: absolute;
    bottom: clamp(2rem, 8vh, 6rem);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    font-family: var(--st-font-ui);
    font-size: clamp(1rem, 3vw, 2.5rem);
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #34d399;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 5;
    text-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
}

.st-display__finish-overlay.visible {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.st-display[data-theme="light"] .st-display__finish-overlay {
    color: #16a34a;
    text-shadow: none;
}

.st-display__message.visible {
    transform: translateY(0);
}

.st-display__message-text {
    display: inline-block;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.st-display__message[data-style="info"] {
    background: rgba(30, 58, 95, 0.88);
    color: #93c5fd;
    border-bottom-color: rgba(96, 165, 250, 0.15);
}

.st-display__message[data-style="warning"] {
    background: rgba(78, 55, 10, 0.88);
    color: #fde68a;
    border-bottom-color: rgba(251, 191, 36, 0.15);
}

.st-display__message[data-style="urgent"] {
    background: rgba(95, 20, 20, 0.88);
    color: #fca5a5;
    border-bottom-color: rgba(248, 113, 113, 0.15);
    animation: st-msg-pulse 0.8s ease-in-out infinite;
}

.st-display__message[data-style="success"] {
    background: rgba(15, 65, 45, 0.88);
    color: #86efac;
    border-bottom-color: rgba(52, 211, 153, 0.15);
}

/* Light theme — use opaque tinted backgrounds instead of dark glass */
.st-display[data-theme="light"] .st-display__message[data-style="info"] {
    background: rgba(219, 234, 254, 0.95);
    color: #1e40af;
    border-bottom-color: rgba(59, 130, 246, 0.12);
}

.st-display[data-theme="light"] .st-display__message[data-style="warning"] {
    background: rgba(254, 243, 199, 0.95);
    color: #92400e;
    border-bottom-color: rgba(245, 158, 11, 0.12);
}

.st-display[data-theme="light"] .st-display__message[data-style="urgent"] {
    background: rgba(254, 226, 226, 0.95);
    color: #991b1b;
    border-bottom-color: rgba(239, 68, 68, 0.12);
}

.st-display[data-theme="light"] .st-display__message[data-style="success"] {
    background: rgba(209, 250, 229, 0.95);
    color: #065f46;
    border-bottom-color: rgba(16, 185, 129, 0.12);
}

@keyframes st-msg-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

/* ============================================
   SPEAKER NOTES
   ============================================ */
.st-display__speaker-notes {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    font-family: var(--st-font-ui);
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    line-height: 1.5;
}

/* ============================================
   DISPLAY SIDEBAR — Refined Rundown
   ============================================ */
.st-display__sidebar {
    width: clamp(200px, 22%, 300px);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.st-display[data-theme="light"] .st-display__sidebar {
    background: rgba(0, 0, 0, 0.03);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-left-color: rgba(0, 0, 0, 0.06);
}

.st-sidebar__header {
    padding: 14px 16px;
    font-family: var(--st-font-ui);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.st-display[data-theme="light"] .st-sidebar__header {
    color: rgba(0, 0, 0, 0.3);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.st-sidebar__list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.st-sidebar__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: var(--st-font-ui);
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.st-display[data-theme="light"] .st-sidebar__row {
    color: rgba(0, 0, 0, 0.4);
}

.st-sidebar__row--active {
    background: rgba(129, 140, 248, 0.1);
    color: #fff;
    border-left-color: var(--st-primary);
}

.st-display[data-theme="light"] .st-sidebar__row--active {
    color: #1e293b;
    background: rgba(99, 102, 241, 0.06);
    border-left-color: var(--st-primary);
}

.st-sidebar__row[data-status="completed"] {
    opacity: 0.45;
}

.st-sidebar__icon {
    width: 16px;
    text-align: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    color: var(--st-primary);
}

.st-sidebar__row[data-status="completed"] .st-sidebar__icon {
    color: var(--st-success);
}

.st-sidebar__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.st-sidebar__time {
    font-family: var(--st-font-mono);
    font-size: 0.72rem;
    flex-shrink: 0;
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   PRESENTATION MODE
   ============================================ */
.st-presentation-mode .st-topbar,
.st-presentation-mode .st-panel {
    display: none !important;
}

.st-presentation-mode .st-stage {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
}

.st-presentation-mode .st-stage #timerDisplay {
    width: 100vw !important;
    height: 100vh !important;
}

/* ============================================
   DISPLAY-ONLY PAGE
   ============================================ */
.st-display-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: #0e0e16;
}

.st-display-page .st-display {
    width: 100vw;
    height: 100vh;
    cursor: pointer;
}

/* Connecting screen (remote display waiting for controller) */
.st-connecting {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    color: var(--st-text-muted);
    font-family: var(--st-font-ui);
    font-size: 1.5rem;
    flex-direction: column;
    gap: 1rem;
    background: #0e0e16;
}

.st-connecting .code {
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.2em;
    font-family: var(--st-font-mono);
}

/* Transparent mode hides connecting screen bg too */
.st-transparent .st-connecting {
    background: transparent !important;
}

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 768px) {
    .st-topbar__brand-text {
        display: none;
    }

    .st-topbar__sep {
        display: none;
    }

    .st-btn--adjust {
        display: none;
    }

    .st-topbar__left .st-mode-pills {
        display: none;
    }

    .st-btn--icon {
        width: 44px;
        height: 44px;
    }

    .st-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: calc(100vh - var(--st-topbar-h));
        border-radius: var(--st-radius) var(--st-radius) 0 0;
        border-bottom: none;
        border-left: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: env(safe-area-inset-bottom);
        margin-right: 0;
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }

    [data-theme="dark"] .st-panel {
        background: var(--st-bg-surface);
    }

    .st-panel--hidden {
        transform: translateY(100%);
        margin-right: 0;
        opacity: 1;
    }

    .st-panel--visible {
        transform: translateY(0);
    }

    .st-notification-container {
        top: calc(var(--st-topbar-h) + 8px);
        right: 8px;
        left: 8px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .st-topbar {
        padding: 0 max(8px, env(safe-area-inset-left)) 0 max(8px, env(safe-area-inset-right));
        gap: 4px;
    }

    .st-topbar__time {
        display: none;
    }

    .st-color-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================
   PRINT
   ============================================ */
@media print {

    /* Hide non-printable UI chrome */
    .st-topbar,
    .st-panel,
    .st-notification-container,
    .st-error-boundary,
    .st-skip-link {
        display: none !important;
    }

    .st-app {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
        color: #000 !important;
    }

    .st-main {
        display: block !important;
    }

    .st-stage {
        display: block !important;
        page-break-inside: avoid;
    }

    /* Ensure timer display is visible in print */
    .st-display {
        background: #fff !important;
        color: #000 !important;
        page-break-inside: avoid;
    }

    .st-display__digits {
        color: #000 !important;
        text-shadow: none !important;
        font-size: 4rem !important;
    }

    .st-display__title {
        color: #333 !important;
    }

    .st-display__progress,
    .st-display__show-progress {
        display: none !important;
    }

    /* Rundown sidebar prints as a table-style list */
    .st-display__sidebar {
        background: #fff !important;
        border-left: 1px solid #ddd !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }

    .st-sidebar__row {
        color: #333 !important;
        border-bottom: 1px solid #eee;
    }

    .st-sidebar__row--active {
        background: #f0f0f0 !important;
        border-left-color: #333 !important;
    }
}

/* ============================================
   MOBILE MODE SELECTOR (shown only on mobile)
   ============================================ */
.st-mobile-mode-section {
    display: none;
}

@media (max-width: 768px) {
    .st-mobile-mode-section {
        display: block;
    }
}

/* ============================================
   PRODUCTION PARITY CONTROLS
   ============================================ */
.st-rundown-actions,
.st-schedule-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.st-rundown-actions .st-btn,
.st-schedule-actions .st-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.st-btn--file {
    cursor: pointer;
}

#scheduleStatus,
#apiCommandStatus {
    margin-top: 8px;
    font-size: 0.78rem;
}

#apiCommandStatus[data-ok="true"] {
    color: var(--st-success);
}

#apiCommandStatus[data-ok="false"] {
    color: var(--st-text-secondary);
}

[data-theme="dark"] #apiCommandStatus[data-ok="true"] {
    color: #34d399;
}

/* ============================================
   NOTIFICATION SYSTEM
   ============================================ */
.st-notification-container {
    position: fixed;
    top: calc(var(--st-topbar-h) + 16px);
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.st-notification {
    padding: 12px 16px;
    background: var(--st-bg-elevated);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    font-size: 14px;
    line-height: 1.5;
    opacity: 0;
    transform: translateX(100%) scale(0.95);
    transition: all 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.st-notification--visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.st-notification--info {
    border-left: 3px solid var(--st-primary);
}

.st-notification--warning {
    border-left: 3px solid var(--st-warning);
    background: var(--st-warning-glow);
}

.st-notification--error {
    border-left: 3px solid var(--st-danger);
    background: var(--st-danger-glow);
}

[data-theme="dark"] .st-notification {
    background: var(--st-bg-elevated);
    border-color: var(--st-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ============================================
   ERROR BOUNDARY
   ============================================ */
.st-error-boundary {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.st-error-dialog {
    background: var(--st-bg-elevated);
    border-radius: var(--st-radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.st-error-icon {
    font-size: 48px;
    color: var(--st-danger);
    margin-bottom: 16px;
}

.st-error-dialog h2 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--st-text);
}

.st-error-dialog p {
    margin: 0 0 24px;
    color: var(--st-text-secondary);
    line-height: 1.5;
}

.st-error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

[data-theme="dark"] .st-error-dialog {
    background: var(--st-bg-elevated);
}

/* ============================================
   API DOCUMENTATION
   ============================================ */
.st-api-docs {
    margin-top: 20px;
    border: 1px solid var(--st-border-strong);
    border-radius: var(--st-radius-sm);
    overflow: hidden;
}

.st-api-docs__summary {
    padding: 14px 18px;
    background: var(--st-bg-input);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--st-text);
    transition: background 0.2s;
    list-style: none;
}

.st-api-docs__summary::-webkit-details-marker {
    display: none;
}

.st-api-docs__summary::after {
    content: '';
    margin-left: auto;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--st-text-muted);
    transition: transform 0.2s var(--st-ease);
}

details[open] .st-api-docs__summary::after {
    transform: rotate(180deg);
}

.st-api-docs__summary:hover {
    background: var(--st-bg-hover);
}

.st-api-docs__content {
    padding: 20px;
    background: var(--st-bg-surface);
    border-top: 1px solid var(--st-border);
}

.st-code-block {
    background: var(--st-bg-elevated);
    border: 1px solid var(--st-border-strong);
    border-radius: var(--st-radius-xs);
    padding: 16px 18px;
    font-family: var(--st-font-mono);
    font-size: 12.5px;
    line-height: 1.7;
    overflow-x: auto;
    margin: 12px 0 20px;
    color: var(--st-text);
    white-space: pre;
}

[data-theme="dark"] .st-code-block {
    background: var(--st-bg-input);
    border-color: var(--st-border-strong);
}

.st-api-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.st-api-list li {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--st-text-secondary);
    background: var(--st-bg-elevated);
    border-radius: var(--st-radius-xs);
    border: 1px solid var(--st-border);
}

.st-api-list li:hover {
    border-color: var(--st-border-strong);
    background: var(--st-bg-hover);
}

.st-api-list code {
    background: var(--st-bg-surface);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--st-font-mono);
    font-size: 12px;
    color: var(--st-primary);
    font-weight: 600;
    border: 1px solid var(--st-border);
}

[data-theme="dark"] .st-api-list code {
    background: var(--st-bg-input);
    border-color: var(--st-border);
}

.st-api-docs__content code {
    background: var(--st-bg-elevated);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--st-font-mono);
    font-size: 12px;
    color: var(--st-primary);
    font-weight: 600;
    border: 1px solid var(--st-border);
}

.st-api-docs__content .st-hint {
    font-size: 0.80rem;
    color: var(--st-text-secondary);
    margin: 0 0 8px;
}

.st-api-docs__content .st-hint strong {
    color: var(--st-text);
    font-weight: 700;
}

/* ============================================
   HELP ICONS
   ============================================ */
.st-help-icon {
    opacity: 0.6;
    transition: opacity 0.2s;
    vertical-align: middle;
    margin-left: 4px;
}

.st-help-icon:hover {
    opacity: 1;
}

.st-icon--xs {
    font-size: 16px !important;
}

/* ============================================
   LAP TIMING (Stopwatch)
   ============================================ */
.st-laps-list {
    margin-top: 14px;
    border-radius: var(--st-radius-sm);
    background: var(--st-bg-surface);
    padding: 8px;
}

.st-lap-row {
    display: grid;
    grid-template-columns: 40px 1fr 1fr;
    gap: 14px;
    padding: 10px 14px;
    font-size: 13.5px;
    border-radius: var(--st-radius-xs);
    transition: background 0.15s;
}

.st-lap-row:hover {
    background: var(--st-bg-hover);
}

.st-lap-number {
    font-weight: 600;
    color: var(--st-text-secondary);
    font-family: var(--st-font-mono);
}

.st-lap-time {
    font-family: var(--st-font-mono);
    color: var(--st-text);
    font-weight: 500;
}

.st-lap-split {
    font-family: var(--st-font-mono);
    color: var(--st-text-muted);
    font-size: 12px;
}

/* ============================================
   KEYBOARD SHORTCUTS MODAL
   ============================================ */
.st-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: st-fade-in 0.2s var(--st-ease);
}

@keyframes st-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.st-modal {
    background: var(--st-bg-elevated);
    border-radius: var(--st-radius-lg);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: st-modal-in 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes st-modal-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

.st-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--st-border);
}

.st-modal__header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--st-text);
}

.st-modal__body {
    padding: 24px;
    overflow-y: auto;
}

.st-shortcuts-grid {
    display: grid;
    gap: 12px;
}

.st-shortcut-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: var(--st-radius-sm);
    background: var(--st-bg-surface);
    transition: background 0.15s;
}

.st-shortcut-row:hover {
    background: var(--st-bg-hover);
}

.st-shortcut-row kbd {
    min-width: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border-radius: var(--st-radius-xs);
    background: var(--st-bg);
    border: 1.5px solid var(--st-border-strong);
    font-family: var(--st-font-mono);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--st-text);
    box-shadow: 0 2px 0 var(--st-border-strong);
}

.st-shortcut-row span {
    flex: 1;
    font-size: 14.5px;
    color: var(--st-text-secondary);
}

/* ============================================
   HINT TEXT
   ============================================ */

/* ============================================
   ENHANCED VISUAL ALERTS
   ============================================ */

/* Critical stage — subtle vignette + pulse on container for heightened urgency */
.st-display--pulse {
    animation: st-container-urgency 1s ease-in-out infinite;
}

@keyframes st-container-urgency {

    0%,
    100% {
        box-shadow: inset 0 0 60px rgba(239, 68, 68, 0.03);
    }

    50% {
        box-shadow: inset 0 0 80px rgba(239, 68, 68, 0.07);
    }
}

/* Warning stage — subtle amber blink at display edges */
.st-display--warning-blink {
    animation: st-warning-blink 2s ease-in-out infinite;
}

@keyframes st-warning-blink {

    0%,
    100% {
        box-shadow: inset 0 0 40px rgba(251, 191, 36, 0.02);
    }

    50% {
        box-shadow: inset 0 0 60px rgba(251, 191, 36, 0.05);
    }
}

/* Progress percentage indicator */
.st-display__progress-pct {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--st-font-mono);
    font-size: clamp(0.7rem, 1.2vw, 1rem);
    font-weight: 700;
    opacity: 0.3;
    z-index: 2;
    font-variant-numeric: tabular-nums;
}

/* Segment drag-reorder states */
.st-segment-row--dragging {
    opacity: 0.4;
}

.st-segment-row--drag-over {
    border-color: var(--st-primary) !important;
    box-shadow: 0 0 0 2px var(--st-primary-glow);
}

.st-display[data-phase="critical"] .st-display__digits {
    animation: st-text-pulse 1s ease-in-out infinite;
}

@keyframes st-text-pulse {

    0%,
    100% {
        text-shadow:
            0 0 1px rgba(239, 68, 68, 0.9),
            0 0 4px rgba(239, 68, 68, 0.4),
            0 0 14px rgba(239, 68, 68, 0.15);
    }

    50% {
        text-shadow:
            0 0 2px rgba(248, 113, 113, 0.95),
            0 0 8px rgba(239, 68, 68, 0.5),
            0 0 20px rgba(239, 68, 68, 0.2);
    }
}

/* ============================================
   ACCESSIBILITY — Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .st-display--flash {
        animation: none !important;
    }

    .st-panel--hidden {
        transition: none !important;
    }

    .st-panel--visible {
        transition: none !important;
    }

    .st-tab-pane {
        animation: none !important;
    }

    .st-notification {
        transition: none !important;
    }
}

/* ============================================
   ONBOARDING — First-Run Hint
   ============================================ */
.st-onboarding {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 420px;
    padding: 40px 32px;
    z-index: 5;
    pointer-events: auto;
    animation: st-onboarding-in 0.8s var(--st-ease) 0.3s both;
    background: var(--st-glass-bg);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    backdrop-filter: blur(20px) saturate(1.2);
    border-radius: var(--st-radius-lg);
    border: 1px solid var(--st-border);
}

.st-onboarding__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--st-text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
    transition: all var(--st-transition);
}

.st-onboarding__close:hover {
    background: var(--st-bg-hover);
    color: var(--st-text);
}

.st-onboarding__icon {
    font-size: 56px;
    color: var(--st-primary);
    margin-bottom: 20px;
    opacity: 0.8;
}

.st-onboarding__title {
    font-family: var(--st-font-ui);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--st-text);
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}

.st-onboarding__subtitle {
    font-family: var(--st-font-ui);
    font-size: 0.9rem;
    color: var(--st-text-secondary);
    margin: 0 0 16px;
    line-height: 1.6;
}

.st-onboarding__actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.st-onboarding__hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--st-text-muted);
    font-weight: 500;
}

.st-onboarding__kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-family: var(--st-font-mono);
    font-weight: 600;
    background: var(--st-bg-input);
    border: 1px solid var(--st-border);
    border-bottom-width: 2px;
    border-radius: 6px;
    color: var(--st-text-secondary);
    vertical-align: middle;
}

@keyframes st-onboarding-in {
    from {
        opacity: 0;
        transform: translate(-50%, -46%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* ============================================
   CONNECTION STATE — Remote Tab
   ============================================ */
.st-connection-state {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--st-radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 14px;
    transition: all var(--st-transition);
}

.st-connection-state__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.st-connection-state__text {
    flex: 1;
    min-width: 0;
}

.st-connection-state__action {
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border: none;
    border-radius: var(--st-radius-xs);
    cursor: pointer;
    font-family: var(--st-font-ui);
    transition: all var(--st-transition);
    background: var(--st-bg-input);
    color: var(--st-text-secondary);
}

.st-connection-state__action:hover {
    background: var(--st-bg-active);
}

.st-connection-state[data-state="disconnected"] {
    background: var(--st-bg-input);
    color: var(--st-text-muted);
}

.st-connection-state[data-state="disconnected"] .st-connection-state__dot {
    background: var(--st-text-dim);
}

.st-connection-state[data-state="connecting"] {
    background: rgba(251, 191, 36, 0.08);
    color: #d97706;
}

[data-theme="dark"] .st-connection-state[data-state="connecting"] {
    color: #fbbf24;
}

.st-connection-state[data-state="connecting"] .st-connection-state__dot {
    background: #fbbf24;
    animation: st-status-pulse 1s ease-in-out infinite;
}

.st-connection-state[data-state="connected"] {
    background: rgba(52, 211, 153, 0.08);
    color: #16a34a;
}

[data-theme="dark"] .st-connection-state[data-state="connected"] {
    color: #34d399;
}

.st-connection-state[data-state="connected"] .st-connection-state__dot {
    background: #34d399;
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
}

.st-connection-state[data-state="reconnecting"] {
    background: rgba(248, 113, 113, 0.08);
    color: #dc2626;
}

[data-theme="dark"] .st-connection-state[data-state="reconnecting"] {
    color: #f87171;
}

.st-connection-state[data-state="reconnecting"] .st-connection-state__dot {
    background: #f87171;
    animation: st-status-pulse 0.8s ease-in-out infinite;
}

/* ============================================
   UNDO TOAST — Action Feedback
   ============================================ */
.st-undo-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--st-bg-elevated);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    font-size: 0.82rem;
    font-family: var(--st-font-ui);
    color: var(--st-text);
    min-width: 200px;
}

[data-theme="dark"] .st-undo-toast {
    background: var(--st-bg-elevated);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.st-undo-toast__text {
    flex: 1;
    min-width: 0;
}

.st-undo-toast__action {
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--st-primary);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--st-font-ui);
    border-radius: var(--st-radius-xs);
    transition: all var(--st-transition);
    white-space: nowrap;
}

.st-undo-toast__action:hover {
    background: var(--st-primary-glow);
}

/* ============================================
   CONFIRM DIALOG — Destructive Actions
   ============================================ */
.st-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: st-fade-in 0.15s var(--st-ease);
}

.st-confirm-dialog {
    background: var(--st-bg-elevated);
    border-radius: var(--st-radius-lg);
    padding: 24px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .st-confirm-dialog {
    background: var(--st-bg-elevated);
}

.st-confirm-dialog__title {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--st-text);
}

.st-confirm-dialog__message {
    margin: 0 0 20px;
    font-size: 0.85rem;
    color: var(--st-text-secondary);
    line-height: 1.5;
}

.st-confirm-dialog__actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.st-confirm-dialog__actions .st-btn--danger {
    padding: 8px 18px;
    background: var(--st-danger);
    color: #fff;
    border: none;
    border-radius: var(--st-radius-xs);
    font-weight: 700;
    cursor: pointer;
    font-family: var(--st-font-ui);
    font-size: 0.82rem;
    transition: all var(--st-transition);
}

.st-confirm-dialog__actions .st-btn--danger:hover {
    filter: brightness(1.1);
}

/* ============================================
   PHASE TRANSITION BURST — glow ring on phase change
   ============================================ */
.st-display--phase-burst::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%) scale(0.3);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    animation: st-phase-burst 0.8s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

.st-display[data-phase="safe"].st-display--phase-burst::after {
    box-shadow: 0 0 40px rgba(52, 211, 153, 0.3), 0 0 80px rgba(52, 211, 153, 0.1);
}

.st-display[data-phase="warning"].st-display--phase-burst::after {
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.3), 0 0 80px rgba(251, 191, 36, 0.1);
}

.st-display[data-phase="critical"].st-display--phase-burst::after {
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.4), 0 0 80px rgba(239, 68, 68, 0.15);
}

.st-display[data-phase="finished"].st-display--phase-burst::after {
    box-shadow: 0 0 40px rgba(52, 211, 153, 0.4), 0 0 80px rgba(52, 211, 153, 0.15);
}

@keyframes st-phase-burst {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0.8;
    }

    60% {
        opacity: 0.4;
    }

    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* ============================================
   FINISH CELEBRATION — radiating sparks
   Uses digits::after (not main::after which is the dot grid)
   ============================================ */
.st-display--celebrate .st-display__digits::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow:
        0 0 0 rgba(52, 211, 153, 0),
        40px -60px 0 rgba(52, 211, 153, 0),
        -50px -40px 0 rgba(96, 165, 250, 0),
        60px 30px 0 rgba(251, 191, 36, 0),
        -30px 50px 0 rgba(167, 139, 250, 0),
        -70px 10px 0 rgba(248, 113, 113, 0),
        50px -20px 0 rgba(52, 211, 153, 0),
        20px 60px 0 rgba(96, 165, 250, 0);
    z-index: 3;
    pointer-events: none;
    animation: st-celebrate-sparks 1.2s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

@keyframes st-celebrate-sparks {
    0% {
        box-shadow:
            0 0 2px rgba(52, 211, 153, 1),
            0 0 2px rgba(52, 211, 153, 1),
            0 0 2px rgba(96, 165, 250, 1),
            0 0 2px rgba(251, 191, 36, 1),
            0 0 2px rgba(167, 139, 250, 1),
            0 0 2px rgba(248, 113, 113, 1),
            0 0 2px rgba(52, 211, 153, 1),
            0 0 2px rgba(96, 165, 250, 1);
    }

    50% {
        box-shadow:
            80px -120px 4px rgba(52, 211, 153, 0.8),
            -100px -80px 4px rgba(52, 211, 153, 0.7),
            -90px 60px 3px rgba(96, 165, 250, 0.8),
            110px 50px 4px rgba(251, 191, 36, 0.7),
            -60px 100px 3px rgba(167, 139, 250, 0.8),
            -130px 20px 4px rgba(248, 113, 113, 0.7),
            100px -40px 3px rgba(52, 211, 153, 0.8),
            40px 120px 4px rgba(96, 165, 250, 0.7);
    }

    100% {
        box-shadow:
            120px -180px 6px rgba(52, 211, 153, 0),
            -150px -120px 6px rgba(52, 211, 153, 0),
            -130px 90px 5px rgba(96, 165, 250, 0),
            160px 80px 6px rgba(251, 191, 36, 0),
            -90px 150px 5px rgba(167, 139, 250, 0),
            -190px 30px 6px rgba(248, 113, 113, 0),
            150px -60px 5px rgba(52, 211, 153, 0),
            60px 180px 6px rgba(96, 165, 250, 0);
    }
}

/* ============================================
   STATUS TRANSITIONS — mode/status entrance
   ============================================ */
.st-display--status-enter .st-display__digits {
    animation: st-status-enter 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes st-status-enter {
    0% {
        opacity: 0.5;
        transform: scale(0.97);
        filter: blur(2px);
    }

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

/* Suppress new animations in reduced motion */
@media (prefers-reduced-motion: reduce) {
    .st-display--phase-burst::after {
        animation: none !important;
    }

    .st-display--celebrate .st-display__digits::after {
        animation: none !important;
    }

    .st-display__digits--tick {
        animation: none !important;
    }

    .st-display--status-enter .st-display__digits {
        animation: none !important;
    }
}