:root {
  color-scheme: light;
  --bg: #fdf6e3;
  --text: #657b83;
  --muted: #839496;
  --event-time: var(--muted);
  --border: #93a1a1;
  --pill-active: #d63384;
  --pill-active-text: #fff;
  --dot-active: #d63384;
  --panel: #fdf6e3;
  --panel-inset: #eee8d5;
  --link: #d63384;
  --danger: #dc322f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  touch-action: pan-x pan-y;
}

body {
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.4;
}

.page-shell {
  width: 100%;
}

.site-header {
  margin-bottom: 1rem;
}

.wordmark {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  line-height: 1.2;
}

.day-nav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0 0 1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.day-nav::-webkit-scrollbar {
  display: none;
}

.day-nav > * {
  flex: 0 0 auto;
}

.weekday-label {
  display: block;
  width: 100%;
  margin: -0.5rem 0 0.5rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.1em;
}

.weekday-label.weekend-rainbow {
  width: fit-content;
  margin-right: auto;
  margin-left: auto;
  background-image: linear-gradient(90deg, #ef4444, #f97316, #eab308, #22c55e, #06b6d4, #3b82f6, #a855f7);
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pill.active {
  background: var(--pill-active);
  border-color: var(--pill-active);
  color: var(--pill-active-text);
}

.day-progress-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  cursor: default;
  vertical-align: middle;
  margin: 0 0.15rem;
}

.day-progress-dot.filled {
  border-color: var(--dot-active);
  background: var(--dot-active);
}

.date-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.date-picker input[type="date"] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.5rem;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

.day-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 2.5rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.day-nav-button[aria-disabled="true"] {
  touch-action: none;
  color: var(--muted);
  background: var(--panel-inset);
  cursor: not-allowed;
}

.events-section {
  display: grid;
}

.venue-group {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  background: transparent;
}

.venue-heading {
  cursor: pointer;
  font-weight: 600;
  padding: 0.2rem 0;
  -webkit-tap-highlight-color: transparent;
}

.event-list {
  list-style: none;
  padding: 0.25rem 0 0;
  margin: 0.5rem 0 0;
}

.venue-empty-message {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

.share-events-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.share-events-feedback {
  color: var(--muted);
  font-size: 0.85rem;
}

.share-events-button {
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--link);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.share-events-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.share-events-button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.event-item {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) 2.25rem;
  align-items: start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.event-item a {
  min-width: 0;
  color: var(--link);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.event-item a:hover {
  text-decoration: underline;
}

.event-time {
  color: var(--event-time);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.event-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-height: 2rem;
  margin-top: -0.3rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.event-star[aria-pressed="true"] {
  color: var(--pill-active);
}

.event-star:hover {
  color: var(--link);
}

.event-star:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.status-banner {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  white-space: pre-line;
}

.status-banner.warning {
  color: var(--danger);
}

.site-footer {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.empty-state {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.empty-state p {
  margin: 0;
}

.hidden {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1b171b;
    --text: #f5f5f5;
    --muted: #a6a6a6;
    --event-time: #c8c8c8;
    --border: #780b62;
    --pill-active: #ff2bd6;
    --pill-active-text: #000;
    --dot-active: #ff2bd6;
    --panel: #211b21;
    --panel-inset: #2a232a;
    --link: #ff2bd6;
    --danger: #dc322f;
  }
}

@media (max-width: 640px) {
  body {
    padding: 12px;
  }
}
