/* ============================================================
   英語Tube — Daylight
   紙白 × ロゴレッド(#e4342b)のライト・クリーン
   規律: アクセントは赤一色 / 影は黒系の低不透明度 / 純白面はsurfaceのみ
   ============================================================ */
:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface-2: #f3f1ee;
  --surface-hover: #edebe7;
  --border: #e6e3df;
  --border-soft: rgba(35, 32, 30, 0.08);
  --text: #23201e;
  --muted: #74706c;
  --muted-strong: #4c4844;
  --accent: #e4342b;
  --accent-text: #c9271f; /* 小サイズ文字用の一段濃い赤（コントラストAA確保） */
  --accent-soft: rgba(228, 52, 43, 0.07);
  --accent-border: rgba(228, 52, 43, 0.42);
  --accent-ink: #ffffff;
  --danger: #d63c31;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --font-ui: 'Geist', 'Noto Sans JP', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-jp: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
  --font-mono: 'Geist Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  line-height: 1.8;
  letter-spacing: 0.01em;
}

/* 微細ノイズで紙のような質感を出す */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(228, 52, 43, 0.16); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 画面幅いっぱいを使う（余白は控えめに） */
.container { max-width: none; margin: 0 auto; padding: 0 clamp(16px, 1.8vw, 36px); }
#studyView { max-width: none; }

/* ---- ヘッダー ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 249, 247, 0.85);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
@supports (backdrop-filter: blur(16px)) {
  .site-header { backdrop-filter: saturate(160%) blur(16px); }
}
.header-inner {
  max-width: none;
  margin: 0 auto;
  padding: 14px clamp(16px, 1.8vw, 36px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.brand-logo { display: block; height: 32px; width: auto; }
.brand-sub { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; margin-left: 2px; }
@media (max-width: 520px) { .brand-sub { display: none; } }

.ghost-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.83rem;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.ghost-btn:hover { border-color: var(--accent-border); background: var(--accent-soft); }

/* ---- ヒーロー ---- */
.lib-hero {
  position: relative;
  padding: 64px 0 20px;
  text-align: center;
}
.lib-hero::before {
  content: '';
  position: absolute;
  inset: -80px -200px 0;
  pointer-events: none;
  background: radial-gradient(60% 50% at 50% 0%, rgba(228, 52, 43, 0.05), transparent 70%);
}
.hero-title {
  position: relative;
  font-family: var(--font-jp);
  font-weight: 900;
  font-size: clamp(1.9rem, 4.2vw, 3.4rem);
  line-height: 1.3;
  margin: 0 0 12px;
  letter-spacing: 0.01em;
  word-break: keep-all;
}
.hero-title .grad {
  background: linear-gradient(92deg, var(--accent), #f05a2e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-title .accent-dot { color: var(--accent); }
.hero-sub {
  position: relative;
  color: var(--muted);
  font-size: 0.98rem;
  margin: 0;
  font-family: 'Noto Sans JP', sans-serif;
}

/* ---- ツールバー ---- */
.toolbar {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 26px 0 14px;
  max-width: 1200px;
  margin: 0 auto;
}
.search-wrap { position: relative; flex: 1; }
.search-ic {
  position: absolute; left: 18px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search {
  width: 100%;
  height: 52px;
  padding: 0 18px 0 48px;
  font-size: 0.95rem;
  font-family: var(--font-ui);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search::placeholder { color: var(--muted); }
.search:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chan-select {
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-family: var(--font-ui);
  max-width: 230px;
  cursor: pointer;
}
.chan-select option { background: var(--surface); color: var(--text); }

/* ---- カテゴリーチップ ---- */
.cat-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 26px;
  justify-content: center;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(90deg, black 88%, transparent);
  mask-image: linear-gradient(90deg, black 88%, transparent);
}
.cat-filter::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  height: 34px;
  padding: 0 16px;
  font-size: 0.83rem;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.cat-chip:hover { border-color: var(--accent-border); color: var(--text); }
.cat-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ---- ライブラリ グリッド ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(282px, 1fr));
  gap: 22px;
  padding-bottom: 64px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-border);
  box-shadow: 0 10px 32px rgba(35, 32, 30, 0.1);
}
.thumb-wrap { position: relative; overflow: hidden; aspect-ratio: 16 / 9; }
.card-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
  transition: transform 0.25s ease;
}
.card:hover .card-thumb { transform: scale(1.03); }
.thumb-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  background: linear-gradient(transparent 62%, rgba(0, 0, 0, 0.6));
  pointer-events: none;
}
.thumb-time {
  position: absolute;
  right: 10px; bottom: 9px;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-feature-settings: 'tnum';
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 6px;
  padding: 2px 7px;
}
.card-body { padding: 13px 16px 16px; }
.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.card-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.card-cat {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 10px;
}
.card-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}
.card-title {
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}
.card-author { color: var(--muted); font-size: 0.78rem; margin-top: 5px; }

.empty { text-align: center; color: var(--muted); padding: 80px 0; }
.empty-sub { font-size: 0.85rem; }

/* ---- 学習画面 ---- */
.study-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 18px;
  gap: 12px;
  flex-wrap: wrap;
}
/* 語彙レベルの内訳バッジ（初級/中級/上級のユニーク単語数） */
.vocab-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: var(--font-ui);
  font-feature-settings: 'tnum';
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted-strong);
}
.vb::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.vb-beg::before { background: #1fa863; }
.vb-int::before { background: #eb9c0c; }
.vb-adv::before { background: #e05252; }
.vb-partial { color: #a3690a; border-color: rgba(235, 156, 12, 0.4); }
.vb-partial::before { background: #eb9c0c; }
.vb-click { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.vb-click:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.lib-none { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 48px 0; }
.footer-note { display: block; margin-top: 8px; font-size: 0.7rem; color: var(--muted); }
.footer-links { display: block; margin-top: 10px; font-size: 0.78rem; }
.footer-links a { color: var(--muted-strong); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.auth-consent { font-size: 0.74rem; color: var(--muted); line-height: 1.7; margin: 2px 0 10px; }
.auth-consent a { color: var(--accent); }

/* ---- 単語帳モーダル ---- */
.vmodal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(35, 32, 30, 0.4); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
}
.vmodal-panel {
  width: 100%; max-width: 560px; max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 18px 60px rgba(35, 32, 30, 0.2);
}
.vmodal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
}
.vmodal-title { font-weight: 700; font-size: 1.02rem; }
.vmodal-close {
  border: 1px solid var(--border); background: transparent; color: var(--muted-strong);
  border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 0.9rem;
}
.vmodal-close:hover { border-color: var(--accent-border); color: var(--text); }
.vmodal-list { overflow-y: auto; padding: 8px 8px; }
.vmodal-loading { color: var(--muted); text-align: center; padding: 28px 0; }
.vmodal-note {
  padding: 10px 20px; border-top: 1px solid var(--border-soft);
  color: var(--muted); font-size: 0.72rem;
}
.vw-row {
  display: grid; grid-template-columns: minmax(130px, auto) 1fr;
  gap: 12px; align-items: baseline;
  padding: 9px 12px; border-radius: 8px;
}
.vw-row:nth-child(odd) { background: var(--surface-2); }
.vw-en {
  font-family: var(--font-mono); font-weight: 600; color: var(--accent-text); font-size: 0.92rem;
  word-break: break-all; text-align: left;
  border: none; background: transparent; padding: 0; cursor: pointer;
}
.vw-en:hover { text-decoration: underline; }
.vw-ja { color: var(--muted-strong); font-size: 0.84rem; line-height: 1.55; }

/* ---- 単語ホバーポップアップ（答えの英文） ---- */
.answer-en .w { border-bottom: 1px dotted rgba(228, 52, 43, 0.45); cursor: pointer; }
.answer-en .w:hover { color: var(--accent); border-bottom-color: var(--accent); }
.word-tip {
  position: fixed; z-index: 1100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 13px;
  box-shadow: 0 10px 32px rgba(35, 32, 30, 0.18);
  font-size: 0.82rem; line-height: 1.6; pointer-events: none;
}
.wt-word { font-family: var(--font-mono); font-weight: 700; color: var(--accent); margin-bottom: 3px; }
.wt-key { color: #a3690a; margin-bottom: 2px; }
.wt-gloss { color: var(--muted-strong); }
@media (max-width: 560px) {
  .vmodal { padding: 10px; }
  .vw-row { grid-template-columns: 1fr; gap: 3px; }
}
.card-vocab { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.card-vocab .vb { padding: 3px 9px; font-size: 0.68rem; gap: 5px; background: var(--surface-2); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(420px, 1fr);
  gap: clamp(24px, 2.5vw, 44px);
  align-items: start;
  padding-bottom: 56px;
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .video-col { position: static; }
}
.video-col { position: sticky; top: 88px; }
.video-wrap {
  position: relative;
  width: 100%;
  max-width: min(100%, calc(76vh * 1.7778)); /* 高さ76vh相当まで（縦はみ出し防止） */
  padding-top: min(56.25%, 72vh);
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(35, 32, 30, 0.16);
}
.video-wrap iframe, .video-wrap > div {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
/* ポスターオーバーレイ（初回再生までサムネ＋再生ボタン。再生開始で消える） */
.poster-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}
.poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.poster-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(55% 55% at 50% 50%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.35));
}
.poster-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: 74px; height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.poster-play svg { margin-left: 3px; }
.poster-overlay:hover .poster-play {
  transform: translate(-50%, -50%) scale(1.07);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.45);
}

.video-meta { margin-top: 16px; }
.video-meta .title { font-weight: 700; font-size: 1.02rem; font-family: var(--font-jp); line-height: 1.5; }
.video-meta .author { color: var(--muted); font-size: 0.82rem; margin-top: 3px; }

/* ---- タブ ---- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 12px;
  width: fit-content;
}
.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 22px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: var(--font-ui);
  transition: background 0.14s, color 0.14s;
}
.tab.active { background: var(--surface-hover); color: var(--text); }

/* ---- 出題コントロール ---- */
.drill-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.mode-hint { font-size: 0.76rem; color: var(--muted); }
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 9px 18px;
  font-size: 0.84rem;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active { background: var(--accent-soft); color: var(--accent-text); }

/* ---- 位置表示 ---- */
.position { margin-bottom: 18px; }
.position-info { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.counter-badge {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  background: var(--accent-soft);
  color: var(--accent-text);
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.78rem;
}
.sync-time {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  font-size: 0.76rem;
  color: var(--muted);
}
.timeline { position: relative; height: 22px; cursor: pointer; }
.timeline::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 9px;
  height: 4px;
  border-radius: 999px;
  background: #e8e5e1;
}
.timeline-fill {
  position: absolute;
  left: 0; top: 9px;
  height: 4px;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
}
.timeline-marker {
  position: absolute;
  top: 50%; left: 0;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  transform: translate(-50%, -50%);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(228, 52, 43, 0.3); }
  50% { box-shadow: 0 0 0 7px rgba(228, 52, 43, 0.08); }
}

/* ---- 出題カード ---- */
.problem-list { min-height: 120px; }
.problem-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: 0 10px 30px rgba(35, 32, 30, 0.06);
}
.problem-ja {
  font-family: var(--font-jp);
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text);
}
.problem-actions { display: flex; gap: 8px; margin-top: 18px; }
.mini-btn {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--accent-text);
  font-weight: 500;
  font-family: var(--font-ui);
  transition: background 0.15s, border-color 0.15s;
}
.mini-btn:hover { background: var(--accent-soft); border-color: var(--accent-border); }
.mini-btn:disabled { opacity: 0.45; cursor: default; }
.rate-btn { font-family: var(--font-mono); font-feature-settings: 'tnum'; color: var(--muted-strong); }
.mini-btn:disabled:hover { background: transparent; border-color: var(--border); }

/* 段階ヒント: 伏字の骨格 → クリックごとに単語を開示 */
.problem-hint {
  margin-top: 14px;
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}
.hint-words {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
}
.hint-word { color: var(--muted); letter-spacing: 1px; }
.hint-word.on { color: var(--accent-text); letter-spacing: normal; font-weight: 600; }
.hint-tip { margin-top: 8px; color: var(--muted-strong); font-size: 0.82rem; }

/* 答え: 霧の中 → 開示でクリアに */
.problem-answer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed rgba(35, 32, 30, 0.18);
  filter: blur(10px);
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
  transition: filter 0.4s ease, opacity 0.4s ease;
}
.problem-answer.revealed {
  filter: blur(0);
  opacity: 1;
  pointer-events: auto;
  user-select: auto;
}
.answer-en {
  display: inline;
  font-family: var(--font-ui);
  font-size: 1.18rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.7;
  padding: 2px 6px;
  margin-left: -6px;
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background-image: linear-gradient(rgba(255, 206, 63, 0.45), rgba(255, 206, 63, 0.45));
  background-repeat: no-repeat;
  background-size: 0% 100%;
}
.problem-answer.revealed .answer-en { animation: marker 0.5s 0.15s ease-out forwards; }
@keyframes marker { to { background-size: 100% 100%; } }
.answer-hint { font-size: 0.84rem; color: var(--muted-strong); margin-top: 12px; }

/* 解説・語彙・言い換えブロック */
.answer-block {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.answer-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 7px;
}
.answer-expl {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.88rem;
  color: var(--muted-strong);
  line-height: 1.9;
}
.vocab-list { display: flex; flex-direction: column; gap: 7px; }
.vocab-item { display: flex; gap: 12px; align-items: baseline; font-size: 0.87rem; }
.vocab-en { color: var(--text); font-weight: 500; font-family: var(--font-ui); white-space: nowrap; }
.vocab-ja { color: var(--muted-strong); font-size: 0.84rem; }
.answer-alt { font-size: 0.92rem; color: var(--text); font-family: var(--font-ui); line-height: 1.7; }

.answer-source { font-size: 0.76rem; color: var(--muted); margin-top: 12px; font-style: italic; }
.sentence-status { color: var(--muted); font-size: 0.88rem; padding: 10px 0; }

/* ---- ボタン ---- */
.play-row { margin-top: 16px; }
.sync-nav { display: flex; gap: 10px; margin-top: 12px; }
.btn {
  border: none;
  border-radius: var(--radius-sm);
  height: 46px;
  padding: 0 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: filter 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); flex: 1.4; }
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 6px 20px rgba(228, 52, 43, 0.28); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); flex: 1; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent-border); }
.btn.full { width: 100%; }
.btn-play {
  width: 100%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}
.btn-play:hover { background: rgba(228, 52, 43, 0.12); }

/* ---- 全文 ---- */
.transcript-hint { font-size: 0.8rem; color: var(--muted); margin: 0 0 14px; }
.transcript-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.transcript-line {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 2px solid transparent;
  cursor: pointer;
  align-items: baseline;
  transition: background 0.12s;
}
.transcript-line:hover { background: var(--surface-2); }
.transcript-line.current {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.tl-num {
  color: var(--muted);
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  font-size: 0.68rem;
  min-width: 2.6em;
}
.tl-time {
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  font-size: 0.7rem;
  min-width: 3em;
}
.tl-text { flex: 1; font-size: 0.92rem; line-height: 1.65; color: var(--muted-strong); }
.transcript-line.current .tl-text { color: var(--text); }

/* ---- フォーム（管理画面と共有） ---- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.field input[type='text'], .field input[type='password'], .field input[type='email'], .field input[type='tel'] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-family: var(--font-ui);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input::placeholder { color: var(--muted); }
.admin-status {
  margin-top: 14px;
  font-size: 0.85rem;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted-strong);
  white-space: pre-wrap;
}
.admin-status.ok { background: rgba(31, 168, 99, 0.1); color: #157347; }
.admin-status.err { background: rgba(224, 82, 82, 0.09); color: #c03d35; }

/* ---- 認証・アカウント ---- */
.header-actions { display: flex; align-items: center; gap: 10px; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}
.user-name { font-size: 0.85rem; color: var(--muted-strong); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(35, 32, 30, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
}
@supports (backdrop-filter: blur(4px)) {
  .modal { backdrop-filter: blur(4px); }
}
.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(35, 32, 30, 0.22);
  padding: 24px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 1.08rem; font-family: var(--font-jp); }
.icon-btn { border: none; background: transparent; font-size: 1.5rem; color: var(--muted); cursor: pointer; line-height: 1; }
.icon-btn:hover { color: var(--text); }

/* SNSログインボタン（ピル型・ブランドカラー） */
.sns-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 999px;
  font-weight: 700;
  margin-top: 10px;
}
.sns-btn:hover { filter: brightness(0.95); }
.google-btn { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.line-btn { background: #06c755; color: #fff; } /* LINEブランドカラー */
.twitter-btn { background: #000; color: #fff; }
.facebook-btn { background: #1877f2; color: #fff; } /* Facebookブランドカラー */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 0.75rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-switch { margin: 14px 0 0; font-size: 0.82rem; color: var(--muted); text-align: center; }
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

/* カードの学習進捗ヘアライン */
.card-progress {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  z-index: 1;
  background: var(--accent);
}

/* ---- フッター ---- */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
  padding: 30px 24px calc(44px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

/* ---- モバイル ---- */
@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .header-inner { padding: 12px 16px; }
  .brand-logo { height: 26px; }
  .lib-hero { padding: 40px 0 12px; }
  .hero-title { font-size: clamp(1.55rem, 7.4vw, 2rem); }
  .hero-sub { font-size: 0.85rem; padding: 0 8px; }
  .toolbar { flex-wrap: wrap; padding-top: 20px; }
  .search, .chan-select { height: 48px; }
  .chan-select { max-width: none; flex: 1 1 100%; }
  .cat-filter { justify-content: flex-start; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 13px; }
  .card-body { padding: 11px 12px 13px; }
  .card-title { font-size: 0.85rem; }
  .card-top { gap: 7px; margin-bottom: 6px; }
  .problem-card { padding: 20px 18px; }
  .problem-ja { font-size: 1.24rem; }
  .sync-nav { flex-wrap: wrap; }
  .btn { font-size: 0.85rem; }
  .btn-primary { flex: 1 1 100%; order: -1; }
  .timeline { height: 26px; }
  .timeline::before, .timeline-fill { top: 11px; }
  .transcript-list { max-height: none; }
}
