:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1f2528;
  --muted: #657177;
  --line: #d9ddd7;
  --accent: #1f6f78;
  --accent-2: #7b4d2d;
  --soft: #e8f1ef;
  --soft-2: #f2e8df;
  --shadow: 0 8px 24px rgba(31, 37, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

body.is-locked {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(246, 245, 241, 0.92), rgba(246, 245, 241, 0.92)),
    radial-gradient(circle at top left, rgba(31, 111, 120, 0.16), transparent 36%),
    radial-gradient(circle at bottom right, rgba(123, 77, 45, 0.16), transparent 34%);
  backdrop-filter: blur(10px);
}

.gate[hidden] {
  display: none;
}

.gate__panel {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.gate__panel h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.05;
}

.gate__text {
  margin: 12px 0 0;
  color: var(--muted);
}

.gate__form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.field--pin {
  grid-template-columns: 64px 1fr;
}

.gate__button {
  min-height: 48px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.gate__error {
  margin: 12px 0 0;
  color: #9d2d2d;
  font-size: 0.9rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 245, 241, 0.96);
  backdrop-filter: blur(16px);
}

.topbar__inner {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 28px 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 560px;
}

.stat {
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px 10px;
  text-align: right;
}

.stat strong {
  display: block;
  font-size: 1.1rem;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 0.78rem;
}

.controls {
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr) minmax(110px, 0.6fr) minmax(220px, 1.4fr) minmax(130px, 0.7fr);
  gap: 10px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 28px 18px;
}

.switch,
.field {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  white-space: nowrap;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.field {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  overflow: hidden;
}

.field span {
  padding-left: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: 0;
  padding: 0 12px 0 8px;
}

.field--search {
  grid-template-columns: 58px 1fr;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

.sidebar {
  position: sticky;
  top: 146px;
  align-self: start;
}

.sidebar h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.yearnav {
  display: grid;
  gap: 8px;
}

.yearnav button,
.resultbar button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.yearnav button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 9px 11px;
  text-align: left;
}

.yearnav button.is-active {
  border-color: var(--accent);
  background: var(--soft);
}

.sourcebox {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.sourcebox p {
  margin: 0 0 8px;
}

.resultbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.halfyears {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}

.halfyear-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.halfyear-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.halfyear-card__title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}

.halfyear-card__text {
  margin: 10px 0 14px;
  color: var(--ink);
}

.halfyear-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.halfyear-card__link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--accent);
  text-decoration: none;
}

.halfyear-card__count {
  color: var(--muted);
  font-size: 0.84rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 700;
}

.tag--open {
  background: var(--soft-2);
}

.resultbar p {
  margin: 0;
  color: var(--muted);
}

.resultbar button {
  padding: 8px 12px;
}

.timeline {
  display: grid;
  gap: 18px;
}

.month {
  margin: 14px 0 0 54px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.entry {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 18px;
}

.entry__marker {
  position: relative;
}

.entry__marker::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 11px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.entry__marker::after {
  content: "";
  position: absolute;
  top: 28px;
  bottom: -24px;
  left: 15px;
  width: 1px;
  background: var(--line);
}

.entry__body {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.badge {
  border-radius: 999px;
  padding: 2px 9px;
  color: var(--ink);
  font-weight: 700;
}

.badge--news {
  background: var(--soft);
}

.badge--chat {
  background: var(--soft-2);
}

.entry h3 {
  margin: 9px 0 8px;
  font-size: 1.28rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.details dt {
  font-weight: 700;
}

.details dd {
  margin: 0;
  min-width: 0;
}

.text p {
  margin: 0 0 10px;
  white-space: pre-wrap;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.attachment {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.photo {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f8f6;
}

.photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #ececea;
}

.photo a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--accent);
  font-size: 0.86rem;
  text-decoration: none;
}

.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .topbar {
    position: static;
  }

  .topbar__inner,
  .layout {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar__inner,
  .resultbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stats {
    justify-content: flex-start;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
    padding-left: 18px;
    padding-right: 18px;
  }

  .field--search {
    grid-column: 1 / -1;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .sidebar {
    position: static;
  }

  .yearnav {
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  }

  .month {
    margin-left: 0;
  }
}

@media (max-width: 620px) {
  .controls {
    grid-template-columns: 1fr;
  }

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

  .entry__marker {
    display: none;
  }

  .entry__body {
    padding: 14px;
  }

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