.timetable-container {
    --timeline-location-width: 100px;
    --tt-accent: #4f46e5;
    --tt-panel: #ffffff;
    --tt-panel-alt: #f8fafc;
    --tt-text: #0f172a;
    --tt-muted: #64748b;
    font-family: "Museo Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.timetable-content-shell {
    position: relative;
    transition:
        opacity 300ms ease-in-out,
        transform 300ms ease-in-out,
        filter 300ms ease-in-out;
}

.timetable-content-shell.is-ready {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.timetable-content-shell.is-refreshing {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.timetable-filter-dropdown {
    position: relative;
}

.timetable-university-filter-dropdown {
    width: min(100%, 200px);
}

.timetable-filter-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    width: 100%;
    min-height: 2.9rem;
    padding: 0.72rem 3rem 0.72rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1;
    transition:
        border-color 180ms ease,
        background-color 180ms ease,
        box-shadow 180ms ease,
        transform 180ms ease;
}

.timetable-filter-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.26);
}

.timetable-filter-trigger:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.timetable-filter-dropdown.is-open .timetable-filter-trigger {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.timetable-filter-trigger-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timetable-filter-chevron {
    position: absolute;
    top: 50%;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    color: rgba(255, 255, 255, 0.92);
    pointer-events: none;
    transform: translateY(-50%);
}

.timetable-filter-dropdown.is-open .timetable-filter-chevron {
    transform: translateY(-50%) rotate(180deg);
}

.timetable-filter-chevron svg {
    width: 100%;
    height: 100%;
    display: block;
}

.timetable-filter-panel {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    z-index: 40;
    width: 100%;
    min-width: 15.5rem;
    padding: 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 1.1rem;
    background: rgba(7, 7, 7, 0.96);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(14px);
}

.timetable-university-filter-dropdown .timetable-filter-panel {
    min-width: 100%;
    box-sizing: border-box;
    padding: 0.35rem;
    overflow: hidden;
}

.timetable-filter-search-shell {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
    min-width: 0;
}

.timetable-filter-search-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.05);
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.timetable-filter-search-field:focus-within {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.timetable-filter-search-icon {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    color: rgba(255, 255, 255, 0.92);
    pointer-events: none;
}

.timetable-filter-search-input {
    flex: 1 1 auto;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
    outline: none;
    text-transform: uppercase;
}

.timetable-filter-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.timetable-filter-search-input:focus,
.timetable-filter-search-input:focus-visible,
.timetable-filter-search-input:active {
    outline: none;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.timetable-filter-search-input::-webkit-search-decoration,
.timetable-filter-search-input::-webkit-search-cancel-button,
.timetable-filter-search-input::-webkit-search-results-button,
.timetable-filter-search-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.timetable-filter-search-clear {
    display: inline-flex;
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    align-items: center;
    justify-content: center;
    border: 0;
    padding: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    transition: color 180ms ease, opacity 180ms ease;
}

.timetable-filter-search-clear svg {
    width: 100%;
    height: 100%;
    display: block;
}

.timetable-filter-search-clear:hover,
.timetable-filter-search-clear:focus-visible {
    color: #ffffff;
    outline: none;
    opacity: 0.78;
}

.timetable-filter-search-results {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    width: 100%;
    min-width: 0;
    max-height: 16rem;
    overflow-y: auto;
    padding-right: 0.1rem;
}

.timetable-filter-empty {
    padding: 0.95rem 0.9rem;
    border-radius: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.timetable-filter-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 2.85rem;
    overflow: hidden;
    padding: 0.8rem 0.9rem;
    border: 0;
    border-radius: 0.85rem;
    background: transparent;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.1;
    text-align: left;
    text-transform: uppercase;
    transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.timetable-filter-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.timetable-filter-option:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
}

.timetable-filter-option.is-selected {
    background: rgba(255, 255, 255, 0.13);
}

.timetable-filter-check {
    flex: 0 0 auto;
    font-size: 0.95rem;
    line-height: 1;
}

.timetable-filter-option-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timetable-refresh-indicator {
    position: sticky;
    bottom: 1rem;
    z-index: 20;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.timetable-refresh-indicator span {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(10, 10, 10, 0.72);
    backdrop-filter: blur(12px);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.timetable-refresh-indicator span::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: var(--tt-accent);
    animation: timetable-refresh-pulse 800ms ease-in-out infinite alternate;
}

@keyframes timetable-refresh-pulse {
    from {
        opacity: 0.45;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1.15);
    }
}

.day-pill {
    border-color: var(--day-pill-border, rgba(255, 255, 255, 0.22));
    background-color: var(--day-pill-bg, rgba(255, 255, 255, 0.06));
    color: var(--day-pill-text, #fff);
}

.day-pill:hover {
    background-color: var(--day-pill-hover-bg, var(--day-pill-bg, rgba(255, 255, 255, 0.06)));
}

.timetable-view-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 2.9rem;
    padding: 0.72rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1;
    text-transform: uppercase;
    transition:
        border-color 180ms ease,
        background-color 180ms ease,
        box-shadow 180ms ease;
}

.timetable-view-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
}

.timetable-view-toggle:focus,
.timetable-view-toggle:focus-visible {
    outline: none;
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.timetable-view-toggle .ui-icon-mask {
    width: 1rem;
    height: 1rem;
}

.timetable-mobile-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0;
    border-radius: 999px;
    flex: 0 0 auto;
}

.timetable-mobile-control .timetable-favorite-heart-icon,
.timetable-mobile-control .ui-icon-mask,
.timetable-mobile-control svg {
    width: 1.12rem;
    height: 1.12rem;
}

.timetable-mobile-control .timetable-favorite-heart-icon {
    width: 1.2rem;
    height: 1.2rem;
}

.timetable-view-toggle--icon-only {
    gap: 0;
    padding: 0;
}

.timeline-shell {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    background: var(--tt-timeline-panel, var(--tt-panel));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.timeline-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.26) transparent;
}

.timeline-scroll.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.timeline-scroll::-webkit-scrollbar {
    height: 10px;
}

.timeline-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.timeline-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.timeline-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}

.timeline-board {
    width: calc(var(--timeline-location-width) + (var(--timeline-hour-width) * var(--timeline-hours-count)) + (var(--timeline-edge-padding) * 2));
    min-width: calc(var(--timeline-location-width) + (var(--timeline-hour-width) * var(--timeline-hours-count)) + (var(--timeline-edge-padding) * 2));
}

.timeline-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: var(--timeline-location-width) 1fr;
    background: var(--timeline-header-bg, var(--tt-timeline-panel-alt, var(--tt-panel-alt)));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.timeline-location-header {
    position: sticky;
    left: 0;
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--tt-text);
    text-transform: uppercase;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.timeline-axis {
    position: relative;
    min-height: 50px;
    padding-top: 8px;
    padding-bottom: 3px;
    overflow: hidden;
}

.timeline-hour-band,
.timeline-track-band {
    position: absolute;
    top: 0;
    bottom: 0;
    background: transparent;
    pointer-events: none;
}

.timeline-hour-band.is-alt {
    background: rgba(255, 255, 255, 0.08);
}

.timeline-track-band.is-alt {
    background: rgba(255, 255, 255, 0.03);
}

.timeline-hour-marker {
    position: absolute;
    top: 6px;
    transform: translateX(-50%);
    font-size: 0.88rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
}

.timeline-hour-marker::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 18px;
    width: 1px;
    height: 23px;
    background: rgba(255, 255, 255, 0.12);
}

.timeline-now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--tt-accent);
}

.timeline-now-line span {
    position: absolute;
    top: 0;
    left: 4px;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: var(--tt-accent);
}

.timeline-row {
    display: grid;
    grid-template-columns: var(--timeline-location-width) 1fr;
    min-height: 98px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.timeline-location-cell {
    position: sticky;
    left: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--tt-timeline-panel-alt, var(--tt-panel-alt));
    box-shadow: 10px 0 18px rgba(0, 0, 0, 0.18);
}

.timeline-location-icon {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--tt-text);
    font-size: 1.95rem;
    flex-shrink: 0;
    overflow: visible;
}

.timeline-location-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.timeline-location-name {
    color: var(--tt-text);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.2;
}

.timeline-track {
    position: relative;
    min-height: 68px;
    padding: 0.2rem 0;
    background: var(--tt-timeline-panel, var(--tt-panel));
    overflow: hidden;
}

.timeline-track-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.09);
}

.timeline-event-tile {
    position: absolute;
    top: 3px;
    bottom: 3px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.45rem 0.6rem;
    text-align: center;
    overflow: hidden;
    min-width: 56px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timeline-event-tile.is-short-slot {
    padding: 0.28rem 0.38rem;
}

.timeline-event-tile.is-cancelled {
    opacity: 0.45;
    text-decoration: line-through;
}

.timeline-event-tile.is-live {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.timeline-event-title {
    display: block;
    color: #fff;
    font-weight: 900;
    font-size: 1.05rem;
    line-height: 1.08;
    margin-bottom: 0.16rem;
    text-align: center;
    width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
    text-wrap: balance;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.42);
}

.timeline-event-title.is-short-slot {
    font-size: 0.8rem;
    line-height: 1.05;
    margin-bottom: 0.1rem;
    text-wrap: pretty;
}

.timeline-event-time {
    display: block;
    color: rgba(255, 255, 255, 0.94);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.36);
}

.tt-live-box,
.tt-hour-header,
.tt-event-card {
    border-color: rgba(255, 255, 255, 0.08);
    background: var(--tt-panel);
}

.tt-hour-header {
    background: var(--tt-panel-alt);
}

.tt-event-card:hover {
    background-color: #141518;
}

.tt-event-meta {
    color: var(--tt-muted);
}

.tt-event-time-label {
    color: #fff;
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.tt-live-box,
.tt-hour-header,
.tt-event-card,
.tt-hour-header h3,
.tt-event-time-label,
.timeline-hour-marker,
.timeline-event-title,
.timeline-event-time {
    font-family: "Museo Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.tt-event-divider {
    color: rgba(255, 255, 255, 0.16);
}

.tt-event-card--highlight {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.tt-event-card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.85rem;
}

.tt-event-card-category-badge,
.tt-favorite-button {
    min-height: 2.1rem;
}

.tt-event-card-category-badge {
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.78rem;
    font-size: 0.64rem;
    line-height: 1;
}

.tt-event-card-meta-inline {
    margin-top: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.tt-event-card-time,
.tt-event-detail-time {
    flex: 0 0 auto;
    white-space: nowrap;
}

.tt-event-card-meta-divider {
    flex: 0 0 auto;
    width: 1px;
    height: 1rem;
    background: rgba(255, 255, 255, 0.2);
}

.tt-event-card-location-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    max-width: 100%;
    color: rgba(255, 255, 255, 0.76);
    transition: color 0.2s ease;
}

.tt-event-card-meta-inline .tt-event-card-location-link {
    flex: 1 1 auto;
}

.tt-event-card-location-link:hover {
    color: #ffffff;
}

.tt-event-card-location-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tt-favorite-button {
    flex: 0 0 auto;
    gap: 0.5rem;
    padding: 0.35rem 0.78rem;
    font-size: 0.76rem;
    line-height: 1;
    white-space: nowrap;
}

.tt-favorite-button .timetable-favorite-heart-icon {
    width: 1rem;
    height: 1rem;
}

.tt-event-detail-meta-row {
    margin-top: 1rem;
    display: flex;
    width: 100%;
    max-width: 48rem;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.tt-event-detail-meta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
}

:root.dark .timetable-container {
    --tt-panel: #1e293b;
    --tt-panel-alt: #0f172a;
    --tt-text: #e2e8f0;
    --tt-muted: #94a3b8;
}

:root.dark .timeline-shell,
:root.dark .timeline-header,
:root.dark .timeline-row,
:root.dark .timeline-location-cell {
    border-color: rgba(255, 255, 255, 0.08);
}

:root.dark .timeline-track-line {
    background: rgba(255, 255, 255, 0.06);
}

:root.dark .timeline-event-tile {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

@media (max-width: 768px) {
    .timetable-container {
        --timeline-location-width: 100px;
    }

    .timetable-university-filter-dropdown {
        width: 100%;
    }

    .timeline-location-header {
        min-height: 28px;
    }

    .timeline-axis {
        min-height: 28px;
        padding-top: 2px;
        padding-bottom: 0;
    }

    .timeline-hour-marker {
        top: 1px;
        font-size: 0.76rem;
    }

    .timeline-hour-marker::after {
        top: 11px;
        height: 10px;
    }

    .timeline-event-tile {
        top: 3px;
        bottom: 3px;
    }

    .timeline-event-tile.is-short-slot {
        padding: 0.24rem 0.3rem;
    }

    .timeline-row {
        min-height: 75px;
    }

    .timeline-location-cell {
        padding-inline: 0;
    }

    .timeline-track {
        min-height: 50px;
        padding: 0.1rem 0;
    }

    .timeline-location-icon {
        width: 88%;
        font-size: 1.72rem;
    }

    .timeline-event-title.is-short-slot {
        font-size: 0.8rem;
        line-height: 1;
    }

    .timetable-view-toggle {
        min-height: 2.45rem;
        padding: 0.6rem 0.9rem;
        font-size: 0.74rem;
    }

    .timetable-mobile-control,
    .timetable-view-toggle--icon-only {
        width: 2.25rem;
        min-width: 2.25rem;
        min-height: 2.25rem;
        padding: 0;
    }

    .tt-event-card-toolbar {
        align-items: flex-start;
    }

    .tt-event-card-category-badge,
    .tt-favorite-button {
        min-height: 1.9rem;
        padding: 0.32rem 0.66rem;
    }

    .tt-event-card-meta-inline {
        gap: 0.5rem;
        font-size: 0.68rem;
    }

    .tt-event-detail-meta-row {
        font-size: 0.82rem;
        letter-spacing: 0.14em;
    }

    .tt-event-detail-meta {
        max-width: 100%;
    }

    .tt-favorite-button {
        font-size: 0.72rem;
    }
}
