/* =========================================================
   英語タイピング学習ツール — style
   FREEMIMETICS 公式サイトのトンマナ（白・紺・青、Zen Kaku Gothic New / Oswald）に、
   ブランドの「クリスタル」の透明感を足したもの。
   透明感は「面を透かす」のではなく「光とふち」で出し、文字の面は読める濃さに保つ。
   ▼ 調整はまず「1. 設定」の値だけを変えてください。
   ========================================================= */

/* =========================================================
   1. 設定
   ========================================================= */
:root {
  /* 公式サイトと同じ色 */
  --bg: #ffffff;   /* 公式と同じ。bg.js の残像色もこの値を使う */
  --surface: #ffffff;
  --soft: #edf2f9;
  --line: #e3eaf3;
  --navy: #0f1d3a;
  --text: #1c2a44;
  --muted: #76839a;
  --accent: #2f6bff;
  --accent-soft: #e8f0ff;

  /* このツールで使う色 */
  --ok: #16a34a;
  --ng: #e5484d;
  --warn: #c2410c;

  /* 指の色（キーと指のイラストで共通） */
  --f-pinky: #f59e0b;
  --f-ring: #10b981;
  --f-middle: #8b5cf6;
  --f-index: #2f6bff;
  --f-thumb: #94a3b8;

  /* クリスタル（ガラス）の質感 */
  --glass: rgb(255 255 255 / 0.74);
  --rim: linear-gradient(135deg, rgb(255 255 255 / 0.95), rgb(186 214 255 / 0.55) 35%, rgb(214 200 255 / 0.5) 65%, rgb(255 255 255 / 0.9));
  --lift: 0 1px 0 rgb(255 255 255 / 0.9) inset, 0 24px 48px -28px rgb(31 80 200 / 0.35), 0 2px 6px -2px rgb(31 80 200 / 0.08);

  /* フォント */
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --font-en: "Oswald", "Zen Kaku Gothic New", Impact, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Courier New", monospace;

  /* 形・余白 */
  --radius: 20px;
  --radius-sm: 12px;
  --key-radius: 8px;
  --hd: 64px;
  --pad: 32px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (max-width: 767px) {
  :root { --pad: 16px; --hd: 56px; --radius: 16px; }
}

/* =========================================================
   2. 基本
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--hd) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.75;
  letter-spacing: 0.04em;
  font-feature-settings: "palt";
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* 背景アニメーション（公式の bg.js が作るキャンバス）：画面に固定して一番奥へ */
.fm-bg { position: fixed; inset: 0; z-index: -1; display: block; width: 100%; height: 100%; pointer-events: none; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3 { color: var(--navy); font-weight: 700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 13px; transition: top 0.2s; }
.skip:focus { top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.warn { color: var(--warn); font-size: 13px; margin: 10px 0 0; }
kbd { font: 500 11px/1 var(--font-en); letter-spacing: 0.08em; padding: 3px 6px; border-radius: 5px; background: rgb(255 255 255 / 0.18); margin-left: 6px; }
.secondary-btn kbd { background: var(--line); }

/* =========================================================
   3. 公式ヘッダー・フッター
   ========================================================= */
.hd {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--hd);
  display: flex;
  align-items: center;
  gap: 56px;
  padding: 0 var(--pad);
  background: rgb(255 255 255 / 0.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  box-shadow: inset 0 -1px 0 rgb(255 255 255 / 0.8), 0 1px 0 rgb(47 107 255 / 0.08);
}
.logo { display: flex; align-items: center; font: 700 24px/1 var(--font-en); letter-spacing: 0.02em; color: var(--navy); white-space: nowrap; }
.logo img { display: block; height: 32px; width: auto; }
.hd-nav { display: flex; gap: 36px; height: 100%; }
.hd-nav a { position: relative; display: flex; align-items: center; font-size: 13.5px; font-weight: 500; color: var(--muted); transition: color 0.2s; }
.hd-nav a:hover { color: var(--navy); }
.hd-nav a.is-active { color: var(--navy); font-weight: 700; }
.hd-nav a.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 16px; height: 2px; border-radius: 2px; background: var(--accent); }

.ft { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 40px; padding: 28px var(--pad); margin-top: 48px; background: rgb(255 255 255 / 0.9); font-size: 12px; color: var(--muted); }
.ft .logo { font-size: 18px; }
.ft .logo img { height: 24px; }
.ft nav { display: flex; flex-wrap: wrap; gap: 8px 28px; color: var(--text); }
.ft nav a:hover { color: var(--accent); }
.ft small { flex-basis: 100%; font: 400 12px var(--font-en); letter-spacing: 0.06em; }
.sns { display: flex; gap: 6px; margin-left: auto; color: var(--navy); }
.sns a { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; transition: background 0.2s; }
.sns a:hover { background: var(--soft); }
.sns svg { width: 16px; height: 16px; fill: currentColor; }

/* =========================================================
   4. ページの骨組み
   ========================================================= */
.app-container { max-width: 1400px; margin: 0 auto; padding: 40px var(--pad) 0; }
.kicker { display: block; margin: 0 0 10px; font: 500 13px/1 var(--font-en); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.page-hd { margin-bottom: 28px; }
.page-hd h1 { margin: 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.3; letter-spacing: 0.06em; }
.page-hd .lead { margin: 12px 0 0; max-width: 720px; color: var(--muted); }

/* ガラスの面：中身は読める濃さ、ふちだけ虹色に光る */
.card, .stat, .sticky-card, .how-to, .about-tool {
  background: var(--glass) padding-box, var(--rim) border-box;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: var(--lift);
}
.card { position: relative; overflow: hidden; padding: 28px; margin-bottom: 24px; }
/* 光の反射：上部に一筋のハイライト */
.card::before { content: ""; position: absolute; inset: 0 0 auto; height: 90px; pointer-events: none; background: linear-gradient(180deg, rgb(255 255 255 / 0.7), rgb(255 255 255 / 0)); }
.card > * { position: relative; }

.how-to { padding: 20px 26px; margin-bottom: 28px; }
.how-to-title { margin: 0 0 10px; font-size: 15px; letter-spacing: 0.08em; }
.how-to-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.how-to-steps li { display: flex; gap: 10px; align-items: baseline; }
.how-to-steps b { flex-shrink: 0; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 600 11px/1 var(--font-en); }

.main-content { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.input-area { min-width: 0; }
.preview-sidebar { position: sticky; top: calc(var(--hd) + 20px); }
.sticky-card { padding: 22px 24px; }
.tips { margin: 0; padding-left: 1.1em; color: var(--muted); font-size: 13px; line-height: 1.85; }
.tips li + li { margin-top: 4px; }
.banner-container { margin: 20px 0; }
.banner-item {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg, #123a78 0%, #2a6fc4 60%, #9fcdf2 100%);
  transition: transform 0.35s var(--ease);
}
.banner-item img { display: block; width: 100%; height: auto; aspect-ratio: 557 / 112; object-fit: contain; color: transparent; }
.banner-item:hover { transform: translateY(-3px); }

.about-tool { margin-top: 36px; padding: 28px; color: var(--muted); }
.about-tool h2 { margin: 0 0 12px; font-size: 16px; letter-spacing: 0.06em; }
.about-tool p { margin: 0 0 10px; font-size: 13px; }

/* =========================================================
   5. ボタン・チップ
   ========================================================= */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #22345e, var(--navy));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25), 0 10px 22px -12px rgb(15 29 58 / 0.6);
  transition: background 0.3s, box-shadow 0.3s;
}
.primary-btn > span { font-family: var(--font-en); transition: transform 0.3s var(--ease); }
.primary-btn:hover { background: linear-gradient(180deg, #2a3f70, #1c2c52); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25), 0 12px 26px -10px rgb(15 29 58 / 0.55); }
.primary-btn:hover > span { transform: translateX(4px); }
.primary-btn.big { width: 100%; height: 54px; font-size: 15px; margin-top: 8px; }
.secondary-btn {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.secondary-btn:hover:not(:disabled) { background: var(--line); }
.secondary-btn:disabled { opacity: 0.45; cursor: default; }
.text-btn { border: 0; background: none; padding: 0; cursor: pointer; font-size: 12.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.text-btn:hover { color: var(--navy); }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--soft); font-size: 13px; cursor: pointer; transition: background 0.2s, color 0.2s; }
.chip:hover { background: var(--line); }
.chip.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: 0 0 0 1px rgb(47 107 255 / 0.2); }
.chip.soon { color: #a3aec0; }
.chip.soon::after { content: "準備中"; margin-left: 6px; font-size: 10px; letter-spacing: 0.02em; }
.chip.soon.active { color: var(--accent); }

.action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0; }

/* =========================================================
   6. ホーム
   ========================================================= */
.course-line { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.course-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.welcome { padding: 18px 24px; }
.welcome b { color: var(--accent); margin-right: 6px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { padding: 14px 18px; }
.stat-label { margin: 0; font-size: 12px; color: var(--muted); }
.stat-value { margin: 2px 0 0; font: 600 30px/1.2 var(--font-en); color: var(--navy); }
.stat-value small { font: 700 13px var(--font); margin-left: 3px; color: var(--muted); }
.stat-sub { margin: 0; font-size: 11px; color: var(--muted); }

.step-title { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; font-size: 18px; letter-spacing: 0.06em; }
.step-num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; font: 600 14px/1 var(--font-en); flex-shrink: 0; }
.sub-title { margin: 0 0 14px; font-size: 15px; letter-spacing: 0.06em; }
.field-label { display: block; margin: 18px 0 10px; font-size: 13px; font-weight: 700; }
.field-label:first-of-type { margin-top: 0; }
.field-label.inline { display: inline; margin: 0 8px 0 0; }

.course-prog { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.course-prog-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.course-prog-head b { font: 600 15px var(--font-en); color: var(--accent); }
.course-bar { position: relative; height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.course-bar > div { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.course-bar .learned { background: #c9dafc; }
.course-bar .mastered { background: linear-gradient(90deg, #2f6bff, #7aa7ff, #b9a6ff); }

.set-summary { margin: 0 0 8px; font-size: 15px; }
.set-summary strong { font: 600 30px var(--font-en); color: var(--accent); margin: 0 3px; vertical-align: -3px; }
.set-summary .plus { color: var(--muted); margin: 0 4px; }
.set-summary .muted { font-size: 12.5px; margin-left: 6px; }

.weak-chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); font: 500 13px var(--font-mono); }
.weak-chip small { color: var(--ng); font-family: var(--font-en); }
.practice-btn { margin-top: 16px; }

.toggle { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 13.5px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.transfer { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.code-area { display: block; width: 100%; min-height: 80px; margin: 10px 0; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--soft); font: 12px/1.5 var(--font-mono); word-break: break-all; resize: vertical; }


/* コースの説明とステップ */
.level-desc { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.course-info { margin-top: 22px; padding: 18px 20px; border-radius: 16px; background: linear-gradient(135deg, rgb(47 107 255 / 0.06), rgb(139 92 246 / 0.05)); box-shadow: inset 0 0 0 1px rgb(47 107 255 / 0.12); }
.course-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--navy); letter-spacing: 0.06em; }
.course-desc { margin: 4px 0 14px; font-size: 12.5px; color: var(--muted); }
.step-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.step-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 10px; padding: 10px 12px; border-radius: 12px; background: rgb(255 255 255 / 0.75); }
.step-list li.now { box-shadow: inset 0 0 0 1.5px var(--accent), 0 6px 16px -10px rgb(47 107 255 / 0.6); }
.step-list li.done .step-badge { background: var(--ok); }
.step-badge { padding: 2px 8px; border-radius: 6px; background: var(--navy); color: #fff; font: 600 11px/1.4 var(--font-en); letter-spacing: 0.08em; }
.step-list li.now .step-badge { background: var(--accent); }
.step-name { font-size: 13.5px; font-weight: 700; color: var(--navy); }
.step-count { font: 500 13px var(--font-en); color: var(--muted); }
.step-bar { grid-column: 1 / -1; position: relative; height: 5px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.step-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
.step-bar .learned { background: #c9dafc; }
.step-bar .mastered { background: linear-gradient(90deg, #2f6bff, #8b5cf6); }
.course-info .course-prog-head { margin: 0; }

/* =========================================================
   7. 出題
   ========================================================= */
.play-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mode-badge { display: inline-flex; align-items: center; height: 28px; padding: 0 14px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--accent); background: rgb(255 255 255 / 0.8); box-shadow: inset 0 0 0 1.5px rgb(47 107 255 / 0.3); }
.mode-badge.mode-recall { color: #7c3aed; box-shadow: inset 0 0 0 1.5px rgb(139 92 246 / 0.35); }
.mode-badge.mode-retype { color: var(--warn); box-shadow: inset 0 0 0 1.5px rgb(194 65 12 / 0.3); }
.mode-badge.practice { color: var(--ok); box-shadow: inset 0 0 0 1.5px rgb(22 163 74 / 0.3); }
.combo { display: inline-flex; align-items: baseline; gap: 6px; margin-left: auto; color: var(--muted); }
.combo small { font: 500 11px var(--font-en); letter-spacing: 0.14em; }
.combo b { font: 600 22px/1 var(--font-en); color: var(--navy); min-width: 2ch; text-align: right; }
.combo.hot b { background: linear-gradient(90deg, #2f6bff, #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.progress { font-family: var(--font-en); color: var(--muted); }
.progress b { font-weight: 600; font-size: 18px; color: var(--navy); }
.progress-bar { height: 4px; margin: 14px 0 22px; border-radius: 2px; background: rgb(47 107 255 / 0.1); overflow: hidden; }
.progress-bar > div { height: 100%; border-radius: 2px; background: linear-gradient(90deg, #2f6bff, #7aa7ff, #b9a6ff); transition: width 0.4s var(--ease); }

/* お題：ここだけ不透明な「濃い結晶」にして主役にする */
.odai { border-radius: 18px; box-shadow: 0 18px 36px -24px rgb(31 80 200 / 0.45); }
.prompt {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 16px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(120deg, #0f1d3a 0%, #1f4fc4 55%, #2f6bff 100%);
}
.prompt::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 46%, rgb(255 255 255 / 0.16) 46% 52%, transparent 52%),
    linear-gradient(115deg, transparent 0 58%, rgb(255 255 255 / 0.08) 58% 70%, transparent 70%),
    linear-gradient(65deg, transparent 0 78%, rgb(160 210 255 / 0.18) 78% 100%);
}
.ja-line { position: relative; flex: 1; margin: 0; color: #fff; font-size: 20px; font-weight: 700; letter-spacing: 0.06em; line-height: 1.5; }
/* 将来の音声ボタン用の余白（いまは空） */
.audio-slot { position: relative; width: 40px; height: 40px; flex-shrink: 0; }

.target-box { padding: 22px; border-radius: 0 0 18px 18px; background: linear-gradient(180deg, #eef4ff, #f8fbff); box-shadow: inset 0 0 0 1.5px rgb(47 107 255 / 0.14); }
.en-line { margin: 0; font: 400 23px/1.65 var(--font-mono); color: var(--navy); word-break: break-word; white-space: pre-wrap; }
.en-line.typing .rest { color: var(--navy); }
.en-line.typing .ok { color: #a9b9d3; }
.en-line.typing .cur { background: var(--accent); color: #fff; border-radius: 3px; box-shadow: 0 0 0 3px rgb(47 107 255 / 0.2); }
.en-line.cloze { letter-spacing: 0.04em; }
.en-line.hidden-en { font: 500 14px var(--font); color: var(--muted); letter-spacing: 0.08em; }
.en-line.done { color: var(--ok); }
.shake { animation: shake 0.28s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); box-shadow: inset 0 0 0 1.5px rgb(229 72 77 / 0.6); }
  75% { transform: translateX(6px); box-shadow: inset 0 0 0 1.5px rgb(229 72 77 / 0.6); }
}

.mode-hint { margin: 14px 2px 10px; font-size: 12.5px; color: var(--muted); }
.type-input {
  display: block;
  width: 100%;
  height: 54px;
  margin-top: 14px;
  padding: 0 18px;
  border: 1.5px solid rgb(47 107 255 / 0.25);
  border-radius: 14px;
  background: rgb(255 255 255 / 0.9);
  font: 400 19px var(--font-mono);
  color: var(--navy);
  letter-spacing: 0.02em;
}
.mode-hint + .type-input { margin-top: 0; }
.type-input::placeholder { font: 400 14px var(--font); color: #a3aec0; letter-spacing: 0.06em; }
.type-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgb(47 107 255 / 0.15); }
.play-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.diff-box { margin: 14px 0 0; padding: 14px 18px; border-radius: 14px; background: #fff7ed; box-shadow: inset 0 0 0 1px #fed7aa; }
.diff-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--warn); }
.diff { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; font: 400 16px var(--font-mono); }
.diff span { display: inline-flex; flex-direction: column; align-items: center; }
.diff small { font: 700 10px var(--font); }
.d-missing { color: var(--ok); text-decoration: underline; text-underline-offset: 3px; }
.d-extra { color: var(--ng); text-decoration: line-through; }
.hint-text { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

.feedback { padding-top: 20px; }
.fb-msg { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 17px; font-weight: 700; color: var(--ok); }
.fb-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: #fff; font: 700 14px/1 var(--font-en); }
.fb-wrong .fb-msg { color: var(--warn); }
.fb-wrong .fb-icon { background: var(--warn); }
.note { margin: 0 0 14px; padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; line-height: 1.8; }
.targets { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.targets-label { font-size: 12px; color: var(--muted); margin-right: 4px; }
.target-chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: 500 13px var(--font-mono); }

/* =========================================================
   8. 画面のキーボード（指の色とキーの色を連動）
   ========================================================= */
.f-pinky { --fc: var(--f-pinky); }
.f-ring { --fc: var(--f-ring); }
.f-middle { --fc: var(--f-middle); }
.f-index { --fc: var(--f-index); }
.f-thumb { --fc: var(--f-thumb); }

.kb-wrap { margin-top: 18px; padding: 18px 18px 0; border-radius: var(--radius); background: linear-gradient(180deg, rgb(238 244 255 / 0.9), rgb(226 236 252 / 0.9)); box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1.5px rgb(255 255 255 / 0.7); user-select: none; }
.kb { display: grid; gap: 6px; }
.kb-row { display: flex; gap: 6px; }
.key {
  position: relative;
  flex: 1 0 0;
  min-width: 0;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--key-radius);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.95) 0%, rgb(255 255 255 / 0.75) 45%, color-mix(in oklab, var(--fc) 22%, white) 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px color-mix(in oklab, var(--fc) 25%, white), 0 2px 0 color-mix(in oklab, var(--fc) 30%, white);
  color: color-mix(in oklab, var(--fc) 45%, var(--navy));
  font: 500 14px/1 var(--font-en);
  text-transform: uppercase;
}
.key.wide { font-size: 10px; letter-spacing: 0.06em; }
.key.home::after { content: ""; position: absolute; bottom: 7px; left: 42%; right: 42%; height: 2px; border-radius: 1px; background: currentColor; opacity: 0.5; }
.key.next {
  background: linear-gradient(180deg, color-mix(in oklab, var(--fc) 70%, white), var(--fc));
  color: #fff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.6), 0 2px 0 color-mix(in oklab, var(--fc) 70%, black), 0 0 0 4px color-mix(in oklab, var(--fc) 25%, transparent), 0 8px 18px -6px var(--fc);
  transform: translateY(-2px);
}
/* 次のキーの表面に光が流れる */
.key.next::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 0.55) 45%, transparent 60%); background-size: 250% 100%; animation: glint 1.6s ease-in-out infinite; }
@keyframes glint { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.key.pressed { transform: translateY(1px); filter: brightness(0.95); }
.key.miss { background: #ffe1e4; color: var(--ng); box-shadow: inset 0 0 0 1px #f3a6ae; }

.hands { display: flex; justify-content: center; align-items: flex-end; gap: 7px; height: 46px; margin-top: 14px; overflow: hidden; }
.finger { width: 30px; border-radius: 15px 15px 0 0; background: linear-gradient(180deg, rgb(255 255 255 / 0.9), color-mix(in oklab, var(--fc) 25%, white)); box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--fc) 35%, white); }
.finger.gap { margin-left: 49px; }
.finger.on { background: linear-gradient(180deg, color-mix(in oklab, var(--fc) 65%, white), var(--fc)); box-shadow: 0 0 0 4px color-mix(in oklab, var(--fc) 25%, transparent), 0 8px 16px -6px var(--fc); transform: translateY(-4px); }
.finger-label { min-height: 1.6em; margin: 8px 0 12px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* =========================================================
   9. 結果
   ========================================================= */
.result-main { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--navy); }
.result-main strong { font: 600 56px/1.1 var(--font-en); margin: 0 6px; background: linear-gradient(90deg, #2f6bff, #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-main span { font-weight: 500; color: var(--muted); }
.result-badges { margin: 16px 0 8px; }
.badge-combo { display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 16px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.badge-combo small { font: 500 11px var(--font-en); letter-spacing: 0.14em; color: var(--muted); }
.badge-combo b { font: 600 20px var(--font-en); color: var(--navy); }
.badge-combo em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--f-pinky); }
.badge-combo.best { box-shadow: inset 0 0 0 1.5px var(--f-pinky), 0 6px 16px -8px var(--f-pinky); }
.result .sub-title { margin-top: 22px; }
.summary-list { list-style: none; margin: 0 0 8px; padding: 0; }
.summary-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.typing-stats { margin: 16px 0; text-align: right; font: 400 12px var(--font-en); letter-spacing: 0.06em; color: var(--muted); }


/* =========================================================
   9.5 AI（解説・ふり返り）
   ========================================================= */
.ai-mark { display: inline-grid; place-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: linear-gradient(120deg, #2f6bff, #8b5cf6); color: #fff; font: 600 11px/1 var(--font-en); letter-spacing: 0.08em; }
.ai-on { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: rgb(139 92 246 / 0.1); color: #7c3aed; font-size: 11px; font-weight: 700; }
.ai-off { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 700; }
.ai-box { margin: 0 0 18px; padding: 14px 16px; border-radius: 14px; background: linear-gradient(135deg, rgb(47 107 255 / 0.06), rgb(139 92 246 / 0.07)); box-shadow: inset 0 0 0 1px rgb(139 92 246 / 0.15); }
.ai-head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 12.5px; font-weight: 700; color: var(--navy); }
.ai-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-btn { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px rgb(139 92 246 / 0.25); font-size: 12.5px; font-weight: 700; color: #6d28d9; cursor: pointer; transition: background 0.2s; }
.ai-btn:hover:not(:disabled) { background: rgb(139 92 246 / 0.08); }
.ai-btn.on { background: #7c3aed; color: #fff; box-shadow: none; }
.ai-btn:disabled { cursor: default; opacity: 0.7; }
.ai-answer { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #fff; font-size: 14px; line-height: 1.85; white-space: pre-wrap; }
.ai-answer.off { color: var(--muted); font-size: 13px; }
.ai-loading::after { content: ""; display: inline-block; width: 1em; animation: dots 1.2s steps(4) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes dots { 0% { width: 0; } 100% { width: 1.2em; } }
.ai-note { margin: 8px 0 0; font-size: 11px; color: var(--muted); }
.ai-review .sub-title { display: flex; align-items: center; gap: 8px; }
.ai-review-body { margin-bottom: 14px; }
.ai-summary { margin: 0 0 8px; font-size: 14px; line-height: 1.85; }
.ai-tips { margin: 0 0 8px; padding-left: 1.2em; font-size: 13.5px; }
.ai-cheer { margin: 0; font-weight: 700; color: #7c3aed; }
.ai-review .secondary-btn { margin-top: 4px; }

/* =========================================================
   10. 文字を大きく
   ========================================================= */
.fs-l .ja-line { font-size: 25px; }
.fs-l .en-line { font-size: 29px; }
.fs-l .type-input { font-size: 23px; height: 62px; }
.fs-l .note { font-size: 16px; }

/* =========================================================
   11. 画面幅ごと
   ========================================================= */
@media (max-width: 1199px) {
  .main-content { grid-template-columns: minmax(0, 1fr); }
  .preview-sidebar { position: static; }
  .hd { gap: 32px; }
}
/* キーボードはスマホ・タブレットでは出さない（画面のキーボードと重なるため） */
@media (max-width: 899px), (hover: none) {
  .kb-wrap, .pc-only { display: none; }
}
@media (max-width: 767px) {
  .hd-nav { gap: 18px; }
  .hd-nav a:not(.is-active) { display: none; }
  .logo img { height: 28px; }
  .app-container { padding-top: 24px; }
  .card { padding: 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 26px; }
  .ja-line { font-size: 17px; }
  .en-line { font-size: 18px; }
  .type-input { font-size: 17px; }
  .prompt, .target-box { padding-left: 16px; padding-right: 16px; }
  .combo { margin-left: 0; }
  .progress { margin-left: auto; }
  .action-row { flex-direction: column; }
  .action-row > * { width: 100%; justify-content: center; }
  .ft { flex-direction: column; align-items: flex-start; }
  .sns { margin-left: -8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
