/* ===== DESIGN TOKENS ===== */
:root {
  --bg: #f5f4f0;
  --bg-card: #ffffff;
  --bg-secondary: #eeede9;
  --bg-blur: rgba(245, 244, 240, 0.94);
  --text: #0e0e0e;
  --text-muted: #6e6e6e;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.13);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.07), 0 4px 18px rgba(0,0,0,0.05);
  --shadow-sheet: 0 -6px 40px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --header-h: 65px;
  --tabs-h: 49px;
  --transition: 0.18s ease;
  --font: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

[data-theme="dark"] {
  --bg: #0b0b0b;
  --bg-card: #1a1a1a;
  --bg-secondary: #252525;
  --bg-blur: rgba(11, 11, 11, 0.95);
  --text: #ebebeb;
  --text-muted: #8a8a8a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.5), 0 4px 18px rgba(0,0,0,0.35);
  --shadow-sheet: 0 -6px 40px rgba(0,0,0,0.55);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  transition: background var(--transition), color var(--transition);
}

button { font-family: var(--font); cursor: pointer; border: none; background: none; }
a { text-decoration: none; color: inherit; }
svg { display: block; flex-shrink: 0; }

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== APP SHELL ===== */
.app-shell { max-width: 640px; margin: 0 auto; min-height: 100dvh; }

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: var(--bg-blur);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
  max-width: 640px;
  margin: 0 auto;
}

.logo {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.demo-badge {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  text-transform: uppercase;
  vertical-align: middle;
}
.takedown-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.takedown-form { display: flex; flex-direction: column; gap: 8px; }
.takedown-textarea { resize: vertical; min-height: 70px; font-family: inherit; font-size: 0.9rem; }
.takedown-status { font-size: 0.82rem; margin-top: 4px; text-align: center; }
.takedown-status.success { color: #4caf50; }
.takedown-status.error { color: #e53935; }

.header-actions { display: flex; align-items: center; gap: 2px; }

/* ===== ICON BUTTON ===== */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover { background: var(--bg-secondary); }
.icon-btn.active { color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ===== TABS ===== */
.tabs {
  position: sticky;
  top: var(--header-h);
  z-index: 39;
  display: flex;
  height: var(--tabs-h);
  background: var(--bg-blur);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  max-width: 640px;
  margin: 0 auto;
  transition: background var(--transition);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.tab.active { color: var(--text); border-bottom-color: var(--text); }

/* ===== MAIN FEED ===== */
.main { padding: 20px 16px 100px; max-width: 640px; margin: 0 auto; }

/* ===== FEED LIST ===== */
.feed-list { display: flex; flex-direction: column; gap: 12px; }

/* ===== CARD ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.card:active { transform: scale(0.988); box-shadow: none; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-meta-left { display: flex; align-items: center; gap: 8px; }
.card-actions { display: flex; align-items: center; }
.card-action { color: var(--text-muted); }
.card-action.active { color: var(--text); }

.card-body { margin-bottom: 14px; }

.card-headline {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.7;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-footer { display: flex; align-items: center; gap: 6px; padding-top: 4px; }
.card-model-badge { margin-left: auto; font-size: 0.65rem; color: var(--text-muted); opacity: 0.6; flex-shrink: 0; }

.card-cached-dot {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.6;
  line-height: 1;
}

.card-attribution {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  flex-wrap: nowrap;
}

.card-attr-author {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.card-attr-sep {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.5;
  flex-shrink: 0;
}

.card-attr-book {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 2;
}

.card-attr-era {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ===== FLAG CIRCLE ===== */
.flag-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--border-strong);
  background: var(--bg-secondary);
}

.flag-circle img {
  height: 16px;
  width: auto;
  max-width: none;
  display: block;
}

/* ===== AVATAR ===== */
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0;
}

.avatar-lg { width: 44px; height: 44px; font-size: 0.88rem; }

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ===== META VIEWS ===== */
.meta-views {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* ===== EMPTY STATES ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 72px 24px;
  gap: 10px;
}

.empty-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 50%;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-size: 1.4rem;
}

.empty-icon svg { width: 24px; height: 24px; }
.empty-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.empty-sub { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

.btn-outline {
  margin-top: 10px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background var(--transition);
}

.btn-outline:hover { background: var(--bg-secondary); }

/* ===== SPINNER ===== */
.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

.spinner.large { width: 32px; height: 32px; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== FEED FOOTER ===== */
.feed-footer {
  margin-top: 24px;
  display: flex;
  gap: 8px;
}

.feed-load-more-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

.feed-load-more-btn:hover { color: var(--text); background: var(--border); }

.settings-footer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.settings-footer-btn:hover { color: var(--text); background: var(--bg-secondary); }

/* ===== ERROR BANNER ===== */
.error-banner {
  padding: 12px 16px;
  background: rgba(220, 38, 38, 0.07);
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: #dc2626;
  margin-bottom: 16px;
  line-height: 1.5;
}

[data-theme="dark"] .error-banner {
  color: #f87171;
  background: rgba(248, 113, 113, 0.09);
  border-color: rgba(248, 113, 113, 0.18);
}

/* ===== PULL TO REFRESH ===== */
/* ===== NEW ITEMS CHIP (X-style floating notification) ===== */
.new-items-chip {
  position: fixed;
  top: calc(var(--header-h) + var(--tabs-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0,0,0,0.22);
  white-space: nowrap;
  animation: chipSlideIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}

.new-items-chip:active { opacity: 0.8; }

@keyframes chipSlideIn {
  from { transform: translateX(-50%) translateY(-16px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);     opacity: 1; }
}

/* ===== FEED REFRESH PILL (X-style update button) ===== */
.feed-refresh-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.feed-refresh-pill:hover { background: var(--bg-secondary); }
.feed-refresh-pill:active { opacity: 0.7; }
.feed-refresh-pill:disabled { opacity: 0.5; cursor: default; }

#feed-bottom-sentinel {
  height: 1px;
  margin-bottom: 8px;
}

/* ===== DIFFICULTY SELECTOR ===== */
.difficulty-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.difficulty-btn {
  flex: 1;
  min-width: fit-content;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}

.difficulty-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.model-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
}
.model-btn-name {
  font-size: 0.82rem;
  font-weight: 600;
}
.model-btn-desc {
  font-size: 0.68rem;
  opacity: 0.75;
}
.model-btn.active .model-btn-desc { opacity: 0.85; }

.pull-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text-muted);
  border-radius: 50%;
}

.pull-spinner.spinning { animation: spin 0.7s linear infinite; }

/* ===== OVERLAY ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.32s ease;
}

.overlay.open { opacity: 1; }

/* ===== BOTTOM SHEET ===== */
.sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  max-height: 93dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: var(--shadow-sheet);
}

.overlay.open .sheet { transform: translateY(0); }

.sheet-handle {
  width: 38px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  gap: 4px;
  flex-shrink: 0;
}

.back-btn { margin-right: 2px; }

.sheet-title {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.sheet-actions { display: flex; align-items: center; }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 52px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== DETAIL CONTEXT CARD ===== */
.detail-context {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

.detail-thinker-row {
  margin-bottom: 12px;
}

.detail-thinker-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.detail-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-thinker-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.detail-meta-row { display: flex; align-items: center; gap: 8px; }

.detail-headline {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.7;
  color: var(--text);
  letter-spacing: -0.01em;
}

.detail-book-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.detail-era {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== DISCLAIMER ===== */
.ai-disclaimer, .feed-disclaimer {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 1.5;
  text-align: center;
  padding: 4px 0;
}

.feed-disclaimer {
  padding: 12px 0 0;
}

/* ===== DETAIL CONTENT FLEX ===== */
#detail-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-sub-categories-section {
  padding-bottom: 4px;
}

/* ===== SUB-CATEGORIES ===== */
.detail-sub-categories-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sub-cat-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sub-cat-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.sub-cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.sub-cat-chip:hover { background: var(--bg-secondary); color: var(--text); }

.sub-cat-chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.sub-cat-arrow {
  color: var(--text-muted);
  font-size: 0.75rem;
  opacity: 0.5;
  user-select: none;
}

.detail-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== AI SECTION ===== */
.ai-section {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
}

.ai-section-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.claude-mark {
  color: var(--text-muted);
  flex-shrink: 0;
}

.explanation-body {
  font-size: 0.9rem;
  line-height: 1.88;
  color: var(--text);
}

.explanation-body p { margin-bottom: 14px; }
.explanation-body p:last-child { margin-bottom: 0; }

/* 記事内の多声的な引用 */
.detail-quotes { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.detail-quotes:empty { display: none; }
.detail-quotes-label {
  font-size: 0.72rem; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 2px;
}
.art-quote {
  margin: 0; padding: 12px 14px;
  border-left: 2px solid var(--border-strong);
  background: var(--bg-secondary); border-radius: var(--radius-sm);
}
.art-quote-text {
  margin: 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 0.98rem; line-height: 1.75; color: var(--text);
}
.art-quote-cite { margin-top: 6px; font-size: 0.76rem; color: var(--text-muted); }

/* ===== QUOTE BOX ===== */
.quote-box {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
}

.quote-box-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.quote-box blockquote {
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.78;
  color: var(--text);
  margin-bottom: 10px;
}

.quote-attribution { font-size: 0.74rem; color: var(--text-muted); line-height: 1.5; }
.quote-sep { opacity: 0.6; }

/* ===== BOOK PROMO ===== */
.book-promo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.book-promo:hover { background: var(--bg-secondary); }
.book-promo-icon { font-size: 1.5rem; line-height: 1; }

.book-promo-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.book-promo-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-promo-sub { font-size: 0.74rem; color: var(--text-muted); }

.book-promo-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 2px;
  width: fit-content;
}

.book-promo-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-promo-ku .book-promo-badge {
  background: #e8f4e8;
  color: #2d7a2d;
}
[data-theme="dark"] .book-promo-ku .book-promo-badge {
  background: rgba(45,122,45,0.2);
  color: #6ecf6e;
}
.book-promo-ku:hover { background: #f5fdf5; }
[data-theme="dark"] .book-promo-ku:hover { background: rgba(45,122,45,0.08); }

.book-promo-audible .book-promo-badge {
  background: #fff3e0;
  color: #e65c00;
}
[data-theme="dark"] .book-promo-audible .book-promo-badge {
  background: rgba(230,92,0,0.2);
  color: #ffab66;
}
.book-promo-audible:hover { background: #fffaf5; }
[data-theme="dark"] .book-promo-audible:hover { background: rgba(230,92,0,0.08); }

/* ===== RABBIT HOLES ===== */
.rabbit-holes-section {}

.rabbit-holes-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rabbit-hole-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.rabbit-hole-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 14px;
  text-align: left;
  font-size: 0.86rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
}

.rabbit-hole-item:last-child { border-bottom: none; }
.rabbit-hole-item:hover { background: var(--bg-secondary); }
.rh-headline { flex: 1; }
.rh-arrow { color: var(--text-muted); flex-shrink: 0; }

/* ===== GENERATE QUOTE BUTTON ===== */
#web-quote-section {
  display: flex;
  flex-direction: column;
}

#web-quote-trigger { padding: 2px 0; }

.generate-quote-btn {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.83rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.generate-quote-btn:hover {
  background: var(--border-strong);
  color: var(--text);
}

/* ===== WEB QUOTE SECTION ===== */
.web-quote-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 2px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.web-quote-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

.web-quote-link:hover { color: var(--text); }

.web-quote-error {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}

/* ===== SETTINGS DIALOG ===== */
.dialog {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: var(--shadow-sheet);
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.overlay.open .dialog { transform: translateY(0); }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  border-bottom: 1px solid var(--border);
}

.dialog-title { font-size: 1.05rem; font-weight: 700; color: var(--text); }

.dialog-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0 0 12px;
  line-height: 1.5;
}

/* ===== SETTINGS SECTIONS ===== */
.settings-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type { border-bottom: none; }

.settings-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* ===== ACCESS SECTION ===== */
.access-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 4px;
  border: 1px solid var(--border);
}

.access-status.ok {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.2);
  color: #16a34a;
}

[data-theme="dark"] .access-status.ok {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.18);
  color: #4ade80;
}

.access-form { display: flex; flex-direction: column; gap: 14px; }
.access-option { display: flex; flex-direction: column; gap: 6px; }
.access-label { font-size: 0.8rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.access-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: -2px; }

.access-provider-status {
  font-size: 0.78rem;
  color: #16a34a;
  padding: 4px 8px;
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.2);
  border-radius: 6px;
}
.access-provider-status.ok { color: #16a34a; }
[data-theme="dark"] .access-provider-status.ok { color: #4ade80; }

.access-provider-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin: 4px 0 0;
}

.api-provider-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.openai-badge {
  background: rgba(16, 163, 127, 0.1);
  border: 1px solid rgba(16, 163, 127, 0.25);
  color: #10a37f;
}
.claude-badge {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #6366f1;
}
[data-theme="dark"] .openai-badge { color: #34d399; }
[data-theme="dark"] .claude-badge { color: #818cf8; }

.access-input-row { display: flex; gap: 8px; }

.access-input {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition);
}

.access-input:focus { border-color: var(--text-muted); }

.access-btn {
  padding: 9px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--bg-secondary);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition);
}

.access-btn:hover { background: var(--border); }

.access-divider {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  position: relative;
  padding: 2px 0;
}

.access-divider::before, .access-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}

.access-divider::before { left: 0; }
.access-divider::after { right: 0; }

.subscribe-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.subscribe-btn:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ===== TAG GRID ===== */
.tag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tag-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}

.tag-chip.active {
  border-color: var(--text);
  background: var(--bg-secondary);
  color: var(--text);
  font-weight: 600;
}

/* ===== TAG LOAD MORE ===== */
.tag-load-more-area {
  margin-top: 10px;
}

.tag-load-more-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.tag-load-more-btn:hover {
  background: var(--border-strong);
  color: var(--text);
}

.tag-load-more-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.apply-btn {
  display: block;
  width: calc(100% - 40px);
  margin: 16px 20px 4px;
  padding: 14px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  transition: opacity var(--transition);
  letter-spacing: -0.01em;
}

.apply-btn:hover { opacity: 0.85; }
.apply-btn:active { opacity: 0.7; }

/* ===== TOGGLE SWITCH ===== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-label-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.toggle-label { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.toggle-sub { font-size: 0.74rem; color: var(--text-muted); line-height: 1.4; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--text);
  border-color: var(--text);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--bg);
}

/* ===== CUSTOM TAG CHIPS ===== */
.custom-tag-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

.custom-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
}

.custom-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.custom-chip-remove:hover { color: var(--text); }

/* concern chip */
.concern-chip {
  border-radius: 10px;
  max-width: 100%;
  flex-wrap: nowrap;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border-color: color-mix(in srgb, var(--text) 20%, transparent);
  padding: 6px 10px;
}

.concern-chip-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.concern-chip-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  font-size: 0.78rem;
  color: var(--text);
}

/* ===== DISCLAIMER DIALOG ===== */
.disclaimer-dialog { max-height: 92dvh; }

.disclaimer-body {
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.disclaimer-section { display: flex; flex-direction: column; gap: 5px; }

.disclaimer-heading { font-size: 0.84rem; font-weight: 700; color: var(--text); }

.disclaimer-body p { font-size: 0.79rem; color: var(--text-muted); line-height: 1.72; }

/* ===== BOOK STORE ===== */
.book-store-dialog {
  max-height: 90dvh;
  overflow-y: auto;
}

.book-store-body {
  padding: 14px 16px 40px;
}

.book-shelf-container {
  display: flex;
  flex-direction: column;
}

.book-shelf {
  display: flex;
  gap: 12px;
  padding: 16px 8px 0;
  align-items: flex-end;
}

.shelf-plank {
  height: 12px;
  background: linear-gradient(180deg, #c8a882 0%, #a0795a 40%, #7d5c3e 100%);
  border-radius: 2px;
  margin: 0 0px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}

[data-theme="dark"] .shelf-plank {
  background: linear-gradient(180deg, #5a4233 0%, #3d2e22 40%, #2a1f16 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.07);
}

.book-cover-card {
  flex: 1;
  aspect-ratio: 2 / 3;
  border-radius: 4px 8px 8px 4px;
  overflow: hidden;
  cursor: pointer;
  box-shadow:
    -3px 0 6px rgba(0,0,0,0.15),
    3px 6px 18px rgba(0,0,0,0.22),
    inset -2px 0 4px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.book-cover-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow:
    -3px 0 6px rgba(0,0,0,0.15),
    6px 14px 28px rgba(0,0,0,0.28);
}

.book-cover-card:active { transform: scale(0.93); box-shadow: none; }

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-cover-placeholder {
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  text-align: center;
}

.book-placeholder-title {
  color: rgba(255,255,255,0.92);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-all;
}

.book-placeholder-author {
  color: rgba(255,255,255,0.6);
  font-size: 0.55rem;
  font-weight: 400;
  line-height: 1.3;
}

.book-detail-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding-top: 4px;
}

.book-detail-cover {
  width: 130px;
  height: 195px;
  border-radius: 4px 8px 8px 4px;
  overflow: hidden;
  box-shadow: -3px 0 6px rgba(0,0,0,0.15), 6px 10px 28px rgba(0,0,0,0.28);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-detail-cover .book-cover-placeholder { font-size: 0.7rem; }

.book-detail-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.book-detail-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.book-detail-author {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.book-detail-intro {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.72;
  margin-top: 6px;
}

.book-cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 20px;
  background: #f4a01c;
  color: #111;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: filter 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.book-cart-btn:hover { filter: brightness(1.08); }
.book-cart-btn:active { opacity: 0.82; }

/* ===== THEME MODE BUTTON (in settings) ===== */
.theme-mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.theme-mode-btn:hover { background: var(--border); color: var(--text); }

/* ===== PROFILE DIALOG ===== */
/* ===== ACCOUNT DIALOG ===== */
.account-dialog {
  max-height: 90dvh;
  overflow-y: auto;
}

.account-body {
  padding: 0 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── User card (logged in) ── */
.account-user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0 16px;
}

.account-user-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-user-info {
  flex: 1;
  min-width: 0;
}

.account-user-email {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-user-since {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.account-logout-btn {
  width: 100%;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.account-logout-btn:hover { border-color: #e74c3c; color: #e74c3c; }

/* ── Auth form ── */
.auth-form-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.auth-email-input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
  margin-bottom: 10px;
}
.auth-email-input:focus { border-color: var(--text); }
.auth-email-input.input-error {
  border-color: #e74c3c;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.auth-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity 0.15s;
}
.auth-send-btn:hover { opacity: 0.82; }
.auth-send-btn:disabled { opacity: 0.4; cursor: default; }

.auth-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.auth-error-msg {
  font-size: 0.82rem;
  color: #e74c3c;
  margin-top: 8px;
  text-align: center;
}

/* ── Sent state ── */
.auth-sent-card {
  text-align: center;
  padding: 16px 0 8px;
}

.auth-sent-icon {
  font-size: 2.2rem;
  margin-bottom: 10px;
}

.auth-sent-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-sent-desc {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-sent-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 16px;
}

.auth-resend-btn {
  width: 100%;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

/* ── OTP digit inputs ── */
.otp-input-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0 4px;
}
.otp-input-row.input-error .otp-digit {
  border-color: #e74c3c;
  animation: shake 0.4s ease;
}
.otp-digit {
  width: 42px;
  height: 52px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
  caret-color: transparent;
}
.otp-digit:focus {
  border-color: var(--text);
  background: var(--bg);
}

/* ── Toast ── */
.quotely-toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}
.quotely-toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.account-email-value {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.account-rank-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.account-rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.account-rank-item:last-child { border-bottom: none; }

.account-rank-num {
  width: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  text-align: center;
}

.account-rank-name {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-rank-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.account-rank-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 10px 0;
  text-align: center;
}

/* ===== SAFE AREA ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .sheet-body { padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
}

/* ===== LANGUAGE TOGGLE ===== */
.lang-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lang-toggle {
  display: flex;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  flex-shrink: 0;
}

.lang-btn {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.lang-btn.active {
  background: var(--text);
  color: var(--bg);
}

/* ===== TRIAL BUTTONS ===== */
.trial-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.trial-btn:hover { background: var(--bg-secondary); color: var(--text); }

.trial-exit-btn {
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.trial-exit-btn:hover { background: var(--border); color: var(--text); }

/* ===== POPULAR MODE BADGE ===== */
.popular-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.25);
  color: #a16207;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}

[data-theme="dark"] .popular-mode-badge {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.2);
  color: #ca8a04;
}

/* ===== CARD AUTHOR NAME ROW (flag after author name) ===== */
.card-author-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

/* ===== PD BADGE ===== */
.pd-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #6366f1;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="dark"] .pd-badge {
  background: rgba(129, 140, 248, 0.1);
  border-color: rgba(129, 140, 248, 0.22);
  color: #818cf8;
}

/* ===== ORIGINAL (コラム) BADGE ===== */
.original-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.22);
  color: #059669;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .original-badge {
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.22);
  color: #34d399;
}

/* ===== TERM (用語) BADGE ===== */
.term-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.22);
  color: #d97706;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .term-badge {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.22);
  color: #fbbf24;
}

.question-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.22);
  color: #6366f1;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .question-badge {
  background: rgba(129, 140, 248, 0.1);
  border-color: rgba(129, 140, 248, 0.25);
  color: #818cf8;
}

/* ===== TERM CARD HEADLINE ===== */
.term-name-label {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.term-headline-text {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.5;
}

/* ===== RELATED BOOK ROW (original / term cards) ===== */
.card-related-book {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 0;
  flex-wrap: wrap;
}
.related-book-title {
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.related-book-author {
  color: var(--text-muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

/* ===== EXPLANATION LOADING SPINNER ===== */
.explanation-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
}

/* ===== PD TAG TREE ===== */
.pd-tag-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.pd-level {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pd-level-label {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-left: 2px;
}

.pd-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pd-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.pd-chip:hover { background: var(--bg-secondary); color: var(--text); }

.pd-chip.active {
  border-color: var(--text);
  background: var(--bg-secondary);
  color: var(--text);
  font-weight: 600;
}

.pd-tree-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ===== ACCESS SWIPE PANELS ===== */
.access-swipe-outer {
  overflow: hidden;
  position: relative;
}

.access-swipe-track {
  display: flex;
  width: 200%;
}

.access-swipe-panel {
  width: 50%;
  flex-shrink: 0;
}

.access-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.access-panel-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

.access-panel-arrow:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

/* ===== LOGIN OVERLAY ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.login-overlay.hidden {
  display: none;
}

.login-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-logo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 6px;
}

.login-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 32px;
}

.login-tabs {
  display: flex;
  width: 100%;
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}

.login-tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.login-tab.active {
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.login-error {
  width: 100%;
  padding: 10px 14px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 8px;
  font-size: 0.83rem;
  margin-bottom: 16px;
  line-height: 1.4;
}

[data-theme="dark"] .login-error {
  background: rgba(220,38,38,0.15);
  color: #f87171;
}

.login-error.hidden { display: none; }

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field.hidden { display: none; }

.login-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.login-input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.login-input:focus {
  border-color: var(--text);
}

.login-input.input-error {
  border-color: #dc2626;
  animation: shake 0.35s ease;
}

.login-submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-submit-btn:hover { opacity: 0.85; }
.login-submit-btn:disabled { opacity: 0.4; cursor: default; }

.login-switch {
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.login-switch-link {
  background: none;
  border: none;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}

.login-guest-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.login-guest-divider::before,
.login-guest-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-guest-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.login-guest-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ===== ONBOARDING OVERLAY ===== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  transition: opacity 0.3s ease;
}
.onboarding-overlay.hidden { display: none; }
.onboarding-overlay.fade-out { opacity: 0; pointer-events: none; }

.onboarding-card {
  width: 100%;
  max-width: 420px;
}

.onboarding-step { display: flex; flex-direction: column; gap: 0; }

.ob-logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 20px;
}

.ob-step-indicator {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}
.ob-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}
.ob-dot.active { background: var(--text); }

.ob-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.ob-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 28px;
  line-height: 1.5;
}

.ob-field { margin-bottom: 24px; }

.ob-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.ob-dob-row {
  display: flex;
  gap: 8px;
}

.ob-select {
  flex: 1;
  padding: 11px 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.ob-select:focus { border-color: var(--text); }

.ob-gender-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ob-gender-btn {
  flex: 1;
  min-width: 72px;
  padding: 10px 8px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ob-gender-btn.active {
  border-color: var(--text);
  color: var(--text);
  font-weight: 700;
  background: var(--bg-secondary);
}

.ob-category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  max-height: 300px;
  overflow-y: auto;
}

.ob-cat-btn {
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ob-cat-btn.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

.ob-next-btn {
  width: 100%;
  padding: 14px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 12px;
  transition: opacity 0.18s;
}
.ob-next-btn:hover { opacity: 0.85; }

.ob-skip-btn {
  width: 100%;
  padding: 10px;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== API GUIDE MODAL ===== */
.api-guide-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}
.api-guide-link:hover { color: var(--text); }

.api-guide-link-inline {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.api-guide-dialog {
  max-height: 88dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.api-guide-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.api-guide-slides-outer {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.api-guide-slides {
  display: flex;
  width: 100%;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.api-guide-slide {
  min-width: 100%;
  flex-shrink: 0;
  padding: 20px 22px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.api-guide-slide-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.api-guide-slide-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin: 0;
}

.api-guide-slide-title .highlight {
  color: #e94f37;
}

.api-guide-slide-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}

.api-guide-feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}

.api-guide-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text);
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
}

.api-guide-feature-icon { font-size: 1rem; flex-shrink: 0; }

.api-guide-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.api-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.5;
}

.api-guide-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--text);
  color: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 1px;
}

.api-guide-cost-table {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.api-guide-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  font-size: 0.86rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.api-guide-cost-row:last-child { border-bottom: none; }

.api-guide-cost-label { color: var(--text-muted); }

.api-guide-cost-val { font-size: 0.9rem; }
.api-guide-cost-free { color: #16a34a; }

.api-guide-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

.api-guide-security-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.api-guide-security-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.5;
}

.api-guide-security-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.api-guide-security-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* Nav: dots + arrows */
.api-guide-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.api-guide-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}

.api-guide-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.api-guide-dot.active {
  background: var(--text);
  transform: scale(1.3);
}

.api-guide-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.api-guide-arrow:hover { background: var(--bg); }
.api-guide-arrow:disabled { opacity: 0.25; cursor: default; }

/* ===== AI PROVIDER BADGE ===== */
.ai-provider-badge {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 4px 0 8px;
  opacity: 0.7;
}
.ai-provider-badge-article {
  margin: 16px 18px 4px;
  text-align: center;
}

/* ===== QOAN — 今日の問い ===== */
.qoan-wrap { display: flex; flex-direction: column; gap: 16px; }
.qoan-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; }
.qoan-date { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.06em; }
.qoan-streak {
  font-size: 0.7rem; color: var(--text-muted);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px 10px;
}
.qoan-big-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 22px 20px;
}
.qoan-big {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.45rem; font-weight: 600; line-height: 1.55;
  margin: 12px 0 10px; color: var(--text);
}
.qoan-meta { font-size: 0.78rem; color: var(--text-muted); }
.qoan-label {
  font-size: 0.72rem; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 10px;
}
.qoan-story {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.qoan-hook {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.04rem; line-height: 1.8; color: var(--text); font-weight: 500;
}
/* 解説：見出し（「解説を読む」と同じ見た目）をクリックで段落＋次の見出しを開く */
.qoan-story-lead { margin-bottom: -4px; }
.qoan-story-step { display: flex; flex-direction: column; gap: 8px; }
.qoan-story-step-head {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 2px 0;
  font-size: 0.8rem; letter-spacing: 0.04em; color: var(--accent, var(--text-muted));
  font-family: inherit; text-align: left;
}
.qoan-story-step-head:hover { opacity: 0.7; }
.qoan-story-step-title { font: inherit; color: inherit; }
.qoan-story-step-caret { display: inline-block; transition: transform 0.2s; }
.qoan-story-step-head.on .qoan-story-step-caret { transform: rotate(90deg); }
.qoan-story-step-body { font-size: 0.92rem; line-height: 1.85; color: var(--text); }
.qoan-story-tail { display: flex; flex-direction: column; gap: 16px; }
.qoan-story-step[hidden], .qoan-story-step-body[hidden], .qoan-story-tail[hidden] { display: none; }
.qoan-sec-label { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 5px; }
.qoan-sec-text { font-size: 0.92rem; line-height: 1.85; color: var(--text); }
.qoan-book {
  display: block; text-decoration: none; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 2px;
}
.qoan-book-label { display: block; font-size: 0.68rem; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 3px; }
.qoan-book-title { font-size: 0.92rem; font-weight: 600; color: var(--text); margin-right: 8px; }
.qoan-book-line { font-size: 0.78rem; color: var(--text-muted); }
.qoan-seeds {
  background: var(--bg-secondary); border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.qoan-seed { padding: 10px 0; border-bottom: 1px solid var(--border); }
.qoan-seed:last-child { border-bottom: none; }
.qoan-seed-head { font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.qoan-seed-era { font-weight: 400; font-size: 0.72rem; color: var(--text-muted); margin-left: 8px; }
.qoan-seed-stance { font-size: 0.85rem; line-height: 1.75; color: var(--text); }
.qoan-seed-cry {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.0rem; font-weight: 500; line-height: 1.6; color: var(--text);
  margin: 2px 0 6px;
}
.qoan-seeds .qoan-book { margin-top: 12px; background: var(--bg-card); }
.qoan-seeds .qoan-sources { margin-top: 4px; }
.qoan-seed-src { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.qoan-ask-card {
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 20px;
}
.qoan-small-q {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.05rem; line-height: 1.7; color: var(--text); margin-bottom: 14px;
}
.qoan-textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font); font-size: 0.92rem; line-height: 1.7;
  padding: 12px;
}
.qoan-textarea:focus { outline: none; border-color: var(--text-muted); }
.qoan-input-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.qoan-counter { font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0; }
.qoan-pen {
  flex: 1; min-width: 0; background: transparent; border: none; border-bottom: 1px dashed var(--border-strong);
  color: var(--text-muted); font-size: 0.8rem; padding: 4px 2px; text-align: right;
}
.qoan-pen:focus { outline: none; color: var(--text); }
.qoan-btn-primary {
  background: var(--text); color: var(--bg); border: none; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; padding: 9px 22px; cursor: pointer;
  transition: opacity var(--transition);
}
.qoan-btn-primary:disabled { opacity: 0.4; }
.qoan-btn-small {
  background: transparent; color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 999px; font-size: 0.78rem; padding: 6px 16px; cursor: pointer;
}
.qoan-note { font-size: 0.74rem; color: var(--text-muted); line-height: 1.7; margin-top: 10px; }
.qoan-mine { margin-top: 4px; }
.qoan-mine-label { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 6px; }
.qoan-public-badge {
  font-size: 0.66rem; color: var(--bg); background: var(--text);
  border-radius: 999px; padding: 2px 8px; margin-left: 8px; letter-spacing: 0.08em;
}
.qoan-mine-text { font-size: 0.95rem; line-height: 1.8; color: var(--text); margin-bottom: 12px; }
.qoan-inbox { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.qoan-inbox-item { margin-bottom: 14px; }
.qoan-inbox-q {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 0.92rem; color: var(--text); margin-bottom: 8px;
}
.qoan-reply-btn { margin-top: 8px; }
.qoan-others {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.qoan-lock-note { font-size: 0.82rem; color: var(--text-muted); line-height: 1.7; }
.qoan-answer { padding: 14px 0; border-bottom: 1px solid var(--border); }
.qoan-answer:last-child { border-bottom: none; }
.qoan-answer-pen { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 5px; }
.qoan-answer-text { font-size: 0.92rem; line-height: 1.8; color: var(--text); }
.qoan-qa { margin: 10px 0 0 12px; padding-left: 12px; border-left: 2px solid var(--border-strong); }
.qoan-qa-q { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 3px; }
.qoan-qa-a { font-size: 0.85rem; color: var(--text); line-height: 1.7; }
.qoan-answer-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.qoan-heart {
  background: transparent; border: 1px solid var(--border-strong); border-radius: 999px;
  color: var(--text-muted); font-size: 0.76rem; padding: 4px 12px; cursor: pointer;
}
.qoan-heart.on { color: #c0392b; border-color: #c0392b; }
.qoan-toi-btn {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 0.76rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.qoan-report {
  margin-left: auto; background: transparent; border: none; color: var(--text-muted);
  font-size: 0.9rem; cursor: pointer; padding: 0 6px;
}
.qoan-profile {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.qoan-axis { margin-bottom: 14px; }
.qoan-axis-labels {
  display: flex; justify-content: space-between;
  font-size: 0.74rem; color: var(--text-muted); margin-bottom: 5px;
}
.qoan-axis-track {
  position: relative; height: 4px; border-radius: 999px; background: var(--bg-secondary);
}
.qoan-axis-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 12px; height: 12px; border-radius: 50%; background: var(--text);
}
.qoan-profile-summary {
  font-size: 0.85rem; line-height: 1.8; color: var(--text);
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px;
}
.qoan-foot { text-align: center; padding: 8px 0 4px; }
.qoan-link {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 0.72rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.qoan-modal-overlay {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.qoan-modal {
  background: var(--bg-card); border-radius: var(--radius); padding: 22px;
  width: 100%; max-width: 440px; box-shadow: var(--shadow-sheet);
}
.qoan-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.qoan-terms p { font-size: 0.8rem; line-height: 1.8; color: var(--text); margin-bottom: 8px; }
.qoan-occasion {
  font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 10px;
}
.qoan-profile-embed { padding: 4px 0; }
.qoan-profile-embed .qoan-btn-small { margin-top: 8px; }
.qoan-credit {
  font-size: 0.7rem; letter-spacing: 0.08em; color: var(--text-muted);
  text-align: center; margin: -6px 0 0; opacity: 0.8;
}
.qoan-mine-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.qoan-seed-tap .qoan-seed-more {
  color: var(--text); margin-left: 8px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; white-space: nowrap;
}
.qoan-seed-article { display: none; }
.qoan-seed-article.open { display: block; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.qoan-seed-article p { font-size: 0.88rem; line-height: 1.85; color: var(--text); margin-bottom: 10px; }
.qoan-seed-article p:last-child { margin-bottom: 0; }
.qoan-seed-soon { color: var(--text-muted); }
.qoan-archive {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.qoan-archive-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.qoan-archive-item {
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  text-align: left; padding: 12px 2px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
}
.qoan-archive-item:last-of-type { border-bottom: none; }
.qoan-archive-date { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.04em; }
.qoan-archive-q {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 0.95rem; color: var(--text); line-height: 1.55;
}
.qoan-archive-floor { font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; }
.qoan-archive-meta { font-size: 0.74rem; color: var(--text-muted); }
.qoan-reading-overlay { align-items: flex-start; overflow-y: auto; padding: 20px 16px; }
.qoan-reading-overlay .qoan-modal {
  max-width: 640px; display: flex; flex-direction: column; gap: 16px; margin: auto;
}
.qoan-reading-back { align-self: flex-start; font-size: 0.8rem; }
.qoan-reading-loading { display: flex; justify-content: center; padding: 40px; }

/* ===== QOAN — 梯子・独白・カード・みんなの声 ===== */
.qoan-step { margin-bottom: 16px; }
.qoan-step-input { position: relative; }
.qoan-stem {
  display: block; font-size: 0.85rem; color: var(--text-muted);
  margin-bottom: 4px; font-style: italic;
}
.qoan-descend {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 0.82rem; cursor: pointer; padding: 4px 0 12px;
  text-decoration: underline; text-underline-offset: 3px;
}
.qoan-heavy-note {
  font-size: 0.76rem; color: var(--text-muted); line-height: 1.7;
  background: var(--bg-secondary); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 14px;
}
.qoan-monologue { margin-bottom: 14px; }
.qoan-mono-label { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 10px; }
.qoan-mono-pair { margin-bottom: 12px; padding-left: 12px; border-left: 2px solid var(--border-strong); }
.qoan-mono-q { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; line-height: 1.6; }
.qoan-mono-a { font-size: 0.95rem; color: var(--text); line-height: 1.8; }
.qoan-card {
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 20px; margin: 4px 0 12px; background: var(--bg-secondary);
}
.qoan-card-big {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 0.92rem; color: var(--text-muted); margin-bottom: 12px; line-height: 1.6;
}
.qoan-card-reflection {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.15rem; font-weight: 600; color: var(--text); line-height: 1.6; margin-bottom: 18px;
}
.qoan-card-axis { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.qoan-card-pole { font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; }
.qoan-card-track { flex: 1; position: relative; height: 4px; border-radius: 999px; background: var(--border-strong); }
.qoan-card-dot { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 14px; height: 14px; border-radius: 50%; background: var(--text); }
.qoan-card-why { font-size: 0.82rem; color: var(--text); line-height: 1.7; }
.qoan-card-brand { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em; color: var(--text-muted); text-align: right; margin-top: 14px; }
.qoan-voice {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px;
}
.qoan-voice-q {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 0.82rem; color: var(--text-muted); margin-bottom: 8px; line-height: 1.5;
}
.qoan-voice-a { font-size: 0.95rem; color: var(--text); line-height: 1.8; margin-bottom: 8px; }
.qoan-voice-foot { font-size: 0.72rem; color: var(--text-muted); }

/* ===== QOAN — 出典 ===== */
.qoan-sources {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 0.72rem; color: var(--text-muted); margin-top: 14px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.qoan-source-check { color: var(--text-muted); margin-right: 2px; }
.qoan-source-link { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }
.qoan-source-link:hover { color: var(--text); }
.qoan-source-sep { color: var(--border-strong); }

/* ===== QOAN — 投票 ===== */
.qoan-vote {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.qoan-vote-choices { display: flex; gap: 10px; margin-top: 4px; }
.qoan-vote-pick {
  flex: 1; background: transparent; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.9rem; padding: 12px 10px; cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.qoan-vote-pick.on { background: var(--text); color: var(--bg); border-color: var(--text); }
/* 対立ブース：言い分（cry）付きは縦積みで、台詞を主役にする */
.qoan-vote-choices:has(.has-cry) { flex-direction: column; }
.qoan-vote-pick.has-cry {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  text-align: left; padding: 14px 16px;
}
.qoan-vote-cry {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.0rem; font-weight: 500; line-height: 1.6;
}
.qoan-vote-name { font-size: 0.78rem; color: var(--text-muted); }
.qoan-vote-pick.on .qoan-vote-name { color: inherit; opacity: 0.8; }
/* 争点カード内の掴み */
.qoan-hook-card { margin: 2px 0 10px; font-size: 0.98rem; }
/* 論題の導入：タイトルを置かず、古い主張→反論の一文を主役にする */
.qoan-clash-lead {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.16rem; line-height: 1.7; font-weight: 500; color: var(--text);
  margin: 12px 0 12px;
}
/* 論題カード＝議論。タイトルを置かず、標準の「名前『発言』」形式で並べる */
.qoan-clash-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 22px 20px;
}
.qoan-clash-matchup {
  font-size: 0.74rem; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 16px;
}
.qoan-rally { display: flex; flex-direction: column; gap: 15px; }
.qoan-rally-hidden[hidden] { display: none; }
.qoan-rally-line {
  font-size: 0.96rem; line-height: 1.85; color: var(--text);
}
.qoan-rally-who {
  font-weight: 600; margin-right: 3px;
}
.qoan-rally-line[data-by="1"] .qoan-rally-who { color: var(--accent, var(--text)); }
.qoan-rally-say {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
}
.qoan-rally-more {
  align-self: flex-start; margin-top: 2px;
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 4px 0;
  font-size: 0.82rem; letter-spacing: 0.04em; color: var(--accent, var(--text-muted));
}
.qoan-rally-more:hover { opacity: 0.7; }
.qoan-clash-tail { display: flex; flex-direction: column; gap: 16px; }
.qoan-vote-reason { display: flex; gap: 8px; margin-top: 10px; }
.qoan-vote-reason.hidden { display: none; }
.qoan-vote-input {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.85rem; padding: 8px 10px;
}
.qoan-vote-input:focus { outline: none; border-color: var(--text-muted); }
.qoan-vote-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; margin: 4px 0 8px; }
.qoan-vote-fill-a { background: var(--text); }
.qoan-vote-fill-b { background: var(--border-strong); }
.qoan-vote-legend { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); }
.qoan-vote-legend .on { color: var(--text); font-weight: 600; }
.qoan-vote-reasons { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.qoan-vote-reason-item { display: flex; gap: 8px; align-items: baseline; }
.qoan-vote-side { font-size: 0.68rem; flex-shrink: 0; padding: 2px 7px; border-radius: 999px; }
.qoan-vote-side.a { background: var(--bg-secondary); color: var(--text); }
.qoan-vote-side.b { background: var(--bg-secondary); color: var(--text-muted); }
.qoan-vote-reason-text { font-size: 0.85rem; color: var(--text); line-height: 1.6; }

/* ===== QOAN — 書籍広告・Geminiマーク ===== */
.qoan-bookad { display: flex; gap: 10px; margin-top: 10px; }
.qoan-bookad-btn {
  flex: 1; text-align: center; text-decoration: none;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.82rem; padding: 9px 8px;
}
.qoan-bookad-btn:hover { background: var(--bg-secondary); }
.gemini-mark.hidden, .claude-mark.hidden { display: none; }
