:root {
  color-scheme: dark;
  --bg: #12161c;
  --panel: #1b212b;
  --panel-2: #232b36;
  --text: #e8eef6;
  --muted: #93a0b0;
  --line: #313a46;
  --accent: #8eb6ff;
  --accent-ink: #10141a;
  --danger: #ffb4b0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button, input { font: inherit; color: inherit; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 28px 32px 12px;
}

h1 { margin: 0; font-size: 32px; font-weight: 500; letter-spacing: -0.03em; }

.muted, .hint { color: var(--muted); }

.search input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.sessions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(420px, 100%);
}
.sessions[hidden] { display: none; }
.sessions ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-height: 168px;
  overflow: auto;
}
.sessions li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
}

button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
}
button:hover { border-color: var(--accent); }
button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button[aria-pressed="true"] .meta,
button[aria-pressed="true"] .excerpt { color: inherit; }
button[aria-pressed="true"] .tag { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }

.message { min-height: 1.2em; margin: 0 32px 8px; color: var(--danger); font-family: ui-sans-serif, system-ui, sans-serif; }
.hint { margin: 6px 0 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 20px;
  padding: 8px 32px 40px;
}

.tools { margin-bottom: 14px; }
.search input { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.card {
  text-align: left;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--panel);
  display: block;
  width: 100%;
}
.card strong { display: block; font-size: 17px; }
.meta, .excerpt { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; }
.meta { color: var(--muted); margin-top: 4px; }
.excerpt { margin: 8px 0 0; color: var(--text); }
.tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--panel-2);
}

.detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.detail h2 { margin: 0 0 8px; font-size: 24px; }
.detail a { color: var(--accent); }
.detail pre {
  white-space: pre-wrap;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
.detail .block { margin-top: 16px; }
.detail h3 { margin: 0 0 6px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

.more { margin-top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 800px) {
  .top, .layout { padding-left: 16px; padding-right: 16px; }
  .top { flex-direction: column; align-items: stretch; }
  .sessions { align-items: stretch; }
  .layout { grid-template-columns: 1fr; }
  .detail { position: static; max-height: none; }
  .message { margin-left: 16px; margin-right: 16px; }
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f1ea;
    --panel: #fffdf8;
    --panel-2: #ece6da;
    --text: #1c1915;
    --muted: #5e584f;
    --line: #ddd4c6;
    --accent: #2457c5;
    --accent-ink: #fff;
    --danger: #9d1c1c;
  }
}
