/*
 * のびてん アプリ全体のスタイル。スマホ最適化を重視したシンプルなCSS。
 */

:root {
  /* アプリは全面ライト配色で固定。宣言が無いと iOS Safari のダークモードで
     フォーム部品(<button>/<input>等)の既定文字色が明色に反転し、白背景の
     .choice-btn 内で「白文字＝不可視」になる（プロフィール名が消える不具合）。 */
  color-scheme: light;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --correct: #16a34a;
  --wrong: #dc2626;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: #fff;
  padding: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; display: inline-flex; align-items: center; gap: 0.45rem; }
.brand-icon { width: 1.5rem; height: 1.5rem; border-radius: 6px; }
/* 開発環境の目印: 最上部に細い帯を表示（本番と取り違え防止）。ヘッダーの色は変えない。 */
.env-banner {
  background: #7c3aed; color: #fff; text-align: center;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; padding: 0.2rem 0.5rem;
}
.app-nav { display: flex; align-items: center; gap: 0.5rem; }
.nav-link {
  color: #fff; text-decoration: none; font-size: 0.85rem;
  background: rgba(255,255,255,0.15); border: none; cursor: pointer;
  padding: 0.35rem 0.6rem; border-radius: 6px;
}
/* ゲストヘッダーの「ログイン」はボタンではなくテキストリンク（新規登録ボタンを主役にする） */
.app-nav .nav-link-text {
  color: #fff; text-decoration: underline; font-size: 0.85rem;
  padding: 0.35rem 0.2rem; align-self: center;
}
.pages-home .app-header .nav-link-text { color: #475569; }

.app-main { max-width: 720px; margin: 0 auto; padding: 1rem; }

.app-footer {
  max-width: 720px;
  margin: 2rem auto 1rem;
  padding: 0 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
}
.app-footer span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.flash { max-width: 720px; margin: 0.5rem auto 0; padding: 0.6rem 1rem; border-radius: 8px; }
.flash-notice { background: #dcfce7; color: #166534; }
.flash-alert { background: #fee2e2; color: #991b1b; }

/* ランディングページ（未ログインのトップ） */
.landing-hero {
  background: linear-gradient(160deg, #2563eb 0%, #4f46e5 100%);
  color: #fff; border-radius: 16px; text-align: center;
  padding: 2.4rem 1.4rem 2rem; margin: 0.5rem 0 1.5rem;
}
.landing-badge {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  background: rgba(255,255,255,0.18); border-radius: 999px;
  padding: 0.25rem 0.8rem; margin-bottom: 1rem; letter-spacing: 0.04em;
}
.landing-hero h1 { font-size: 2rem; line-height: 1.35; margin: 0 0 0.8rem; }
.landing-hero p { font-size: 0.95rem; line-height: 1.9; opacity: 0.95; margin: 0 0 1.4rem; }
.landing-cta { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.btn-hero {
  background: #fff; color: var(--primary); font-size: 1.05rem;
  padding: 0.8rem 2rem; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.btn-hero:hover { background: #f1f5ff; }
.landing-login-link { color: #fff; font-size: 0.85rem; text-decoration: underline; opacity: 0.9; }

/* ヒーロー内の実績数字 */
.hero-stats { display: flex; justify-content: center; gap: 1.6rem; margin-bottom: 1.4rem; }
.hero-stats div { display: flex; flex-direction: column; align-items: center; }
.hero-stats strong { font-size: 1.4rem; }
.hero-stats span { font-size: 0.72rem; opacity: 0.85; }

/* アプリ画面のライブモック（実CSSコンポーネントをスマホ枠に入れて見せる） */
.phone-row { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; }
.phone-frame { width: 260px; }
.phone-screen {
  border: 6px solid #1f2937; border-radius: 26px; background: var(--bg);
  padding: 0.9rem 0.8rem; box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  pointer-events: none; user-select: none;   /* 見本なので操作不可 */
}
.phone-screen .quiz-prompt { font-size: 0.95rem; margin: 0.4rem 0 0.8rem; line-height: 1.6; }
.phone-screen .choices { gap: 0.45rem; }
.phone-screen .choice-btn { min-height: 40px; font-size: 0.85rem; padding: 0.5rem 0.8rem; border-radius: 10px; }
.phone-screen .daily-bar-area { height: 44px; }
.phone-caption { text-align: center; font-size: 0.82rem; color: var(--muted); margin-top: 0.6rem; }
.mock-mastery-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  font-size: 0.85rem; padding: 0.3rem 0;
}

/* 悩み共感チェックリスト */
.pain-list { list-style: none; padding: 0; margin: 0 0 1.2rem; display: grid; gap: 0.6rem; }
.pain-list li {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.8rem 1rem 0.8rem 2.6rem; position: relative; font-size: 0.92rem;
}
.pain-list li::before {
  content: "✓"; position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%);
  color: var(--primary); font-weight: 800; font-size: 1.1rem;
}
.landing-lead { text-align: center; line-height: 2; font-size: 0.95rem; }

/* 家族で競う（みんなの成績のミニモック） */
.family-score-card { max-width: 340px; margin: 0 auto; }
.family-score-head { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.5rem; }
.family-score-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.35rem 0; font-size: 0.95rem;
}
.family-score-row .mastery-bar { width: 110px; }
.family-score-caption {
  text-align: center; margin: 0.8rem 0 0; font-size: 0.9rem; font-weight: 700; color: var(--primary);
}
.sp-only { display: inline; }
@media (min-width: 560px) { .sp-only { display: none; } }

/* FAQ（ネイティブアコーディオン） */
details.faq {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.8rem 1rem; margin-bottom: 0.5rem;
}
details.faq summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 1.5rem; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "＋"; position: absolute; right: 0; color: var(--muted); }
details.faq[open] summary::after { content: "−"; }
details.faq p { margin: 0.6rem 0 0; font-size: 0.9rem; color: var(--muted); line-height: 1.8; }

.landing-section { margin: 2.2rem 0; }
.landing-section h2 { text-align: center; font-size: 1.25rem; margin-bottom: 1rem; }
.feature-grid { display: grid; gap: 0.75rem; }
@media (min-width: 560px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature-card { margin-bottom: 0; }
.feature-card .feature-icon { font-size: 1.8rem; }
.feature-card h3 { font-size: 1.02rem; margin: 0.4rem 0; }
.feature-card p { font-size: 0.88rem; color: var(--muted); margin: 0; line-height: 1.7; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; counter-reset: step; }
.steps li {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.9rem 1rem 0.9rem 3.2rem; position: relative; counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%);
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.steps li strong { display: block; }
.steps li span { font-size: 0.85rem; color: var(--muted); }
.landing-bottom-cta { margin-bottom: 1rem; }

/* カード */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }

/* ホームの「復習」導線 */
.review-cta { border-color: var(--primary); background: #eef2ff; text-align: center; font-weight: 600; }

/* 単元ページのモード選択（ボタン＋説明のセット） */
.mode-option { margin-top: 1.1rem; }
.mode-desc { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--muted); line-height: 1.6; }

/* ホームの教科ボタン */
.subject-btn {
  justify-content: space-between; font-weight: 700;
  text-decoration: none; color: var(--text);
}

/* 単元一覧 */
.subject-block { margin-bottom: 1.5rem; }
/* 単元のグループ（都道府県・歴史…）ごとのセクション */
.unit-section { margin-bottom: 1.6rem; }
.unit-section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  font-size: 1rem; color: var(--muted);
  margin: 0 0 0.6rem; padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--border);
}
.unit-section-count { font-size: 0.78rem; font-weight: 600; flex-shrink: 0; }
.unit-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.unit-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.75rem 1rem;
}
.unit-item .meta { color: var(--muted); font-size: 0.85rem; }
/* 単元ページへのリンク行（行全体をタップできるように a を敷き詰める） */
.unit-link-item { padding: 0; }
.unit-link {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; padding: 0.9rem 1rem; text-decoration: none; color: var(--text);
}
.unit-link .unit-main { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }

/* 単元ごとの定着度（おぼえた X/N）。まだ＝未着手 */
.mastery { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--muted); }
/* コンプリート（ぜんぶおぼえた）は星と同系の金バッジで示す（緑と金の混在を避ける） */
.mastery.is-full {
  color: #92400e; font-weight: 700;
  background: #fef3c7; border-radius: 999px; padding: 0.15rem 0.6rem;
}
.mastery-none { color: var(--muted); }
.mastery-bar {
  display: inline-block; width: 72px; height: 6px; border-radius: 999px;
  background: var(--border); overflow: hidden; flex-shrink: 0;
}
.mastery-fill { display: block; height: 100%; background: var(--correct); border-radius: 999px; }
/* おぼえたの星（SVGアイコン。絵文字のプラットフォーム差異を避ける） */
.icon-star { width: 1em; height: 1em; fill: #f59e0b; vertical-align: -0.125em; flex-shrink: 0; }
.star-count { display: inline-flex; align-items: center; gap: 0.05em; }

.qcount-badge {
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

/* ボタン */
.btn {
  display: inline-block; cursor: pointer;
  background: var(--primary); color: #fff; text-decoration: none;
  border: none; border-radius: 8px; padding: 0.6rem 1.1rem;
  font-size: 1rem; font-weight: 600;
}
.btn:hover { background: var(--primary-dark); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-ghost { background: transparent; color: var(--primary); padding: 0.3rem 0; border: none; cursor: pointer; }
/* 削除リンク（フォーム末尾）: 保存ボタンの下にまとめる */
.form-delete { margin-top: 1rem; text-align: center; }

/* 遷移中（連打防止）: 以降のタップを無効化し、処理中を視覚化 */
body.navigating { cursor: progress; }

/* 通信中の見える化: 画面中央に出るサークル型スピナー＋うっすら白いスクリム。
   一瞬で終わる遷移ではチラつかせないよう、ごく短く（0.15s）遅らせて表示する。 */
body.navigating::before {
  content: ""; position: fixed; inset: 0; z-index: 99;
  background: rgba(255, 255, 255, 0.45);
  opacity: 0; animation: loading-appear 0.15s ease-out 0.15s forwards;
}
body.navigating::after {
  content: ""; position: fixed; top: 50%; left: 50%;
  width: 44px; height: 44px; margin: -22px 0 0 -22px; z-index: 100;
  border: 4px solid rgba(37, 99, 235, 0.25);   /* 薄い青のリング */
  border-top-color: var(--primary);            /* 濃い青の回転アーク */
  border-radius: 50%;
  opacity: 0;
  /* 回転はずっと・表示は少し遅らせてフェードイン（2つのアニメーションを併用） */
  animation: loading-spin 0.7s linear infinite, loading-appear 0.2s ease-out 0.15s forwards;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }
@keyframes loading-appear { to { opacity: 1; } }
body.navigating .btn,
body.navigating .btn-ghost,
body.navigating .choice-btn,
body.navigating .app-main button,
body.navigating .app-main a,
body.navigating .app-header a,
body.navigating .app-header button,
body.navigating .app-footer a {
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.1s ease;
}

/* 解説の読み流し防止: ロック中のリンクは主ボタンの背景が左から右へ
   充填されていくアニメーションで残り時間を表現する（充填完了＝押せる）。
   クリック自体はJSで遮断し、シェイクで反応を返すので pointer-events は切らない */
.is-holding { cursor: default; }
.quit-link.is-holding { opacity: 0.55; }
.btn.is-holding {
  /* 未充填部分は半透明の黒を重ねて暗くする（白文字の可読性を保ったまま進捗を見せる） */
  background-image: linear-gradient(to right, transparent 50%, rgba(17, 24, 39, 0.35) 50%);
  background-size: 200% 100%;
  background-position: 100% 0;
  animation: hold-fill var(--hold-duration, 5s) linear forwards;
}
@keyframes hold-fill { to { background-position: 0 0; } }

/* 引用句の出典（解説の下に小さく表示） */
.citations { margin-top: 0.4rem; }
.citations p { margin: 0; color: var(--muted); font-size: 0.8rem; }

/* 「やめる/中断」は主要ボタンから十分離し、控えめにして誤タップを防ぐ */
.quit-area { margin-top: 2rem; text-align: center; }
.quit-link { color: var(--muted); font-size: 0.85rem; text-decoration: underline; }

/* クイズ */
.quiz-progress { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.quiz-progress .tag { flex-shrink: 0; white-space: nowrap; }  /* 「練習」等が縦に潰れないように */
.quiz-progress > span:not(.tag) { flex: 1; min-width: 0; }    /* 範囲・正答率は折り返し可 */
.quiz-prompt { font-size: 1.25rem; font-weight: 600; margin: 0.5rem 0 1.25rem; line-height: 1.9; }
/* ルビ（ふりがな）。デフォルト非表示で、トグル(html.furigana-on)で表示する */
rt { font-size: 0.55em; color: var(--muted); display: none; }
html.furigana-on rt { display: ruby-text; }
.choice-btn rt { color: inherit; opacity: 0.7; }

/* ふりがな表示トグル（カード下に控えめに置く） */
.furigana-area { text-align: center; margin: 0.75rem 0; }
.furigana-toggle {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 0.3rem 0.9rem; font-size: 0.8rem; cursor: pointer;
}
.furigana-toggle.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.choices { display: grid; gap: 0.9rem; }
.choice-btn {
  display: flex; align-items: center; width: 100%; text-align: left;
  min-height: 64px;                 /* スマホで押しやすいタップ領域 */
  color: var(--text);               /* <button> は色を継承しないので明示（ダークモードでの白文字化防止） */
  background: var(--card); border: 2px solid var(--border);
  border-radius: 12px; padding: 1rem 1.25rem;
  font-size: 1.2rem; line-height: 1.75; cursor: pointer; /* ルビ(ふりがな)ぶんの行間を確保 */
}
.choice-btn .choice-label { display: inline; }
.choice-btn:hover { border-color: var(--primary); }
.choice-btn:active { background: #eef2ff; border-color: var(--primary); }

/* 管理画面: ハブページのメニューと、各ページ共通のパンくず */
.admin-breadcrumb { margin-bottom: 0.5rem; }
.admin-breadcrumb a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.admin-menu .unit-link strong { font-size: 1.05rem; }
.admin-menu .chev { color: var(--muted); font-size: 1.2rem; }
.admin-session-card {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin-top: 1.5rem;
}
.admin-session-card form { margin: 0; }

/* 問題への報告リンク（フィードバック画面の隅に控えめに） */
.question-report { text-align: right; margin-top: 0.6rem; }
.question-report form { margin: 0; }
.feedback-form { display: flex; flex-direction: column; gap: 0.4rem; text-align: left; margin-top: 0.4rem; }
.feedback-comment {
  width: 100%; padding: 0.6rem; border: 1px solid var(--border); border-radius: 8px;
  font-size: 1rem; min-height: 3.5rem; font-family: inherit;
}
.feedback-send { align-self: flex-end; }
.feedback-detail { text-align: left; margin-top: 0.4rem; }
.feedback-detail-lead { font-size: 0.9rem; font-weight: 600; color: var(--text); margin: 0 0 0.5rem; }
.reason-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.reason-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.35rem 0.6rem; border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.85rem; background: var(--card); cursor: pointer;
}
.reason-chip input { margin: 0; }
.reason-chip:has(input:checked) { border-color: var(--primary); background: #eef4ff; color: var(--primary); font-weight: 600; }
.feedback-reported { font-size: 0.85rem; color: var(--muted); text-align: right; margin: 0.4rem 0 0; }
.feedback-comment-view {
  margin-top: 0.35rem; padding: 0.4rem 0.6rem; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; white-space: pre-wrap;
  font-size: 0.9rem; color: var(--text);
}
.feedback-reasons-view { margin-top: 0.3rem; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.tag-reason { background: #fff7ed; color: #9a3412; }
.footer-link { color: var(--muted); text-decoration: underline; }
.footer-sep { color: var(--border); margin: 0 0.3rem; }
/* 利用規約・プライバシーポリシー等の文書ページ */
.legal { line-height: 1.9; }
.legal h1 { font-size: 1.4rem; margin: 0 0 1rem; }
.legal h2 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; }
.legal p, .legal li { font-size: 0.92rem; }
.legal ul, .legal ol { padding-left: 1.4rem; }
.legal li { margin: 0.2rem 0; }
.legal-meta { margin-top: 2rem; color: var(--muted); font-size: 0.85rem; }
/* LINEログインボタン（LINEブランドカラー） */
.btn-line { background: #06C755; color: #fff; }
.btn-line:hover { background: #05b34c; }
/* ハニーポット（人には見えない位置へ）。display:none だと検出するボットがいるため画面外へ */
.hp-field { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }
.inquiry-meta { margin-top: 0.4rem; font-size: 0.78rem; color: var(--muted); }
.inquiry-meta summary { cursor: pointer; }
.inquiry-meta dl { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.5rem; margin: 0.3rem 0 0; }
.inquiry-meta dt { font-weight: 600; }
.inquiry-meta dd { margin: 0; }
.inquiry-meta dd.wrap { word-break: break-all; }

/* 学習者(Profile)ピッカー */
.profile-row { display: flex; align-items: center; gap: 0.5rem; }
.profile-row .profile-select { flex: 1; font-weight: 700; justify-content: center; text-align: center; }
.profile-row .profile-select.is-current { border-color: var(--primary); background: #eef2ff; }
.profile-actions { display: flex; flex-direction: column; gap: 0.2rem; }
.profile-actions .btn-ghost { font-size: 0.8rem; }
/* button_to はデフォルトで form を生む。choices グリッド内で高さを揃える */
.choices form { margin: 0; }
.profile-row form { margin: 0; flex: 1; }

.answer-input {
  width: 100%; font-size: 1.1rem; padding: 0.8rem;
  border: 2px solid var(--border); border-radius: 10px; margin-bottom: 1rem;
}

.feedback { text-align: center; padding: 1rem 0; }
.feedback .mark { font-size: 3rem; font-weight: 800; }
.feedback.correct .mark { color: var(--correct); }
.feedback.wrong .mark { color: var(--wrong); }
.feedback .label { font-size: 1.2rem; font-weight: 700; }
.feedback.correct .label { color: var(--correct); }
.feedback.wrong .label { color: var(--wrong); }

/* 正解のお祝い: ◯がポンッと弾んで登場、ほめ言葉がふわっと浮き上がる */
.feedback.correct .mark { display: inline-block; animation: mark-pop 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28) both; }
.feedback.correct .label { animation: label-rise 0.4s ease-out 0.15s both; }
@keyframes mark-pop {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes label-rise {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
/* コンボ（連続正解）バッジ */
.feedback .streak {
  display: inline-block; margin-top: 0.5rem; padding: 0.2rem 0.7rem;
  font-size: 0.95rem; font-weight: 700; color: #9a3412;
  background: #fff7ed; border: 1px solid #fdba74; border-radius: 999px;
  animation: label-rise 0.4s ease-out 0.3s both;
}
@media (prefers-reduced-motion: reduce) {
  .feedback.correct .mark, .feedback.correct .label, .feedback .streak { animation: none; }
}

/* 紙吹雪（JSが .confetti-piece を生成して落とす） */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti-piece {
  position: absolute; top: -5vh; width: 9px; height: 9px; will-change: transform, opacity;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(-5vh) rotateZ(0); opacity: 1; }
  100% { transform: translateY(105vh) rotateZ(720deg); opacity: 0.9; }
}
.answer-line { font-size: 1.1rem; margin: 0.5rem 0; }
.explanation { background: #f1f5f9; border-radius: 8px; padding: 0.8rem; color: #334155; text-align: left; margin: 1rem 0; }

/* 成績: 今日のサマリ・がんばり・おぼえたマップ */
.today-card { text-align: center; border-color: var(--primary); background: #eef2ff; }
.today-card .today-num { font-size: 1.1rem; font-weight: 600; }
.today-card .today-num strong { font-size: 1.6rem; color: var(--primary); }
.streak { font-size: 1.05rem; margin: 0.2rem 0 0.8rem; }
.streak strong { color: #ea580c; }

.daily-bars { display: flex; gap: 0.4rem; align-items: flex-end; }
.daily-col { flex: 1; text-align: center; }
.daily-bar-area { height: 64px; display: flex; align-items: flex-end; justify-content: center; }
.daily-bar { width: 60%; background: var(--primary); border-radius: 4px 4px 0 0; opacity: 0.75; }
.daily-col.is-today .daily-bar { opacity: 1; }
.daily-col.is-today .daily-label { font-weight: 700; color: var(--primary); }
.daily-count { font-size: 0.75rem; color: var(--muted); }
.daily-label { font-size: 0.75rem; color: var(--muted); }

.subject-mastery { border-top: 1px solid var(--border); padding: 0.6rem 0; }
.subject-mastery:first-of-type { border-top: none; }
.subject-mastery summary {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  cursor: pointer; list-style: none; font-weight: 700;
}
.subject-mastery summary::-webkit-details-marker { display: none; }
.subject-mastery summary::after { content: "▸"; color: var(--muted); }
.subject-mastery[open] summary::after { content: "▾"; }
.subject-mastery .mastery { margin-left: auto; }
.mastery-units { list-style: none; padding: 0.4rem 0 0; margin: 0; display: grid; gap: 0.45rem; }
.mastery-units li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.9rem; }
.mastery-units a { color: var(--text); text-decoration: none; }

/* 結果・成績 */
.score-big { font-size: 2.5rem; font-weight: 800; color: var(--primary); text-align: center; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; text-align: center; }
.stat-grid .num { font-size: 1.5rem; font-weight: 700; }
.stat-grid .lbl { font-size: 0.8rem; color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.tag { display: inline-block; font-size: 0.7rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: #e5e7eb; color: #374151; }
.tag.published { background: #dcfce7; color: #166534; }
.tag.draft { background: #fef9c3; color: #854d0e; }
.tag.correct { background: #dcfce7; color: #166534; }
.tag.wrong { background: #fee2e2; color: #991b1b; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.6rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem;
}
textarea { min-height: 5rem; font-family: inherit; }

/* 生年月日ピッカー（スクラッチ実装）。年/月/日の3フィールド＋タップで開く候補パネル。
   自由入力もでき、スマホでもポチポチ選ぶだけで入力できる。年から選ぶのでカレンダーは使わない */
/* 3フィールドを1本の枠でくくり、ひとつの入力欄のように見せる */
.bd-fields {
  display: inline-flex; align-items: baseline; gap: 0.15rem;
  padding: 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.bd-fields.is-active, .bd-fields:focus-within {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.bd-field { display: inline-flex; align-items: baseline; gap: 0.1rem; }
.bd-suffix { color: var(--muted); font-size: 0.95rem; }
/* 中の各入力は枠・背景を消して1つの欄に溶け込ませる */
.form-group .bd-fields .bd-input {
  width: auto; text-align: center; border: none; background: transparent; padding: 0;
  font-size: 1rem; color: var(--text);
}
.form-group .bd-fields .bd-input:focus { outline: none; }
.form-group .bd-fields .bd-year { width: 3.2rem; }
.form-group .bd-fields .bd-md { width: 1.8rem; }
.bd-input::placeholder { color: #cbd5e1; }

/* 候補パネル: フィールドの下にカードで開く（インライン。保存ボタンを覆わない）。中身はスクロール。 */
.bd-panel {
  margin-top: 0.4rem;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  padding: 0.6rem; max-height: 44vh; overflow-y: auto;
  animation: bd-pop 0.12s ease-out;
}
@keyframes bd-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.bd-panel-head { font-size: 0.8rem; color: var(--muted); margin: 0.1rem 0 0.5rem; }
.bd-grid { display: grid; gap: 0.4rem; }
.bd-panel-year .bd-grid { grid-template-columns: repeat(4, 1fr); }
.bd-panel-month .bd-grid { grid-template-columns: repeat(4, 1fr); }
.bd-panel-day .bd-grid { grid-template-columns: repeat(7, 1fr); }
.bd-opt {
  min-height: 44px; padding: 0.5rem 0.25rem; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: background 0.08s, border-color 0.08s, transform 0.02s;
}
.bd-opt:hover { border-color: var(--primary); background: #eff4ff; }
.bd-opt:active { transform: scale(0.96); }
.bd-opt.is-selected { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (prefers-reduced-motion: reduce) { .bd-panel { animation: none; } .bd-opt:active { transform: none; } }

/* ===== LP リニューアル（案1b） ===== */

/* LP のみヘッダーを白背景に（ログインはアウトラインのピル） */
.pages-home .app-header { background:#fff; border-bottom:1px solid #eef2f7; }
.pages-home .app-header .brand { color:var(--primary); }
.pages-home .app-header .nav-link { background:transparent; color:#475569; border:1px solid #dbe1ea; }

/* ヒーロー写真バンド + 白地メッセージ。app-main の余白を突き破って横いっぱい(フルブリード)に */
.lp-hero {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}
/* ヒーローをヘッダー直下にぴったり付ける（上の余白を除去） */
.pages-home .app-main { padding-top: 0; }
.lp-hero-photo { display:block; width:100%; height:210px; object-fit:cover; object-position:center 52%; }
.lp-hero-copy { background:#fff; padding:1.5rem 1.3rem 1rem; text-align:center; border-bottom:1px solid #eef2f7; }
.lp-badge {
  display:inline-block; font-size:0.72rem; font-weight:700; letter-spacing:0.04em;
  color:var(--primary); background:#eef2ff; border-radius:999px; padding:0.22rem 0.75rem; margin-bottom:0.7rem;
}
.lp-hero-title { font-size:1.7rem; line-height:1.35; margin:0 0 0.5rem; color:var(--text); }
.lp-hero-sub   { font-size:0.88rem; line-height:1.8; color:#5b6472; margin:0 0 1rem; }
.lp-hero-sub strong { color:var(--text); }
.lp-stats { display:flex; justify-content:center; gap:1.6rem; }
.lp-stats div { display:flex; flex-direction:column; align-items:center; }
.lp-stats strong { font-size:1.2rem; color:var(--primary); }
.lp-stats span   { font-size:0.68rem; color:var(--muted); }

/* 実演カード */
.lp-demo-wrap { padding:0; }
.lp-demo { margin-top:0.2rem; box-shadow:0 8px 24px rgba(20,40,80,0.10); }
.lp-demo-head { display:flex; align-items:center; gap:0.5rem; margin-bottom:0.5rem; }
.lp-tag-accent { background:#eef2ff; color:var(--primary); font-weight:700; }
.lp-demo-prompt { font-size:0.98rem; font-weight:600; line-height:1.9; margin:0.2rem 0 0.7rem; }
/* 見本の問題は常にふりがなを表示（LPには furigana トグルが無いため） */
.lp-demo rt { display:ruby-text; }
/* 見本なので操作不可（hover/tap のフィードバックを出さない） */
.lp-demo .choices { gap:0.45rem; pointer-events:none; user-select:none; }
.lp-demo .choice-btn { min-height:44px; font-size:0.9rem; padding:0.4rem 0.9rem; border-radius:11px;
  display:flex; align-items:center; justify-content:flex-start; cursor:default; }
.lp-demo .choice-btn.is-correct { background:#f0fdf4; border-color:var(--correct); font-weight:600; }
.lp-check { color:var(--correct); font-weight:800; margin-left:auto; padding-left:0.5rem; }
.lp-demo-note { font-size:0.82rem; color:#334155; background:#f1f5f9; border-radius:8px;
  padding:0.55rem 0.7rem; margin:0.7rem 0 0; line-height:1.6; }

/* 主CTA・信頼チップ */
.lp-cta-primary { font-size:1.05rem; font-weight:700; padding:0.85rem 1rem; border-radius:12px;
  box-shadow:0 6px 16px rgba(37,99,235,0.32); margin:0.9rem 0 0.6rem; }
.lp-trust { display:flex; justify-content:center; gap:0.5rem; flex-wrap:wrap; margin-bottom:1.6rem; }
.lp-trust span { font-size:0.74rem; font-weight:600; color:#475569; background:#eef2ff;
  border-radius:999px; padding:0.25rem 0.7rem; }

/* できること: 実物UIカード */
.lp-features { display:grid; gap:0.7rem; }
.lp-feature { padding:0.9rem 1rem; margin-bottom:0; }
.lp-feature-head { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:0.7rem; }
.lp-feature-head strong { font-size:0.95rem; color:var(--text); }
.lp-feature-head span   { font-size:0.74rem; color:#94a3b8; }
.lp-mini-row { display:flex; align-items:center; justify-content:space-between; gap:0.5rem;
  font-size:0.82rem; padding:0.35rem 0.6rem; background:#f8fafc; border-radius:8px; margin-bottom:0.35rem; }
.lp-mini-row:last-child { margin-bottom:0; }
.lp-ellipsis { color:#334155; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lp-when { flex-shrink:0; font-size:0.7rem; font-weight:700; color:var(--primary);
  background:#eef2ff; padding:0.1rem 0.5rem; border-radius:999px; }
.lp-subject-chips { display:flex; gap:0.4rem; flex-wrap:wrap; }
.lp-subject-chips span { display:flex; align-items:center; gap:0.35rem; font-size:0.8rem;
  background:#f8fafc; border:1px solid #eef2f7; border-radius:999px; padding:0.25rem 0.7rem; }
.lp-subject-chips b { color:var(--primary); }
/* 「みんなの成績」の mastery-fill は既存が緑(--correct)。LPでも緑のままでOK。 */

@media (min-width: 560px) {
  .lp-features { grid-template-columns: 1fr 1fr; }
  /* PCではフルブリード(100vw)を解除。横に伸びすぎると画像が縦に薄切りされ、
     スマホを見る親子(顔=上/スマホ=下)が収まらず見切れるため、コンテンツ幅に収める。 */
  .lp-hero { margin-left:0; margin-right:0; width:auto; border-radius:12px; overflow:hidden; }
  .lp-hero-photo { height:300px; object-position:center 50%; }
}

/* 画面下部の追従CTA */
.lp-sticky-cta { position:fixed; left:0; right:0; bottom:0; z-index:20;
  display:flex; align-items:center; gap:0.7rem; padding:0.7rem 1rem;
  background:rgba(255,255,255,0.92); backdrop-filter:blur(6px); border-top:1px solid var(--border);
  max-width:720px; margin:0 auto; }         /* app-main と同じ最大幅に合わせる */
.lp-sticky-text { flex:1; min-width:0; }
.lp-sticky-text strong { display:block; font-size:0.9rem; line-height:1.2; }
.lp-sticky-text span   { font-size:0.72rem; color:var(--muted); }
.lp-sticky-btn { flex-shrink:0; background:var(--primary); color:#fff; text-decoration:none;
  font-weight:700; font-size:0.92rem; padding:0.6rem 1.1rem; border-radius:999px; }
/* 追従CTA(position:fixed)が最下部を覆うので、本文末尾とフッター(利用規約・プライバシー等)が
   隠れないよう、ページ全体の下に余白を確保する。
   app-mainだけに余白を付けると、その後ろにある app-footer がクリアされず隠れてしまう。 */
.pages-home { padding-bottom:5.5rem; }

/* --- 広告スロット --- */
.ad-slot { margin: 1.25rem 0; }
/* LPフッター付近の控えめな広告（区切り線＋上下余白でひかえめに） */
.lp-footer-ad { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.lp-footer-ad .ad-slot { margin: 0; }
/* 開発プレビュー用のダミー枠（本番の実広告では出ない） */
.ad-slot--placeholder {
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:0.2rem;
  min-height:100px; padding:1rem;
  border:1px dashed var(--border); border-radius:12px;
  background:repeating-linear-gradient(45deg, #fafbfe, #fafbfe 10px, #f1f4fa 10px, #f1f4fa 20px);
  color:var(--muted); text-align:center;
}
.ad-slot__label { font-size:0.7rem; font-weight:700; letter-spacing:0.08em;
  padding:0.1rem 0.5rem; border:1px solid var(--border); border-radius:999px; background:#fff; }
.ad-slot__hint { font-size:0.75rem; }

/* --- 退会 --- */
.btn-danger { background: var(--wrong); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.withdrawal-warning {
  border: 1px solid var(--wrong); border-radius: 10px; background: #fef2f2;
  padding: 0.8rem 1rem; margin: 0.8rem 0; font-size: 0.92rem;
}
.withdrawal-warning ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.withdrawal-profiles { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 0.8rem; }
.withdrawal-profile-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; }
.withdrawal-consent { display: flex; align-items: center; gap: 0.5rem; margin: 1rem 0 0.8rem; font-weight: 700; }
.withdrawal-link-area { text-align: center; margin-top: 2rem; }
.withdrawal-link { color: var(--muted); font-size: 0.82rem; }

/* --- ホーム画面追加(A2HS) --- */
/* 設定ハブの項目（buttonをリンク項目と同じ見た目に） */
.a2hs-item { display: block; }
.a2hs-trigger {
  background: none; border: none; cursor: pointer; font: inherit;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; padding: 0.9rem 1rem; color: var(--text); text-align: left;
}
/* 結果画面の控えめな一行ヒント */
.a2hs-hint { text-align: center; margin: 1.2rem 0 0; font-size: 0.82rem; color: var(--muted); }
.a2hs-hint-link {
  background: none; border: none; cursor: pointer; font: inherit; padding: 0;
  color: var(--primary); text-decoration: underline;
}
/* ボトムシート（手順ガイド） */
.a2hs-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0); transition: background 0.2s ease;
}
.a2hs-backdrop.is-open { background: rgba(0, 0, 0, 0.45); }
.a2hs-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 720px; margin: 0 auto; padding: 0.6rem 1.2rem 1.2rem;
  background: var(--card); border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(100%); transition: transform 0.2s ease;
}
.a2hs-backdrop.is-open .a2hs-sheet { transform: translateY(0); }
.a2hs-sheet-handle {
  width: 2.4rem; height: 0.3rem; border-radius: 999px; background: var(--border);
  margin: 0.2rem auto 0.8rem;
}
.a2hs-sheet-title { margin: 0 0 0.2rem; font-size: 1.1rem; }
.a2hs-sheet-lead { margin: 0 0 0.8rem; font-size: 0.85rem; color: var(--muted); }
.a2hs-steps { margin-bottom: 1rem; }
.a2hs-share-icon {
  display: inline-block; border: 1.5px solid var(--text); border-top: none;
  padding: 0 0.3rem; font-weight: 700; border-radius: 2px; color: var(--text);
}
/* シート表示中は背面のスクロールを止める */
body.sheet-open { overflow: hidden; }
