.typing-article { max-width: 860px; margin: 40px auto 56px; }
.typing-article h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.3; letter-spacing: -.02em; margin-bottom: 14px; }
.typing-lead { color: #496373; font-size: 1.05rem; line-height: 1.9; margin-bottom: 22px; }
.typing-device-note { border: 1px solid #f0c36b; border-radius: 12px; padding: 12px 16px; background: #fff8e8; color: #6b4a00; font-weight: 700; line-height: 1.7; }

.typing-panel { border: 1px solid #d8e3e7; border-radius: 20px; background: rgba(255, 255, 255, .96); box-shadow: 0 12px 30px rgba(29, 63, 78, .08); padding: clamp(20px, 4vw, 34px); }
.typing-panel h2 { color: #12364b; font-size: 1.35rem; margin-bottom: 18px; }
.typing-panel h3 { color: #12364b; font-size: 1.1rem; margin: 28px 0 6px; }


.typing-filters { display: flex; flex-wrap: wrap; gap: 14px; }
.typing-filters label { display: grid; gap: 6px; font-weight: 800; flex: 1 1 180px; }
.typing-filters select { width: 100%; min-height: 46px; border: 1px solid #91b9c2; border-radius: 10px; padding: 10px 12px; font: inherit; background: #fff; color: #173b52; }
.typing-filters select:disabled { background: #eef2f4; color: #8a9aa2; }
.typing-pool { color: #496373; margin: 14px 0 4px; }
.typing-best-line { color: #496373; margin: 0 0 18px; }
.typing-best-line strong { color: #087c86; font-size: 1.15rem; }

.typing-start, .typing-secondary { font: inherit; font-weight: 900; border-radius: 14px; cursor: pointer; min-height: 52px; padding: 12px 26px; }
.typing-start { display: inline-flex; align-items: center; gap: 12px; border: 0; background: #087c86; color: #fff; font-size: 1.15rem; box-shadow: 0 8px 18px rgba(8, 124, 134, .25); }
.typing-start span { font-size: .75rem; font-weight: 800; border: 1px solid rgba(255, 255, 255, .6); border-radius: 6px; padding: 2px 7px; }
.typing-start:hover { background: #066b74; }
.typing-start:disabled { background: #9fb4ba; box-shadow: none; cursor: not-allowed; }
.typing-secondary { border: 1px solid #087c86; background: #fff; color: #087c86; }
.typing-secondary:hover { background: #edf8f9; }
.typing-start:focus-visible, .typing-secondary:focus-visible, .typing-filters select:focus-visible { outline: 3px solid #f2b84b; outline-offset: 2px; }

.typing-rules { margin-top: 22px; border-top: 1px solid #d8e3e7; padding-top: 14px; }
.typing-rules summary { cursor: pointer; font-weight: 800; color: #087c86; }
.typing-rules li { line-height: 1.8; margin-bottom: 6px; color: #33505f; }
kbd { display: inline-block; min-width: 1.6em; border: 1px solid #b6c8cf; border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; background: #f7fafb; font: inherit; font-size: .85em; font-weight: 800; text-align: center; color: #173b52; }

.typing-game { position: relative; overflow: hidden; }
.typing-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.typing-status > div { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.typing-label { color: #5d7480; font-size: .85rem; font-weight: 800; }
.typing-status strong { color: #12364b; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.typing-unit { color: #5d7480; font-weight: 700; }
.typing-score, .typing-combo { justify-content: flex-end; }
.typing-timebar { height: 8px; border-radius: 999px; background: #e4ecef; margin: 10px 0 22px; overflow: hidden; }
.typing-timebar span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #087c86, #34b3a0); transition: width .1s linear; }

.typing-card { min-height: 250px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; border-radius: 16px; background: #f4f9fa; padding: 24px clamp(14px, 4vw, 40px); }
.typing-tag { margin: 0 0 12px; color: #087c86; font-size: .82rem; font-weight: 900; letter-spacing: .08em; }
.typing-hint { margin: 0 0 22px; color: #173b52; font-size: clamp(1.15rem, 2.6vw, 1.5rem); font-weight: 800; line-height: 1.7; max-width: 40em; }
.typing-answer { margin: 0; min-height: 1.6em; font-size: clamp(1.6rem, 4.5vw, 2.4rem); font-weight: 900; letter-spacing: .08em; word-break: break-all; }
.typing-typed { color: #087c86; }
.typing-rest { color: #c3d3d8; }
.typing-answer.is-miss { animation: typing-shake .22s ease; }
@keyframes typing-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.typing-buffer { min-height: 1.5em; margin: 8px 0 0; color: #5d7480; font-family: ui-monospace, Menlo, monospace; font-size: 1.1rem; }
.typing-feedback { min-height: 1.8em; margin: 14px 0 6px; text-align: center; font-weight: 800; }
.typing-feedback.is-good { color: #0b7a4b; }
.typing-feedback.is-pass { color: #b4492f; }
.typing-feedback.is-warn { color: #8a5a00; }
.typing-keys { margin: 0; text-align: center; color: #5d7480; font-size: .9rem; }
.typing-countdown { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .88); color: #087c86; font-size: 5rem; font-weight: 900; }
.typing-countdown[hidden] { display: none; }

.typing-newbest { display: inline-block; margin: 0 0 14px; border-radius: 999px; padding: 6px 14px; background: #fff1cc; color: #8a5a00; font-weight: 900; }
.typing-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 22px; }
.typing-summary div { border-radius: 14px; background: #f4f9fa; padding: 14px; text-align: center; }
.typing-summary dt { color: #5d7480; font-size: .85rem; font-weight: 800; }
.typing-summary dd { margin: 4px 0 0; color: #12364b; font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.typing-result-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.typing-review-note { color: #5d7480; margin-bottom: 10px; }
.typing-review { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.typing-review li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; border-bottom: 1px solid #e4ecef; padding: 8px 2px; }
.typing-mark { width: 1.6em; text-align: center; font-weight: 900; }
.typing-review .is-ok .typing-mark { color: #0b7a4b; }
.typing-review .is-hint .typing-mark { color: #8a5a00; }
.typing-review .is-pass .typing-mark, .typing-review .is-time .typing-mark { color: #b4492f; }
.typing-review-term { flex: 1 1 14em; font-weight: 700; }
.typing-review a { color: #087c86; font-weight: 700; text-decoration: underline; font-size: .9rem; }


@media (max-width: 640px) {
    .typing-summary { grid-template-columns: repeat(2, 1fr); }
  .typing-status strong { font-size: 1.4rem; }
}

.typing-start-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.game-sound-toggle { min-height: 40px; border: 1px solid #91b9c2; border-radius: 999px; padding: 6px 14px; background: #fff; color: #173b52; font: inherit; font-size: .9rem; font-weight: 800; cursor: pointer; }
.game-sound-toggle[aria-pressed="true"] { border-color: #087c86; background: #effbfc; color: #087c86; }
.game-sound-toggle:focus-visible { outline: 3px solid #f2b84b; outline-offset: 2px; }
.typing-keys .game-sound-toggle { min-height: 32px; padding: 2px 12px; margin-left: 6px; }

/* トップページのゲーム入口（A案） */
.game-promo { margin: 0 0 44px; }
.game-promo-head { margin-bottom: 14px; }
.game-promo-head .section-kicker { margin-bottom: 4px; }
.game-promo-head h2 { margin: 0; color: #12364b; font-size: clamp(1.3rem, 2.6vw, 1.7rem); }
.game-promo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.game-promo-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid #d8e3e7; border-radius: 20px; background: #fff; box-shadow: 0 12px 30px rgba(29, 63, 78, .1); transition: transform .18s ease, box-shadow .18s ease; }
.game-promo-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(29, 63, 78, .16); }
.game-promo-card:focus-visible { outline: 3px solid #f2b84b; outline-offset: 3px; }
.game-promo-art { position: relative; display: block; height: 150px; background-size: cover; background-position: center; }
.game-promo-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(255, 255, 255, .15), rgba(255, 255, 255, .55)); }
.game-promo-art img { position: absolute; z-index: 1; right: 14px; bottom: -26px; width: 150px; height: auto; transition: transform .2s ease; }
.game-promo-card:hover .game-promo-art img { transform: translateY(-6px) rotate(-3deg); }
.game-promo-body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 18px 20px; }
.game-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.game-badge { padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.game-badge.is-pc { background: #e8f1ff; color: #2457a6; }
.game-badge.is-sp { background: #e6f7ee; color: #127a45; }
.game-promo-name { color: #12364b; font-size: 1.35rem; font-weight: 900; line-height: 1.3; }
.game-promo-sub { margin-top: -6px; color: #5d7480; font-size: .82rem; font-weight: 800; }
.game-promo-text { color: #496373; line-height: 1.7; font-size: .95rem; padding-right: 120px; }
.game-promo-go { margin-top: 6px; padding: 9px 18px; border-radius: 12px; background: #087c86; color: #fff; font-weight: 900; }
.is-cards .game-promo-go { background: #3a6fd8; }
@media (max-width: 640px) {
  .game-promo-grid { grid-template-columns: 1fr; }
  .game-promo-art { height: 130px; }
  .game-promo-art img { width: 130px; }
  .game-promo-text { padding-right: 0; }
}
@media (prefers-reduced-motion: reduce) { .game-promo-card, .game-promo-art img { transition: none; } .game-promo-card:hover, .game-promo-card:hover .game-promo-art img { transform: none; } }

/* 背景とキャラクター */
/* 背景画像（16:9）は幅いっぱいに置き、画像の下端（56.25vw）までに地の色へ溶けこませる。 */
.game-body { background: linear-gradient(rgba(244, 247, 248, .4), rgba(244, 247, 248, .85) 38vw, #f4f7f8 56vw) top / 100% 56.25vw no-repeat, var(--game-bg) center top / 100% auto no-repeat, #f4f7f8; }
.game-bg-typing { --game-bg: url("game-bg-typing.webp"); }
.game-bg-cards { --game-bg: url("game-bg-cards.webp"); }
.typing-panel { position: relative; }
.game-mascot-setup { position: absolute; right: 18px; top: -64px; width: 150px; height: auto; pointer-events: none; }
.game-mascot-result { float: right; width: 150px; height: auto; margin: -50px -6px 0 12px; }
.typing-card { position: relative; padding-left: clamp(14px, 18vw, 180px); }
.typing-card .game-mascot { position: absolute; left: 10px; bottom: 6px; width: clamp(80px, 16vw, 160px); height: auto; }
.game-mascot[data-state="happy"], .game-mascot[data-state="oops"] { animation: mascot-pop .3s ease; }
@keyframes mascot-pop { 40% { transform: translateY(-8px) scale(1.04); } }
@media (max-width: 640px) {
  .game-mascot-setup { width: 96px; top: -34px; right: 8px; }
  .game-mascot-result { width: 104px; margin-top: -30px; }
  .typing-card { padding: 24px 14px 100px; }
  .typing-card .game-mascot { left: 50%; margin-left: -45px; bottom: 4px; width: 90px; }
}
@media (prefers-reduced-motion: reduce) { .game-mascot { animation: none !important; } }

/* 結果の評価（2026-10-16） */
.game-rank { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; border-radius: 16px; padding: 12px 16px; background: #f4f9fa; }
.game-rank-letter { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #8ca5af; color: #fff; font-size: 2.1rem; font-weight: 900; flex: none; }
.game-rank.is-S .game-rank-letter { background: #e0a100; } .game-rank.is-A .game-rank-letter { background: #d4553f; } .game-rank.is-B .game-rank-letter { background: #087c86; }
.game-rank-text { display: grid; gap: 2px; } .game-rank-word { color: #12364b; font-size: 1.2rem; } .game-rank-note { color: #5d7480; font-size: .88rem; }
.game-tally { margin: -10px 0 20px; color: #496373; font-size: .92rem; line-height: 1.7; }
.is-hintall .typing-mark { color: #b6463a; }

/* ステージ選択（2026-10-17）：カードをタップして選ぶ */
.stage-title { display: grid; gap: 2px; }
.stage-title span { color: #e0a100; font-size: .78rem; font-weight: 900; letter-spacing: .22em; }
.stage-select { margin: 4px 0 18px; }
.stage-worlds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; padding: 6px; border-radius: 18px; background: #e8f0f3; }
.stage-world { display: grid; gap: 0; justify-items: center; min-height: 58px; border: 0; border-radius: 13px; padding: 6px 4px; background: transparent; color: #496373; font: inherit; cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.stage-world strong { font-size: 1.2rem; font-weight: 900; line-height: 1.2; }
.stage-world span { font-size: .75rem; font-weight: 800; opacity: .8; }
.stage-world:hover { background: rgba(255, 255, 255, .7); }
.stage-world.is-on { background: #fff; color: #087c86; box-shadow: 0 4px 12px rgba(29, 63, 78, .14); transform: translateY(-1px); }
.stage-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.cards-stage-page .stage-grid, #cards-stages .stage-grid { grid-template-columns: repeat(3, 1fr); }
.stage-card { --tone1: #5aa9e6; --tone2: #2f6fd0; position: relative; display: flex; flex-direction: column; overflow: hidden; border: 3px solid transparent; border-radius: 18px; padding: 0; background: #fff; color: #12364b; font: inherit; text-align: left; cursor: pointer; box-shadow: 0 6px 0 #d5e1e5, 0 10px 22px rgba(29, 63, 78, .1); transition: transform .16s ease, box-shadow .16s ease, border-color .16s; animation: stage-in .4s ease both; animation-delay: calc(var(--i, 0) * 50ms); }
.stage-card:hover { transform: translateY(-4px) rotate(-.6deg); }
.stage-card:active { transform: translateY(2px); box-shadow: 0 2px 0 #d5e1e5, 0 4px 10px rgba(29, 63, 78, .1); }
.stage-card.is-on { border-color: #f2b84b; transform: translateY(-6px); box-shadow: 0 6px 0 #e0a100, 0 0 0 5px rgba(242, 184, 75, .28), 0 16px 30px rgba(29, 63, 78, .2); }
.stage-card.is-on::after { content: "▶ もう一回でスタート"; white-space: nowrap; position: absolute; left: 0; right: 0; bottom: 0; padding: 4px; background: #f2b84b; color: #5a3b00; font-size: .68rem; font-weight: 900; text-align: center; }
.stage-card.is-pop { animation: stage-pop .32s ease; }
.stage-card:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.stage-card:focus-visible { outline: 3px solid #087c86; outline-offset: 3px; }
.stage-art { position: relative; display: grid; place-items: center; height: 96px; color: var(--tone2); background: radial-gradient(circle at 20% 15%, rgba(255, 255, 255, .45) 0 18%, transparent 19%), radial-gradient(circle at 85% 80%, rgba(255, 255, 255, .25) 0 22%, transparent 23%), linear-gradient(135deg, var(--tone1), var(--tone2)); }
.stage-art svg { width: 52px; height: 52px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .15)); transition: transform .2s ease; }
.stage-card:hover .stage-art svg, .stage-card.is-on .stage-art svg { transform: scale(1.12) rotate(-6deg); }
.stage-art-text { padding: 0 10px; color: #fff; font-size: 1.25rem; font-weight: 900; letter-spacing: .04em; text-align: center; line-height: 1.35; text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.stage-body { display: grid; gap: 2px; padding: 10px 12px 30px; }
.stage-no { color: #8aa0aa; font-size: .7rem; font-weight: 900; letter-spacing: .14em; }
.stage-name { font-size: 1.15rem; font-weight: 900; line-height: 1.3; }
.stage-sub { color: #5d7480; font-size: .78rem; font-weight: 700; line-height: 1.4; }
.stage-meta { display: grid; gap: 1px; margin-top: 6px; color: #496373; font-size: .76rem; font-weight: 800; }
.stage-meta span:first-child { color: var(--tone2); }
.stage-medal { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 34px; height: 34px; border: 3px solid #fff; border-radius: 50%; background: #8ca5af; color: #fff; font-size: 1rem; font-weight: 900; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.stage-medal.is-S { background: linear-gradient(135deg, #ffd34d, #e0a100); } .stage-medal.is-A { background: #d4553f; } .stage-medal.is-B { background: #087c86; }
.stage-medal.is-none { background: rgba(255, 255, 255, .35); border-color: rgba(255, 255, 255, .7); font-size: .75rem; }
.stage-progress { margin: 14px 0 0; color: #496373; font-size: .88rem; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.stage-progress .stage-medal { position: static; width: 24px; height: 24px; border-width: 2px; font-size: .75rem; box-shadow: none; }
.stage-progress strong { color: #e0a100; font-size: 1.1rem; }
.stage-tip { color: #8aa0aa; font-size: .8rem; }
.tone-physics { --tone1: #6db7ff; --tone2: #2c68d6; }
.tone-chemistry { --tone1: #ff9f6b; --tone2: #e2533a; }
.tone-biology { --tone1: #7fd98a; --tone2: #2b9a4c; }
.tone-earth { --tone1: #c9a46a; --tone2: #8a5a2b; }
.tone-gas { --tone1: #7ed2f0; --tone2: #2b8fc4; }
.tone-change { --tone1: #ffb36b; --tone2: #d0602a; }
.tone-solution { --tone1: #8be0c8; --tone2: #1f9a86; }
.tone-ion { --tone1: #b39cff; --tone2: #6a45d8; }
.tone-review { --tone1: #ff8fb1; --tone2: #d0427a; }
.tone-mix { --tone1: #3d4a7a; --tone2: #182447; }
.stage-card.is-boss .stage-art { background: radial-gradient(circle at 30% 25%, rgba(255, 215, 90, .35) 0 14%, transparent 15%), radial-gradient(circle at 75% 70%, rgba(255, 255, 255, .12) 0 20%, transparent 21%), linear-gradient(135deg, var(--tone1), var(--tone2)); }
.stage-card.is-boss .stage-art svg path { fill: #ffd34d; }
.stage-card.is-boss .stage-no { color: #e0a100; }
.stage-ready { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; border-radius: 18px; padding: 14px 18px; background: linear-gradient(135deg, #fff8e6, #eef9fa); border: 2px solid #f2dca2; }
.stage-ready-info { display: grid; gap: 2px; }
.stage-ready-name { margin: 0; color: #12364b; font-size: 1.25rem; font-weight: 900; }
.stage-ready .typing-pool, .stage-ready .typing-best-line { margin: 0; font-size: .9rem; }
.stage-ready .typing-start { min-width: 170px; justify-content: center; font-size: 1.25rem; animation: stage-glow 1.8s ease-in-out infinite; }
.stage-ready .typing-start:disabled { animation: none; }
@keyframes stage-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes stage-pop { 40% { transform: translateY(-10px) scale(1.04); } 100% { transform: translateY(-6px); } }
@keyframes stage-glow { 50% { box-shadow: 0 8px 18px rgba(8, 124, 134, .25), 0 0 0 6px rgba(8, 124, 134, .14); } }
@media (max-width: 760px) {
  .stage-grid, #cards-stages .stage-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stage-grid > .stage-card.is-boss:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stage-art { height: 78px; }
  .stage-art svg { width: 42px; height: 42px; }
  .stage-world strong { font-size: 1.05rem; }
  .stage-ready { position: sticky; bottom: 8px; z-index: 5; padding: 10px 12px; gap: 8px; box-shadow: 0 10px 26px rgba(29, 63, 78, .22); }
  .stage-ready-name { font-size: 1.05rem; }
  .stage-art-text { font-size: .9rem; padding: 0 26px 0 6px; }
  .stage-medal { width: 26px; height: 26px; top: 6px; right: 6px; border-width: 2px; font-size: .78rem; }
  .stage-medal.is-none { font-size: .62rem; }
  .stage-ready { flex-wrap: nowrap; }
  .stage-ready-info { min-width: 0; }
  .stage-ready .typing-pool { display: none; }
  .stage-ready .typing-best-line { font-size: .74rem; white-space: nowrap; }
  .stage-ready .typing-start-row { flex-wrap: nowrap; gap: 6px; flex: none; }
  .stage-ready .typing-start { min-width: 0; min-height: 48px; padding: 8px 18px; font-size: 1.05rem; }
  .stage-ready .game-sound-toggle { min-height: 36px; padding: 4px 8px; font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) { .stage-card, .stage-card.is-pop, .stage-ready .typing-start { animation: none; } .stage-card, .stage-art svg { transition: none; } }
.stage-select.is-entered .stage-card { animation: none; }
.stage-select.is-entered .stage-card.is-pop { animation: stage-pop .32s ease; }
.tone-element { --tone1: #9fb4c8; --tone2: #4f6b86; }
.tone-acid { --tone1: #f0c75a; --tone2: #b5800f; }
