/* 親指練習帳：KS共通デザイン（~/Documents/Claude/案内/KSデザイン/01_KS_DESIGN_CURRENT.md） */
:root {
  --bg: #FAFAFA;
  --ink: #22272C;
  --muted: #747C84;
  --blue: #406F98;       /* 構造・選択・左の親指 */
  --red: #F04B32;        /* 少量の朱・右の親指 */
  --soft: #E8EFF5;       /* 重要な情報の面 */
  --card: #FFFFFF;
  --field: #F1F3F5;
  --line: #DDE2E6;
  --on-blue: #FFFFFF;
  --num: Futura, "Futura PT", "Hiragino Sans", -apple-system, sans-serif;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1C1F23; --ink: #F2F4F6; --muted: #ADB8C4;
    --blue: #88B9DF; --red: #F17B65; --soft: #283747;
    --card: #292F36; --field: #292F36; --line: #414850; --on-blue: #1C1F23;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.75 var(--font);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
main { max-width: 560px; margin: 0 auto; padding-block: 24px; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
p { margin: 0 0 12px; }
b { font-weight: 600; }
.help { color: var(--muted); font-size: 13px; }

/* タイトル：OYA Y UBI（Y だけ朱）、日本語の名前、青の短い線 */
.top { padding-bottom: 20px; }
.title { margin: 0; font-family: var(--num); font-weight: 500; font-size: 30px; letter-spacing: .3em; line-height: 1; }
.title b { color: var(--red); font-weight: 500; }
.title-ja { margin: 8px 0 0; font-size: 11px; letter-spacing: .3em; color: var(--muted); }
.title-line { width: 40px; height: 2px; background: var(--blue); margin-top: 14px; }

.remind { background: var(--soft); border-radius: 10px; padding: 10px 14px; font-size: 13px; }

/* 今日の数字・結果の数字 */
.today { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--soft); border-radius: 12px; padding: 14px 6px; margin: 4px 0 8px; text-align: center; }
.today > div { min-width: 0; }
.today .big { font-size: 30px; line-height: 1.2; }
.today .unit { font-size: 11px; color: var(--muted); margin-left: 2px; }
.today p { margin: 2px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .05em; }

.sec { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .2em; margin: 28px 0 8px; }
.sub-h { font-size: 15px; margin: 28px 0 8px; padding-top: 20px; border-top: 1px solid var(--line); }

/* 段の一覧・レッスンの一覧 */
.steps, .lessons { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.steps li, .lessons li { border-bottom: 1px solid var(--line); }
.steps button, .lessons button {
  width: 100%; min-height: 56px; display: grid; align-items: center; gap: 12px;
  background: none; border: 0; color: var(--ink); font: inherit; text-align: left; padding: 10px 2px; cursor: pointer;
}
.steps button { grid-template-columns: 28px 1fr auto; }
.lessons button { grid-template-columns: 34px 1fr auto; }
.step-n, .l-id { font-size: 18px; color: var(--blue); }
.l-id { font-size: 14px; }
.step-name, .l-name { font-weight: 600; }
.step-st, .l-st { font-size: 12px; color: var(--muted); text-align: right; }
.l-main { display: flex; flex-direction: column; min-width: 0; }
.l-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.steps button.done .step-st, .lessons button.done .l-st { color: var(--blue); font-weight: 600; }
.steps button:disabled { opacity: .45; cursor: default; }
.steps button:focus-visible, .lessons button:focus-visible, .btn:focus-visible, .back:focus-visible, .link:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.weak { font-size: 22px; letter-spacing: .1em; color: var(--red); margin: 4px 0 12px; }
#r-weak { font-size: 15px; }

/* ボタン：主は青＋白、補助は白地＋青 */
.btn {
  display: block; width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--blue);
  background: var(--blue); color: var(--on-blue); font: 600 16px/1.2 var(--font); letter-spacing: .05em; padding: 12px 16px; cursor: pointer;
  transition: opacity .15s, transform .15s;
}
.btn:active { transform: scale(.98); opacity: .85; }
.btn.sub { background: var(--card); color: var(--blue); }
.row { display: flex; gap: 10px; margin: 8px 0 12px; }
.row .btn { flex: 1; font-size: 14px; }
.col { display: grid; gap: 10px; margin-top: 16px; }
.btn.sideL { background: var(--blue); border-color: var(--blue); }
.btn.sideR { background: var(--red); border-color: var(--red); color: #fff; }

.back { background: none; border: 0; color: var(--blue); font: inherit; font-size: 15px; padding: 8px 0; min-height: 44px; cursor: pointer; }
.link { background: none; border: 0; color: var(--blue); font: 600 15px var(--font); padding: 8px 4px; min-height: 44px; cursor: pointer; }
.kicker { margin: 8px 0 0; font-size: 12px; letter-spacing: .25em; color: var(--muted); }
.vt { font-size: 24px; margin: 2px 0 14px; letter-spacing: .05em; }

/* 1 持ち方 */
.pic { margin: 0 0 12px; display: flex; justify-content: center; }
.pic svg { width: min(100%, 260px); height: auto; }
.ph { fill: var(--card); stroke: var(--ink); stroke-width: 2; }
.kb { fill: var(--field); }
.keys rect { fill: var(--line); }
.keys .kl, .keys .km { fill: var(--blue); opacity: .55; }
.keys .km { opacity: .3; }
.keys .kr { fill: var(--red); opacity: .55; }
.thumb-l, .thumb-r { fill: var(--muted); opacity: .35; stroke: var(--ink); stroke-width: 1.5; }
.tips { padding-left: 1.3em; margin: 0 0 16px; }
.tips li { margin-bottom: 6px; }
.note { background: var(--soft); border-radius: 12px; padding: 14px 16px 4px; margin: 0 0 18px; font-size: 14px; }
.note-h { font-weight: 600; color: var(--blue); }

/* 2 受け持ちの図 */
.cL { color: var(--blue); font-weight: 600; }
.cR { color: var(--red); font-weight: 600; }
.kbd { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr 1.4fr 1fr; grid-template-rows: repeat(4, 48px); gap: 6px; background: var(--field); padding: 8px; border-radius: 12px; margin: 14px 0 6px; }
.k { display: flex; align-items: center; justify-content: center; text-align: center; border-radius: 8px; font-size: 17px; line-height: 1.15; color: #fff; }
.k.f { font-size: 11px; }
.kL { background: var(--blue); }
.kM { background: var(--card); color: var(--blue); border: 2px dashed var(--blue); }
.kR { background: var(--red); }
@media (prefers-color-scheme: dark) { .kL, .kR { color: #1C1F23; } }
.k.tall { grid-row: span 2; }
.quiz-n { color: var(--muted); font-size: 13px; text-align: center; margin: 8px 0 0; }
.quiz-key { font-size: 44px; text-align: center; margin: 4px 0 12px; font-weight: 600; }
.quiz-fb { text-align: center; min-height: 1.75em; margin-top: 10px; font-weight: 600; }
.result-big { font-size: 40px; text-align: center; margin: 8px 0; }
.row.two .btn { font-size: 16px; min-height: 56px; }

/* 打つ練習。キーボードが出ても見えるように、上につめる */
#v-type { padding-top: 0; }
.type-bar { display: flex; justify-content: space-between; align-items: center; margin-top: -14px; }
.type-bar span { font-size: 14px; color: var(--muted); }
.type-name { font-size: 12px; color: var(--muted); margin: 0 0 4px; letter-spacing: .05em; }
.target { font-size: 30px; line-height: 1.5; letter-spacing: .06em; margin: 0 0 10px; min-height: 1.5em; word-break: break-all; }
.ch { display: inline-block; padding-bottom: 2px; border-bottom: 3px solid transparent; }
.ch.sL { color: var(--blue); }
.ch.sM { color: var(--blue); }
.ch.sM::after { content: ""; }
.ch.sR { color: var(--red); }
.ch.sN { color: var(--ink); }
.ch.ok { opacity: .28; }
.ch.cur { border-bottom-color: var(--ink); }
.ch.cur.bad { background: var(--soft); border-bottom-color: var(--red); }
.typed {
  width: 100%; font: 22px/1.4 var(--font); color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; outline: none;
}
.typed:focus { border-color: var(--blue); }
.type-hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; min-height: 3.4em; }
.type-foot { display: flex; justify-content: space-between; align-items: center; }
.legend { font-size: 12px; }

/* 速さの記録 */
.hist { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.hist li { display: grid; grid-template-columns: 44px 1fr 72px 44px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.h-date, .h-acc { color: var(--muted); }
.h-cpm, .h-acc { text-align: right; }
.h-bar { height: 8px; background: var(--field); border-radius: 4px; overflow: hidden; }
.h-bar i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: 13px; padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: calc(100% - 40px); }

@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
