/* 定期テスト前のまとめページ（test-g1-*.html など）専用 */
.ts-page article { max-width: 1000px; margin: 28px auto 44px; }
.ts-page article section { border-top: 0; padding: 0; }
.ts-page h2, .ts-page h3 { margin: 0; }
.ts-page svg text { font-family: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", system-ui, sans-serif; }

/* 上の見出し */
.ts-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: 32px; border-radius: 20px; color: #fff; background: linear-gradient(125deg, #12354a 0%, #0b5f6b 70%, #087c86 100%); }
.ts-kicker { margin: 0 0 8px; font-size: .9rem; font-weight: 700; letter-spacing: .06em; color: #a9e4e8; }
.ts-hero h1 { margin: 0 0 14px; color: #fff; font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.3; }
.ts-page .ts-hero .lead { margin: 0; color: #e4f3f5; font-size: 1rem; line-height: 1.85; }
.ts-hero svg { display: block; width: 100%; height: auto; }

/* 光・音・力へ飛ぶカード */
.ts-jump { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; }
.ts-page article .ts-jump a { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); color: #173b52; text-decoration: none; transition: transform .16s ease, box-shadow .16s ease; }
.ts-page article .ts-jump a:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(29, 63, 78, .12); }
.ts-jump svg { flex: 0 0 44px; width: 44px; height: 44px; }
.ts-jump strong { display: block; font-size: 1.15rem; color: var(--deep); }
.ts-jump span { display: block; font-size: .82rem; font-weight: 500; line-height: 1.5; color: #496373; }

/* 色分け */
.ts-light { --main: #c58220; --deep: #8a5a10; --soft: #fff8ea; --line: #f0dcb4; }
.ts-sound { --main: #247fa9; --deep: #17607f; --soft: #edf7fc; --line: #c6e3f1; }
.ts-force { --main: #b34550; --deep: #8e3039; --soft: #fdf1f1; --line: #f1d0d3; }

/* 使い方の4ステップ */
.ts-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 28px 0 0; padding: 0; list-style: none; counter-reset: ts-step; }
.ts-page .ts-steps li { position: relative; margin: 0; padding: 14px 14px 14px 52px; border: 1px solid #c8e4e7; border-radius: 14px; background: #fff; line-height: 1.55; font-size: .88rem; color: #496373; counter-increment: ts-step; }
.ts-steps li::before { content: counter(ts-step); position: absolute; left: 14px; top: 14px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #087c86; color: #fff; font-weight: 700; }
.ts-steps strong { display: block; color: #173b52; font-size: .98rem; }
.ts-tools { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; margin: 14px 0 0; font-size: .9rem; color: #496373; }
.ts-tools p { margin: 0; }
.ts-print { min-height: 44px; padding: 8px 16px; border: 1px solid #087c86; border-radius: 10px; background: #fff; color: #087c86; font: inherit; font-weight: 700; cursor: pointer; }
.ts-print:hover { background: #edf8f9; }

/* 各分野 */
.ts-page article .ts-field { margin: 44px 0 0; scroll-margin-top: 16px; }
.ts-field-head { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: 14px; background: var(--main); color: #fff; }
.ts-field-head svg { flex: 0 0 40px; width: 40px; height: 40px; }
.ts-field-head h2 { color: #fff; font-size: 1.45rem; }
.ts-page .ts-field-head p { margin: 2px 0 0; font-size: .88rem; line-height: 1.6; color: #fff; }
.ts-sub { margin: 26px 0 12px !important; font-size: 1.12rem; color: var(--deep); }

/* 図のカード */
.ts-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0 0; }
.ts-fig { display: flex; flex-direction: column; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.ts-fig svg { display: block; width: 100%; height: auto; background: var(--soft); }
.ts-fig figcaption { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 14px 16px 12px; }
.ts-fig h3 { font-size: 1.04rem; color: var(--deep); }
.ts-page .ts-fig p { margin: 0; font-size: .92rem; line-height: 1.75; }
.ts-mark { display: inline-flex; gap: 8px; align-items: center; align-self: flex-start; min-height: 36px; margin-top: auto; font-size: .84rem; color: #496373; cursor: pointer; }
.ts-mark input { width: 18px; height: 18px; accent-color: var(--main); }

/* 図の中の文字と線 */
.tf { font-size: 13px; fill: #173b52; }
.tf-b { font-weight: 700; }
.tf-s { font-size: 11.5px; fill: #496373; }
.tf-w { fill: #fff; }
.tf-amber { fill: #8a5a10; }
.tf-blue { fill: #17607f; }
.tf-red { fill: #8e3039; }
.tf-green { fill: #1e6554; }
.tf-purple { fill: #643f8c; }
.t-norm { stroke: #5c7884; stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
.t-ray { fill: none; stroke-width: 2.5; }
.t-arc { fill: none; stroke-width: 2; }
.t-flow { fill: none; stroke: #fff; stroke-width: 4; stroke-dasharray: 0.1 47.9; stroke-linecap: round; animation: ts-flow 1.6s linear infinite; }
.t-wave { fill: none; stroke: #7cf0c4; stroke-width: 2.5; }
.t-move { animation: ts-move var(--dur, 1.6s) linear infinite; }
@keyframes ts-flow { to { stroke-dashoffset: -48; } }
@keyframes ts-move { to { transform: translateX(var(--len)); } }
@media (prefers-reduced-motion: reduce) { .t-flow, .t-move { animation: none; } }

/* 表 */
.ts-table-wrap { margin: 16px 0 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.ts-table-wrap table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ts-table-wrap caption { padding: 12px 14px 4px; text-align: left; font-weight: 700; color: var(--deep); }
.ts-table-wrap caption small { display: block; margin-top: 2px; font-size: .82rem; font-weight: 500; line-height: 1.6; color: #496373; }
.ts-table-wrap th, .ts-table-wrap td { padding: 9px 12px; border-top: 1px solid var(--line); text-align: left; line-height: 1.6; }
.ts-table-wrap thead th { background: var(--soft); color: var(--deep); }

/* まちがえやすい点 */
.ts-traps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ts-trap { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; font-size: .92rem; line-height: 1.7; }
.ts-page .ts-trap p { display: grid; grid-template-columns: 24px 1fr; gap: 6px; margin: 0; }
.ts-page .ts-trap p + p { margin-top: 6px; }
.ts-no { color: #a23a44; font-weight: 700; }
.ts-yes { color: #087c86; font-weight: 700; }

/* 1問チェック */
.ts-page .ts-checks { display: grid; gap: 8px; }
.ts-checks details { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ts-checks summary { padding: 12px 16px; font-weight: 700; line-height: 1.7; cursor: pointer; }
.ts-checks summary:focus-visible, .ts-print:focus-visible, .ts-page article .ts-jump a:focus-visible { outline: 3px solid #c58220; outline-offset: 3px; }
.ts-page .ts-checks p { margin: 0; padding: 0 16px 14px; font-size: .94rem; line-height: 1.8; }
.ts-checks b { color: var(--deep); }

/* 教材へのカード */
.ts-units { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ts-unit { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.ts-unit > img { display: block; width: 100%; height: 150px; object-fit: contain; background: #f5fafb; border-bottom: 1px solid var(--line); }
.ts-unit-body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.ts-unit h3 { font-size: 1rem; color: #173b52; }
.ts-page .ts-unit p { margin: 0; font-size: .86rem; line-height: 1.6; }
.ts-unit ul { display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 0; padding: 0; list-style: none; }
.ts-page .ts-unit li { margin: 0; line-height: 1.4; }
.ts-page article .ts-unit li a { display: inline-block; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: var(--deep); font-size: .82rem; text-decoration: none; }
.ts-page article .ts-unit li a:hover { border-color: var(--main); }

/* 動画 */
.ts-videos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ts-page article .ts-video { display: block; color: #173b52; font-size: .86rem; line-height: 1.55; text-decoration: none; }
.ts-page article .ts-video:hover { color: #087c86; text-decoration: underline; }
.ts-thumb { position: relative; display: block; margin-bottom: 8px; overflow: hidden; border-radius: 10px; }
.ts-thumb img { display: block; width: 100%; height: auto; }
.ts-thumb::after { content: ""; position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin: -11px 0 0 -7px; border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent #fff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .55)); }

/* 印をつけたところ */
.ts-review { margin: 44px 0 0 !important; padding: 20px 22px !important; border: 2px solid #087c86 !important; border-radius: 16px; background: #effbfc; }
.ts-review h2 { font-size: 1.2rem; }
.ts-page .ts-review p { margin: 8px 0 0; font-size: .94rem; }
.ts-review ul { margin: 10px 0 0; padding-left: 20px; }
.ts-page .ts-review li { margin-bottom: 6px; line-height: 1.7; }
.ts-closing { margin: 32px 0 0 !important; font-size: .92rem; color: #496373; }
.ts-closing h2 { margin-bottom: 6px !important; font-size: 1.1rem; color: #173b52; }
.ts-closing p { margin: 6px 0; }

@media (max-width: 760px) {
  .ts-hero { grid-template-columns: 1fr; padding: 22px 18px; }
  .ts-hero svg { max-width: 360px; }
  .ts-jump, .ts-figs, .ts-traps { grid-template-columns: 1fr; }
  .ts-steps, .ts-videos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .ts-steps, .ts-videos { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .site-header, .lab-site-footer, .ts-tools, .ts-mark, .ts-jump, .ts-steps, .ts-unit > img, .ts-videos-wrap, .ts-review, .adsbygoogle { display: none !important; }
  .ts-page article { max-width: none; margin: 0; }
  .ts-hero { display: block; padding: 0; color: #173b52; background: none; }
  .ts-hero svg { display: none; }
  .ts-hero h1, .ts-page .ts-hero .lead { color: #173b52; }
  .ts-kicker { color: #496373; }
  .ts-field-head { padding: 6px 0; border-bottom: 3px solid var(--main); border-radius: 0; background: none; color: #173b52; }
  .ts-field-head h2, .ts-page .ts-field-head p { color: #173b52; }
  .ts-field-head svg { display: none; }
  .ts-page article .ts-field { margin-top: 18px; }
  .ts-fig, .ts-trap, .ts-checks details, .ts-unit, .ts-table-wrap { break-inside: avoid; }
  .t-flow { display: none; }
  .t-move { animation: none; }
}
