:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --panel: #ffffff;
  --panel-soft: #faf8f3;
  --line: rgba(31, 38, 35, 0.12);
  --text: #1d2522;
  --muted: #6d766f;
  --faint: #9aa29c;
  --green: #1f6b54;
  --blue: #276a86;
  --gold: #d6a632;
  --red: #b7553f;
  --shadow: 0 12px 32px rgba(31, 38, 35, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(14px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 243, 238, 0.95);
  backdrop-filter: blur(14px);
}

.kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(24px, 3.2vw, 38px);
}

h2 {
  font-size: clamp(22px, 2.4vw, 32px);
}

h3 {
  font-size: 20px;
}

p {
  margin: 0;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ghost-button,
.filter-button,
.icon-button,
select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.ghost-button,
.filter-button,
.icon-button {
  cursor: pointer;
}

.ghost-button {
  min-height: 36px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ghost-button:hover,
.ghost-button.active {
  color: var(--green);
  border-color: rgba(31, 107, 84, 0.28);
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  width: min(1280px, calc(100% - 28px));
  margin: 18px auto 36px;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.search-box,
.filter-group,
.preference-panel {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(31, 38, 35, 0.04);
}

.search-box span,
.filter-group p,
.preference-panel p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.search-box input {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text);
}

.filter-button {
  min-height: 36px;
  padding: 8px 10px;
  text-align: left;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.filter-button:hover,
.filter-button.active {
  border-color: rgba(31, 107, 84, 0.25);
  background: rgba(31, 107, 84, 0.08);
  color: var(--green);
}

.preference-panel {
  color: var(--muted);
  font-size: 13px;
}

.feed {
  min-width: 0;
}

.feed-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

#feed-summary {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

select {
  min-height: 38px;
  padding: 7px 30px 7px 10px;
  color: var(--muted);
  font-weight: 800;
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(31, 38, 35, 0.05);
}

.event-card.is-hidden {
  opacity: 0.58;
}

.date-tile {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.date-tile span,
.date-tile em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  text-transform: uppercase;
}

.date-tile strong {
  color: var(--text);
  font-size: 30px;
  line-height: 1;
}

.event-main {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.event-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: start;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.meta-line span:first-child {
  color: var(--green);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--faint);
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  border-color: rgba(183, 85, 63, 0.25);
  background: rgba(183, 85, 63, 0.08);
  color: var(--red);
}

.description {
  color: #34403b;
}

.why {
  color: var(--text);
  font-weight: 760;
}

.card-bottom,
.source-row,
.tag-list {
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-bottom {
  justify-content: space-between;
  gap: 12px;
}

.tag-list {
  flex-wrap: wrap;
  min-width: 0;
}

.tag-list span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.source-row {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
}

.source-row a {
  text-decoration: none;
}

.source-row a:hover {
  text-decoration: underline;
}

.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  border-radius: 999px;
  background: rgba(214, 166, 50, 0.16);
  color: #8a6410;
  font-weight: 900;
}

.empty-state {
  padding: 24px;
  border: 1px dashed rgba(31, 38, 35, 0.28);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
}

.empty-state h3 {
  margin-bottom: 6px;
  color: var(--text);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #1d2522;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.toast button {
  margin-left: 10px;
  border: 0;
  background: transparent;
  color: var(--gold);
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 850px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 720px);
  }

  .sidebar {
    position: static;
  }

  .filter-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
  }

  .filter-group p {
    flex: 0 0 100%;
  }

  .filter-button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .feed-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .event-card {
    grid-template-columns: 58px minmax(0, 1fr);
    padding: 10px;
  }

  .date-tile {
    min-height: 64px;
  }

  .date-tile strong {
    font-size: 25px;
  }

  .card-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}
