:root {
  --paper: #ffffff;
  --ink: #171717;
  --muted: #6f6a64;
  --line: #dfd9d2;
  --soft: #f6f3ef;
  --red: #c81e1e;
  --red-dark: #991b1b;
  --success: #167447;
  --content: 1120px;
  --serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", STSong, SimSun, serif;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.header-inner {
  max-width: var(--content);
  min-height: 76px;
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: auto 1fr minmax(260px, 340px);
  align-items: center;
  gap: 28px;
}

.site-name {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 20px;
}

.site-nav a,
.text-link,
.issue-permalink,
.card-week {
  text-decoration-color: #bab2aa;
  text-underline-offset: 4px;
}

.site-nav a:hover,
.text-link:hover,
.issue-permalink:hover,
.card-week:hover {
  color: var(--red);
}

.site-search {
  display: flex;
}

.site-search input {
  min-width: 0;
  width: 100%;
  padding: 9px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: var(--paper);
}

.site-search button,
.copy-button,
.random-button {
  border: 1px solid var(--red);
  color: #fff;
  background: var(--red);
  cursor: pointer;
  font-weight: 700;
}

.site-search button {
  padding: 9px 15px;
  border-radius: 0 6px 6px 0;
}

.site-search button:hover,
.copy-button:hover,
.random-button:hover {
  border-color: var(--red-dark);
  background: var(--red-dark);
}

.site-search input:focus,
.site-search button:focus-visible,
.copy-button:focus-visible,
.random-button:focus-visible,
select:focus {
  outline: 3px solid rgba(200, 30, 30, 0.2);
  outline-offset: 2px;
}

.page-shell {
  max-width: var(--content);
  min-height: calc(100vh - 165px);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.page-intro {
  margin-bottom: 36px;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 20px 0 24px;
}

.eyebrow,
.sidebar-label {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-intro h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.issue-masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
}

.issue-date-line {
  margin: 13px 0 0;
  color: var(--muted);
}

.issue-date-line time {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.issue-date-line strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.48rem;
  letter-spacing: 0.04em;
}

.random-control {
  flex: 0 0 auto;
  text-align: right;
}

.random-button {
  min-height: 44px;
  padding: 9px 22px;
  border-radius: 4px;
}

.random-button:disabled,
.copy-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.random-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.random-panel {
  margin: -12px 0 32px;
  padding: 20px;
  border: 1px solid var(--ink);
  border-top: 4px solid var(--red);
  background: var(--soft);
}

.random-panel[hidden] {
  display: none;
}

.random-panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.random-panel-heading .eyebrow {
  margin: 0;
}

.random-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.issue-permalink {
  display: inline-block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.entry-list {
  display: grid;
  gap: 24px;
}

.entry-card {
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  box-shadow: 0 5px 18px rgba(39, 31, 24, 0.04);
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 24px;
  margin-bottom: 20px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.category-label {
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.category-label.is-unclassified {
  color: var(--muted);
}

.card-week {
  display: inline-block;
  margin-left: auto;
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 700;
}

.entry-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: clamp(1.05rem, 2.2vw, 1.22rem);
  line-height: 1.85;
}

.v50-keyword,
.manual-keyword {
  color: var(--ink);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(200, 30, 30, 0.45);
  text-decoration-thickness: 0.18em;
  text-underline-offset: 0.12em;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 40px;
  margin-top: 24px;
}

.copy-button {
  min-height: 42px;
  padding: 8px 22px;
  border-radius: 4px;
}

.copy-feedback {
  color: var(--muted);
  font-size: 0.88rem;
}

.copy-feedback.is-success {
  color: var(--success);
}

.copy-feedback.is-error {
  color: var(--red-dark);
}

.context-panel {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.context-panel summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.context-panel p {
  margin: 12px 0;
}

.context-panel a,
.entry-meta a {
  color: var(--red);
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

.menu-section {
  margin: 0 0 34px;
  padding: 24px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  background: var(--soft);
}

.menu-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.menu-section-heading .eyebrow {
  margin-bottom: 3px;
}

.menu-section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
}

.menu-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

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

.menu-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.menu-card-main {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.menu-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.45;
}

.menu-spec,
.menu-conditions {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.menu-price {
  flex: 0 0 auto;
  margin: 0;
  color: var(--red);
  font-family: var(--serif);
  font-size: 1.36rem;
  font-weight: 800;
  white-space: nowrap;
}

.menu-conditions {
  padding: 7px 9px;
  border-left: 3px solid var(--red);
  background: var(--soft);
}

.menu-facts {
  display: grid;
  gap: 5px;
  margin: 15px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
}

.menu-facts div {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 8px;
}

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

.menu-facts dd {
  margin: 0;
}

.menu-source {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.73rem;
}

.menu-source a,
.menu-issue-link {
  color: var(--red);
  text-underline-offset: 3px;
}

.menu-issue-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.86rem;
  font-weight: 700;
}

.menu-pending {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px;
  border: 1px dashed #c8c0b8;
  background: var(--paper);
}

.menu-pending span {
  color: var(--muted);
  font-size: 0.84rem;
}

.menu-archive {
  margin-bottom: 34px;
}

.menu-archive .menu-section {
  margin-bottom: 18px;
}

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

.category-filter {
  display: flex;
  gap: 0;
  margin: -12px 0 32px;
  border-bottom: 1px solid var(--line);
}

.category-filter a {
  position: relative;
  padding: 11px 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.category-filter a:hover,
.category-filter a.is-current {
  color: var(--red);
}

.category-filter a.is-current::after {
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 3px;
  background: var(--red);
  content: "";
}

.week-sidebar {
  position: sticky;
  top: 20px;
}

.week-sidebar ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.week-sidebar a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 12px;
  border-left: 3px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.week-sidebar a:hover,
.week-sidebar a.is-current {
  border-left-color: var(--red);
  color: var(--ink);
  background: var(--soft);
}

.week-sidebar small {
  font-size: 0.72rem;
}

.mobile-week-picker {
  display: none;
}

.empty-state {
  padding: 48px 24px;
  border: 1px dashed #c8c0b8;
  border-radius: 10px;
  text-align: center;
  background: var(--soft);
}

.empty-state h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
}

.compact-empty {
  align-self: start;
}

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

.empty-state .text-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--red);
}

.site-footer {
  padding: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 0.84rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 800px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    gap: 12px 18px;
  }

  .site-nav {
    justify-self: end;
  }

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

  .page-shell {
    padding-top: 30px;
  }

  .issue-masthead {
    align-items: center;
  }

  .archive-layout {
    display: block;
  }

  .menu-list {
    grid-template-columns: 1fr;
  }

  .week-sidebar {
    display: none;
  }

  .mobile-week-picker {
    display: grid;
    gap: 7px;
    margin-bottom: 24px;
  }

  .mobile-week-picker label {
    font-size: 0.84rem;
    font-weight: 700;
  }

  .mobile-week-picker select {
    width: 100%;
    min-height: 46px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    background: var(--paper);
  }
}

@media (max-width: 520px) {
  .header-inner,
  .page-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .site-name {
    font-size: 1.04rem;
  }

  .site-nav {
    gap: 12px;
    font-size: 0.86rem;
  }

  .page-shell {
    padding-top: 20px;
    padding-bottom: 56px;
  }

  .page-intro {
    margin-bottom: 20px;
    padding: 14px 0 18px;
  }

  .page-intro h1 {
    font-size: 2rem;
  }

  .issue-masthead {
    align-items: end;
    gap: 14px;
  }

  .issue-date-line {
    margin-top: 8px;
    font-size: 0.82rem;
  }

  .issue-date-line time {
    gap: 7px;
  }

  .issue-date-line strong {
    font-size: 1.08rem;
  }

  .issue-permalink {
    margin-top: 6px;
    font-size: 0.8rem;
  }

  .random-control {
    max-width: 118px;
  }

  .random-button {
    width: 100%;
    min-height: 44px;
    padding: 8px 13px;
  }

  .random-hint {
    display: none;
  }

  .random-panel {
    margin-top: 0;
    padding: 12px;
  }

  .random-panel-heading {
    display: block;
  }

  .random-status {
    margin-top: 4px;
  }

  .category-filter {
    margin-top: -6px;
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .menu-section {
    margin-bottom: 24px;
    padding: 16px 13px;
  }

  .menu-section-heading {
    align-items: start;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 13px;
  }

  .menu-card {
    padding: 15px 13px;
  }

  .menu-card-main {
    gap: 8px;
  }

  .menu-price {
    font-size: 1.2rem;
  }

  .menu-pending {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .category-filter a {
    flex: 0 0 auto;
    padding: 10px 13px;
  }

  .entry-card {
    padding: 19px 17px;
  }

  .card-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
    padding-bottom: 10px;
  }

  .card-week {
    margin-left: 0;
    font-size: 0.82rem;
  }

  .entry-body {
    font-size: 1.04rem;
    line-height: 1.78;
  }

  .copy-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .copy-button {
    width: 100%;
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
