/* =====================================================================
   style.css — 見た目の設定
   iPhone の Safari を最優先にした作り。ダークモードにも自動で対応します。
   ===================================================================== */

:root {
  /* 基本色(明るいモード) */
  --bg: #eef1f7;
  --bg-2: #e4e8f2;
  --card: #ffffff;
  --card-2: #f5f7fb;
  --text: #14161d;
  --text-2: #4b5060;
  --muted: #7a8194;
  --line: rgba(20, 22, 29, 0.08);
  --shadow: 0 1px 2px rgba(20, 22, 29, 0.04), 0 8px 24px -12px rgba(20, 22, 29, 0.18);
  --shadow-lg: 0 2px 4px rgba(20, 22, 29, 0.05), 0 16px 40px -16px rgba(20, 22, 29, 0.3);

  /* アクセント(藍→紫) */
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: rgba(79, 70, 229, 0.10);
  --accent-text: #4338ca;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --header-grad: linear-gradient(160deg, #1b1a4a 0%, #2b2477 55%, #4b2d9e 100%);

  /* 検索先の色 */
  --jstage: #0f9d6d;
  --cinii: #d97b1a;
  --pubmed: #2f7de1;
  --openalex: #a247f2;

  --ok: #0f9d6d;
  --ok-soft: rgba(15, 157, 109, 0.10);
  --danger: #e5484d;
  --warn-soft: rgba(245, 158, 11, 0.12);

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f16;
    --bg-2: #12151f;
    --card: #171a25;
    --card-2: #1e2230;
    --text: #eef0f6;
    --text-2: #b7bccb;
    --muted: #8a90a3;
    --line: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 20px 50px -18px rgba(0, 0, 0, 0.8);
    --accent: #7c74ff;
    --accent-2: #a78bfa;
    --accent-soft: rgba(124, 116, 255, 0.16);
    --accent-text: #b4adff;
    --grad: linear-gradient(135deg, #6d63ff 0%, #a855f7 100%);
    --header-grad: linear-gradient(160deg, #0f0e2c 0%, #1e1a5c 55%, #3a2380 100%);
    --ok-soft: rgba(15, 157, 109, 0.18);
    --warn-soft: rgba(245, 158, 11, 0.16);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 50% -200px, var(--bg-2), transparent);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:active { transform: scale(0.97); }
a { color: var(--accent-text); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); }

/* ---- 上部(タイトルとタブ) ---- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  color: #fff;
  background: var(--header-grad);
  padding: calc(10px + env(safe-area-inset-top)) 18px 0;
  border-bottom-left-radius: var(--r-lg);
  border-bottom-right-radius: var(--r-lg);
  box-shadow: 0 10px 30px -12px rgba(27, 26, 74, 0.55);
  overflow: hidden;
}
.top::before {
  /* 見出しの右上にうすい光の円を置く */
  content: "";
  position: absolute;
  right: -60px; top: -80px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.22), transparent 70%);
  pointer-events: none;
}
.top .bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.top h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-width: 0;
  flex: 1;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.top h1 .brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.top .account {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
.top .account.on { background: #fff; color: var(--accent); border-color: #fff; }
.top .account.on::before { content: "●"; font-size: 8px; margin-right: 6px; vertical-align: 2px; color: var(--ok); }
.top h1 .mark {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}
.top h1 small {
  margin-left: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.04em;
}
/* 「アルファ版」のバッジ(見出しの横)と、各ページの上に出す注意書き */
.top h1 .alpha {
  flex: none;
  padding: 2px 8px;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  background: rgba(255,255,255,0.14);
  white-space: nowrap;
}
.alpha-note {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--warn-soft);
  font-size: 13.5px;
  line-height: 1.75;
}
.alpha-note b { font-weight: 800; }
@media (max-width: 460px) { .top h1 small { display: none; } }
.tabs { display: flex; gap: 2px; }
.tabs button, .tabs a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  border: 0;
  background: none;
  padding: 10px 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: rgba(255,255,255,0.62);
  position: relative;
  white-space: nowrap;
}
@media (max-width: 460px) { .tabs button, .tabs a { font-size: 14.5px; letter-spacing: -0.02em; } }
.tabs button::after, .tabs a::after {
  content: "";
  position: absolute;
  left: 22%; right: 22%; bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #fff;
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity .2s, transform .2s;
}
.tabs button.active, .tabs a.active { color: #fff; }
.tabs button.active::after, .tabs a.active::after { opacity: 1; transform: scaleX(1); }
.badge {
  display: inline-block;
  min-width: 22px;
  padding: 0 7px;
  margin-left: 2px;
  border-radius: 11px;
  background: #fff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  vertical-align: 1px;
}
.badge:empty { display: none; }

main { flex: 1 0 auto; width: 100%; padding: 16px 16px 88px; max-width: 760px; margin: 0 auto; }

/* ---- 検索窓 ---- */
.search-hero {
  position: relative;
  isolation: isolate;
  width: min(1140px, calc(100vw - 32px));
  margin-left: 50%;
  transform: translateX(-50%);
  min-height: min(64vh, 580px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 76px 0 62px;
}
.search-hero::before, .search-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.search-hero::before {
  background: url("/neural-bg.svg?v=0.11.6") center / 100% 100% no-repeat;
  animation: neural-breathe 18s ease-in-out infinite alternate;
}
.search-hero::after {
  background: radial-gradient(ellipse 38% 60% at 50% 43%, var(--bg) 0%, transparent 100%);
  opacity: .58;
}
.search-hero > * { position: relative; z-index: 1; }
@keyframes neural-breathe {
  from { opacity: .68; transform: translateY(-5px) scale(1); }
  to { opacity: 1; transform: translateY(6px) scale(1.025); }
}
@media (prefers-color-scheme: dark) {
  .search-hero::before { filter: brightness(.85); }
}
@media (prefers-reduced-motion: reduce) {
  .search-hero::before { animation: none; }
}
.search-heading { text-align: center; margin: 0 0 40px; }
.search-heading .search-kicker {
  margin: 0 0 8px;
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
}
.search-kicker a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.search-kicker a:hover, .search-kicker a:focus-visible { color: var(--accent-2); }
.search-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(27px, 5vw, 42px);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -.035em;
}
.searchbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 16px;
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  transition: box-shadow .2s;
}
.searchbar:focus-within { box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent-soft); }
.searchbar::before {
  /* 虫めがねのアイコン(SVG を埋め込み) */
  content: "";
  flex: none;
  width: 20px; height: 20px;
  margin-right: 2px;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'><circle cx='10.5' cy='10.5' r='6.5'/><line x1='15.5' y1='15.5' x2='21' y2='21'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'><circle cx='10.5' cy='10.5' r='6.5'/><line x1='15.5' y1='15.5' x2='21' y2='21'/></svg>") center / contain no-repeat;
}
.searchbar input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 18px; /* 16px 以上にすると iPhone で拡大されない */
  -webkit-appearance: none;
}
.searchbar input:focus { outline: none; }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; }
.searchbar button {
  flex: none;
  height: 52px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.7);
}
.searchbar button:disabled { opacity: 0.5; box-shadow: none; }
.search-filters { margin-top: 4px; text-align: center; }
.search-filters summary {
  display: inline-block;
  padding: 4px 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.search-filters summary::-webkit-details-marker { display: none; }
.search-filters summary::after { content: "⌄"; margin-left: 7px; color: var(--accent-text); }
.search-filters[open] summary::after { content: "⌃"; }
.search-filters summary:hover { color: var(--accent-text); }
.search-filters .filters { justify-content: center; margin: 12px 0 0; }
.quick-filters { justify-content: center; margin: 18px 0 0; }
#tab-search.has-results .search-hero { width: 100%; margin-left: 0; transform: none; min-height: 0; padding: 0 0 12px; }
#tab-search.has-results .search-hero::before, #tab-search.has-results .search-hero::after { display: none; }
#tab-search.has-results .search-heading { display: none; }
#tab-search.has-results .searchbar input,
#tab-search.has-results .searchbar button { height: 44px; }

@media (max-width: 600px) {
  .search-hero { min-height: min(58vh, 480px); padding: 56px 0 42px; }
  .search-heading { margin-bottom: 32px; }
  .search-heading h2 { font-size: clamp(25px, 7vw, 34px); }
  .searchbar input { font-size: 16px; }
  .searchbar button { padding: 0 20px; }
}

/* ---- 絞り込みボタン(チップ) ---- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  -webkit-user-select: none;
  user-select: none;
  transition: background .15s, color .15s;
}
.chip input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin: 0;
  border-radius: 50%;
  border: 2px solid var(--muted);
  display: grid;
  place-items: center;
  flex: none;
}
.chip input[type="checkbox"]::after {
  content: "";
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: 0;
}
.chip:has(input:checked) { background: var(--grad); border-color: transparent; color: #fff; }
.chip:has(input:checked) input[type="checkbox"] { border-color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.18); }
.chip:has(input:checked) input[type="checkbox"]::after { opacity: 1; }
.chip small { color: var(--muted); font-size: 11.5px; margin-left: 2px; }
.chip:has(input:checked) small { color: rgba(255,255,255,0.8); }
.chip.select { padding: 0 8px 0 14px; }
.chip select {
  border: 0;
  background: transparent;
  padding: 8px 2px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  -webkit-appearance: menulist;
}

/* ---- 説明・お知らせ ---- */
.intro {
  margin: 18px 0;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 15px;
  box-shadow: var(--shadow);
}
.intro h2 { margin: 0 0 10px; font-size: 17px; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.intro h3 { margin: 12px 0 4px; font-size: 14.5px; font-weight: 700; color: var(--text); }
.intro p { margin: 0 0 10px; }
.intro ul { margin: 0 0 10px; padding: 0; list-style: none; }
.intro li { margin: 0 0 8px; padding-left: 14px; position: relative; }
.intro li::before {
  content: "";
  position: absolute; left: 0; top: 0.65em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--grad);
}
.intro details { margin: 4px 0 10px; }
.intro summary { cursor: pointer; font-weight: 700; color: var(--accent-text); padding: 6px 0; }
.intro .links { margin: 0; font-size: 14px; }
.intro b { color: var(--text); }
.intro .alpha-note { margin: 22px 0 0; }
.home-alpha { margin: 96px 0 0; }
.home-alpha .alpha-note { margin: 0; }

.note {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--accent-text);
  word-break: break-word;
}
.note code {
  background: var(--card);
  padding: 1px 6px;
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

.teach {
  margin: 10px 0 0;
  padding: 14px 16px;
  background: var(--warn-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--r-md);
  font-size: 15px;
}
.teach p { margin: 0 0 8px; }
.teach .row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.teach .row .ja { font-weight: 700; min-width: 90px; }
.teach .row input {
  flex: 1;
  min-width: 140px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  font-size: 16px;
}
.teach .row button {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--grad);
  color: #fff;
  font-weight: 700;
}

/* ---- 検索先の切り替え(セグメント) ---- */
.source-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 18px;
  padding: 4px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.source-tabs button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 6px 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  line-height: 1.2;
  position: relative;
  transition: background .18s, box-shadow .18s;
}
.source-tabs button .name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.source-tabs button .name::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--dot, var(--muted));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--dot, var(--muted)) 25%, transparent);
}
.source-tabs button[data-source="jstage"]   { --dot: var(--jstage); }
.source-tabs button[data-source="cinii"]    { --dot: var(--cinii); }
.source-tabs button[data-source="pubmed"]   { --dot: var(--pubmed); }
.source-tabs button[data-source="openalex"] { --dot: var(--openalex); }
.source-tabs button .num {
  font-size: 12.5px;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.source-tabs button.active {
  background: var(--card);
  box-shadow: var(--shadow);
}
.source-tabs button.active .name { color: var(--text); }
.source-tabs button.active .num { color: var(--dot); font-weight: 700; }
.source-tabs button .num.err { color: var(--danger); }

/* ---- 検索結果 ---- */
.results { margin-top: 16px; }
.results h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 4px 12px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.results h2 small { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.results h2 .count {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.list { display: flex; flex-direction: column; gap: 12px; }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 16px 12px 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise .35s ease both;
}
.card::before {
  /* 左端の色の帯。検索先ごとに色が変わる */
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--src-color, var(--accent));
}
.card:has(.src.jstage)   { --src-color: var(--jstage); }
.card:has(.src.cinii)    { --src-color: var(--cinii); }
.card:has(.src.pubmed)   { --src-color: var(--pubmed); }
.card:has(.src.openalex) { --src-color: var(--openalex); }

.card .meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.card .src {
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--src-color, var(--accent));
  background: color-mix(in srgb, var(--src-color, var(--accent)) 13%, transparent);
}
.card .title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.45; letter-spacing: -0.005em; }
.card .title-en { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.card .authors { margin: 8px 0 0; font-size: 14px; color: var(--text-2); }
.card .journal { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.card .pubtype { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.card .note {
  margin: 8px 0 0;
  padding: 0;
  background: none;
  font-size: 13.5px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.card .actions a,
.card .actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text-2);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
  transition: background .15s, transform .1s;
}
.card .actions a.open {
  color: #fff;
  border-color: transparent;
  background: var(--grad);
  box-shadow: 0 6px 14px -8px rgba(79, 70, 229, 0.8);
}
.card .actions a.oa,
.card .actions button.ja { color: var(--ok); border-color: transparent; background: var(--ok-soft); }
.card .actions button.save.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.card .actions button.remove { color: var(--danger); }
.card .actions button:disabled { opacity: 0.5; }

.card .abstract {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--card-2);
  border-radius: var(--r-sm);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 3px solid var(--line);
}
.card .abstract.japanese {
  background: var(--ok-soft);
  border-left-color: var(--ok);
}

/* 日本語訳の配色・囲みはそのまま、本文の行間と段落を読みやすくする */
.card .abstract.md { white-space: normal; line-height: 1.85; font-size: 15px; font-weight: 400; }
.card .abstract.md > *:first-child { margin-top: 0; }
.card .abstract.md > *:last-child { margin-bottom: 0; }
.card .abstract.md h4 {
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ok);
}
.card .abstract.md p { margin: 0 0 20px; font-weight: 400; }
.card .abstract.md h5 { margin: 19px 0 8px; font-size: 14px; font-weight: 800; color: var(--text-2); }
.card .abstract.md h5:first-child { margin-top: 0; }
.card .abstract.md ul {
  margin: 0 0 12px;
  padding-left: 1.2em;
  list-style: none;
}
.card .abstract.md li { position: relative; margin-bottom: 9px; }
.card .abstract.md ul li::before {
  content: '';
  position: absolute;
  left: -1em;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}
.card .abstract.md li:last-child { margin-bottom: 0; }
.card .abstract.md .numbered-points { margin: 0 0 14px; padding: 0; list-style: none; }
.card .abstract.md .numbered-points li { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: start; gap: 8px; margin-bottom: 8px; }
.card .abstract.md .point-number { color: inherit; font-weight: 400; white-space: nowrap; }

.card textarea.memo {
  width: 100%;
  margin-top: 14px;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card-2);
  font-size: 15px;
  resize: vertical;
}
.card textarea.memo:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.card .saved-at { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* 保存した論文のタグ・絞り込み・引用文献リスト */
.saved-tools {
  margin: 6px 0 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow);
}
.saved-heading, .saved-filter-heading, .citation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.saved-heading h2 { margin: 0; font-size: 20px; }
.saved-heading .muted { font-size: 13px; font-variant-numeric: tabular-nums; }
.saved-filters { margin: 18px 0; }
.saved-filter-heading { margin-bottom: 10px; }
.saved-filter-heading h3, .citation-panel h3 { margin: 0; font-size: 14px; color: var(--text-2); }
.text-button { border: 0; background: transparent; color: var(--accent-text); font-size: 13px; font-weight: 700; padding: 5px 0; }
.saved-facet-group + .saved-facet-group { margin-top: 15px; }
.saved-facet-group p { margin: 0 0 7px; font-size: 12px; color: var(--muted); font-weight: 700; }
.saved-facet-buttons, .paper-tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.facet-chip, .paper-tag, .paper-tag-remove {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.facet-chip { min-height: 34px; padding: 4px 12px; }
.facet-chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.citation-open {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 14px;
}
.citation-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.citation-panel p { margin: 8px 0 12px; font-size: 12px; color: var(--muted); }
.citation-panel textarea {
  display: block;
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card-2);
  color: var(--text);
  line-height: 1.65;
  font-size: 13px;
  resize: vertical;
}
.citation-actions { justify-content: flex-start; margin-top: 10px; }
.citation-actions button {
  min-height: 36px;
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-2);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 700;
}
.paper-tags { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.paper-tag-list { align-items: center; margin-top: 12px; }
.paper-tag-list .muted { margin: 0; font-size: 12px; }
.paper-tag-heading { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.paper-tag { min-height: 32px; padding: 4px 11px; }
.year-tag { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.paper-tag-choice { min-height: 34px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--card-2); color: var(--text-2); font-size: 13px; font-weight: 600; }
.paper-tag-choice.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.paper-tag-choice:disabled { opacity: .55; }
.paper-tag-form { display: flex; gap: 7px; }
.paper-tag-form input { min-width: 0; flex: 1; height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card-2); font-size: 14px; }
.paper-tag-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.paper-tag-form button { min-height: 40px; padding: 4px 12px; border: 1px solid var(--accent); border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 700; }

.more {
  display: block;
  width: 100%;
  margin-top: 14px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent-text);
  font-weight: 700;
  box-shadow: var(--shadow);
}
.more:disabled { color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 56px 0; font-size: 15px; }

/* ---- 動き ---- */
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  button:active { transform: none; }
}


/* ---- ログイン・会員登録 ---- */
.auth {
  max-width: 560px;
  margin: 40px auto 30px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(22px, 5vw, 38px);
  box-shadow: var(--shadow-lg);
}
.auth-intro { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 25px; }
.auth-icon { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--grad); color: #fff; font-size: 24px; box-shadow: 0 9px 18px -10px var(--accent); }
.auth-eyebrow { margin: 1px 0 5px; color: var(--accent-text); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.auth-intro h2 { margin: 0; font-size: clamp(20px, 5vw, 25px); line-height: 1.35; }
.auth-intro p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.social-auth { display: grid; gap: 10px; }
.social-auth a { display: flex; justify-content: center; align-items: center; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 700; }
.social-auth a:hover { border-color: var(--accent); background: var(--accent-soft); }
.social-link { max-width: 760px; margin: 0 auto 16px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px 16px; }
.social-link a { color: var(--muted); font-size: 12px; text-decoration: none; border-bottom: 1px solid var(--line); }
.social-link a:hover { color: var(--accent-text); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 23px 0; color: var(--muted); font-size: 12px; white-space: nowrap; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-msg { margin: 0 0 12px; padding: 10px 14px; background: var(--accent-soft); color: var(--accent-text); border-radius: var(--r-sm); font-size: 14.5px; }
.auth-switch { display: flex; gap: 4px; padding: 4px; background: var(--card-2); border-radius: 999px; margin-bottom: 16px; }
.auth-switch button { flex: 1; min-height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 700; }
.auth-switch button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h3 { margin: 0; font-size: 18px; }
.auth-form > label, .field > label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.auth-form input[type="email"], .auth-form input[type="password"], .auth-form input[type="text"], .auth-form select, .auth-form textarea {
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card-2);
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  -webkit-appearance: none;
}
.auth-form select { -webkit-appearance: menulist; appearance: menulist; }
.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.auth-form textarea { height: auto; min-height: 150px; padding: 12px 14px; line-height: 1.6; resize: vertical; font-family: inherit; }
.actions button.soon { opacity: 0.5; cursor: default; }
.contact-form { margin-top: 8px; }
.contact-form .lbl { display: block; }
.contact-form .req, .contact-form .opt { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
.contact-form .req { background: var(--danger); color: #fff; }
.contact-form .opt { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.contact-form .count { font-size: 12.5px; text-align: right; font-weight: 400; }
.contact-form .trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { padding: 12px 14px; border-radius: var(--r-sm); font-size: 14.5px; line-height: 1.6; }
.form-status.ok { background: rgba(16, 185, 129, 0.12); color: var(--ok); }
.form-status.err { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.form-status.pending { background: var(--card-2); color: var(--muted); }
.auth-form .primary {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.7);
}
.auth-form .primary:disabled { opacity: 0.5; box-shadow: none; }
.auth-form .muted { margin: 0; font-size: 13.5px; }
.field .label { display: block; font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.field .req { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
.field .multi { display: flex; flex-wrap: wrap; gap: 8px; }
.field .multi .chip { min-height: 36px; font-size: 14px; }
.consent { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px !important; font-weight: 500 !important; font-size: 14px !important; }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }

/* ---- フッター ---- */
.foot {
  width: 100%;
  margin: 0;
  padding: 34px clamp(20px, 5vw, 88px) calc(40px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  background: var(--card-2);
}
.foot nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.foot a { color: var(--text-2); text-decoration: none; font-weight: 600; }
.foot p { margin: 0; }

/* ---- 静的ページ(使い方・用語集・規約) ---- */
.page { padding: 20px 16px 40px; max-width: 760px; margin: 0 auto; }
.page article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  font-size: 16px;
  line-height: 1.75;
}
.page h1 { margin: 0 0 14px; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.35; }
.page h2 { margin: 28px 0 10px; font-size: 18px; font-weight: 800; padding-left: 12px; border-left: 4px solid var(--accent); line-height: 1.4; }
.page h3 { margin: 18px 0 4px; font-size: 16px; font-weight: 700; }
.page p { margin: 0 0 12px; }
.page .lead { font-size: 16.5px; color: var(--text-2); }
.page ul, .page ol { padding-left: 22px; margin: 0 0 12px; }
.page li { margin-bottom: 6px; }
.page table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 0 0 12px; }
.page th, .page td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.page th { color: var(--muted); font-weight: 600; font-size: 13px; }
.page .crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.page .crumb a { color: var(--muted); }
.page .cta {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, 0.8);
}
.page ul.words { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 20px; }
.page ul.words li { break-inside: avoid; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.page ul.words a { font-weight: 600; text-decoration: none; }
.page ul.words .muted { display: block; font-size: 12.5px; }
@media (max-width: 460px) { .page ul.words { columns: 1; } }

/* ---- 検索語とご意見への導線 ---- */
.feedback-box {
  margin: 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow);
}
.ranking-box {
  margin: 0;
  padding: 56px 0 0;
  text-align: center;
}
.ranking-box h2, .feedback-box h2 { margin: 0 0 4px; color: var(--text); font-size: 20px; line-height: 1.4; letter-spacing: -.01em; }
.ranking-box .chips { display: flex; justify-content: center; align-content: center; flex-wrap: wrap; gap: 24px 28px; min-height: 220px; padding: 28px 12px 12px; }
.ranking-box a.chip {
  min-height: 48px;
  padding: 9px 19px;
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  border-color: var(--accent-soft);
  box-shadow: 0 6px 20px -12px rgba(79,70,229,.4);
  animation: word-float 7s ease-in-out infinite;
}
.ranking-box a.chip:nth-child(3n) { background: var(--card-2); }
.ranking-box a.chip:nth-child(4n) { font-size: 16px; }
.ranking-box a.chip:hover, .ranking-box a.chip:focus-visible { border-color: var(--accent); background: var(--accent-soft); animation-play-state: paused; box-shadow: 0 8px 22px -9px rgba(79,70,229,.45); }
.ranking-box a.chip .rank { display: inline-block; min-width: 18px; margin-right: 4px; font-size: 11.5px; font-weight: 800; color: var(--accent-text); }
.ranking-box a.chip .sample-mark { margin-left: 6px; color: var(--muted); font-size: 11px; font-weight: 500; }
.ranking-box a.chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@keyframes word-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) {
  .ranking-box a.chip { animation: none; }
}
@media (max-width: 600px) {
  .ranking-box { padding-top: 40px; }
  .ranking-box .chips { gap: 14px; min-height: 0; padding: 26px 0 0; }
  .ranking-box a.chip { min-height: 42px; padding: 7px 13px; font-size: 13px; }
  .ranking-box a.chip:nth-child(4n) { font-size: 14px; }
}
.feedback-box { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 88px; background: var(--card-2); }
.feedback-cta { display: inline-flex; align-items: center; justify-content: center; gap: 12px; flex: none; min-height: 56px; padding: 12px 22px; border-radius: 999px; background: var(--grad); color: #fff; text-decoration: none; font-size: 15px; font-weight: 800; box-shadow: 0 8px 20px -8px rgba(79,70,229,.65); }
.feedback-cta:hover { filter: brightness(1.08); }
@media (max-width: 650px) { .feedback-box { display: block; margin-top: 64px; } .feedback-box h2 { margin-bottom: 20px; } .feedback-cta { width: 100%; } .home-alpha { margin-top: 72px; } }
ol.ranking { padding-left: 1.6em; font-size: 17px; }
ol.ranking li { margin: 0 0 10px; }
ol.ranking a { font-weight: 700; }
