*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: #fafafa;
    color: #333;
    line-height: 1.5;
}

.site-header {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px 8px;
}
.site-header h1 { font-size: 1.5rem; font-weight: 700; }
.subtitle { color: #666; font-size: 0.95rem; }

.staleness-warning {
    max-width: 800px;
    margin: 8px auto;
    padding: 8px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #856404;
}

.controls {
    max-width: 800px;
    margin: 8px auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.view-toggle { display: flex; gap: 4px; }
.view-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
.view-btn.active { background: #333; color: #fff; border-color: #333; }
.last-updated { font-size: 0.8rem; color: #888; }

.filters {
    max-width: 800px;
    margin: 8px auto;
    padding: 0 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.category-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
}
.cat-btn.active { border-color: currentColor; }
.cat-btn .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.city-filter {
    margin-left: auto;
    font-size: 0.85rem;
}
.city-filter select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* List View */
.list-view {
    max-width: 800px;
    margin: 16px auto;
    padding: 0 16px;
}
.date-group-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    padding: 16px 0 6px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 8px;
}
.event-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
}
.event-card:hover { border-color: #ccc; }
.event-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.event-card-header .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}
.event-title {
    font-size: 0.95rem;
    font-weight: 600;
    flex: 1;
}
.event-category-badge {
    font-size: 0.7rem;
    color: #888;
    white-space: nowrap;
}
.event-meta {
    font-size: 0.8rem;
    color: #666;
    margin-top: 2px;
    padding-left: 18px;
}
.event-details {
    margin-top: 8px;
    padding-left: 18px;
    font-size: 0.85rem;
    color: #555;
    display: none;
}
.event-card.expanded .event-details { display: block; }
.event-details p { margin-bottom: 6px; }
.event-details .more-info {
    color: #4A90D9;
    text-decoration: none;
    font-weight: 500;
}
.event-details .more-info:hover { text-decoration: underline; }

/* Calendar View */
.calendar-view {
    max-width: 800px;
    margin: 16px auto;
    padding: 0 16px;
}
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.calendar-nav button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
#cal-month-label { font-weight: 600; font-size: 1rem; }
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-header {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    padding: 4px;
}
.cal-day {
    min-height: 60px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}
.cal-day.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-day.today { border-color: #4A90D9; }
.cal-day-num { font-weight: 600; color: #333; }
.cal-day-dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.cal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.cal-day-count {
    font-size: 0.65rem;
    color: #888;
    margin-top: 1px;
}

/* Map View */
.map-view {
    max-width: 800px;
    margin: 16px auto;
    padding: 0 16px;
}
.map-date-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    font-size: 0.85rem;
}
.map-date-filter input[type="date"] {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
}
#map-container {
    height: 500px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    z-index: 0;
}
.map-popup-venue {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.map-popup-events {
    max-height: 200px;
    overflow-y: auto;
}
.map-popup-event {
    padding: 3px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.8rem;
}
.map-popup-event:last-child { border-bottom: none; }
.map-popup-event .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}
.map-popup-date {
    color: #888;
    font-size: 0.75rem;
}

/* Time Range Slider */
.time-slider-container {
    max-width: 800px;
    margin: 8px auto;
    padding: 0 16px;
}
.time-slider-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 6px;
}
#time-range-label {
    font-weight: 600;
    color: #333;
}
.time-slider-track {
    position: relative;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin: 0 8px;
    user-select: none;
    touch-action: none;
}
.time-slider-fill {
    position: absolute;
    height: 100%;
    background: #4A90D9;
    border-radius: 4px;
    pointer-events: none;
}
.time-slider-thumb {
    position: absolute;
    top: 50%;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid #4A90D9;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 2;
    touch-action: none;
}
.time-slider-thumb:active { cursor: grabbing; background: #e8f0fe; }
.time-slider-thumb:hover { box-shadow: 0 0 0 4px rgba(74,144,217,0.2); }
.time-slider-ticks {
    display: flex;
    justify-content: space-between;
    margin: 4px 8px 0;
    font-size: 0.65rem;
    color: #aaa;
}

.empty-state {
    max-width: 800px;
    margin: 40px auto;
    text-align: center;
    color: #888;
    font-size: 0.95rem;
}

.site-footer {
    max-width: 800px;
    margin: 32px auto 16px;
    padding: 16px;
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    border-top: 1px solid #e0e0e0;
}

/* Category colors */
.cat-music { color: #4A90D9; }
.cat-theater { color: #D94A4A; }
.cat-dance { color: #D94AD9; }
.cat-visual-arts { color: #4AD94A; }
.cat-film { color: #D9D94A; }
.cat-lecture { color: #4AD9D9; }
.cat-literary { color: #D9944A; }
.cat-festival { color: #FF6B6B; }
.cat-other-arts { color: #999; }
.cat-uncategorized { color: #999; }

@media (max-width: 600px) {
    .site-header h1 { font-size: 1.2rem; }
    .controls { flex-direction: column; align-items: flex-start; }
    .filters { flex-direction: column; align-items: flex-start; }
    .city-filter { margin-left: 0; }
    .cal-day { min-height: 44px; }
    .cal-day-num { font-size: 0.7rem; }
    #map-container { height: 400px; }
    .map-date-filter { font-size: 0.8rem; }
    .time-slider-thumb { width: 24px; height: 24px; }
}
