/* TypeScript と非同期。style.css と flow.css の上に重ねる */
.fhead p a, .srcl a, .ty-go a, .ty-psrc a, .foot p a { color: #1d4ed8; text-underline-offset: 2px; }
.hint { display: inline-block; vertical-align: middle; font-size: 10.5px; font-weight: 700; line-height: 1.5; color: #475569; background: #f8fafc; border: 1px dashed #94a3b8; border-radius: 999px; padding: 0 8px; margin-left: 6px; white-space: nowrap; }
.aitag { font-size: 12px; font-weight: 700; color: #6d28d9; background: #ede9fe; border-radius: 6px; padding: 2px 8px; margin-right: 8px; vertical-align: middle; }
.srcl { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.subh { margin: 22px 0 8px; font-size: 15.5px; display: flex; align-items: baseline; gap: 2px 8px; flex-wrap: wrap; }
.ty-sub { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.ty-go { margin: 6px 0 0; font-size: 12.5px; font-weight: 700; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ty-go a { text-decoration: none; }
.ty-go a:hover { text-decoration: underline; }

/* コード */
.ty-pre { margin: 6px 0 0; background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 9px 12px; font: 500 12.5px/1.6 var(--latin); white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.ty-pre code { font: inherit; }
.ty-lines { padding: 7px 0; }
.ty-l { display: block; padding: 0 12px; }
.ty-l.on { background: rgba(250, 204, 21, .24); }
.ty-l.type { background: rgba(167, 139, 250, .22); }
.ty-l.err { background: rgba(239, 68, 68, .22); text-decoration: underline wavy #f87171; text-underline-offset: 4px; }
.ty-mk { background: rgba(167, 139, 250, .35); color: inherit; border-radius: 3px; padding: 0 1px; }

/* カード */
.ty-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ty-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ty-card { padding: 12px 15px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ty-card h3 { margin: 0; font-size: 14.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.ty-card p { margin: 4px 0 0; font-size: 13px; color: var(--ink2); }
.ty-card .srcl, .ty-card .ty-go { margin-top: auto; padding-top: 6px; }
.ty-card .ty-go + .srcl { margin-top: 0; }
.ty-card.ai { background: #faf8ff; border-color: #dccdfb; }

/* 型が消える・状態を足す */
.ty-erase, .ty-never { padding: 12px 16px; }
.ty-ebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.ty-elabel { font: 600 12.5px var(--latin); color: var(--muted); overflow-wrap: anywhere; }
.ty-btn { appearance: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; cursor: pointer; }
.ty-btn:hover { border-color: #94a3b8; }
.ty-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.ty-btn:disabled { color: #94a3b8; cursor: default; border-style: dashed; }
.ty-enote { margin: 8px 0 0; font-size: 13px; color: var(--ink2); }
.ty-errmsg { margin: 6px 0 0; font: 600 12.5px/1.55 var(--latin); color: #991b1b; background: #fef2f2; border-radius: 8px; padding: 6px 10px; overflow-wrap: anywhere; }
.ty-errmsg span { display: inline-block; font-size: 11px; color: #fff; background: #dc2626; border-radius: 5px; padding: 0 6px; margin-right: 8px; }
.ty-okmsg { margin: 6px 0 0; font: 600 12.5px var(--latin); color: #166534; background: #f0fdf4; border-radius: 8px; padding: 6px 10px; }
.ty-now { margin-top: 10px; padding: 12px 16px; }
.ty-now h3 { margin: 0 0 6px; font-size: 15px; }
.ty-now ul { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; font-size: 13.5px; color: var(--ink2); }
.ty-psrc { font-size: 12px; color: var(--muted); }

/* 選ぶ問題（型を当てる・エラーを読む） */
.ty-quiz, .ty-equiz { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; counter-reset: q; }
.ty-quiz li, .ty-equiz li { counter-increment: q; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.ty-quiz li::before, .ty-equiz li::before { content: 'Q' counter(q); font: 600 12px var(--latin); color: var(--muted); }
.ty-quiz li.ok, .ty-equiz li.ok { border-color: #86efac; background: #f0fdf4; }
.ty-quiz li.ng, .ty-equiz li.ng { border-color: #fca5a5; background: #fef2f2; }
.ty-quiz1 { grid-template-columns: minmax(0, 1fr); }
.ty-quiz1 li::before { content: none; }
.ty-ask { margin: 8px 0 0; font-size: 13.5px; font-weight: 700; }
.ty-ch { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ty-ch button { appearance: none; font: 600 12.5px var(--latin); color: var(--ink); background: var(--paper); border: 1px solid #cbd5e1; border-radius: 999px; padding: 5px 13px; cursor: pointer; text-align: left; max-width: 100%; overflow-wrap: anywhere; }
.ty-ch button:hover { border-color: #64748b; }
.ty-ch button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.ty-why { margin-top: 8px; font-size: 13px; color: var(--ink2); }
.ty-why b { color: var(--ink); }
.ty-why p { margin: 4px 0 0; }
.ty-rb { display: inline-block; font-size: 11.5px; color: #166534 !important; background: #dcfce7; border-radius: 6px; padding: 0 6px; margin-right: 6px; }
.ty-score { margin: 10px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ty-score:empty { display: none; }
.ty-score b { font-family: var(--latin); font-size: 18px; color: #0f766e; }

/* 順番当て */
.ty-loop { margin: 0 0 10px; font-size: 13px; color: var(--ink2); background: var(--line2); border-radius: 10px; padding: 8px 12px; max-width: 64em; }
.ty-loop .srcl { display: inline; margin: 0; }
.ty-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ty-tabs button { appearance: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--ink2); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.ty-tabs button:hover { border-color: #94a3b8; color: var(--ink); }
.ty-tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.ty-panel { padding: 12px 16px; }
.ty-ocols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ty-ocode .ty-pre { margin-top: 0; }
.ty-oans .ty-ask { margin-top: 0; }
.ty-logs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ty-log { appearance: none; font: 600 13px var(--latin); color: var(--ink); background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.ty-log:hover { border-color: #f59e0b; }
.ty-log:disabled { background: var(--line2); border-color: var(--line); color: #94a3b8; cursor: default; }
.ty-picked { margin: 10px 0 0; font-size: 13.5px; color: var(--ink2); }
.ty-picked b { font-family: var(--latin); color: var(--ink); }
.ty-obtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ty-verdict { margin: 10px 0 0; font-size: 13.5px; border-radius: 10px; padding: 7px 11px; }
.ty-verdict.ok { background: #f0fdf4; color: #14532d; }
.ty-verdict.ng { background: #fef2f2; color: #7f1d1d; }
.ty-verdict:not(.ok):not(.ng) { background: var(--line2); color: var(--ink2); }
.ty-verdict b { font-family: var(--latin); }
.ty-step { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ty-sbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ty-sbar > b { font-size: 14px; }
.ty-scount { font: 600 13px var(--latin); color: var(--muted); margin-right: auto; }
.ty-boxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.ty-box { border-radius: 10px; padding: 8px 10px; min-width: 0; border: 1px solid var(--line); background: var(--paper); }
.ty-box > b { display: block; font-size: 12px; margin-bottom: 4px; }
.ty-box ol { margin: 0; padding-left: 1.9em; font: 500 12.5px/1.55 var(--latin); overflow-wrap: anywhere; }
.ty-bx-stack { background: #eff6ff; border-color: #bfdbfe; }
.ty-bx-stack > b { color: #1d4ed8; }
.ty-bx-stack ol { list-style: none; padding-left: 0; }
.ty-bx-micro { background: #f5f3ff; border-color: #ddd6fe; }
.ty-bx-micro > b { color: #6d28d9; }
.ty-bx-task { background: #fff7ed; border-color: #fed7aa; }
.ty-bx-task > b { color: #c2410c; }
.ty-bx-out { background: #0f172a; border-color: #0f172a; color: #e2e8f0; }
.ty-bx-out > b { color: #94a3b8; }
.ty-empty { margin: 0; font-size: 12px; color: var(--muted); }
.ty-bx-out .ty-empty { color: #64748b; }
.ty-snote { margin: 8px 0 0; font-size: 13.5px; color: var(--ink2); }
.ty-lesson { margin: 8px 0 0; font-size: 13.5px; background: #f0fdf4; color: #14532d; border-radius: 10px; padding: 7px 11px; }
.ty-lesson b { display: inline-block; font-size: 11.5px; background: #166534; color: #fff; border-radius: 6px; padding: 0 7px; margin-right: 8px; }
.ty-allq { margin-top: 10px; padding: 12px 16px; }
.ty-allq h3 { margin: 0 0 6px; font-size: 14.5px; }
.ty-allq .ty-quiz li { border: 0; padding: 0; background: transparent; }

/* Laravel → JSON → TypeScript */
.ty-map { padding: 12px 16px; }
.ty-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.ty-pill { appearance: none; font: 600 12.5px var(--latin); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.ty-pill:hover { border-color: #94a3b8; }
.ty-pill[aria-pressed="true"] { background: #facc15; border-color: #eab308; color: #422006; }
.ty-panes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.ty-pane { min-width: 0; }
.ty-ph { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 13px; }
.ty-ph span { font: 500 11.5px var(--latin); color: var(--muted); overflow-wrap: anywhere; }
.ty-fnote { margin-top: 10px; background: #fffbeb; border-radius: 10px; padding: 9px 13px; }
.ty-fnote h3 { margin: 0; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.ty-fnote p { margin: 4px 0 0; font-size: 13px; color: var(--ink2); }
.ty-panenote { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.ty-codes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.ty-cc2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ty-cc2 > div { min-width: 0; }
.ty-ccard { padding: 12px 15px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ty-ccard h3 { margin: 0; font-size: 14.5px; }
.ty-ccard p { margin: 4px 0 0; font-size: 13px; color: var(--ink2); }
.ty-ccard .ty-go { margin-top: auto; padding-top: 6px; }
.ty-sublabel { font-size: 12px !important; font-weight: 700; color: var(--muted) !important; margin-top: 8px !important; }
.ty-apinote { margin: 10px 0 0; font-size: 13px; color: var(--ink2); max-width: 64em; }
.ty-apinote p { margin: 0; }

/* エラーの文の部分 */
.ty-anat { padding: 12px 16px; }
.ty-term { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 10px 12px; font: 500 12.5px/1.7 var(--latin); overflow-wrap: anywhere; }
.ty-term p { margin: 0; white-space: pre-wrap; }
.ty-tcode { color: #cbd5e1; }
.ty-trel { margin-top: 6px !important; color: #94a3b8; }
.ty-part { appearance: none; font: inherit; color: #fde68a; background: transparent; border: 0; border-bottom: 1px dashed #fbbf24; border-radius: 3px; padding: 0 2px; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.ty-part:hover { background: rgba(251, 191, 36, .16); }
.ty-part[aria-pressed="true"] { background: #fbbf24; color: #0f172a; }
.ty-part[data-p="wave"] { color: #f87171; border-bottom-color: #f87171; }
.ty-anote { margin: 8px 0 0; font-size: 13px; color: var(--ink2); }
.ty-anote b { font-family: var(--latin); color: var(--ink); margin-right: 6px; overflow-wrap: anywhere; }
.ty-dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.ty-dl div { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; min-width: 0; }
.ty-dl dt { font: 600 12.5px/1.5 var(--latin); overflow-wrap: anywhere; }
.ty-dl dd { margin: 2px 0 0; font-size: 13px; color: var(--ink2); }

/* チェックリスト */
.cklist { padding: 10px 16px; }
.ckgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 22px; }
.ckgrid h3 { margin: 4px 0 4px; font-size: 14.5px; }
.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.mlist label { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; cursor: pointer; padding: 5px 0; }
.mlist input { flex: none; width: 17px; height: 17px; margin: 2px 0 0; accent-color: #0d9488; cursor: pointer; }
.mlist input:checked + span { color: var(--muted); text-decoration: line-through; }
.ckfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.ckcount { font-family: var(--latin); font-size: 13px; color: var(--muted); }
.ckreset { appearance: none; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink2); cursor: pointer; }

.ty-btn:focus-visible, .ty-ch button:focus-visible, .ty-tabs button:focus-visible, .ty-log:focus-visible, .ty-pill:focus-visible, .ty-part:focus-visible, .ty-go a:focus-visible, .srcl a:focus-visible, .ty-psrc a:focus-visible, .mlist input:focus-visible, .ckreset:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

@media (max-width: 1100px) {
  .ty-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ty-cc2 { grid-template-columns: minmax(0, 1fr); }
  .ty-panes { grid-template-columns: minmax(0, 1fr); }
  .ty-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .ty-grid, .ty-quiz, .ty-equiz, .ty-ocols, .ty-dl, .ckgrid { grid-template-columns: minmax(0, 1fr); }
  .ty-pre { font-size: 12px; }
}
