:root {
  color-scheme: light;
  --paper: #f4efe4;
  --card: #fffaf3;
  --ink: #1d1814;
  --muted: #5e5348;
  --line: #e0d3c2;
  --stamp: #c4452d;
  --stamp-ink: #fff8f3;
  --creator: #c4452d;
  --builder: #2a4a78;
  --hub: #2f6a4a;
  --high: #1e6b42;
  --medium: #8a5a12;
  --low: #6d655c;
  --margin: #e7b4b0;
  --focus: #1d1814;
  --shadow: 0 1px 0 rgba(28, 23, 18, 0.04), 0 16px 40px rgba(90, 55, 20, 0.06);
  --sans: "Noto Sans CJK JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif CJK JP", "Noto Serif CJK", serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #14110e;
    --card: #221c17;
    --ink: #f3ecdf;
    --muted: #cbbba8;
    --line: #3a322a;
    --stamp: #e36a52;
    --stamp-ink: #1a100e;
    --creator: #e36a52;
    --builder: #a9c0e4;
    --hub: #8fbf9f;
    --high: #7dcea0;
    --medium: #e2b56a;
    --low: #b3a89c;
    --margin: #6a3a38;
    --focus: #f3ecdf;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #14110e;
  --card: #221c17;
  --ink: #f3ecdf;
  --muted: #cbbba8;
  --line: #3a322a;
  --stamp: #e36a52;
  --stamp-ink: #1a100e;
  --creator: #e36a52;
  --builder: #a9c0e4;
  --hub: #8fbf9f;
  --high: #7dcea0;
  --medium: #e2b56a;
  --low: #b3a89c;
  --margin: #6a3a38;
  --focus: #f3ecdf;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 72px 28px;
  border-left: 2px solid var(--margin);
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 2;
}

.skip:focus { top: 12px; }

.kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
  margin-top: 8px;
}

.brand img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex: none;
}

#theme { white-space: nowrap; flex: none; }

.kicker {
  margin: 0;
  color: var(--stamp);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 4.2vw, 2.55rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  white-space: nowrap;
}

.lede {
  margin: 12px 0 20px;
  max-width: 40rem;
  color: var(--muted);
}

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

.search input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
}

.search input::placeholder { color: var(--muted); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 12px;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

button, .open {
  font: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.seg button, .toolbar button, .star, .ghost, .open {
  border-radius: 999px;
  min-height: 40px;
}

.seg button, .toolbar button, .ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 6px 12px;
}

.seg button[aria-checked="true"], #list-only[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.status {
  min-height: 1.4em;
  margin: 16px 0 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 14px;
  align-items: start;
  padding: 14px 8px;
  margin: 0 -8px;
  border-bottom: 1px solid var(--line);
  border-radius: 12px;
}

@media (hover: hover) {
  .row:hover { background: color-mix(in srgb, var(--line) 42%, transparent); }
}

.star {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  padding: 0;
}

.star[aria-pressed="true"] {
  background: var(--stamp);
  border-color: var(--stamp);
  color: var(--stamp-ink);
}

.who h2 {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin: 2px 0 4px;
  font-size: 1rem;
  font-weight: 650;
}

.handle { overflow-wrap: anywhere; }

.name {
  color: var(--muted);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.focus {
  margin: 0;
  overflow-wrap: anywhere;
}

.focus.clamp:not(.is-open) {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--creator);
  display: inline-block;
}

.dot.ugc { background: var(--builder); }
.dot.hub { background: var(--hub); }

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.high { color: var(--high); }
.badge.medium { color: var(--medium); }
.badge.low { color: var(--low); }

.source {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caveat {
  margin: 8px 0 0;
  color: var(--stamp);
  font-size: 0.88rem;
}

.actions {
  display: flex;
  gap: 8px;
}

.ghost, .open {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 0 12px;
  border-radius: 10px;
  min-height: 40px;
}

.open {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
}

.more {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--stamp);
  font: inherit;
  font-weight: 650;
  min-height: 32px;
  cursor: pointer;
}

.empty {
  padding: 28px 0;
  color: var(--muted);
}

footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.88rem;
}

footer p { margin: 0 0 8px; }

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

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

button { position: relative; }
.open { position: relative; }

@media (max-width: 640px) {
  .page { padding: 20px 14px 56px 18px; }
  .row { grid-template-columns: auto 1fr; }
  .actions { grid-column: 2; }
  .source { max-width: none; white-space: normal; }
  .brand img { width: 44px; height: 44px; }
}
