/* Living Water 问答 */

:root {
  /* Same greys as the rest of the site (src/app/globals.css). */
  --bg: #efefef;
  --panel: #f7f7f7;
  --field: #ffffff;
  --ink: #111111;
  --ink-2: #3b3b3b;
  --muted: #6a6a6a;
  --line: #e0e0e0;
  --chip: #e4e4e4;
  --chip-ink: #4a4a4a;
  --btn: #e4e4e4;
  --btn-hover: #d8d8d8;
  --primary: #111111;
  --primary-ink: #ffffff;
  --stage-top: #f7f7f7;
  --stage-bot: #d2d2d2;
  --card: #ffffff;
  --card-ink: #1b1b1b;
  --card-sub: #8d8d8d;
  --shadow: rgba(0, 0, 0, 0.10);
  --shadow-strong: rgba(0, 0, 0, 0.18);
  --todo-bg: #fff1b8;
  --todo-ink: #5c4600;
  --quote-line: #d0d0d0;
  --focus: #111111;

  --sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --display: "Inter Tight", "Inter", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121212;
    --panel: #1a1a1a;
    --field: #232323;
    --ink: #f2f2f2;
    --ink-2: #cfcfcf;
    --muted: #8d8d8d;
    --line: #262626;
    --chip: #2a2a2a;
    --chip-ink: #c4c4c4;
    --btn: #2a2a2a;
    --btn-hover: #343434;
    --primary: #f2f2f2;
    --primary-ink: #111111;
    --stage-top: #1c1c1c;
    --stage-bot: #0a0a0a;
    --card: #262626;
    --card-ink: #eeeeee;
    --card-sub: #9a9a9a;
    --shadow: rgba(0, 0, 0, 0.45);
    --shadow-strong: rgba(0, 0, 0, 0.6);
    --todo-bg: #4a3c0e;
    --todo-ink: #ffe594;
    --quote-line: #3a3a3a;
    --focus: #f2f2f2;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --panel: #1a1a1a;
  --field: #232323;
  --ink: #f2f2f2;
  --ink-2: #cfcfcf;
  --muted: #8d8d8d;
  --line: #262626;
  --chip: #2a2a2a;
  --chip-ink: #c4c4c4;
  --btn: #2a2a2a;
  --btn-hover: #343434;
  --primary: #f2f2f2;
  --primary-ink: #111111;
  --stage-top: #1c1c1c;
  --stage-bot: #0a0a0a;
  --card: #262626;
  --card-ink: #eeeeee;
  --card-sub: #9a9a9a;
  --shadow: rgba(0, 0, 0, 0.45);
  --shadow-strong: rgba(0, 0, 0, 0.6);
  --todo-bg: #4a3c0e;
  --todo-ink: #ffe594;
  --quote-line: #3a3a3a;
  --focus: #f2f2f2;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ───────── layout ───────── */
.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

/* Top bar: copied from the site (src/app/globals.css .nav / .site-tabs) so it doesn't jump between pages. */
.site-nav { background: var(--bg); }
.site-nav-in {
  max-width: 1180px; margin: 0 auto; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.site-brand {
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none;
  font: 800 18px/1 var(--display); letter-spacing: -0.03em;
}
.site-brand img { display: block; width: auto; height: 44px; }
.site-tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--field); }
.site-tabs a { padding: 7px 15px; border-radius: 999px; text-decoration: none; font-size: 14px; line-height: 1.3; color: var(--muted); white-space: nowrap; }
.site-tabs a:hover { color: var(--ink); }
.site-tabs a[aria-current="page"] { background: var(--primary); color: var(--primary-ink); }
@media (max-width: 640px) { .site-nav-in { padding: 16px 20px; } }
@media (max-width: 400px) { .site-tabs a { padding: 6px 11px; } }
@media (max-width: 374px) { .site-brand span { display: none; } }

.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  min-width: 0;
}

.cats {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 2px;
}
.cats::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 0;
  background: var(--chip);
  color: var(--chip-ink);
  border-radius: 4px;
  padding: 4px 9px;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { background: var(--btn-hover); }
.chip .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.6; }
.chip .sw { width: 7px; height: 7px; border-radius: 2px; background: var(--c); }

.views {
  flex: none;
  display: flex;
  background: var(--chip);
  border-radius: 5px;
  padding: 2px;
}
.views button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
}
.views button[aria-pressed="true"] { background: var(--field); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }

/* ───────── deck view ───────── */
.deck {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
}

.stage {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--stage-top) 0%, var(--stage-bot) 100%);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.stage.dragging { cursor: grabbing; }

.cards {
  position: absolute;
  inset: 0;
  perspective: 900px;
  perspective-origin: 50% 12%;
}

.card {
  position: absolute;
  left: 50%;
  top: 0;
  width: min(360px, calc(100% - 96px));
  height: 72px;
  margin: 0;
  padding: 0 16px 0 14px;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: var(--card-ink);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  transform-origin: 50% 0;
  will-change: transform, opacity;
  backface-visibility: hidden;
  box-shadow: 0 1px 1px var(--shadow), 0 8px 22px var(--shadow);
  cursor: inherit;
}
.card.is-focus { box-shadow: 0 1px 2px var(--shadow), 0 14px 34px var(--shadow-strong); }
.card .mark {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--c);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 600;
}
.card .txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.card .sub {
  font-size: 11px;
  color: var(--card-sub);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.card .q {
  font-size: 13.5px;
  line-height: 1.38;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card.is-focus .q { font-weight: 600; }

.ticks {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tick {
  display: block;
  width: 28px;
  height: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.tick::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: var(--c);
  opacity: 0.55;
  transition: width 0.2s ease, opacity 0.2s ease;
}
.tick:hover::before { opacity: 1; width: 14px; }
.tick.on::before { width: 22px; opacity: 1; background: var(--ink); }

.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
  z-index: 5000;
}

/* ───────── panel ───────── */
.panel {
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
}
.panel-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 0;
}
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.arrows { display: flex; gap: 6px; }
.sq {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 3px;
  background: var(--btn);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.sq:hover { background: var(--btn-hover); }
.sq:disabled { opacity: 0.4; cursor: default; }
.sq svg { width: 14px; height: 14px; fill: none; stroke: var(--ink-2); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 24px;
}
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block;
  background: var(--chip);
  color: var(--chip-ink);
  border-radius: 3px;
  padding: 2px 7px;
  font-size: 11.5px;
}
.tag.draft { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }

.pre {
  margin: 14px 0 0;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--quote-line);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-line;
}
.question {
  margin: 12px 0 0;
  font-size: 19px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.note { margin: 8px 0 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.75; }
.asker {
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.asker .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--c, var(--muted)); opacity: 0.85; }

.answer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
  max-width: 38em;
}
.answer p { margin: 0 0 14px; }
.answer ul { margin: 0 0 14px; padding-left: 1.2em; }
.answer li { margin: 0 0 6px; }
.answer li::marker { color: var(--muted); }
.answer blockquote {
  margin: 0 0 14px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--quote-line);
  color: var(--ink-2);
}
.answer cite { font-style: normal; color: var(--muted); font-size: 13px; white-space: nowrap; }
.answer > :last-child { margin-bottom: 0; }
.answer .empty { color: var(--muted); }
mark.todo {
  background: var(--todo-bg);
  color: var(--todo-ink);
  border-radius: 2px;
  padding: 1px 4px;
  font-size: 0.92em;
}

.panel-foot { flex: none; padding: 12px 20px 18px; border-top: 1px solid var(--line); }
.primary {
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.primary:hover { opacity: 0.88; }

/* ───────── list view ───────── */
.list {
  min-height: 0;
  overflow-y: auto;
  padding-block: 36px 64px;
  padding-inline: 20px;
}
.list-inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 40px; }
.list-intro { margin: 0; color: var(--muted); font-size: 13px; }
.group h2 {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}
.group h2 .mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--c);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.group h2 .n { color: var(--muted); font-weight: 400; font-size: 12px; font-variant-numeric: tabular-nums; }
.group details { border-top: 1px solid var(--line); }
.group details:last-child { border-bottom: 1px solid var(--line); }
.group summary {
  list-style: none;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  gap: 8px;
  align-items: baseline;
  padding: 13px 0;
  cursor: pointer;
  font-size: 14.5px;
  line-height: 1.6;
}
.group summary::-webkit-details-marker { display: none; }
.group summary .num { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.group summary .pm { color: var(--muted); font-size: 14px; text-align: right; }
.group details[open] summary .pm { transform: rotate(45deg); }
.group details[open] summary .qq { font-weight: 600; }
.group .body { padding: 0 0 22px 38px; }
.group .body .note, .group .body .pre { margin: 0 0 12px; }
.group .body .answer { margin-top: 0; padding-top: 0; border-top: 0; }
.list-foot { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ───────── narrow screens ───────── */
@media (max-width: 820px) {
  html, body { height: auto; }
  .app { height: auto; display: block; }
  .top { gap: 10px; padding: 10px 16px; }
  .deck { display: block; }
  .stage { height: min(62svh, 560px); min-height: 400px; }
  .card { width: min(340px, calc(100% - 72px)); }
  .ticks { left: 10px; }
  .tick { width: 18px; height: 7px; }
  .tick::before { top: 3px; width: 7px; }
  .tick.on::before { width: 14px; }
  .panel { border-left: 0; }
  .panel-top { padding: 16px 16px 0; }
  .panel-body { overflow: visible; padding: 16px 16px 20px; }
  .panel-foot { padding: 12px 16px 20px; }
  .list { padding-block: 24px 48px; padding-inline: 16px; }
  .group .body { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tick::before { transition: none; }
}
