/* 学びタッチ とけい（kaku.css・keisan.css の上に重ねる） */
.tbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: center; padding: 10px 14px 4px; }
.tbar .modes { display: flex; gap: 8px; padding: 0; flex: 0 1 auto; }
.tbar .mode { min-height: 50px; padding: 4px 14px; }
.tbar .mode b { font-size: 19px; }
.seg.lv button { min-height: 48px; min-width: 66px; font-size: 16px; }

.tstage {
  display: grid; gap: 10px 24px; justify-items: center; align-items: center;
  padding: 6px 14px 14px; max-width: 1200px; margin: 0 auto;
  grid-template-columns: 1fr; grid-template-areas: "side" "clock";
  --clk: min(92vw, calc(100vh - 470px), 520px);
  --clk: min(92vw, calc(100svh - 470px), 520px);
}
body.mode-read .tstage { --clk: min(80vw, calc(100vh - 560px), 460px); --clk: min(80vw, calc(100svh - 560px), 460px); }
.clockw { grid-area: clock; position: relative; width: var(--clk); height: var(--clk); min-width: 220px; min-height: 220px; }
#clock { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
#clock.grab-m, #clock.grab-h { cursor: grabbing; }
body.mode-read #clock { cursor: default; }
.face { fill: #fff; stroke: #44403c; stroke-width: 3; }
.tick { stroke: #a8a29e; stroke-width: 1.2; }
.tick.big { stroke: #1f2937; stroke-width: 2.6; }
.hnum { font-size: 21px; font-weight: 700; fill: #1f2937; text-anchor: middle; dominant-baseline: central; font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
.mnum { font-size: 9.5px; font-weight: 700; fill: #2563eb; text-anchor: middle; dominant-baseline: central; font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
body.no-mnum .mnum { display: none; }
.hand line { stroke-linecap: round; }
.hand.h line { stroke: #1f2937; stroke-width: 9; }
.hand.m line { stroke: #c2410c; stroke-width: 5.5; }
#clock.grab-m .hand.m line, #clock.grab-h .hand.h line { filter: drop-shadow(0 0 3px rgba(194, 65, 12, .6)); }
.pin { fill: #1f2937; }
.clockw .maru { position: absolute; inset: -4%; width: 108%; height: 108%; z-index: 3; pointer-events: none; }

.side { grid-area: side; display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 560px; }
.tq { text-align: center; line-height: 1.3; }
.tq .big3 { display: block; font-size: clamp(34px, 7vw, 56px); font-weight: 700; color: var(--ink); }
.tq .tq2 { font-size: 19px; color: var(--sub); font-weight: 700; }
.ans { display: flex; gap: 14px; align-items: flex-end; justify-content: center; flex-wrap: wrap; }
.grp2 { display: flex; gap: 6px; align-items: flex-end; }
.pad.tp { --pad: clamp(64px, 17vw, 96px); width: var(--pad); height: var(--pad); min-width: 0; min-height: 0; border-radius: 12px; }
.pad.tp .ghost { font-size: calc(var(--pad) * 0.78); }
.unit { font-size: 26px; font-weight: 700; padding-bottom: 6px; }
.side .msg { width: 100%; }

/* 横長：とけいは右（ひだりてなら左）、文と ボタンは もう一方 */
@media (min-aspect-ratio: 5/4) and (min-width: 700px) {
  .tstage { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "side clock"; --clk: min(52vw, calc(100vh - 150px), 600px); --clk: min(52vw, calc(100svh - 150px), 600px); }
  body.mode-read .tstage { --clk: min(48vw, calc(100vh - 150px), 560px); --clk: min(48vw, calc(100svh - 150px), 560px); }
  body.lefty .tstage { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "clock side"; }
  .pad.tp { --pad: clamp(64px, 8vw, 100px); }
}
@media (max-width: 600px) and (orientation: portrait) {
  .tbar { padding-top: 6px; gap: 6px; }
  .tbar .modes { width: 100%; }
  .tbar .mode { flex: 1; font-size: 14px; padding: 2px 6px; min-height: 46px; }
  .tbar .mode b { font-size: 16px; }
  .seg.lv button { min-width: 0; padding: 2px 10px; min-height: 44px; font-size: 15px; }
  .tstage { gap: 6px; padding-top: 2px; --clk: min(90vw, calc(100vh - 440px)); --clk: min(90vw, calc(100svh - 440px)); }
  body.mode-read .tstage { --clk: min(80vw, calc(100vh - 520px)); --clk: min(80vw, calc(100svh - 520px)); }
  body.mode-read .tstage { grid-template-areas: "clock" "side"; }
  .tq .big3 { font-size: 34px; }
  .tq .tq2 { font-size: 16px; }
  .pad.tp { --pad: 62px; }
  .unit { font-size: 20px; }
  .side .msg { min-height: 48px; padding: 5px 10px; font-size: 16px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  body.mode-read .tq .tq2 { display: none; }
  body.mode-read .tq .big3 { font-size: 28px; }
  body.mode-read .clockw { min-width: 170px; min-height: 170px; }
  body.mode-read .tstage { --clk: min(80vw, calc(100vh - 480px)); --clk: min(80vw, calc(100svh - 480px)); }
}
