:root {
  --bg: #eef1f8; --card: #ffffff; --ink: #2b3350; --sub: #6b7391; --line: #e2e6f0;
  --pri: #4f46e5; --pri-d: #4338ca; --ok: #16a34a; --ok-bg: #dcfce7;
  --ng: #dc2626; --ng-bg: #fee2e2; --accent: #0d9488; --accent-bg: #cffafe;
  --shadow: 0 8px 30px rgba(40, 50, 90, .10);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; min-height: 100%; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "BIZ UDPGothic", "Yu Gothic", system-ui, sans-serif;
  overscroll-behavior-y: contain;
}
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 48px; }
.en { font-family: "SF Pro Text", "Helvetica Neue", Arial, sans-serif; }
.hidden { display: none !important; }

/* ヘッダー */
.app-head { display: flex; align-items: center; gap: 10px; margin: 6px 2px 16px; }
.app-head h1 { font-size: 19px; font-weight: 800; }
.app-head .badge { font-size: 11px; color: #fff; background: var(--pri); padding: 3px 9px; border-radius: 999px; font-weight: 700; }

/* カード */
.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.section-title { font-size: 13px; font-weight: 800; color: var(--sub); margin: 2px 2px 10px; letter-spacing: .04em; }
.lead { font-size: 13px; color: var(--sub); line-height: 1.7; }

.hero .overview { align-items: flex-start; }
.streak { font-size: 12px; font-weight: 800; color: var(--accent); margin-top: 8px; }
/* 端末チェックカード */
.device .dev-head { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.caps { list-style: none; display: grid; gap: 7px; }
.cap { font-size: 12.5px; line-height: 1.55; }
.cap.ok { color: var(--ink); }
.cap.ng { color: var(--ng); }
.cap b { font-weight: 800; }
.dev-note { font-size: 11px; color: var(--sub); margin-top: 10px; line-height: 1.6; }
.btn.cont { background: linear-gradient(90deg, var(--pri), var(--accent)); font-size: 15px; }
.all-clear { text-align: center; font-weight: 800; color: var(--accent); padding: 6px; }
.sc-card.cleared { background: linear-gradient(180deg, #f5fffb, #ffffff); }

/* レベルの階段 */
.level { margin-top: 18px; }
.level-head { display: flex; align-items: center; gap: 10px; margin: 0 4px 10px; }
.level-head .level-emoji { font-size: 22px; }
.level-head b { font-size: 15px; font-weight: 800; display: block; }
.level-head span { font-size: 11px; color: var(--sub); }
.sc-list { display: grid; gap: 10px; }
.sc-card { display: flex; align-items: center; gap: 12px; background: var(--card); border: none; border-radius: 18px;
  box-shadow: var(--shadow); padding: 14px; cursor: pointer; transition: .15s; text-align: left; width: 100%; }
.sc-card:active { transform: scale(.99); }
.sc-card .sc-emoji { font-size: 26px; flex: none; width: 30px; text-align: center; }
.sc-card .sc-body { flex: 1; min-width: 0; }
.sc-card .sc-body b { font-size: 15px; font-weight: 800; display: block; }
.sc-card .sc-body span { font-size: 11px; color: var(--sub); }
.sc-ring { --p: 0; width: 44px; height: 44px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), #e9edf3 0); display: grid; place-items: center; }
.sc-ring > i { width: 34px; height: 34px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: var(--accent); font-style: normal; }

/* 進捗リング風 + バー */
.overview { display: flex; align-items: center; gap: 16px; }
.ring { --p: 0; width: 74px; height: 74px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--pri) calc(var(--p) * 1%), #e9edf3 0); display: grid; place-items: center; }
.ring > i { width: 58px; height: 58px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  font-size: 17px; font-weight: 800; color: var(--pri); font-style: normal; }
.overview .ov-text b { font-size: 15px; } .overview .ov-text p { font-size: 12px; color: var(--sub); margin-top: 3px; line-height: 1.6; }

/* ステップ一覧 */
.steps { display: grid; gap: 10px; }
.step { display: flex; align-items: center; gap: 12px; border: 2px solid var(--line); background: #fbfcfe;
  border-radius: 16px; padding: 14px; cursor: pointer; transition: .15s; text-align: left; width: 100%; }
.step:active { transform: scale(.99); }
.step .num { width: 34px; height: 34px; border-radius: 12px; background: var(--pri); color: #fff; font-weight: 800;
  display: grid; place-items: center; flex: none; font-size: 15px; }
.step.done .num { background: var(--ok); }
.step .st-body { flex: 1; }
.step .st-body b { font-size: 15px; font-weight: 800; display: block; }
.step .st-body span { font-size: 12px; color: var(--sub); }
.step .st-prog { font-size: 12px; font-weight: 800; color: var(--sub); flex: none; }
.step .st-prog.full { color: var(--ok); }

.tilebar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.tile { border: none; border-radius: 16px; padding: 14px; text-align: left; cursor: pointer; box-shadow: var(--shadow);
  background: var(--card); transition: .15s; }
.tile:active { transform: scale(.99); }
.tile b { display: block; font-size: 14px; font-weight: 800; }
.tile span { font-size: 11px; color: var(--sub); }
.tile.accent { background: var(--accent); color: #fff; } .tile.accent span { color: rgba(255,255,255,.85); }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 14px;
  padding: 15px 20px; font-size: 16px; font-weight: 800; cursor: pointer; transition: .15s; width: 100%; color: #fff; background: var(--pri); }
.btn:active { transform: translateY(1px); }
.btn.sub { background: var(--accent); }
.btn.ghost { background: #eef0f7; color: var(--sub); }
.btn.line { background: #fff; color: var(--pri); border: 1.5px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 11px 15px; font-size: 14px; width: auto; }
.link { background: none; border: none; color: var(--sub); font-size: 13px; cursor: pointer; text-decoration: underline; padding: 8px; }
.actions { display: flex; gap: 10px; margin-top: 14px; } .actions .btn { flex: 1; }

.backbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: none; background: var(--card); box-shadow: var(--shadow);
  font-size: 17px; cursor: pointer; flex: none; }
.progressbar { flex: 1; height: 8px; background: #e9edf3; border-radius: 999px; overflow: hidden; }
.progressbar > i { display: block; height: 100%; width: 0; background: var(--pri); transition: width .3s; }
.count { font-size: 12px; color: var(--sub); font-weight: 700; flex: none; }

/* オンボーディング */
.onboard { border: 1.5px solid var(--pri); }
.ob-steps { display: grid; gap: 8px; font-size: 13px; line-height: 1.6; color: var(--ink); }
.ob-steps b { color: var(--pri); }

/* カンペ検索 */
.cs-search { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fbfcfe; font-size: 15px; color: var(--ink); -webkit-appearance: none; }
.cs-search:focus { outline: none; border-color: var(--pri); }

/* フレーズ行（カンペ / ステップ1） */
.grp-name { font-size: 12px; font-weight: 800; color: var(--accent); margin: 16px 2px 8px; letter-spacing: .04em; }
.grp-name:first-child { margin-top: 2px; }
.phrase { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.phrase:last-child { border-bottom: none; }
.phrase .p-body { flex: 1; min-width: 0; }
.phrase .p-en { font-size: 16px; font-weight: 700; line-height: 1.4; }
.phrase .p-kana { font-size: 12px; color: var(--accent); margin-top: 2px; }
.phrase .p-ja { font-size: 13px; color: var(--ink); margin-top: 3px; }
.phrase .p-note { font-size: 11px; color: var(--sub); margin-top: 4px; line-height: 1.6; }
.snd { width: 40px; height: 40px; border-radius: 12px; border: none; background: var(--accent-bg); color: var(--accent);
  font-size: 18px; cursor: pointer; flex: none; }
.snd.big { width: 66px; height: 66px; font-size: 28px; border-radius: 20px; }
.snd:active { transform: scale(.95); }
.seen-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; margin-top: 6px; }
.star { width: 38px; height: 40px; border: none; background: transparent; color: #cbd2e0; font-size: 20px; cursor: pointer; flex: none; padding: 0; }
.star.on { color: #f5b301; }
.star:active { transform: scale(.9); }
.p-sc { font-size: 11px; color: var(--accent); font-weight: 700; margin-bottom: 3px; }

/* 質問と返し（Q→返しの候補） */
.qa-pair { margin: 10px 0 16px; }
.qa-q, .qa-a { display: flex; align-items: flex-start; gap: 10px; }
.qa-q { background: #eef0ff; border: 1.5px solid #d6dbff; border-radius: 14px; padding: 12px 14px; }
.qa-body { flex: 1; min-width: 0; }
.qa-role { font-size: 11px; font-weight: 800; color: var(--pri); margin-bottom: 3px; }
.qa-role.a { color: var(--accent); margin: 4px 2px 6px; }
.qa-replies { margin-left: 14px; border-left: 2px dashed var(--line); padding-left: 12px; margin-top: 8px; }
.qa-a { background: var(--accent-bg); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.qa-a:last-child { margin-bottom: 0; }
.qa-q .p-en { font-size: 16px; } .qa-a .p-en { font-size: 15px; }

/* 学習カード */
.q-card { min-height: 62vh; display: flex; flex-direction: column; }
.q-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.q-tag { font-size: 11px; font-weight: 800; color: var(--accent); background: var(--accent-bg); padding: 4px 10px; border-radius: 999px; }
.q-hint { font-size: 12px; color: var(--sub); }
.prompt-big { font-size: 26px; font-weight: 800; text-align: center; margin: 18px 0 6px; line-height: 1.4; }
.prompt-ja { font-size: 20px; font-weight: 800; text-align: center; margin: 12px 0; }
.prompt-kana { font-size: 14px; color: var(--accent); text-align: center; margin-bottom: 6px; }
.center { text-align: center; }
.choices { display: grid; gap: 10px; margin-top: auto; padding-top: 18px; }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; border: 2px solid var(--line); background: #fbfcfe;
  border-radius: 16px; padding: 15px; font-size: 15px; font-weight: 600; cursor: pointer; transition: .12s; width: 100%; color: var(--ink); }
.choice .k { font-size: 12px; color: var(--sub); background: #eef0f7; border-radius: 8px; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center; flex: none; font-weight: 800; }
.choice:active { transform: scale(.99); }
.choice.correct { border-color: var(--ok); background: var(--ok-bg); }
.choice.wrong { border-color: var(--ng); background: var(--ng-bg); }
.choice.dim { opacity: .5; }
.choice[disabled] { cursor: default; }

.reveal { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; display: none; }
.reveal.show { display: block; animation: fade .2s; }
.reveal .verdict { font-size: 15px; font-weight: 800; margin-bottom: 8px; }
.reveal .verdict.ok { color: var(--ok); } .reveal .verdict.ng { color: var(--ng); }
.reveal .r-en { font-size: 18px; font-weight: 800; } .reveal .r-kana { font-size: 13px; color: var(--accent); margin-top: 2px; }
.reveal .r-ja { font-size: 14px; margin-top: 4px; } .reveal .r-note { font-size: 12px; color: var(--sub); margin-top: 6px; line-height: 1.6; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* シャドーイング（声に出す） */
.rec-state { text-align: center; font-size: 13px; color: var(--sub); min-height: 40px; margin-top: 10px; line-height: 1.6; }
.rec-state.heard { color: var(--ink); font-weight: 700; }
.rec-state .g { color: var(--ok); font-weight: 800; } .rec-state .b { color: var(--ng); }
.mic-wrap { display: flex; justify-content: center; margin-top: 10px; }
.mic { width: 84px; height: 84px; border-radius: 50%; border: none; background: var(--pri); color: #fff; font-size: 34px; cursor: pointer;
  box-shadow: 0 8px 22px rgba(79,70,229,.4); transition: .15s; }
.mic.rec { background: var(--ng); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 8px 22px rgba(220,38,38,.4); } 50% { box-shadow: 0 8px 30px rgba(220,38,38,.7); } }

/* ビルダー（自分のスタンドアップ） */
.b-sec { margin-top: 14px; }
.b-sec > .b-label { font-size: 13px; font-weight: 800; margin: 2px 2px 8px; }
.opt { display: block; width: 100%; text-align: left; border: 2px solid var(--line); background: #fbfcfe; border-radius: 14px;
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer; transition: .12s; }
.opt:active { transform: scale(.99); }
.opt.on { border-color: var(--pri); background: #eef0ff; }
.opt .o-en { font-size: 15px; font-weight: 700; } .opt .o-ja { font-size: 12px; color: var(--sub); margin-top: 2px; }
.script { background: #0f172a; color: #e2e8f0; border-radius: 16px; padding: 16px; margin-top: 6px; line-height: 1.9; font-size: 16px; }
.script .s-line { display: block; }
.script .muted { color: #64748b; }

/* 会話ダイアログ（チャット吹き出し） */
.dlg { display: grid; gap: 12px; margin-top: 14px; }
.turn { display: flex; gap: 8px; align-items: flex-start; }
.turn.B { flex-direction: row-reverse; }
.turn .who { width: 26px; height: 26px; border-radius: 50%; background: var(--pri); color: #fff; font-weight: 800; font-size: 12px; display: grid; place-items: center; flex: none; margin-top: 2px; }
.turn.B .who { background: var(--accent); }
.bubble { background: #eef1f8; border-radius: 14px; padding: 10px 12px; max-width: 82%; transition: box-shadow .15s; }
.turn.B .bubble { background: var(--accent-bg); }
.bubble.active { box-shadow: 0 0 0 2px var(--pri); }
.t-en { font-size: 15px; font-weight: 700; line-height: 1.4; }
.t-ja { font-size: 12px; color: var(--sub); margin-top: 3px; }
.bubble .snd { width: 32px; height: 32px; font-size: 15px; margin-top: 8px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #0f172a; color: #fff;
  padding: 12px 18px; border-radius: 12px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow); z-index: 50; opacity: 0;
  transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.voice-sel { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fbfcfe;
  font-size: 15px; font-weight: 700; color: var(--ink); appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7391' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.foot { text-align: center; font-size: 11px; color: var(--sub); margin-top: 22px; line-height: 1.7; }
