       :root {
            color-scheme: light dark;
            --accent: #0069c0;
            --background: #f3f4f6;
            --surface: #ffffff;
            --surface-border: rgba(15, 23, 42, 0.08);
            --text: #1f2933;
            --muted: #4d5968;
            --passage: #c026d3;
        }

        @media (prefers-color-scheme: dark) {
            :root {
                --background: #0f172a;
                --surface: #111827;
                --surface-border: rgba(255, 255, 255, 0.06);
                --text: #e5e7eb;
                --muted: #94a3b8;
                --passage: #d946ef;
            }
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.5;
            background: var(--background);
            color: var(--text);
            min-height: 100vh;
            display: flex;
            align-items: start;
            justify-content: center;
            padding: clamp(1.5rem, 3vw, 3rem);
        }

        main {
            width: min(1024px, 100%);
            background: var(--surface);
            border-radius: 20px;
            border: 1px solid var(--surface-border);
            box-shadow: 0 25px 60px rgba(15, 23, 42, 0.1);
            padding: clamp(1.5rem, 3vw, 3rem);
            display: flex;
            flex-direction: column;
            gap: 2.5rem;
        }

        header h1 {
            margin: 0 0 0.5rem;
            color: var(--accent);
            font-size: clamp(1.75rem, 3vw, 2.4rem);
        }

        header p {
            margin: 0;
            color: var(--muted);
        }

        .config-section {
            display: grid;
            gap: 1.5rem;
            border: 1px solid var(--surface-border);
            border-radius: 16px;
            padding: clamp(1.5rem, 3vw, 2rem);
            background: rgba(0, 105, 192, 0.05);
        }

        form {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 1rem 1.25rem;
        }

        label {
            display: flex;
            flex-direction: column;
            font-weight: 600;
            font-size: 0.95rem;
            gap: 0.45rem;
        }

        input {
            padding: 0.65rem 0.75rem;
            border-radius: 10px;
            border: 1px solid var(--surface-border);
            background: var(--surface);
            color: inherit;
            font-size: 1rem;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
        }

        input:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(0, 105, 192, 0.15);
        }

        .form-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            align-items: center;
        }

        button {
            border: none;
            border-radius: 999px;
            padding: 0.75rem 1.5rem;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.15s ease, box-shadow 0.15s ease;
        }

        button:focus-visible {
            outline: 3px solid rgba(0, 105, 192, 0.35);
            outline-offset: 3px;
        }

        .btn-primary {
            background: var(--accent);
            color: #fff;
            box-shadow: 0 12px 18px rgba(0, 105, 192, 0.25);
        }

        .btn-primary:hover {
            transform: translateY(-1px);
            box-shadow: 0 16px 26px rgba(0, 105, 192, 0.35);
        }

        .btn-ghost {
            background: transparent;
            color: var(--accent);
        }

        .btn-secondary {
            background: transparent;
            color: var(--accent);
            border: 1px solid var(--accent);
            border-radius: 999px;
            padding: 0.65rem 1.2rem;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
        }

        .btn-secondary:hover {
            background: rgba(0, 105, 192, 0.12);
        }

        .planning-section {
            display: grid;
            gap: 1.5rem;
            height: 165px;
        }

        .planning-header.is-fixed {
            position: fixed;
            z-index: 40;
            background: var(--surface);
            border-bottom: 1px solid var(--surface-border);
            max-height: 100vh;
            overflow-y: auto;
            padding-left: clamp(1.5rem, 3vw, 3rem);
            padding-right: clamp(1.5rem, 3vw, 3rem);
        }

        .planning-header {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            justify-content: space-between;
            align-items: baseline;
            padding: 20px 0;
        }

        .planning-title {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .view-toggle {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.2rem;
            border-radius: 999px;
            border: 1px solid var(--surface-border);
            background: rgba(0, 105, 192, 0.08);
        }

        .btn-toggle {
            border-radius: 999px;
            border: none;
            background: transparent;
            color: var(--muted);
            padding: 0.4rem 0.85rem;
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
        }

        .btn-toggle.is-active {
            background: var(--accent);
            color: #fff;
            box-shadow: 0 8px 16px rgba(0, 105, 192, 0.2);
        }

        .planning-meta {
            /*! display: flex; */
            flex-direction: column;
            gap: 0.25rem;
            align-items: flex-end;
        }

        @media (max-width: 600px) {
            .planning-header {
                align-items: flex-start;
            }

            .planning-meta {
                align-items: flex-start;
            }
        }

        .planning-header h2 {
            margin: 0;
        }

        .summary {
            color: var(--muted);
            font-size: 0.95rem;
        }

#end-summary {
    position: initial;
    font-size: 2em;
    display: block;
    text-align: center;
    margin: 0 0 20px;
}

        .groups-grid {
            display: grid;
            gap: 1rem;
            grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        }

        .groups-grid--table {
            grid-template-columns: 1fr;
        }

        .groups-grid--table .group-card {
            grid-template-columns: minmax(180px, 1.2fr) minmax(200px, 1fr) 2fr;
            align-items: center;
            gap: 0.75rem;
            border-radius: 0;
            border-left: none;
            border-right: none;
            background: transparent;
            padding: 0.75rem 0;
        }

        .groups-grid--table .group-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.15rem;
        }

        .groups-grid--table .times {
            font-size: 0.85rem;
        }

        .groups-grid--table .stage-grid {
            grid-template-columns: 1fr;
            gap: 0.5rem;
        }

        @media (max-width: 720px) {
            .groups-grid--table .group-card {
                grid-template-columns: 1fr;
                padding: 0.85rem 0;
            }
        }

        .group-card {
            border: 1px solid var(--surface-border);
            border-radius: 16px;
            padding: 1.25rem;
            display: grid;
            gap: 1rem;
            background: rgba(255, 255, 255, 0.85);
        }

        @media (prefers-color-scheme: dark) {
            .group-card {
                background: rgba(17, 24, 39, 0.85);
            }
        }

        .stage-grid {
            display: grid;
            gap: 1rem;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        }

        .stage-block {
            border: 1px solid var(--surface-border);
            border-radius: 12px;
            padding: 1rem;
            display: grid;
            gap: 0.75rem;
            background: rgba(0, 105, 192, 0.04);
        }

        .stage-block--passage {
            border-color: rgba(192, 38, 211, 0.25);
            background: rgba(192, 38, 211, 0.12);
        }

        .stage-block--questions {
            border-color: rgba(0, 105, 192, 0.2);
            background: rgba(0, 105, 192, 0.08);
        }

        .stage-block.is-not-started {
            box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.05);
            opacity: 0.9;
        }

        .stage-block.is-running {
            border-color: rgba(0, 105, 192, 0.45);
            box-shadow: 0 10px 24px rgba(0, 105, 192, 0.2);
        }

        .stage-block.is-done {
            border-color: rgb(236, 237, 238);
            background: rgba(243, 244, 246, 0.3);
        }

        @media (prefers-color-scheme: dark) {
            .stage-block {
                background: rgba(255, 255, 255, 0.04);
            }
            .stage-block--passage {
                background: rgba(217, 70, 239, 0.22);
                border-color: rgba(217, 70, 239, 0.35);
            }
            .stage-block--questions {
                background: rgba(0, 105, 192, 0.2);
            }

            .stage-block.is-not-started {
                box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06);
                opacity: 0.92;
            }

            .stage-block.is-running {
                border-color: rgba(0, 158, 255, 0.55);
                box-shadow: 0 12px 24px rgba(0, 158, 255, 0.22);
            }

            .stage-block.is-done {
                border-color: rgba(49, 55, 68, 0.34);
                background: rgb(16, 23, 38);
            }
        }

        .stage-header {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            font-weight: 600;
        }

        .group-header {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            font-weight: 600;
        }

        .times {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
            color: var(--muted);
            font-size: 0.9rem;
        }

        .timer-display {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.35rem;
        }

        .timer-display span {
            font-size: 2.4rem;
            font-variant-numeric: tabular-nums;
            letter-spacing: 0.05em;
        }

        .stage-block--passage .timer-display span {
            color: var(--passage);
        }

        .stage-block--questions .timer-display span {
            color: var(--accent);
        }

        .timer-status {
            font-size: 0.85rem;
            color: var(--muted);
        }

        .stage-block--passage .timer-status,
        .stage-block--passage .stage-target {
            color: #a855f7;
        }

        .stage-target {
            color: var(--muted);
            font-size: 0.85rem;
        }

        .stage-block.is-done .stage-target {
            opacity: 0;
        }

        .stage-block.over-target .timer-display span,
        .stage-block.over-target .timer-status,
        .stage-block.over-target .stage-target {
            color: #d97706;
        }

        .icon-btn {
            width: 48px;
            height: 48px;
            padding: 0;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .icon-btn svg {
            width: 22px;
            height: 22px;
        }

        .icon-btn--reset {
            background: rgba(15, 23, 42, 0.18);
            color: #fff;
            border: none;
        }

        .icon-btn--reset:hover {
            background: rgba(15, 23, 42, 0.28);
        }

        @media (prefers-color-scheme: dark) {
            .icon-btn--reset {
                background: rgba(255, 255, 255, 0.14);
            }

            .icon-btn--reset:hover {
                background: rgba(255, 255, 255, 0.22);
            }
        }

        .stage-block--passage .btn-primary {
            background: var(--passage);
            box-shadow: 0 12px 18px rgba(192, 38, 211, 0.3);
        }

        .stage-block--passage .btn-primary:hover {
            box-shadow: 0 16px 26px rgba(192, 38, 211, 0.4);
        }

        .card-actions {
            display: flex;
            gap: 0.75rem;
            justify-content: center;
        }

#export-section {
    text-align: center;
    line-height: 3em;
}

        .hidden {
            display: none !important;
        }
