/* 適性検査・教育DX ベータ 共通スタイル（ケアUI原則準拠）
   本文#1F2933 / アクセント#1A6B8A / 注意#C2571A / 最小16px / 意味は色+形+文言の3重符号 */
:root {
  --ink: #1F2933;
  --sub: #52606D;
  --line: #CBD2D9;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --accent: #1A6B8A;
  --accent-dark: #145268;
  --caution: #C2571A;
  --ok: #2F855A;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink); background: var(--bg);
  font-size: 17px; line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 20px 18px 64px; }
.wrap-wide { max-width: 1040px; margin: 0 auto; padding: 20px 18px 64px; }
h1 { font-size: 1.4rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
p { margin: 8px 0; }
.muted { color: var(--sub); }
.small { font-size: 0.9rem; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin: 14px 0;
}

/* ボタン: 56px以上・道路標識テスト */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; width: 100%; padding: 14px 20px;
  font-size: 1.1rem; font-weight: 700; color: #fff;
  background: var(--accent); border: none; border-radius: var(--radius);
  cursor: pointer; text-decoration: none; line-height: 1.3;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { background: #9AA5B1; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--accent); border: 2px solid var(--accent); }
.btn-ghost:hover { background: #EAF2F6; }
.btn-sm { min-height: 44px; width: auto; padding: 8px 16px; font-size: 0.95rem; }

/* 選択肢: 全幅カード */
.choice {
  display: block; width: 100%; text-align: left;
  min-height: 56px; padding: 16px 18px; margin: 10px 0;
  font-size: 1.05rem; color: var(--ink);
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  cursor: pointer;
}
.choice:hover { border-color: var(--accent); }
.choice.sel { border-color: var(--accent); background: #EAF2F6; box-shadow: inset 0 0 0 1px var(--accent); }

/* 進捗 */
.progress { height: 10px; background: #E4E7EB; border-radius: 6px; overflow: hidden; margin: 4px 0 6px; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.encourage { color: var(--accent-dark); font-weight: 700; }

/* フォーム */
label.field { display: block; margin: 14px 0 4px; font-weight: 700; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=password], select, textarea {
  width: 100%; font-size: 1.05rem; padding: 13px 14px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* バッジ・注記 */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.pill-draft { background: #FDEBD8; color: var(--caution); }
.pill-pub { background: #DBF0E4; color: var(--ok); }
.disclaimer {
  border-left: 4px solid var(--sub); background: #EEF1F4;
  padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; color: var(--sub); margin: 12px 0;
}

/* 横スクロール可能なテーブル包み（狭幅ではみ出し防止） */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 460px; }

/* テーブル（管理・高密度可） */
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { background: #EEF1F4; font-size: 0.85rem; color: var(--sub); }
tr.clickable:hover { background: #F0F5F8; cursor: pointer; }

/* スコアバー */
.bigscore { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent-dark); line-height: 1; }
.aspbar { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.aspbar .name { width: 120px; font-size: 0.9rem; }
.aspbar .track { flex: 1; height: 14px; background: #E4E7EB; border-radius: 7px; overflow: hidden; }
.aspbar .track > i { display: block; height: 100%; background: var(--accent); }
.aspbar .pct { width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* 参考: 人となり欄（物理的分離） */
.karte-ref { border-top: 3px double var(--line); margin-top: 24px; padding-top: 16px; }
.karte-ref h3 { font-size: 1rem; color: var(--sub); margin: 0 0 8px; }
.animal-badge { display: inline-block; padding: 6px 14px; border-radius: 999px; background: #EEF1F4; color: var(--ink); font-weight: 700; }

/* 音声画面 */
.mic-stage { text-align: center; padding: 24px 0; }
.mic-btn {
  width: 140px; height: 140px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; font-size: 1.05rem; font-weight: 700;
  cursor: pointer; box-shadow: 0 6px 18px rgba(26,107,138,.35);
}
.mic-btn.rec { background: var(--caution); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{ transform: scale(1);} 50%{ transform: scale(1.06);} }
.bubble { text-align: left; background: #EAF2F6; border-radius: 14px; padding: 14px 16px; margin: 12px 0; }
.bubble.you { background: #EEF1F4; }
.hint { color: var(--sub); font-size: 0.92rem; }

.icon { width: 24px; height: 24px; vertical-align: middle; }
.center { text-align: center; }
.spacer { height: 16px; }
.hidden { display: none !important; }
.err { color: var(--caution); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(8px); display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; font-weight: 700; opacity: 0; transition: opacity .22s, transform .22s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.check-pop { display: inline-flex; animation: checkPop .45s cubic-bezier(.2,1.4,.4,1); }
@keyframes checkPop { 0% { transform: scale(0); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* ===== 楽しさ仕様 ===== */
/* ミュートトグル（右上固定） */
.mute-toggle { position: fixed; top: 14px; right: 14px; z-index: 70; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--accent-dark); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.mute-toggle:hover { background: #EAF2F6; }
.sound-hint { position: fixed; top: 66px; right: 14px; z-index: 70; background: var(--ink); color: #fff; font-size: .82rem; padding: 8px 12px; border-radius: 8px; opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s; max-width: 220px; }
.sound-hint.show { opacity: 1; transform: translateY(0); }

/* 選択のマイクロアニメーション */
@keyframes tapPulse { 0% { transform: scale(1); } 40% { transform: scale(.97); } 100% { transform: scale(1); } }
.choice.tapped { animation: tapPulse .22s ease; }
.choice.sel { animation: selPop .28s cubic-bezier(.2,1.3,.4,1); }
@keyframes selPop { 0% { transform: scale(1);} 50% { transform: scale(1.015);} 100% { transform: scale(1);} }

/* 紙吹雪キャンバス */
.confetti-cv { position: fixed; inset: 0; z-index: 80; pointer-events: none; }

/* 完了画面の弾むチェック */
.done-check { width: 84px; height: 84px; margin: 6px auto 10px; border-radius: 50%; background: #DBF0E4; display: flex; align-items: center; justify-content: center; animation: checkPop .5s cubic-bezier(.2,1.5,.4,1); }

/* 下部固定の録音フッター（音声ヒアリング） */
.voice-body { padding-bottom: 190px; }
.mic-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mic-footer .mic-btn { width: 92px; height: 92px; font-size: .98rem; box-shadow: 0 4px 14px rgba(26,107,138,.32); }
.mic-footer .rec-meta { min-height: 20px; font-size: .92rem; color: var(--sub); font-variant-numeric: tabular-nums; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--caution); margin-right: 6px; vertical-align: middle; animation: pulse 1.1s infinite; }

/* 段階プログレスバー（テスト生成中） */
.prog-wrap { margin: 10px 0; }
.prog-track { height: 12px; background: #E4E7EB; border-radius: 7px; overflow: hidden; }
.prog-track > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #4C9FBF); border-radius: 7px; transition: width .6s cubic-bezier(.3,.7,.3,1); background-size: 200% 100%; animation: progShimmer 1.4s linear infinite; }
@keyframes progShimmer { 0% { background-position: 0 0; } 100% { background-position: 200% 0; } }
.prog-msg { margin-top: 10px; font-weight: 700; color: var(--accent-dark); }
.prog-steps { margin-top: 8px; font-size: .88rem; color: var(--sub); }
.prog-steps .s { opacity: .4; }
.prog-steps .s.active { opacity: 1; color: var(--accent-dark); font-weight: 700; }
.prog-steps .s.done { opacity: .8; color: var(--ok); }

/* 生成完了の弾むバッジ */
.gen-done-badge { width: 72px; height: 72px; margin: 4px auto 8px; border-radius: 50%; background: #DBF0E4; display: flex; align-items: center; justify-content: center; animation: checkPop .5s cubic-bezier(.2,1.5,.4,1); }

/* ===== 実技課題型（practical） ===== */
.deadline-bar { background: #EAF2F6; border: 1px solid var(--accent); color: var(--accent-dark); font-weight: 700; font-size: .92rem; padding: 8px 12px; border-radius: 10px; margin: 0 0 12px; text-align: center; }
.deadline-bar.over { background: #FDEBD8; border-color: var(--caution); color: var(--caution); }
.notes { margin: 8px 0; padding-left: 20px; }
.notes li { margin: 4px 0; }
.task-preview { margin: 12px 0; }
.task-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; }
/* 課題ナビ（A/B/C チップ） */
.task-nav { display: flex; gap: 8px; margin-bottom: 8px; }
.task-chip { flex: 1; text-align: center; padding: 8px 4px; border-radius: 10px; border: 2px solid var(--line); font-weight: 700; font-size: .92rem; color: var(--sub); background: #fff; }
.task-chip.cur { border-color: var(--accent); color: var(--accent-dark); background: #EAF2F6; }
.task-chip.ok { border-color: var(--ok); color: var(--ok); background: #DBF0E4; }
.mini-check { color: var(--ok); font-weight: 800; margin-right: 3px; }
.mini-warn { color: var(--caution); font-weight: 800; margin-right: 3px; }
.criteria { background: #F0F5F8; border-radius: 8px; padding: 8px 12px; font-size: .88rem; color: var(--sub); margin: 8px 0; }
/* データ表（課題A） */
.data-table { overflow-x: auto; margin: 10px 0; }
.data-table table { border: 1px solid var(--line); border-radius: 8px; }
.data-table td, .data-table th { text-align: right; }
.data-table td:first-child, .data-table th:first-child { text-align: left; font-weight: 700; }
/* モード切替セグメント（課題B） */
.seg { display: flex; gap: 8px; margin: 12px 0 4px; }
.seg-btn { flex: 1; padding: 10px; border: 2px solid var(--line); background: #fff; border-radius: 10px; font-weight: 700; color: var(--sub); cursor: pointer; font-size: .95rem; }
.seg-btn.on { border-color: var(--accent); background: #EAF2F6; color: var(--accent-dark); }
.filelist { margin: 8px 0; }
.file-item { padding: 6px 10px; background: #F0F5F8; border-radius: 8px; margin: 4px 0; font-size: .9rem; }
/* プレビュー（iframe） */
.preview-frame { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 10px 0; }
.preview-cap { background: #EEF1F4; padding: 6px 12px; font-size: .82rem; color: var(--sub); font-weight: 700; }
.preview-frame iframe { width: 100%; height: 420px; border: 0; background: #fff; display: block; }
/* 文字数カウンター（課題C） */
.counter { text-align: right; font-size: .85rem; color: var(--sub); font-variant-numeric: tabular-nums; margin: 4px 0 10px; }
.counter.ok { color: var(--ok); }
.counter.over { color: var(--caution); font-weight: 700; }
/* 確認画面 */
.rev-list { margin: 12px 0; }
.rev-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
/* 管理: 課題別カード */
.task-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 14px 0; }
.task-card h3 { margin: 0 0 8px; }
.task-card h4 { margin: 8px 0 4px; font-size: .95rem; }
.chk { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.chk.ok { background: #DBF0E4; color: var(--ok); }
.chk.ng { background: #FDEBD8; color: var(--caution); }
.chk-row { margin: 6px 0; }
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 8px 0; font-size: .92rem; }
.mini-table { overflow-x: auto; }
.mini-table table { font-size: .85rem; }
.mini-table th, .mini-table td { padding: 5px 7px; }
.submitpre { background: #F5F7FA; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .85rem; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }
.c-field { margin: 10px 0; }
/* アシスタントの声 選択UI */
.voice-card { background: #F8FAFB; }
.voice-list { margin-top: 10px; }
.voice-option { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 12px; padding: 6px 8px 6px 6px; margin: 8px 0; background: #fff; }
.voice-option.sel { border-color: var(--accent); background: #EAF2F6; }
.voice-pick { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: none; background: transparent; font-size: 1.02rem; font-weight: 700; color: var(--ink); cursor: pointer; text-align: left; border-radius: 10px; }
.voice-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: 0 0 auto; position: relative; }
.voice-option.sel .voice-radio { border-color: var(--accent); }
.voice-option.sel .voice-radio::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.voice-try { min-height: 44px; padding: 8px 14px; border: 2px solid var(--accent); background: #fff; color: var(--accent); border-radius: 10px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.voice-try:hover { background: #EAF2F6; }
.voice-try.playing { background: var(--accent); color: #fff; animation: pulse 1s infinite; }
.more-voices-toggle { margin-top: 10px; width: 100%; }
.voice-more { margin-top: 4px; border-top: 1px dashed var(--line); padding-top: 4px; }
.voice-scroll { max-height: 380px; overflow-y: auto; padding-right: 4px; -webkit-overflow-scrolling: touch; }
.voice-group-title { font-weight: 700; color: var(--accent-dark); font-size: .95rem; margin: 12px 0 2px; padding-bottom: 2px; border-bottom: 2px solid #EAF2F6; position: sticky; top: 0; background: #F8FAFB; }

/* 運営用: 削除ゾーン */
.danger-zone { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; }
.btn-danger { background: #fff; color: var(--caution); border: 2px solid var(--caution); }
.btn-danger:hover { background: #FDEBD8; }
/* テンプレート登録ゾーン */
.tmpl-zone { border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 14px; }

/* プレビュー帯（管理者がテスト内容を確認） */
.preview-banner { position: sticky; top: 0; z-index: 90; background: #5B45A8; color: #fff; text-align: center; font-weight: 700; font-size: .9rem; padding: 8px 12px; }
body.has-preview-banner .mute-toggle { top: 52px; }

/* QRコード */
.qr-box { margin-top: 12px; text-align: center; }
.qr-canvas { width: 220px; height: 220px; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ===== タイトル/ヒーロー画面（index.html） ===== */
/* デスクトップ〜モバイル共通で「中央の1枚の画面」として佇む。全幅左寄せ崩れを防ぐため
   .hero に align-items:center を明示し、内側は max-width で必ず絞る（margin:auto頼みにしない）。 */
.hero { min-height: 100vh; min-height: 100svh; box-sizing: border-box;
  display: flex; flex-direction: column;
  background:
    radial-gradient(900px 520px at 50% 8%, rgba(255,255,255,.10), rgba(255,255,255,0) 60%),
    radial-gradient(1200px 700px at 50% -12%, #2C8FB0 0%, #1A6B8A 46%, #124A5E 100%);
  color: #fff; padding: 48px 24px calc(28px + env(safe-area-inset-bottom)); overflow-x: hidden; }
/* width:min(480px,100%) はビューポートを絶対に超えない（flexのcross-axisに頼らない）。
   margin:auto が水平・垂直センタリングを担い、footは自然に最下部へ。 */
.hero-inner { width: min(480px, 100%); margin: auto; text-align: center; }
.hero-badge { display: inline-block; letter-spacing: .28em; font-size: .74rem; font-weight: 700; opacity: .88; margin-bottom: 20px; padding: 6px 15px; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; }
.hero-title { font-size: clamp(2.05rem, 8.5vw, 3rem); line-height: 1.18; margin: 0 0 16px; font-weight: 800; letter-spacing: .01em; text-shadow: 0 2px 14px rgba(0,0,0,.2); }
.hero-sub { font-size: clamp(1rem, 3.4vw, 1.12rem); opacity: .96; margin: 0 0 32px; line-height: 1.85; }
.hero-actions { display: flex; flex-direction: column; gap: 12px; width: min(320px, 100%); margin: 0 auto; }
.hero-btn { box-shadow: 0 8px 22px rgba(0,0,0,.22); }
.hero .btn { background: #fff; color: var(--accent-dark); }
.hero .btn:hover { background: #EAF2F6; }
.hero .btn-ghost { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.7); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); }
.hero-features { display: flex; flex-wrap: wrap; gap: 12px 20px; justify-content: center; margin-top: 38px; }
.hero-feat { font-size: .92rem; opacity: .96; display: inline-flex; align-items: center; gap: 7px; }
.hero-feat-ic { display: inline-flex; opacity: .95; }
.hero-foot { width: min(480px, 100%); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.18); }
.hero-foot .muted { color: rgba(255,255,255,.7); }
.hero-foot a.muted { text-decoration: underline; white-space: nowrap; }
.rise { opacity: 0; transform: translateY(14px); animation: heroRise .6s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes heroRise { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; opacity: 1; transform: none; } }

/* ===== 設問エディタ ===== */
.qe-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; background: #FBFCFD; }
.qe-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.qe-head b { min-width: 40px; color: var(--accent-dark); }
.qe-aspect { flex: 1; max-width: 220px; }
.qe-head input.qe-aspect { min-height: 40px; padding: 6px 10px; font-size: 0.9rem; }
.qe-tools { margin-left: auto; display: flex; gap: 4px; }
.qe-tools .btn-sm { min-height: 36px; padding: 4px 10px; }
.qe-text { min-height: 56px; margin: 4px 0 8px; }
.qe-choices { display: flex; flex-direction: column; gap: 6px; }
.qe-choice { display: flex; gap: 6px; align-items: center; }
.qe-choice input[type=text] { flex: 1; min-height: 40px; padding: 6px 10px; font-size: 0.92rem; }
.qe-choice input[type=number] { width: 74px; min-height: 40px; padding: 6px 8px; font-size: 0.92rem; text-align: right; }
.qe-x { min-height: 36px; padding: 2px 10px; }
.qe-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.qe-savebar { position: sticky; bottom: 0; background: var(--card); padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.qe-overlay { position: fixed; inset: 0; background: rgba(31,41,51,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.qe-modal { width: min(680px, 96vw); max-height: 86vh; overflow-y: auto; margin: 0; }
.qe-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.qe-modal-tools { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.qe-modal-list { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-bottom: 12px; max-height: 46vh; overflow-y: auto; }
.qe-bank-group { margin: 8px 0; }
.qe-bank-grouphead { display: block; padding: 4px 0; border-bottom: 1px solid var(--line); }
.qe-bank-item { display: block; padding: 5px 0 5px 22px; font-size: 0.92rem; cursor: pointer; }
.qe-bank-item:hover { background: #EAF2F6; border-radius: 6px; }
.qe-card > .qe-summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; padding: 2px 0; }
.qe-card > .qe-summary::-webkit-details-marker { display: none; }
.qe-card > .qe-summary::before { content: '▸'; color: var(--accent); font-size: 0.9rem; transition: transform .15s; }
.qe-card[open] > .qe-summary::before { transform: rotate(90deg); }
.qe-summary b { min-width: 40px; color: var(--accent-dark); }
.qe-sum-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; }
.qe-sum-aspect { background: #E4EDF2; color: var(--accent-dark); flex-shrink: 0; }
.qe-body { padding-top: 8px; }
