/* 学びタッチ けいさんカード（kaku.css の上に重ねる） */
.top .count { font-size: 18px; font-weight: 700; color: var(--sub); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- えらぶ ---- */
.setup { max-width: 860px; margin: 0 auto; padding: 8px 16px 12px; }
.pick h2 { font-size: 19px; margin: 16px 0 8px; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kind {
  min-height: 96px; border: 3px solid var(--line); border-radius: 18px; background: var(--card); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; touch-action: manipulation;
}
.kind b { font-size: 34px; line-height: 1.1; }
.kind span { font-size: 16px; font-weight: 700; color: var(--sub); }
.kind[aria-checked="true"] { border-color: var(--accent); background: var(--accent-bg); }
.kind:focus-visible, .dan:focus-visible, .seg button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.dans { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.dan {
  min-height: 60px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer;
  font-size: 28px; font-weight: 700; line-height: 1.1; touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dan small { font-size: 12px; color: var(--sub); font-weight: 700; }
.dan.all { font-size: 17px; white-space: nowrap; }
.dan[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.dan[aria-pressed="true"] small { color: #ffe4d4; }
.seg.big { display: flex; flex-wrap: wrap; border: 0; border-radius: 0; overflow: visible; gap: 8px; }
.seg.big button { min-height: 52px; padding: 4px 16px; border: 2px solid var(--line); border-radius: 14px; font-size: 17px; touch-action: manipulation; }
.nnote { margin: 6px 0 0; color: var(--sub); font-size: 15px; }
.startrow { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 22px 0 6px; }
.btn.big { min-height: 64px; min-width: 200px; font-size: 22px; border-radius: 18px; }
.badge { display: inline-block; min-width: 26px; padding: 0 7px; border-radius: 13px; background: var(--accent); color: #fff; font-size: 15px; line-height: 26px; }
.badge:empty { display: none; }

/* ---- とく ---- */
.play {
  display: grid; gap: 10px; justify-items: center; align-content: start;
  padding: 10px 14px 14px;
  grid-template-areas: "q" "pads" "msg" "tools";
  --pad: min(43vw, calc((100dvh - 390px) * 0.9), 300px);
}
.qarea { grid-area: q; text-align: center; }
.q { font-size: clamp(44px, 11vw, 84px); font-weight: 700; line-height: 1.1; letter-spacing: .04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q .op { color: var(--accent); margin: 0 .12em; }
.yomi { min-height: 1.6em; font-size: 20px; font-weight: 700; color: var(--ok); }
.pads { grid-area: pads; position: relative; display: flex; gap: 12px; }
.padw { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.plbl { font-size: 14px; color: var(--sub); font-weight: 700; }
.pad {
  position: relative; width: var(--pad); height: var(--pad); min-width: 120px; min-height: 120px;
  background: #fff; border: 3px solid #d6cfc2; border-radius: 16px; overflow: hidden;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  background-image: linear-gradient(var(--guide), var(--guide)); background-size: 100% 1px; background-position: 0 50%; background-repeat: no-repeat;
}
.pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; touch-action: none; cursor: crosshair; }
.pad .ghost {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 0;
  font-size: calc(var(--pad) * 0.78); line-height: 1; font-weight: 400; color: #e9d5c6; pointer-events: none;
  font-family: "UD デジタル 教科書体 N-R", "UD Digi Kyokasho N-R", system-ui, sans-serif;
}
.pad.ask { border-color: var(--next); box-shadow: 0 0 0 5px rgba(251, 146, 60, .25); }
.pad.bad { border-color: var(--red); border-style: dashed; }
.maru { position: absolute; inset: -6% -4%; width: 108%; height: 112%; z-index: 3; pointer-events: none; }
.play .msg { grid-area: msg; width: min(92vw, 640px); }
.play .tools { grid-area: tools; }
.choose { grid-area: tools; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; }
.btn.digit { min-width: 96px; min-height: 96px; font-size: 56px; border-width: 3px; border-color: var(--next); font-family: "UD デジタル 教科書体 N-R", "UD Digi Kyokasho N-R", system-ui, sans-serif; }

/* 横長の画面：式は左、書く所は右（ひだりてなら 入れかえ） */
@media (min-aspect-ratio: 5/4) and (min-width: 700px) {
  .play {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 1fr auto auto auto 1fr;
    grid-template-areas: ". pads" "q pads" "msg pads" "tools pads" ". pads"; align-items: start; column-gap: 24px;
    --pad: min(30vw, calc(100dvh - 170px), 400px);
    max-width: 1200px; margin: 0 auto; height: calc(100dvh - 64px); min-height: 0;
  }
  body.lefty .play { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "pads ." "pads q" "pads msg" "pads tools" "pads ."; }
  .q { font-size: clamp(56px, 8vw, 104px); }
  .play .msg { width: 100%; }
  .pads { align-self: center; }
}
/* スマートフォン（たて） */
@media (max-width: 600px) and (orientation: portrait) {
  .play { gap: 6px; padding: 6px 10px 10px; --pad: min(44vw, calc((100dvh - 360px) * 0.95)); }
  .yomi { font-size: 17px; min-height: 1.4em; }
  .play .msg { min-height: 52px; padding: 5px 10px; font-size: 16px; }
  .btn.digit { min-width: 80px; min-height: 80px; font-size: 46px; }
  .kind { min-height: 80px; }
  .kind b { font-size: 28px; }
  .top .brand { font-size: 13px; }
  .top h1 { font-size: 18px; }
  .top .btn .lbl { display: none; }
}

/* ---- おわり ---- */
.done { max-width: 720px; margin: 0 auto; padding: 16px; text-align: center; }
.done h2 { font-size: 28px; margin: 4px 0; }
.maru-big { width: 120px; height: 120px; }
.maru-big path { fill: none; stroke: #e11d48; stroke-width: 5; stroke-linecap: round; }
.misslist { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; }
.mi { padding: 8px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); font-size: 24px; font-weight: 700; }
.mi b { color: var(--accent); }
.mi span { display: block; font-size: 14px; color: var(--sub); }
