/* ko-kobun（古文・漢文）。字は Klee One（国語ページで よみこむ）→ 教科書体 → 丸ゴシック。
   色：正かい＝みどり・まちがい＝赤・かわった 字＝オレンジ・読んで いる 字＝きいろく 光る。字は 16px 以上 */
.kbn { --kf: "Klee One", "UD Digi Kyokasho NK-R", "UD デジタル 教科書体 NK-R", "UD Digi Kyokasho N-R", "UD デジタル 教科書体 N-R", "YuKyokasho", "游教科書体", "HGKyokashotai", "HG教科書体", "Hiragino Maru Gothic ProN", "ヒラギノ丸ゴ ProN", "Zen Maru Gothic", "M PLUS Rounded 1c", "BIZ UDGothic", "Noto Sans JP", sans-serif;
  --o: #f59e0b; --od: #b45309; --ok: #10b981; --okd: #047857; --ng: #ef4444; --ngd: #b91c1c; --s: #2563eb; --sl: #e8f0ff;
  --paper: #fffdf5; --line: #e7dcc0; --lit: #fde68a;
  --fs: 1.3rem; font-size: 1.05rem; position: relative; color: var(--ink, #1f2937); }
.kbn.kbn-big { --fs: 1.55rem; }
.kbn [hidden] { display: none !important; }
.kbn button { font-family: inherit; -webkit-tap-highlight-color: transparent; color: inherit; }
.kbn ruby, .kbn .kbn-q, .kbn .kbn-kline, .kbn .kbn-ntx, .kbn .kbn-card, .kbn .kbn-tate, .kbn .kbn-kd, .kbn .kbn-yf, .kbn .kbn-tori, .kbn .kbn-ttl, .kbn .kbn-rules { font-family: var(--kf); }
.kbn rt { font-size: .5em; font-weight: 500; font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; }
.kbn svg { display: block; }

/* 問い */
.kbn-qbox { display: flex; gap: 8px; align-items: flex-start; background: linear-gradient(180deg, #fff8e6, #fffdf6); border: 2px solid var(--o); border-radius: 16px; padding: 8px 8px 8px 14px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(245, 158, 11, .12); }
.kbn-q { flex: 1; margin: 0; font-weight: 600; font-size: 1.12rem; line-height: 1.8; }
.kbn-qs { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2px solid #bfdbfe; background: #fff; color: var(--s) !important; padding: 7px; cursor: pointer; }
.kbn-qs svg { width: 100%; height: 100%; }
.kbn-dots { display: flex; justify-content: center; gap: 6px; margin: -2px 0 8px; }
.kbn-dots:empty { display: none; }
.kbn-dots i { font-style: normal; width: 24px; height: 24px; line-height: 24px; border-radius: 50%; background: #e5e7eb; color: #6b7280; font-size: .78rem; font-weight: 800; text-align: center; transition: all .2s; }
.kbn-dots i.on { background: var(--o); color: #fff; transform: scale(1.12); }
.kbn-dots i.ok { background: var(--ok); color: #fff; }
.kbn-note { color: #6b7280; }
.kbn-nl { display: inline-block; padding: 0 10px; border-radius: 999px; background: #475569; color: #fff; font-size: .8rem; font-weight: 700; font-family: sans-serif; margin-bottom: 4px; }

/* よそう */
.kbn-guess { background: #fff; border: 2px dashed var(--o); border-radius: 16px; padding: 8px 12px 10px; margin-bottom: 12px; }
.kbn-gq { margin: 0 0 8px; font-weight: 700; line-height: 1.7; }
.kbn-gt { display: inline-block; margin-right: 8px; padding: 0 10px; border-radius: 999px; background: var(--o); color: #fff; font-size: .85rem; vertical-align: .1em; }
.kbn-gb { display: flex; flex-wrap: wrap; gap: 8px; }
.kbn-g { min-height: 50px; min-width: 64px; padding: 4px 16px; border: 2px solid #cbd5e1; background: #fff; border-radius: 12px; font-weight: 700; font-size: 1.05rem; cursor: pointer; box-shadow: 0 2px 0 #cbd5e1; }
.kbn-g:disabled { opacity: .5; cursor: default; }
.kbn-g.ok { opacity: 1; background: #d1fae5; border-color: var(--ok); }
.kbn-g.ng { opacity: 1; background: #fee2e2; border-color: var(--ng); }
.kbn-gr { margin: 8px 0 0; font-weight: 700; color: var(--od); }
.kbn-gr.fin { color: var(--okd); }
.kbn-gok { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; background: var(--ok); color: #fff; font-size: .85rem; }
.kbn-body.kbn-wait { opacity: .35; pointer-events: none; filter: grayscale(.4); }
.kbn-body.kbn-in, .kbn-yf.kbn-in { animation: kbn-in .35s ease-out; }

/* 光る 字（読み上げ） */
.kbn-ch { border-radius: 4px; transition: background .15s, color .15s; }
.kbn-ch.kbn-lit { background: linear-gradient(transparent 55%, var(--lit) 55%); }
.kbn-ch.kbn-now { background: #fbbf24; color: #78350f; box-shadow: 0 0 0 2px #fbbf24; }

/* kana */
.kbn-rules { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin: 0 0 10px; padding: 8px 12px; border-radius: 14px; background: #f8fafc; border: 2px solid #e2e8f0; font-size: .95rem; line-height: 1.7; }
.kbn-rules span { display: block; width: 100%; }
.kbn-rt { padding: 0 10px; border-radius: 999px; background: var(--s); color: #fff; font-size: .8rem; font-family: sans-serif; }
.kbn-kbox { background: var(--paper); border: 2px solid var(--line); border-radius: 18px; padding: 16px 10px 12px; text-align: center; }
.kbn-kline { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 6px 16px; font-size: var(--fs); line-height: 1.6; }
.kbn-wd { display: inline-flex; flex-wrap: wrap; justify-content: center; max-width: 100%; align-items: flex-end; gap: 2px; }
.kbn-kc { position: relative; min-width: 40px; min-height: 52px; padding: 2px 4px; border: 2px solid transparent; background: transparent; border-radius: 10px; font-size: var(--fs); font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.kbn-kc:hover { background: #fff7e0; }
.kbn-kc:active { transform: translateY(1px); }
.kbn-kp { font-size: var(--fs); padding: 0 2px; align-self: flex-end; }
.kbn-kc.kbn-chg { border-color: var(--o); background: #fff1d6; color: #9a3412; animation: kbn-pop .35s; }
.kbn-kc.kbn-chg .kbn-kt { color: #c2410c; }
.kbn-old { font-size: .55em; color: #9ca3af; text-decoration: line-through; text-decoration-color: var(--ng); text-decoration-thickness: 2px; line-height: 1; }
.kbn-kc.kbn-miss { border-color: var(--ng); background: #fff1f2; }
.kbn-hint .kbn-tg:not(.kbn-chg) { animation: kbn-blink 1s ease-in-out infinite; }
.kbn-left { margin-top: 8px; font-weight: 700; color: #64748b; }
.kbn-left b { color: var(--od); font-size: 1.2em; }
.kbn-okt { color: var(--okd); }
.kbn-now-line { margin-top: 12px; padding: 10px; border-top: 2px dashed var(--line); }
.kbn-ntx { font-size: var(--fs); line-height: 1.9; font-weight: 600; }
.kbn-ntx .kbn-chg2 { color: #c2410c; background: linear-gradient(transparent 60%, #fed7aa 60%); }

/* pair */
.kbn-ttl { text-align: center; font-weight: 700; font-size: 1.1rem; margin: 0 0 6px; color: #7c2d12; }
.kbn-bar, .kbn-ybar { display: flex; justify-content: center; margin: 0 0 10px; }
.kbn-pwrap { position: relative; display: grid; grid-template-columns: 1fr 1fr; column-gap: 30px; row-gap: 6px; align-items: start; }
.kbn-ph { text-align: center; font-size: .85rem; font-weight: 700; color: #64748b; font-family: sans-serif; }
.kbn-col { display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 2; }
.kbn-card { position: relative; width: 100%; text-align: left; padding: 10px 10px 10px 12px; border: 2px solid #d9d2bf; border-radius: 14px; background: linear-gradient(180deg, #fff 0%, #fffdf7 60%, #f8f3e6 100%); box-shadow: 0 3px 0 #e3dbc6, 0 5px 10px rgba(80, 60, 20, .08); font-size: 1.08rem; line-height: 1.85; font-weight: 600; cursor: pointer; transition: transform .15s, border-color .15s, background .2s; }
.kbn-card.kbn-o { padding-bottom: 34px; background: linear-gradient(180deg, #fffaf0, #fdf3dc); border-color: #e2cf9f; }
.kbn-card.kbn-m { font-size: 1rem; line-height: 1.75; }
.kbn-card:active { transform: translateY(2px); }
.kbn-card.kbn-sel { border-color: var(--o); background: linear-gradient(180deg, #fffaf0, #ffefc9); transform: translateY(-3px); box-shadow: 0 0 0 4px rgba(245, 158, 11, .3), 0 8px 14px rgba(180, 83, 9, .2); }
.kbn-card.kbn-ok { border-color: var(--pc, var(--ok)); background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc, #10b981) 22%, transparent); cursor: default; }
.kbn-card.kbn-ok::before { content: attr(data-n); position: absolute; top: -10px; left: -8px; width: 24px; height: 24px; line-height: 24px; border-radius: 50%; background: var(--pc, var(--ok)); color: #fff; font-size: .85rem; text-align: center; font-family: sans-serif; }
.kbn-card.kbn-ng { border-color: var(--ng); background: #fff1f2; }
.kbn-mini { position: absolute; right: 6px; bottom: 5px; width: 30px; height: 30px; padding: 5px; border-radius: 50%; border: 2px solid #bfdbfe; background: #fff; color: var(--s); box-sizing: border-box; }
.kbn-mini svg { width: 100%; height: 100%; }
.kbn-wire { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 1; }
.kbn-wp { fill: none; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 400; stroke-dashoffset: 400; animation: kbn-draw .5s ease-out forwards; }
.kbn-hl { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; background: var(--o); color: #fff; font-size: .85rem; }

/* kaeri（たて書きの 漢文） */
.kbn-kbx { display: flex; gap: 12px; align-items: flex-start; justify-content: center; }
.kbn-tate { flex: none; display: flex; flex-direction: column; align-items: center; padding: 14px 8px; border-radius: 16px; background: var(--paper); border: 2px solid var(--line); box-shadow: inset 0 0 0 4px #fff; }
.kbn-cell { position: relative; width: 92px; height: 62px; padding: 0; border: 2px solid transparent; border-radius: 12px; background: transparent; cursor: pointer; transition: background .15s, border-color .15s; }
.kbn-cell:hover { background: #fff7e0; }
.kbn-tc { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%); font-size: 2.1rem; font-weight: 600; line-height: 1; }
.kbn-to { position: absolute; left: calc(50% + 21px); top: 24px; writing-mode: vertical-rl; white-space: nowrap; z-index: 3; pointer-events: none; font-size: .78rem; line-height: 1; letter-spacing: -.05em; color: #334155; font-weight: 700; }
.kbn-tk { pointer-events: none; position: absolute; right: calc(50% + 19px); top: 32px; writing-mode: vertical-rl; font-size: .95rem; line-height: 1; color: #b91c1c; font-weight: 800; }
.kbn-tn { position: absolute; left: 2px; top: 2px; width: 24px; height: 24px; line-height: 24px; border-radius: 50%; font-size: .85rem; font-weight: 800; font-family: sans-serif; text-align: center; }
.kbn-tn:empty { display: none; }
.kbn-cell.kbn-ok { background: #ecfdf5; border-color: #a7f3d0; cursor: default; }
.kbn-cell.kbn-ok .kbn-tn { background: var(--ok); color: #fff; animation: kbn-pop .35s; }
.kbn-cell.kbn-ng { border-color: var(--ng); background: #fff1f2; }
.kbn-cell.kbn-x .kbn-tc { color: #b8b8b8; }
.kbn-cell.kbn-blink { animation: kbn-blink 1s ease-in-out infinite; }
.kbn-tp { height: 22px; width: 92px; position: relative; font-size: 1.3rem; line-height: 1; }
.kbn-tp { text-indent: 54px; margin-top: -10px; }
.kbn-kside { flex: 1; min-width: 0; max-width: 300px; display: flex; flex-direction: column; gap: 10px; }
.kbn-key { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; line-height: 1.5; padding: 8px 10px; border-radius: 12px; background: #f8fafc; border: 2px solid #e2e8f0; }
.kbn-key b { display: inline-block; min-width: 2.2em; margin-right: 6px; color: #b91c1c; font-size: 1.05rem; }
.kbn-key b.kbn-xk { color: #b8b8b8; }
.kbn-kd { padding: 8px 10px; border-radius: 12px; background: #fff; border: 2px dashed var(--line); min-height: 80px; }
.kbn-kdt { display: flex; flex-wrap: wrap; gap: 4px; font-size: 1.35rem; font-weight: 600; }
.kbn-kw { padding: 0 4px; border-radius: 6px; background: #ecfdf5; animation: kbn-pop .3s; }
.kbn-kw small { font-size: .7em; color: #047857; }
.kbn-kdl { font-size: 1.3rem; line-height: 2; font-weight: 600; }

/* awase（かるた） */
.kbn-yf { padding: 12px 12px 4px; border-radius: 18px; background: linear-gradient(180deg, #fffaf0, #fdf1d6); border: 2px solid #e2cf9f; margin-bottom: 12px; text-align: center; }
.kbn-yh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.kbn-yl { padding: 0 10px; border-radius: 999px; background: #9a3412; color: #fff; font-size: .8rem; font-weight: 700; font-family: sans-serif; }
.kbn-who { font-size: .9rem; color: #7c2d12; }
.kbn-ytx { font-size: 1.3rem; line-height: 2; font-weight: 600; }
.kbn-ys { font-size: 1.3rem; line-height: 2; font-weight: 600; color: #047857; }
.kbn-yq { color: #cbd5e1; letter-spacing: .3em; }
.kbn-ybar { margin: 6px 0 4px; }
.kbn-mora { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 6px 0 8px; font-size: .9rem; }
.kbn-ml { padding: 0 8px; border-radius: 999px; background: #475569; color: #fff; font-size: .75rem; font-family: sans-serif; }
.kbn-ku { padding: 2px 6px; border-radius: 8px; background: #fff; border: 1px solid #e2cf9f; font-family: var(--kf); }
.kbn-ku i { font-style: normal; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: var(--o); color: #fff; font-size: .78rem; font-family: sans-serif; }
.kbn-field { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 12px 6px; border-radius: 16px; background: #f1f5e9; border: 2px solid #d9e4c4; }
.kbn-tori { width: 62px; height: 178px; padding: 8px 4px; border: 3px solid #4d7c0f; border-radius: 6px; background: #fffef8; box-shadow: 0 3px 0 #3f6212, 0 6px 10px rgba(0, 0, 0, .12); cursor: pointer; transition: transform .2s, opacity .3s; display: flex; justify-content: center; }
.kbn-tt { writing-mode: vertical-rl; font-size: 1.05rem; line-height: 1.5; letter-spacing: .02em; font-weight: 600; text-align: start; }
.kbn-tori:active { transform: translateY(2px); }
.kbn-tori.kbn-ng { border-color: var(--ng); background: #fff1f2; }
.kbn-tori.kbn-take { opacity: .25; transform: translateY(-8px) rotate(-6deg); cursor: default; border-color: var(--ok); }
.kbn-tori.kbn-blink { animation: kbn-blink 1s ease-in-out infinite; }

/* ひとこと・ボタン */
.kbn-msg { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; padding: 10px 14px; border-radius: 14px; font-weight: 700; line-height: 1.7; position: relative; }
.kbn-msg::before { content: ""; position: absolute; top: -9px; left: 26px; border: 9px solid transparent; border-top: 0; }
.kbn-msg.ok { background: #ecfdf5; border: 2px solid var(--ok); color: #065f46; } .kbn-msg.ok::before { border-bottom-color: var(--ok); }
.kbn-msg.ng { background: #fff1f2; border: 2px solid var(--ng); color: #9f1239; } .kbn-msg.ng::before { border-bottom-color: var(--ng); }
.kbn-msg.info { background: #eef4ff; border: 2px solid #93b4f0; color: #1e3a8a; } .kbn-msg.info::before { border-bottom-color: #93b4f0; }
.kbn-mi { flex: none; width: 26px; height: 26px; margin-top: 3px; }
.kbn-mi svg { width: 100%; height: 100%; }
.kbn-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 4px; }
.kbn-acts:empty { display: none; }
.kbn-go { min-height: 52px; padding: 6px 24px; border: 0; border-radius: 14px; background: var(--teal-d, #0f8a72); color: #fff !important; font-weight: 700; font-size: 1.1rem; cursor: pointer; box-shadow: 0 3px 0 #0a6553; }
.kbn-go:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a6553; }
.kbn-b { display: inline-flex; align-items: center; gap: 6px; min-height: 50px; padding: 4px 16px; border: 2px solid var(--ink, #1f2937); background: #fff; border-radius: 14px; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.kbn-b svg { width: 22px; height: 22px; }
.kbn-spk { border-color: var(--s); color: var(--s) !important; }
.kbn-shk { animation: kbn-shake .3s 1; }

@media (max-width: 480px) {
  .kbn { --fs: 1.2rem; }
  .kbn-pwrap { column-gap: 22px; }
  .kbn-card { padding: 8px 8px 8px 10px; font-size: 1rem; }
  .kbn-card.kbn-m { font-size: .95rem; }
  .kbn-kc { min-width: 34px; }
  .kbn-cell, .kbn-tp { width: 84px; }
  .kbn-tp { text-indent: 50px; }
  .kbn-tori { width: 52px; height: 170px; padding: 6px 2px; }
  .kbn-tt { font-size: 1rem; line-height: 1.45; }
  .kbn-field { gap: 6px; padding: 10px 2px; }
}
@keyframes kbn-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes kbn-pop { from { transform: scale(.85); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes kbn-blink { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); background-color: transparent; } 50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, .45); background-color: #fff3c4; } }
@keyframes kbn-draw { to { stroke-dashoffset: 0; } }
@keyframes kbn-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .kbn *, .kbn-msg { animation: none !important; transition: none !important; } .kbn-wp { stroke-dashoffset: 0; } }
