    .tyi-app {
      /* タッチかけ算(かけ算分解ゲーム)と同じパレットに統一 */
      --tyi-ink:        #1f2937;
      --tyi-muted:      #6b7280;
      --tyi-line:       #dbe2ea;
      --tyi-blue:       #3b82f6;
      --tyi-blue-soft:  #dbeafe;
      --tyi-green:      #10b981;
      --tyi-green-soft: #d1fae5;
      --tyi-orange:     #f59e0b;
      --tyi-orange-soft:#fef3c7;
      --tyi-red:        #ef4444;
      --tyi-paper:      #ffffff;
      --tyi-yellow:     #fef3c7;
      --tyi-navy:       #1f2937;
      --tyi-navy-2:     #111827;
      --tyi-purple:     #3b82f6;
      --tyi-shadow:     0 8px 24px rgba(0,0,0,0.08);
      --tyi-header-h:   56px;
    }

    .tyi-app *, .tyi-app *::before, .tyi-app *::after { box-sizing: border-box; }

    html:has(.tyi-app), body:has(.tyi-app) { height: 100%; }

    body:has(.tyi-app) {
      margin: 0;
      overflow: hidden;
      color: var(--tyi-ink);
      background: #ffffff;
      font-family: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
      -webkit-tap-highlight-color: transparent;
    }

    .tyi-app button { font: inherit; }

    .tyi-app {
      width: 100%;
      height: 100dvh;
      min-height: 0;
      display: grid;
      grid-template-rows: var(--tyi-header-h) minmax(0, 1fr);
      background: radial-gradient(circle at top, #ffffff, #f6f7fb);
      user-select: none;
      touch-action: manipulation;
    }

    .tyi-topbar {
      z-index: 20;
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 0 16px;
      height: var(--tyi-header-h);
      color: var(--tyi-ink);
      background: rgba(255,255,255,0.92);
      backdrop-filter: blur(8px);
      border-bottom: 1px solid var(--tyi-line);
      box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    }

    .tyi-brand {
      display: flex;
      align-items: center;
      gap: 9px;
      min-width: 0;
      font-size: clamp(14px, 1.8vw, 20px);
      font-weight: 900;
      line-height: 1;
      white-space: nowrap;
    }

    .tyi-brand-mark {
      width: 32px;
      height: 32px;
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      border-radius: 10px;
      color: #fff;
      background: linear-gradient(135deg, var(--tyi-blue), #2563eb);
      box-shadow: 0 4px 12px rgba(59,130,246,.28);
    }

    .tyi-brand-mark svg { width: 20px; height: 20px; fill: currentColor; }

    /* タイマーバー（タッチかけ算と同じ見た目） */
    .tyi-timer-bar-wrap {
      width: clamp(70px, 12vw, 150px);
      height: 10px;
      background: #e5e7eb;
      border-radius: 999px;
      flex: 0 0 auto;
    }

    .tyi-timer-bar {
      height: 100%;
      width: 100%;
      background: var(--tyi-green);
      border-radius: 999px;
      transition: width .3s linear, background .3s ease;
      transform-origin: left center;
    }

    .tyi-timer-bar.tyi-warn   { background: var(--tyi-orange); }
    .tyi-timer-bar.tyi-danger { background: var(--tyi-red); }

    .tyi-stats {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: auto;
    }

    .tyi-stat {
      display: flex;
      align-items: baseline;
      gap: 5px;
      min-width: 0;
      padding: 0;
      border: 0;
      border-radius: 0;
      background: transparent;
      white-space: nowrap;
      font-size: clamp(13px, 1.5vw, 18px);
      font-weight: 900;
    }

    .tyi-stat-label {
      display: inline;
      margin: 0;
      color: var(--tyi-muted);
      font-size: 11px;
      font-weight: 800;
    }

    .tyi-stat-value {
      display: inline;
      font-size: 1.25em;
      font-weight: 900;
      line-height: 1;
      color: var(--tyi-blue);
      font-variant-numeric: tabular-nums;
    }

    /* のこり秒はkbgのタイマーラベルと同じ強調 */
    .tyi-stat-time .tyi-stat-value {
      font-size: clamp(18px, 2.2vw, 26px);
      color: var(--tyi-ink);
      min-width: 2ch;
      text-align: right;
    }
    .tyi-stat-time .tyi-stat-value.tyi-warn   { color: var(--tyi-orange); }
    .tyi-stat-time .tyi-stat-value.tyi-danger { color: var(--tyi-red); }

    .tyi-outs { color: var(--tyi-red); letter-spacing: 3px; font-size: 1em; }
    .tyi-outs .tyi-safe { color: #e5e7eb; }

    .tyi-top-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }

    .tyi-icon-button {
      min-width: 38px;
      height: 38px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 0 10px;
      border: 1px solid var(--tyi-line);
      border-radius: 12px;
      color: var(--tyi-muted);
      background: #fff;
      cursor: pointer;
      transition: transform .16s ease, background .16s ease;
    }

    .tyi-icon-button:hover { background: #f4f8fa; }
    .tyi-icon-button:active { transform: scale(.95); }
    .tyi-icon-button svg { width: 20px; height: 20px; fill: currentColor; }
    /* 修正: 音アイコンのON/OFFが同時に表示されないよう hidden を明示的に効かせる */
    .tyi-icon-button svg[hidden] { display: none !important; }
    .tyi-icon-button[disabled] { opacity: .38; cursor: default; }

    .tyi-game-shell {
      position: relative;
      min-height: 0;
      padding: 0;
    }

    .tyi-stage {
      position: relative;
      width: 100%;
      height: 100%;
      min-height: 410px;
      margin: 0 auto;
      overflow: hidden;
      border: 0;
      border-radius: 0;
      background: #fff;
      box-shadow: none;
      isolation: isolate;
    }

    .tyi-stage::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -1;
      opacity: .5;
      background:
        radial-gradient(circle at 25% 5%, rgba(28,197,235,.055), transparent 25%),
        radial-gradient(circle at 75% 30%, rgba(143,70,247,.04), transparent 28%);
    }

    .tyi-mode-badge {
      position: absolute;
      top: 16px;
      left: 18px;
      z-index: 5;
      display: none;
      align-items: center;
      gap: 7px;
      padding: 8px 12px;
      border-radius: 999px;
      color: #fff;
      background: var(--tyi-purple);
      font-size: 13px;
      font-weight: 900;
      box-shadow: 0 7px 18px rgba(73, 51, 155, .22);
    }

    .tyi-mode-badge.tyi-show { display: flex; }

    .tyi-playfield {
      position: absolute;
      inset: 0;
      overflow: hidden;
    }

    .tyi-finish-line {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 18px;
      z-index: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, #dcebed 18%, #dcebed 82%, transparent);
    }

    .tyi-finish-line::after {
      content: "素数はそのまま通そう";
      position: absolute;
      right: 18px;
      top: 8px;
      color: #96a8ae;
      font-size: 12px;
      font-weight: 800;
    }

    .tyi-number-card {
      position: absolute;
      z-index: 2;
      width: 78px;
      height: 78px;
      display: grid;
      place-items: center;
      border: 0;
      border-radius: 50%;
      color: #fff;
      background: linear-gradient(145deg, var(--orb-a, #1bbaf2), var(--orb-b, #5865f5));
      box-shadow: 0 9px 22px var(--orb-shadow, rgba(45,113,239,.24)), inset 0 1px 2px rgba(255,255,255,.5);
      font-size: 30px;
      font-weight: 900;
      line-height: 1;
      cursor: pointer;
      transform: translate3d(0,0,0);
      will-change: transform;
    }

    .tyi-number-card:hover { filter: brightness(1.04) saturate(1.08); }
    .tyi-number-card:active { filter: brightness(.9) saturate(1.12); }
    .tyi-number-card.tyi-spawn { animation: card-in .24s cubic-bezier(.2,.9,.25,1.3); }
    .tyi-number-card.tyi-splitting {
      pointer-events: none;
      filter: brightness(1.1);
      box-shadow: 0 15px 30px var(--orb-shadow, rgba(45,113,239,.23)), inset 0 2px 3px rgba(255,255,255,.55);
    }
    .tyi-number-card.tyi-wrong { background: linear-gradient(145deg, #ff6e75, #e62f60); box-shadow: 0 10px 23px rgba(216, 44, 82, .25); animation: shake .34s ease; }
    .tyi-number-card.tyi-prime-done { background: linear-gradient(145deg, #36d6ad, #0caa82); box-shadow: 0 10px 23px rgba(5, 120, 88, .2); cursor: default; }

    .tyi-split-burst {
      position: absolute;
      z-index: 7;
      width: 10px;
      height: 10px;
      pointer-events: none;
      transform: translate(-50%, -50%);
    }

    .tyi-split-ring {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 34px;
      height: 34px;
      border: 3px solid var(--burst-color, #24c5e9);
      border-radius: 50%;
      opacity: .52;
      transform: translate(-50%, -50%) scale(.35);
      animation: split-ring .42s cubic-bezier(.12,.72,.22,1) forwards;
    }

    .tyi-split-particle {
      position: absolute;
      left: 50%;
      top: 50%;
      width: var(--particle-size, 7px);
      height: var(--particle-size, 7px);
      border-radius: 50%;
      background: var(--burst-color, #24c5e9);
      box-shadow: 0 0 9px color-mix(in srgb, var(--burst-color, #24c5e9) 45%, transparent);
      animation: split-particle .46s cubic-bezier(.12,.66,.22,1) forwards;
      animation-delay: var(--particle-delay, 0ms);
    }

    @keyframes split-ring {
      to { opacity: 0; transform: translate(-50%, -50%) scale(1.55); }
    }
    @keyframes split-particle {
      0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
      18% { opacity: .82; }
      100% { opacity: 0; transform: translate(calc(-50% + var(--particle-x)), calc(-50% + var(--particle-y))) scale(.2); }
    }

    @keyframes card-in { from { scale: .55; opacity: 0; } to { scale: 1; opacity: 1; } }
    @keyframes shake { 0%,100% { margin-left: 0; } 25% { margin-left: -10px; } 75% { margin-left: 10px; } }

    .tyi-popup {
      position: absolute;
      z-index: 8;
      translate: -50% -50%;
      pointer-events: none;
      color: var(--tyi-blue);
      font-size: 21px;
      font-weight: 900;
      text-shadow: 0 2px 0 #fff, 0 0 8px #fff;
      animation: popup-up .8s ease-out forwards;
      white-space: nowrap;
    }

    .tyi-popup.tyi-error { color: var(--tyi-red); }
    .tyi-popup.tyi-success { color: var(--tyi-green); }
    @keyframes popup-up { 0% { opacity: 0; transform: translateY(10px) scale(.85); } 18% { opacity: 1; } 100% { opacity: 0; transform: translateY(-45px) scale(1.08); } }

    .tyi-flash {
      position: absolute;
      inset: 0;
      z-index: 12;
      pointer-events: none;
      opacity: 0;
      background: rgba(232, 71, 95, .19);
    }
    .tyi-flash.tyi-on { animation: flash .35s ease; }
    @keyframes flash { 0%,100% { opacity: 0; } 35% { opacity: 1; } }

    .tyi-toast {
      position: absolute;
      left: 50%;
      top: 20px;
      z-index: 18;
      max-width: calc(100% - 40px);
      padding: 11px 18px;
      translate: -50% -20px;
      opacity: 0;
      border-radius: 999px;
      color: #fff;
      background: var(--tyi-navy);
      font-weight: 900;
      pointer-events: none;
      transition: .2s ease;
    }
    .tyi-toast.tyi-show { translate: -50% 0; opacity: 1; }

    .tyi-overlay {
      position: absolute;
      inset: 0;
      z-index: 15;
      display: grid;
      place-items: center;
      padding: 22px;
      background: rgba(15,23,42,0.55);
      backdrop-filter: blur(5px);
    }

    .tyi-overlay.tyi-hidden { display: none; }

    .tyi-panel {
      width: min(560px, 100%);
      max-height: 100%;
      overflow: auto;
      padding: clamp(24px, 4vw, 34px);
      border: 0;
      border-radius: 24px;
      background: #fff;
      box-shadow: 0 24px 60px rgba(0,0,0,0.2);
      text-align: center;
      position: relative;
      animation: pop-in .25s cubic-bezier(0.34,1.56,0.64,1);
    }

    .tyi-panel-close {
      position: absolute;
      top: 12px;
      right: 12px;
      width: 36px;
      height: 36px;
      display: grid;
      place-items: center;
      padding: 0;
      border: 0;
      border-radius: 50%;
      color: var(--tyi-muted);
      background: #f3f4f6;
      font-size: 16px;
      font-weight: 900;
      line-height: 1;
      cursor: pointer;
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
      transition: background .15s, color .15s;
    }
    .tyi-panel-close:hover  { background: var(--tyi-line); color: var(--tyi-ink); }
    .tyi-panel-close:active { transform: scale(.94); }

    @keyframes pop-in {
      from { opacity: 0; transform: scale(0.88); }
      to   { opacity: 1; transform: scale(1); }
    }

    .tyi-panel-icon {
      width: 76px;
      height: 76px;
      display: grid;
      place-items: center;
      margin: 0 auto 14px;
      border-radius: 20px;
      color: var(--tyi-blue);
      background: var(--tyi-blue-soft);
      font-size: 34px;
      font-weight: 1000;
      box-shadow: inset 0 -5px 0 rgba(103, 70, 0, .13);
    }

    h1, h2 { margin: 0; color: var(--tyi-navy); line-height: 1.2; }
    h1 { font-size: clamp(28px, 5vw, 42px); }
    h2 { font-size: clamp(25px, 4vw, 36px); }

    .tyi-lead {
      margin: 13px 0 19px;
      color: #4d5c78;
      font-size: clamp(15px, 2vw, 18px);
      font-weight: 700;
      line-height: 1.75;
    }

    /* ===== あそびかたの動くデモ（6秒ループ） ===== */
    .tyi-demo-stage {
      position: relative;
      height: 172px;
      margin: 30px 0 0;
      border: 1px solid var(--tyi-line);
      border-radius: 18px;
      background: linear-gradient(180deg, #ffffff, #f6f8fb);
      overflow: hidden;
    }

    .tyi-demo-finish {
      position: absolute;
      left: 12px; right: 12px;
      bottom: 30px;
      border-top: 3px dashed #cbd5e1;
    }

    .tyi-demo-goal-label {
      position: absolute;
      right: 14px;
      bottom: 8px;
      color: var(--tyi-muted);
      font-size: 11px;
      font-weight: 800;
    }

    .tyi-demo-card {
      position: absolute;
      top: 0;
      left: 50%;
      width: 46px;
      height: 46px;
      display: grid;
      place-items: center;
      margin-left: -23px;
      border-radius: 13px;
      color: #fff;
      font-size: 20px;
      font-weight: 900;
      font-variant-numeric: tabular-nums;
      opacity: 0;
    }

    /* まだ分けられる数（合成数） */
    .tyi-demo-composite {
      background: linear-gradient(145deg, #60a5fa, #2563eb);
      box-shadow: 0 8px 18px rgba(37,99,235,.28);
      animation: demo-composite 6s linear infinite;
    }

    /* 分かれたあとの2つ */
    .tyi-demo-split {
      background: linear-gradient(145deg, #34d399, var(--tyi-green));
      box-shadow: 0 8px 18px rgba(16,185,129,.28);
      width: 40px; height: 40px;
      margin-left: -20px;
      font-size: 18px;
    }
    .tyi-demo-split-a { animation: demo-split-a 6s linear infinite; }
    .tyi-demo-split-b { animation: demo-split-b 6s linear infinite; }

    /* もう分けられない数（素数） */
    .tyi-demo-prime {
      background: linear-gradient(145deg, #fbbf24, #f59e0b);
      box-shadow: 0 8px 18px rgba(245,158,11,.3);
      animation: demo-prime 6s linear infinite;
    }

    /* タップの指マーク */
    .tyi-demo-tap {
      position: absolute;
      top: 0; left: 50%;
      width: 46px; height: 46px;
      margin-left: -23px;
      border: 3px solid var(--tyi-blue);
      border-radius: 50%;
      opacity: 0;
      animation: demo-tap 6s linear infinite;
    }

    /* 素数が通過したときの合図 */
    .tyi-demo-pass {
      position: absolute;
      left: 50%;
      bottom: 4px;
      margin-left: -14px;
      width: 28px; height: 28px;
      display: grid; place-items: center;
      border-radius: 50%;
      color: #fff;
      background: var(--tyi-green);
      font-size: 15px; font-weight: 900;
      opacity: 0;
      animation: demo-pass 6s linear infinite;
    }

    /* 24 が落ちて→タップで消える */
    @keyframes demo-composite {
      0%              { transform: translateY(-52px); opacity: 0; }
      4%              { opacity: 1; }
      30%             { transform: translateY(64px); opacity: 1; }
      34%             { transform: translateY(64px) scale(1.14); opacity: 1; }
      38%, 100%       { transform: translateY(64px) scale(.6); opacity: 0; }
    }

    @keyframes demo-tap {
      0%, 27%   { transform: translateY(64px) scale(.5); opacity: 0; }
      31%       { transform: translateY(64px) scale(1); opacity: 1; }
      40%, 100% { transform: translateY(64px) scale(1.7); opacity: 0; }
    }

    /* 4 と 6 に分かれて左右へ */
    @keyframes demo-split-a {
      0%, 36%   { transform: translate(0, 67px) scale(.6); opacity: 0; }
      42%       { transform: translate(-46px, 74px) scale(1); opacity: 1; }
      50%       { transform: translate(-52px, 92px) scale(1); opacity: 1; }
      56%, 100% { transform: translate(-56px, 104px) scale(.9); opacity: 0; }
    }

    @keyframes demo-split-b {
      0%, 36%   { transform: translate(0, 67px) scale(.6); opacity: 0; }
      42%       { transform: translate(46px, 74px) scale(1); opacity: 1; }
      50%       { transform: translate(52px, 92px) scale(1); opacity: 1; }
      56%, 100% { transform: translate(56px, 104px) scale(.9); opacity: 0; }
    }

    /* 7 はタップせず下まで通す */
    @keyframes demo-prime {
      0%, 58%   { transform: translateY(-52px); opacity: 0; }
      62%       { transform: translateY(-30px); opacity: 1; }
      90%       { transform: translateY(128px); opacity: 1; }
      96%, 100% { transform: translateY(150px); opacity: 0; }
    }

    @keyframes demo-pass {
      0%, 88%   { transform: scale(.4); opacity: 0; }
      92%       { transform: scale(1.1); opacity: 1; }
      99%, 100% { transform: scale(1); opacity: 0; }
    }

    /* デモに同期する2つの説明（重ならないよう高さ固定） */
    .tyi-demo-captions {
      position: relative;
      height: 46px;
      margin: 10px 0 4px;
    }

    .tyi-demo-caption {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      margin: 0;
      padding: 0 8px;
      font-size: 15px;
      font-weight: 900;
      line-height: 1.4;
      opacity: 0;
    }
    .tyi-demo-caption b { font-size: 1.08em; }
    .tyi-demo-caption-1 { color: #1d4ed8; animation: demo-cap-1 6s linear infinite; }
    .tyi-demo-caption-2 { color: #b45309; animation: demo-cap-2 6s linear infinite; }

    @keyframes demo-cap-1 {
      0%        { opacity: 0; }
      6%, 48%   { opacity: 1; }
      54%, 100% { opacity: 0; }
    }
    @keyframes demo-cap-2 {
      0%, 54%   { opacity: 0; }
      60%, 94%  { opacity: 1; }
      99%, 100% { opacity: 0; }
    }

    /* アウト条件だけは1行のテキストで残す */
    .tyi-demo-warning {
      margin: 6px 0 22px;
      padding: 10px 14px;
      border-radius: 14px;
      color: #9c263e;
      background: #ffeaed;
      font-size: 13px;
      font-weight: 800;
      line-height: 1.5;
    }

    .tyi-difficulty-title {
      margin: 0 0 9px;
      color: var(--tyi-navy);
      font-size: 14px;
      font-weight: 900;
    }

    .tyi-difficulty-picker {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin: 0 0 22px;
    }

    /* タッチかけ算のレベルボタンと同じ形式（星｜名前｜説明の3カラム） */
    .tyi-difficulty-button {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 10px;
      min-height: 0;
      padding: 12px 16px;
      border: 2px solid var(--tyi-line);
      border-radius: 14px;
      color: var(--tyi-ink);
      background: #f9fafb;
      text-align: left;
      font-family: inherit;
      font-weight: 900;
      cursor: pointer;
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
      transition: border-color .15s, background .15s, transform .1s;
    }

    .tyi-difficulty-button:hover  { transform: translateY(-1px); }
    .tyi-difficulty-button:active { transform: scale(.98); }

    .tyi-difficulty-button[aria-pressed="true"][data-difficulty="easy"]   { border-color: var(--tyi-green);  background: var(--tyi-green-soft); }
    .tyi-difficulty-button[aria-pressed="true"][data-difficulty="normal"] { border-color: var(--tyi-blue);   background: var(--tyi-blue-soft); }
    .tyi-difficulty-button[aria-pressed="true"][data-difficulty="hard"]   { border-color: var(--tyi-orange); background: var(--tyi-orange-soft); }

    .tyi-difficulty-star  { font-size: 18px; }
    .tyi-difficulty-button strong { display: block; font-size: 16px; }
    .tyi-difficulty-button small  { display: block; color: var(--tyi-muted); font-size: 12px; font-weight: 800; }

    .tyi-main-button {
      appearance: none;
      min-width: 172px;
      min-height: 52px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 9px;
      padding: 13px 36px;
      border: 0;
      border-radius: 999px;
      color: #fff;
      background: linear-gradient(135deg, #34d399, var(--tyi-green));
      box-shadow: 0 8px 20px rgba(16,185,129,0.35);
      font-family: inherit;
      font-weight: 900;
      font-size: clamp(15px, 1.8vw, 18px);
      cursor: pointer;
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
      transition: transform .12s, box-shadow .12s;
    }

    .tyi-main-button:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(16,185,129,0.4); }

    .tyi-main-button:active { transform: scale(.97); }

    /* サブボタン（kbgの kbg-back-btn 相当） */
    .tyi-main-button.tyi-secondary {
      background: #fff;
      color: var(--tyi-ink);
      border: 2px solid var(--tyi-line);
      box-shadow: none;
    }
    .tyi-main-button.tyi-secondary:hover  { transform: translateY(-1px); background: #f9fafb; box-shadow: none; }
    .tyi-main-button.tyi-secondary:active { transform: scale(.97); }
    .tyi-main-button svg { width: 23px; height: 23px; fill: currentColor; }

    .tyi-result-score { margin: 10px 0 18px; color: var(--tyi-blue); font-size: 54px; font-weight: 1000; line-height: 1; }
    .tyi-result-score small { display: block; margin-bottom: 6px; color: var(--tyi-muted); font-size: 13px; }

    .tyi-result-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin: 18px 0 24px;
    }
    .tyi-result-item { padding: 12px 8px; border-radius: 14px; background: #f2f5fc; }
    .tyi-result-item b { display: block; color: var(--tyi-navy); font-size: 23px; }
    .tyi-result-item span { color: var(--tyi-muted); font-size: 11px; font-weight: 800; }

    .tyi-pause-card { width: min(420px, 100%); }

    @media (max-width: 760px) {
      .tyi-app { grid-template-rows: 64px minmax(0, 1fr); }
      .tyi-topbar { grid-template-columns: 1fr auto; padding: 7px 10px; }
      .tyi-brand-mark { width: 40px; height: 40px; }
      .tyi-brand span { font-size: 16px; }
      .tyi-stats { position: absolute; top: 72px; left: 50%; z-index: 22; translate: -50% 0; }
      .tyi-stat {
        min-width: 78px;
        padding: 4px 8px;
        background: rgba(255,255,255,.94);
        box-shadow: 0 5px 18px rgba(44,75,88,.1);
      }
      .tyi-stat-value { font-size: 19px; }
      .tyi-top-actions { grid-column: 2; }
      .tyi-icon-button { min-width: 34px; height: 34px; padding: 0 8px; }
      .tyi-game-shell { padding: 0; }
      .tyi-stage { border-width: 0; border-radius: 0; }
      .tyi-mode-badge { top: 72px; }
      .tyi-number-card { width: 68px; height: 68px; font-size: 26px; }
      .tyi-panel { padding: 22px 17px; }
      .tyi-demo-stage { height: 150px; }
    }

    @media (max-width: 520px) {
      .tyi-brand span { max-width: 110px; white-space: normal; line-height: 1.1; }
      .tyi-top-actions .tyi-label { display: none; }
      .tyi-stats { gap: 4px; width: calc(100% - 32px); }
      .tyi-stat { flex: 1; min-width: 0; }
      .tyi-demo-stage { height: 138px; }
      .tyi-demo-caption { font-size: 13px; }
      .tyi-demo-captions { height: 42px; }
      .tyi-demo-warning { font-size: 12px; padding: 9px 12px; }
      .tyi-difficulty-picker { gap: 5px; margin-bottom: 18px; }
      .tyi-difficulty-button { min-height: 60px; padding-inline: 3px; }
      .tyi-difficulty-button strong { font-size: 14px; }
      .tyi-difficulty-button small { font-size: 10px; }
      .tyi-panel-icon { width: 61px; height: 61px; margin-bottom: 10px; }
      .tyi-lead { line-height: 1.55; }
      .tyi-result-grid { gap: 5px; }
      .tyi-result-item { padding: 10px 4px; }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
      .tyi-split-burst { display: none !important; }

      /* 動きを減らす設定：デモは静止画として全要素を並べて見せる */
      .tyi-demo-card, .tyi-demo-tap, .tyi-demo-pass, .tyi-demo-caption { animation: none !important; opacity: 1 !important; }
      .tyi-demo-composite { transform: translateY(18px) !important; }
      .tyi-demo-tap       { transform: translateY(18px) !important; }
      .tyi-demo-split-a   { transform: translate(-52px, 96px) !important; }
      .tyi-demo-split-b   { transform: translate(52px, 96px) !important; }
      .tyi-demo-prime     { transform: translateY(96px) !important; margin-left: -23px !important; }
      .tyi-demo-pass      { display: none !important; }
      .tyi-demo-captions  { height: auto !important; }
      .tyi-demo-caption   { position: static !important; margin-bottom: 6px !important; }
    }
  
