:root {
  --paper: #f2eee5;
  --paper-deep: #e8e0d1;
  --ink: #172525;
  --muted: #5e6b68;
  --line: rgba(23, 37, 37, 0.17);
  --teal: #155f5a;
  --teal-soft: #c9ddd6;
  --coral: #e36f52;
  --white: #fffdf8;
  --shadow: 0 22px 55px rgba(28, 48, 45, 0.09);
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 86% -10%, rgba(227, 111, 82, 0.18), transparent 34rem),
    linear-gradient(180deg, var(--paper) 0, #f8f5ee 38rem, var(--paper) 100%);
}

button, input, select { font: inherit; }

button, select { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  color: var(--white);
  background: var(--ink);
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.local-preview-banner {
  padding: 0.6rem 1rem;
  text-align: center;
  font-size: 0.83rem;
  font-weight: 700;
  color: #4b2018;
  background: #ffd8ca;
  border-bottom: 1px solid rgba(75, 32, 24, 0.2);
}

.masthead,
main,
footer {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  min-height: 22rem;
  padding: 4rem 0 3.2rem;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.section-index {
  margin: 0 0 0.75rem;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

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

h1 {
  max-width: 8ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.3rem, 15vw, 10rem);
  font-weight: 500;
  letter-spacing: -0.08em;
  line-height: 0.78;
}

.lede {
  max-width: 34rem;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.7;
}

.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto;
  padding: 0.65rem 0.9rem;
  color: var(--teal);
  background: rgba(255, 253, 248, 0.7);
  border: 1px solid var(--line);
  border-radius: 99rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.privacy-chip span {
  width: 0.55rem;
  height: 0.55rem;
  background: var(--coral);
  border-radius: 50%;
}

.status-panel,
.empty-state {
  margin: 3rem 0;
  padding: 3rem;
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: var(--shadow);
}

.status-panel[data-state="error"] { border-color: rgba(227, 111, 82, 0.65); }

.status-kicker {
  margin: 0 0 0.5rem;
  color: var(--teal);
  font-weight: 800;
}

.status-panel p:last-child,
.empty-state p:last-child { margin-bottom: 0; color: var(--muted); }

.app-content > section { padding: 5.25rem 0; border-bottom: 1px solid var(--line); }

.overview {
  display: grid;
  grid-template-columns: minmax(15rem, 0.8fr) 2fr;
  gap: 3rem;
  align-items: start;
}

h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 5vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 0;
}

.overview-grid div {
  min-height: 10rem;
  padding: 1.35rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.overview-grid dt { color: var(--muted); font-size: 0.86rem; }

.overview-grid dd {
  margin: 1.3rem 0 0;
  color: var(--teal);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 6vw, 4.5rem);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.result-count { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.filter-panel {
  display: grid;
  grid-template-columns: minmax(13rem, 1.35fr) 2fr auto;
  gap: 1rem;
  align-items: end;
  padding: 1.25rem;
  background: var(--teal);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
}

.filter-panel label { display: grid; gap: 0.45rem; }

.filter-panel label > span {
  color: rgba(255, 253, 248, 0.78);
  font-size: 0.78rem;
  font-weight: 700;
}

.filter-panel input,
.filter-panel select {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.68rem 0.75rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid transparent;
  border-radius: 0.62rem;
}

.select-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }

.quiet-button {
  min-height: 2.85rem;
  padding: 0.65rem 1rem;
  color: var(--ink);
  background: var(--paper-deep);
  border: 1px solid rgba(23, 37, 37, 0.2);
  border-radius: 0.62rem;
  font-weight: 700;
}

.quiet-button:hover { background: var(--teal-soft); }

.track-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 2rem 0 0;
  padding: 1px;
  list-style: none;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  overflow: hidden;
}

.track-card {
  min-width: 0;
  padding: 1.4rem;
  background: var(--white);
}

.track-number { margin: 0 0 2.3rem; color: var(--coral); font-size: 0.78rem; font-weight: 800; }

.track-title { margin: 0; font-size: 1.2rem; line-height: 1.35; }

.track-artist { margin: 0.45rem 0 0; color: var(--teal); font-weight: 750; }

.track-meta { margin: 0.65rem 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1.2rem 0 0; padding: 0; list-style: none; }

.tag-list li {
  padding: 0.28rem 0.55rem;
  color: var(--teal);
  background: #e3eee8;
  border-radius: 99rem;
  font-size: 0.75rem;
}

.empty-state { box-shadow: none; }

.empty-mark { margin: 0; color: var(--coral); font: 3rem Georgia, serif; }

.empty-state h3 { margin: 0.7rem 0 0; font-size: 1.25rem; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.4rem;
}

.pagination[hidden] { display: none; }

.pagination p { min-width: 8rem; text-align: center; color: var(--muted); }

.pagination button:disabled { cursor: not-allowed; opacity: 0.5; }

.scope-note {
  max-width: 52rem;
  margin: 0 0 2.4rem;
  color: var(--muted);
  line-height: 1.75;
}

.trend-list { display: grid; gap: 1rem; }

.trend-card {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.trend-month { margin: 0; font: 1.55rem Georgia, serif; }

.trend-coverage { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

.trend-bars { display: grid; gap: 0.8rem; }

.trend-row { display: grid; grid-template-columns: minmax(6rem, 9rem) 1fr 4.5rem; gap: 0.75rem; align-items: center; }

.trend-label, .trend-value { font-size: 0.84rem; }

.trend-value { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.trend-progress {
  width: 100%;
  height: 0.62rem;
  appearance: none;
  color: var(--coral);
  background: var(--paper-deep);
  border: 0;
  border-radius: 99rem;
  overflow: hidden;
}

.trend-progress::-webkit-progress-bar { background: var(--paper-deep); }
.trend-progress::-webkit-progress-value { background: var(--coral); border-radius: 99rem; }
.trend-progress::-moz-progress-bar { background: var(--coral); border-radius: 99rem; }

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

footer { padding: 2.2rem 0 3.5rem; color: var(--muted); font-size: 0.78rem; }

@media (max-width: 860px) {
  .masthead { min-height: 18rem; }
  .overview { grid-template-columns: 1fr; }
  .filter-panel { grid-template-columns: 1fr; }
  .select-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quiet-button { width: 100%; }
}

@media (max-width: 600px) {
  .masthead { align-items: start; flex-direction: column; justify-content: end; gap: 2rem; padding-top: 3rem; }
  .privacy-chip { align-self: start; }
  .app-content > section { padding: 3.7rem 0; }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-grid div { min-height: auto; }
  .overview-grid dd { margin-top: 0.4rem; }
  .section-heading { align-items: start; flex-direction: column; gap: 0.75rem; }
  .select-grid { grid-template-columns: 1fr; }
  .track-list { grid-template-columns: 1fr; }
  .trend-card { grid-template-columns: 1fr; }
  .trend-row { grid-template-columns: minmax(5rem, 7rem) 1fr 3.8rem; gap: 0.5rem; }
  .status-panel, .empty-state { padding: 2rem 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* v0.16: compact private listening records. */
body {
  background: #f6f4ef;
}

.compact-header,
.compact-main {
  width: min(46rem, calc(100% - 1.5rem));
  margin-inline: auto;
}

.compact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.compact-header h1 {
  max-width: none;
  margin: 0;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
}

.compact-header span {
  color: var(--muted);
  font-size: 0.75rem;
}

.compact-main {
  padding: 0.8rem 0 2rem;
}

.compact-main .status-panel,
.compact-main .empty-state {
  margin: 1rem 0;
  padding: 1.25rem;
  border-radius: 0.8rem;
  box-shadow: none;
}

.top-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  position: sticky;
  z-index: 5;
  top: 0;
  margin-bottom: 0.8rem;
  padding: 0.25rem;
  background: rgba(246, 244, 239, 0.96);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.top-tabs button {
  min-height: 2.6rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0.55rem;
  font-weight: 750;
}

.top-tabs button[aria-selected="true"] {
  color: var(--white);
  background: var(--teal);
}

[role="tabpanel"][hidden],
.empty-state[hidden] {
  display: none;
}

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

.record-search input {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.72rem 0.85rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

.compact-count {
  margin: 0.65rem 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.records-list,
.changes-list,
.release-list,
.session-list {
  display: grid;
  gap: 0.55rem;
}

.year-fold,
.month-fold,
.release-fold,
.layer-fold,
.highlight-fold,
.change-month-fold {
  min-width: 0;
}

.fold-toggle {
  position: relative;
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0 0 1.1rem;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.fold-toggle:focus-visible {
  outline-offset: -3px;
}

.fold-toggle::before {
  position: absolute;
  top: 50%;
  left: 0.15rem;
  content: "›";
  transform: translateY(-50%);
  transform-origin: center;
}

.fold-toggle[aria-expanded="true"]::before {
  transform: translateY(-50%) rotate(90deg);
}

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

.year-fold > .fold-toggle {
  padding: 0.7rem 0 0.7rem 1.2rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.month-fold {
  margin-left: 0.35rem;
  border-left: 2px solid var(--teal-soft);
}

.month-fold > .fold-toggle {
  padding: 0.55rem 0.7rem 0.55rem 1.7rem;
  color: var(--teal);
  font-size: 0.86rem;
  font-weight: 750;
}

.month-fold > .fold-panel > .release-list {
  padding: 0 0 0.35rem 0.6rem;
}

.release-fold,
.change-month-fold {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  overflow: hidden;
}

.release-fold > .fold-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.75rem 0.75rem 0.75rem 1.7rem;
}

.cover-thumb {
  width: 3.25rem;
  height: 3.25rem;
  object-fit: cover;
  border-radius: 0.3rem;
}

.release-identity,
.release-compact-meta {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}

.release-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.release-artist,
.captured-date,
.layer-status,
.change-count {
  color: var(--muted);
  font-size: 0.75rem;
}

.release-compact-meta {
  justify-items: end;
}

.stance {
  width: fit-content;
  padding: 0.15rem 0.42rem;
  border-radius: 99rem;
  color: var(--teal);
  background: #e3eee8;
  font-size: 0.7rem;
  font-weight: 750;
}

.stance-negative { color: #812f22; background: #fae3dc; }
.stance-mixed { color: #6c4b00; background: #f6eac8; }
.stance-unclear { color: var(--muted); background: #eceae4; }

.session-list {
  padding: 0 0.75rem 0.75rem;
}

.session-card {
  padding: 0.8rem;
  background: #f8f6f1;
  border-radius: 0.6rem;
}

.session-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.original-note,
.structured-note,
.change-month-fold section {
  margin: 0.75rem 0 0;
}

.note-label,
.change-heading,
.claim-kind,
.taste-kind {
  margin: 0;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
}

.note-text,
.layer-text {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.6;
}

.criterion-list,
.stance-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.criterion-list li,
.stance-counts li {
  padding: 0.25rem 0.45rem;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 0.35rem;
  font-size: 0.72rem;
}

.layer-fold,
.highlight-fold {
  margin-top: 0.6rem;
  padding: 0.55rem 0.65rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.layer-fold > .fold-toggle,
.highlight-fold > .fold-toggle {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 750;
}

.plain-list {
  display: grid;
  gap: 0.6rem;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.plain-list li + li {
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}

.highlight-fold > .fold-toggle {
  display: flex;
  gap: 0.45rem;
}

.highlight-label {
  color: var(--coral);
}

.change-month-fold > .fold-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.85rem 0.85rem 1.7rem;
}

.change-month-fold > .fold-panel > section {
  padding: 0 0.85rem 0.85rem;
}

@media (max-width: 420px) {
  .compact-header,
  .compact-main {
    width: min(100% - 1rem, 46rem);
  }

  .release-fold > .fold-toggle {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .release-compact-meta {
    grid-column: 2;
    justify-items: start;
  }
}
