:root {
  color-scheme: light;
  --ink: #1d2522;
  --muted: #62706a;
  --line: #dce5df;
  --paper: #fbfcf9;
  --panel: #ffffff;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #f2b84b;
  --rose: #cf5c5c;
  --shadow: 0 18px 40px rgba(30, 45, 39, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  align-items: center;
  background: rgba(251, 252, 249, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: center;
  color: inherit;
  display: flex;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--brand);
  border-radius: 8px;
  color: white;
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand small,
.muted,
.event-card small,
.hero-panel small {
  color: var(--muted);
}

.nav-actions,
.action-row,
.section-heading {
  align-items: center;
  display: flex;
  gap: 10px;
}

.page-tabs {
  background: #edf2ef;
  border-radius: 8px;
  display: flex;
  padding: 3px;
}

.page-tab {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  min-height: 36px;
  padding: 0 13px;
}

.page-tab.active {
  background: white;
  color: var(--brand-dark);
  box-shadow: 0 1px 4px rgba(30, 45, 39, 0.12);
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 30px clamp(16px, 4vw, 48px) 56px;
}

.hero {
  align-items: end;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) 280px;
  margin: 24px 0 34px;
}

.games-heading {
  align-items: end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 24px 0 30px;
}

.games-heading h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.games-count {
  border-left: 4px solid var(--accent);
  display: grid;
  min-width: 190px;
  padding: 8px 0 8px 16px;
}

.games-count strong {
  font-size: 2rem;
}

.games-count span,
.game-card p,
.game-people small {
  color: var(--muted);
}

.games-heading-actions {
  align-items: stretch;
  display: flex;
  gap: 12px;
}

.games-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.game-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: space-between;
  min-height: 225px;
  padding: 20px;
}

.game-card h2 {
  font-size: 1.45rem;
  margin-bottom: 8px;
}

.bgg-link {
  color: var(--brand-dark);
  display: inline-flex;
  font-size: 0.88rem;
  font-weight: 800;
  margin: -6px 0 16px;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-tag {
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  min-height: 36px;
  padding: 0 12px;
}

.filter-tag.active,
.filter-tag:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.category-tag {
  background: #eef7f5;
  border: 1px solid #c7e5df;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 8px;
}

.editable-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-toggle {
  display: block;
}

.tag-toggle input {
  block-size: 1px;
  inline-size: 1px;
  opacity: 0;
  position: absolute;
}

.tag-toggle span {
  align-items: center;
  background: #eef7f5;
  border: 1px solid #c7e5df;
  border-radius: 999px;
  color: var(--brand-dark);
  display: flex;
  gap: 7px;
  min-height: 34px;
  padding: 5px 10px;
}

.tag-toggle small {
  color: var(--muted);
  font-weight: 700;
}

.tag-toggle input:not(:checked) + span {
  background: #f9e4e4;
  border-color: #edc6c6;
  color: #9c3838;
  text-decoration: line-through;
}

.field-help {
  color: var(--muted);
  font-size: 0.84rem;
  margin: -8px 0 0;
}

.game-people {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.game-people span {
  display: grid;
  gap: 2px;
}

.game-person-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.person-actions {
  display: flex;
  gap: 6px;
}

.eyebrow {
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.3rem, 6vw, 4.7rem);
  line-height: 0.98;
  margin-bottom: 18px;
  max-width: 820px;
}

.hero-text {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
  max-width: 620px;
}

.hero-panel {
  background: #173d38;
  border: 1px solid #245e56;
  border-radius: 8px;
  color: white;
  min-height: 190px;
  padding: 24px;
}

.hero-panel span {
  color: var(--accent);
  display: block;
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
}

.layout {
  align-items: start;
  display: grid;
  gap: 22px;
  grid-template-columns: 330px minmax(0, 1fr);
}

.event-list,
.detail-pane {
  min-width: 0;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 12px;
}

.event-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 16px;
  text-align: left;
  width: 100%;
}

.event-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.event-card.cancelled {
  background: #f5f6f6;
  opacity: 0.8;
}

.event-card.ended {
  background: #f1f3f2;
  border-color: #d4d9d6;
  color: #6f7773;
}

.cancelled-label {
  background: #f9e4e4;
  border-radius: 999px;
  color: #9c3838;
  display: inline-flex;
  font-size: 0.72rem;
  font-style: normal;
  margin-left: 6px;
  padding: 4px 7px;
  vertical-align: middle;
}

.ended-label {
  background: #e4e8e6;
  border-radius: 999px;
  color: #59615d;
  display: inline-flex;
  font-size: 0.72rem;
  font-style: normal;
  margin-left: 6px;
  padding: 4px 7px;
  vertical-align: middle;
}

.mode-label {
  background: #e7f0fa;
  border-radius: 999px;
  color: #245786;
  display: inline-flex;
  font-size: 0.72rem;
  font-style: normal;
  margin-left: 6px;
  padding: 4px 7px;
  vertical-align: middle;
}

.cancelled-banner {
  align-items: center;
  background: #f9e4e4;
  border: 1px solid #edc6c6;
  border-radius: 8px;
  color: #7f2929;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 14px 16px;
}

.ended-banner {
  align-items: center;
  background: #eef0ef;
  border: 1px solid #d4d9d6;
  border-radius: 8px;
  color: #525a56;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 14px 16px;
}

.danger-text {
  color: var(--rose);
}

.event-card span {
  color: var(--brand-dark);
  font-size: 0.85rem;
  font-weight: 800;
}

.event-card strong {
  font-size: 1.05rem;
}

.event-detail,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 30px);
}

.detail-header {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) 150px;
}

.detail-header h2 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.05;
  margin-bottom: 12px;
}

.detail-header p {
  color: var(--muted);
  line-height: 1.6;
}

.seat-meter {
  background: #eef7f5;
  border: 1px solid #c7e5df;
  border-radius: 8px;
  color: var(--brand-dark);
  padding: 18px;
  text-align: center;
}

.seat-meter span {
  display: block;
  font-size: 2.7rem;
  font-weight: 900;
}

.facts {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 24px 0;
}

.facts div {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding-top: 12px;
}

.facts span {
  color: var(--muted);
}

.primary-button,
.secondary-button,
.icon-button {
  border-radius: 8px;
  min-height: 42px;
}

.primary-button {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: white;
  font-weight: 800;
  padding: 0 16px;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.primary-button.danger-button {
  background: var(--rose);
  border-color: var(--rose);
}

.primary-button.danger-button:hover {
  background: #a63f3f;
  border-color: #a63f3f;
}

.secondary-button,
.icon-button {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
  padding: 0 14px;
}

.icon-button {
  width: 42px;
}

.compact {
  min-height: 36px;
}

.attendees {
  border-top: 1px solid var(--line);
  margin-top: 28px;
  padding-top: 22px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 7px 10px;
}

.chip {
  background: #f6efd8;
  color: #6b4c00;
}

.chip.small {
  font-size: 0.78rem;
  padding: 5px 8px;
}

.status.confirmed {
  background: #e7f6ed;
  color: #1f7a45;
}

.status.waitlist {
  background: #fff1d6;
  color: #865900;
}

.status.pending {
  background: #f9e4e4;
  color: #9c3838;
}

.status.declined {
  background: #eceff1;
  color: #59636a;
}

.private-note {
  background: #f7faf9;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 12px;
}

.attendee-table {
  display: grid;
  gap: 10px;
}

.attendee-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1.2fr auto;
  padding: 12px;
}

.attendee-row small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.interest-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1 / -1;
}

.interest-summary {
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 14px 0;
  padding: 14px;
}

.interest-summary h4 {
  margin: 0 0 10px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.mini-button {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.86rem;
  font-weight: 800;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  text-decoration: none;
}

.mini-button:hover {
  border-color: var(--brand);
}

.mini-button.danger {
  color: var(--rose);
}

.toast,
.loading {
  background: #173d38;
  border-radius: 8px;
  color: white;
  font-weight: 800;
  margin-bottom: 16px;
  padding: 12px 14px;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: min(92vw, 520px);
  padding: 0;
}

dialog::backdrop {
  background: rgba(29, 37, 34, 0.48);
}

.modal-form {
  display: grid;
  gap: 16px;
  padding: 24px;
  position: relative;
}

.modal-form.wide {
  max-width: min(92vw, 760px);
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.9rem;
  font-weight: 800;
  gap: 6px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.checkbox-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.checkbox-row input {
  height: 18px;
  min-height: 18px;
  width: 18px;
}

.interest-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 14px;
}

.interest-fieldset legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  padding: 0 6px;
}

.interest-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.interest-option {
  color: var(--ink);
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
}

.interest-option input {
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  position: absolute;
}

.interest-option span {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  min-height: 38px;
  padding: 8px 10px;
}

.interest-option input:checked + span {
  background: #eef7f5;
  border-color: var(--brand);
  color: var(--brand-dark);
}

.close-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.6rem;
  position: absolute;
  right: 12px;
  top: 10px;
}

@media (max-width: 840px) {
  .hero,
  .layout,
  .detail-header,
  .facts,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: 150px;
  }

  .attendee-row {
    grid-template-columns: 1fr;
  }

  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .games-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .games-heading-actions {
    flex-direction: column;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .nav-actions,
  .action-row {
    flex-wrap: wrap;
  }

  .primary-button,
  .secondary-button {
    flex: 1;
  }

  .interest-grid {
    grid-template-columns: 1fr;
  }
}
