:root {
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --soft: #fafafa;
  --blue: #225a96;
  --blue-bg: #eaf1f8;
  --amber: #8a5a00;
  --amber-bg: #fbf2df;
  --gray-bg: #f0f0f0;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: #000;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(100% - 40px, 960px);
  margin: 0 auto;
}

.site {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.header-inner {
  display: flex;
  height: 62px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
}

.brand-name {
  font-size: 19px;
  letter-spacing: 0.04em;
}

.brand-section {
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.main {
  flex: 1;
  padding: 32px 0 60px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.date-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #cfcfcf;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
}

.button:hover {
  border-color: var(--text);
  color: var(--text);
}

.button-plain {
  border-color: transparent;
  color: var(--muted);
}

.button-plain:hover {
  border-color: var(--line);
  color: var(--text);
}

.date-input,
.select,
.search {
  height: 34px;
  padding: 0 9px;
  border: 1px solid #cfcfcf;
  border-radius: 4px;
  outline: none;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
}

.date-input:focus,
.select:focus,
.search:focus {
  border-color: var(--text);
}

.date-input {
  min-width: 138px;
}

.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.tab {
  padding: 6px 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.3;
}

.tab:hover {
  color: var(--text);
  background: var(--soft);
}

.tab.active {
  background: var(--text);
  color: #fff;
}

.tab-count {
  margin-left: 3px;
  font-size: 10.5px;
  opacity: 0.65;
}

.filter-fields {
  display: flex;
  align-items: center;
  gap: 7px;
}

.select {
  min-width: 110px;
}

.search {
  width: 220px;
}

.result-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin: 11px 0 7px;
  color: var(--muted);
  font-size: 12px;
}

.result-note {
  margin-left: 12px;
  color: var(--amber);
}

.event-list {
  border-top: 1px solid var(--line);
}

.event-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 16px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line);
}

.event-row:hover {
  background: var(--soft);
  color: var(--text);
}

.event-time {
  color: #555;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.event-body {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.event-title {
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.separator {
  margin: 0 5px;
  color: #b5b5b5;
}

.status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 11px;
  white-space: nowrap;
}

.status-upcoming {
  color: var(--blue);
  background: var(--blue-bg);
}

.status-reviewing {
  color: var(--amber);
  background: var(--amber-bg);
}

.status-ended {
  color: #666;
  background: var(--gray-bg);
}

.row-arrow {
  color: #aaa;
  font-size: 14px;
  text-align: right;
}

.state {
  padding: 58px 0;
  color: var(--muted);
  text-align: center;
  font-size: 13.5px;
}

.state p {
  margin: 0;
}

.state .button {
  margin-top: 14px;
}

.back-line {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12.5px;
}

.back-line a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.detail {
  max-width: 780px;
}

.detail-head {
  margin-bottom: 24px;
}

.detail-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.category {
  color: var(--muted);
  font-size: 12px;
}

.detail-head h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.info-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.info-list > div {
  padding: 12px 16px 12px 0;
}

.info-list > div:nth-child(even) {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.info-list > div:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.info-list dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.info-list dd {
  margin: 0;
  font-size: 14px;
}

.detail-section {
  margin: 27px 0;
}

.detail-section h2 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
}

.conditions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0 24px;
  margin: 0;
  border-top: 1px solid var(--line);
}

.conditions > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.conditions dt {
  min-width: 56px;
  color: var(--muted);
  font-size: 12px;
}

.conditions dd {
  margin: 0;
  font-size: 13.5px;
}

.description {
  margin: 0;
  color: #333;
  font-size: 15px;
  line-height: 1.9;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: #999;
  font-size: 11.5px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 0;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .container {
    width: calc(100% - 28px);
  }

  .header-inner {
    height: 56px;
  }

  .brand-section {
    display: none;
  }

  .main {
    padding: 24px 0 44px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .page-head h1 {
    font-size: 26px;
  }

  .date-nav {
    width: 100%;
  }

  .date-nav .date-input {
    flex: 1;
    min-width: 120px;
  }

  .filters {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .filter-fields {
    width: 100%;
  }

  .filter-fields .select {
    flex: 0 0 42%;
    min-width: 0;
  }

  .filter-fields .search {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .event-row {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px 0;
  }

  .event-title {
    font-size: 15px;
  }

  .event-meta {
    font-size: 12px;
  }

  .row-arrow {
    display: none;
  }

  .detail-head h1 {
    font-size: 26px;
  }

  .info-list {
    grid-template-columns: 1fr;
  }

  .info-list > div,
  .info-list > div:nth-child(even) {
    padding: 10px 0;
    border-left: 0;
  }

  .info-list > div:nth-child(n + 2) {
    border-top: 1px solid var(--line);
  }

  .info-list > div:nth-child(2) {
    border-top: 1px solid var(--line);
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 14px 0;
  }
}

/* Flask forms */
form {
  margin: 0;
}

.date-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-filter {
  display: flex;
  align-items: center;
  gap: 7px;
}

.inline-filter .select {
  flex: 0 0 auto;
}

.inline-filter .search {
  width: 220px;
}

.tab {
  display: inline-flex;
  align-items: center;
}

@media (max-width: 720px) {
  .date-nav .date-form {
    flex: 1;
    min-width: 0;
  }

  .date-nav .date-form .date-input {
    width: 100%;
  }

  .inline-filter {
    width: 100%;
  }

  .inline-filter .select {
    flex: 0 0 42%;
    min-width: 0;
  }

  .inline-filter .search {
    flex: 1;
    width: auto;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .date-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .date-nav .date-form {
    order: -1;
    flex: 0 0 100%;
    width: 100%;
  }

  .date-nav .date-form .date-input {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .date-nav > .button {
    flex: 1;
    min-width: 0;
  }

  .inline-filter {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .inline-filter .select {
    flex: 1 1 100%;
    width: 100%;
  }

  .inline-filter .search {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .inline-filter .button {
    flex: 0 0 auto;
  }
}

/* Overview */
.site-nav a.active {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.overview-group {
  margin-top: 22px;
}

.overview-date {
  margin: 0 0 6px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

@media (max-width: 720px) {
  .site-nav {
    gap: 10px;
  }
}
