/* IT用語クイズ（quiz.js）。PC は 1600x900 の舞台を画面に合わせて拡縮、スマホ（body.phone）は縦の配置 */
#quiz { position: fixed; inset: 0; z-index: 70; overflow: hidden; color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(1100px 700px at 72% 8%, rgba(40, 110, 255, .22), transparent 60%), radial-gradient(900px 600px at 8% 92%, rgba(30, 160, 255, .14), transparent 60%), linear-gradient(180deg, #071533 0%, var(--bg) 100%); }
#quiz * { box-sizing: border-box; }
.qz-stage { position: absolute; left: 50%; top: 50%; width: 1600px; height: 900px; transform: translate(-50%, -50%) scale(var(--qs, 1)); display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 26px 210px; }

.qz-top { width: 100%; display: flex; align-items: center; gap: 16px; margin-bottom: auto; }
.qz-mode { padding: 8px 18px; border-radius: 999px; background: linear-gradient(180deg, #ffcf5c, #ff9d2e); color: #2a1600; font: 800 20px/1 var(--f-ui); box-shadow: 0 0 16px rgba(255, 180, 70, .5); white-space: nowrap; }
.qz-prog { flex: 1; display: flex; gap: 6px; }
.qz-prog i { width: 28px; height: 10px; border-radius: 99px; background: #1b2a55; }
.qz-prog i.ok { background: #5cf0b0; box-shadow: 0 0 8px rgba(92, 240, 176, .6); }
.qz-prog i.ng { background: #ff5a7a; }
.qz-prog i.now { background: var(--gold); box-shadow: 0 0 8px rgba(255, 211, 107, .7); }
.qz-score { display: flex; align-items: baseline; gap: 10px; padding: 10px 20px; }
.qz-score .lbl, .qz-combo .lbl { font: 700 14px/1 var(--f-num); letter-spacing: .14em; color: var(--label); }
.qz-score b { font: 700 36px/1 var(--f-num); color: #fff; font-variant-numeric: tabular-nums; }
.qz-quit { padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--edge); background: rgba(10, 20, 50, .7); color: #b9cdf2; font: 800 15px/1 var(--f-ui); cursor: pointer; }

/* 問題パネル */
.qz-qp { position: relative; width: 100%; height: 360px; overflow: hidden; }
.qz-qhead { display: flex; align-items: center; justify-content: space-between; padding: 14px 26px; background: linear-gradient(90deg, rgba(47, 114, 230, .55), rgba(47, 114, 230, .15)); border-bottom: 1.5px solid var(--edge-soft); }
.qz-qno { font: 400 34px/1 var(--f-impact); color: #fff; text-shadow: 0 0 12px rgba(70, 190, 255, .7); }
.qz-qno small { font: 700 20px/1 var(--f-num); color: var(--label); margin-left: 6px; }
.qz-chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--edge-soft); background: rgba(70, 214, 255, .1); color: var(--cyan-hi); font: 800 16px/1 var(--f-ui); }
.qz-qtext { display: flex; flex-direction: column; justify-content: center; height: calc(100% - 64px); margin: 0; padding: 30px 50px; font: 800 44px/1.55 var(--f-ui); color: #fff; text-align: center; text-wrap: balance; word-break: auto-phrase; transition: opacity .2s; }
.qz-ask { display: block; margin-top: 10px; font-size: 26px; color: var(--cyan-hi); transition: opacity .2s; }
#quiz.answered .qz-qtext { opacity: 0; }

/* 解答欄 */
.qz-ans { display: flex; align-items: center; gap: 22px; }
.qz-timer { position: relative; width: 108px; height: 108px; flex: none; }
.qz-timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.qz-timer .bg { fill: rgba(5, 16, 44, .9); stroke: #1b2a55; stroke-width: 10; }
.qz-timer .fg { fill: none; stroke: var(--cyan); stroke-width: 10; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--cyan)); }
.qz-timer b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 34px/1 var(--f-num); color: #fff; font-variant-numeric: tabular-nums; }
#quiz.danger .qz-timer .fg { stroke: #ff4f6a; filter: drop-shadow(0 0 8px #ff4f6a); }
#quiz.danger .qz-timer b { color: #ff8aa0; }
.qz-boxes { display: flex; gap: 10px; --n: 6; }
.qz-boxes span { width: min(92px, calc((1040px - (var(--n) - 1) * 10px) / var(--n))); height: 104px; display: grid; place-items: center; border-radius: 14px; border: 2.5px solid var(--edge); background: rgba(5, 16, 44, .9);
  font: 800 min(58px, calc(560px / var(--n))) / 1 var(--f-ui); color: #fff; box-shadow: inset 0 0 14px rgba(70, 150, 255, .15); }
.qz-boxes span small { font: 700 22px/1 var(--f-code); color: #ffd3f0; }
.qz-boxes span.fill { border-color: var(--cyan); color: var(--cyan-hi); text-shadow: 0 0 12px rgba(70, 214, 255, .6); }
.qz-boxes span.cur { border-color: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .22), 0 0 18px rgba(70, 214, 255, .6); }
.qz-boxes span.cur:empty::after { content: ""; width: 4px; height: 50%; background: #fff; animation: caret 1s steps(1) infinite; }
.qz-boxes span.good { border-color: #5cf0b0; color: #b9ffe0; text-shadow: 0 0 12px rgba(92, 240, 176, .7); box-shadow: 0 0 16px rgba(92, 240, 176, .45); animation: qzGood .4s ease-out both; }
.qz-boxes span.good:nth-child(2) { animation-delay: .05s; } .qz-boxes span.good:nth-child(3) { animation-delay: .1s; } .qz-boxes span.good:nth-child(4) { animation-delay: .15s; } .qz-boxes span.good:nth-child(5) { animation-delay: .2s; } .qz-boxes span.good:nth-child(n+6) { animation-delay: .25s; }
.qz-boxes span.reveal { border-color: #ff8aa0; color: #ffe1e8; }
.qz-boxes.bad span { animation: qzBad .35s; }
@keyframes qzGood { 50% { transform: scale(1.18); } }
@keyframes qzBad { 0% { border-color: #ff5a7a; background: rgba(255, 90, 122, .4); } 25% { translate: -6px 0; } 50% { translate: 5px 0; } 75% { translate: -3px 0; } 100% { translate: 0 0; } }
#quiz.shake .qz-qp { animation: eshake .35s; }

.qz-ctrl { display: flex; align-items: center; gap: 14px; margin-bottom: auto; font: 700 18px/1 var(--f-ui); color: var(--muted); }
.qz-btn { padding: 9px 22px; border-radius: 999px; border: 1.5px solid var(--edge); background: rgba(10, 20, 50, .7); color: #dfe9ff; font: 800 18px/1 var(--f-ui); cursor: pointer; }
.qz-btn.ok { border-color: var(--cyan); background: linear-gradient(180deg, #2f8bff, #1a5ee0); color: #fff; }
#quiz.answered .qz-ctrl { visibility: hidden; }

/* 正解・不正解と解説（問題パネルの中に出す） */
.qz-stamp { position: absolute; left: 50%; top: 40%; translate: -50% -50%; text-align: center; white-space: nowrap; pointer-events: none; opacity: 0; }
.qz-stamp b { display: block; font: 400 120px/1 var(--f-impact); color: #fff; letter-spacing: .16em; -webkit-text-stroke: 10px #0b3a9c; paint-order: stroke fill; text-shadow: 0 0 36px rgba(70, 214, 255, .9); }
.qz-stamp span { display: inline-block; margin-top: 4px; padding: 4px 22px; transform: skewX(-12deg); background: linear-gradient(90deg, #ffcf5c, #ff9d2e); color: #2a1600; font: 400 30px/1.2 var(--f-impact); letter-spacing: .1em; }
.qz-stamp small { display: block; margin-top: 6px; font: 700 32px/1 var(--f-num); color: var(--gold); -webkit-text-stroke: 6px #4a2a00; paint-order: stroke fill; }
#quiz.ng .qz-stamp b { font-size: 90px; -webkit-text-stroke-color: #6a0f2a; text-shadow: 0 0 30px rgba(255, 90, 122, .8); }
#quiz.ng .qz-stamp span { background: linear-gradient(90deg, #ff8aa0, #ff5a7a); color: #fff; }
.qz-stamp.show { animation: qzStamp .9s ease-out forwards; }
@keyframes qzStamp { 0% { opacity: 0; scale: 2.2; } 25% { opacity: 1; scale: .95; } 35% { scale: 1; } 70% { opacity: 1; top: 40%; scale: 1; } 100% { opacity: 1; top: 24%; scale: .6; } }
.qz-exp { position: absolute; left: 24px; right: 24px; bottom: 20px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 24px; align-items: center; padding: 14px 20px; border-radius: 12px; background: rgba(5, 16, 44, .85); border: 1.5px solid var(--edge-soft); opacity: 0; transform: translateY(20px); transition: opacity .3s .55s, transform .3s .55s; pointer-events: none; }
#quiz.answered .qz-exp { opacity: 1; transform: none; pointer-events: auto; }
.qz-term { grid-row: span 2; font: 400 40px/1 var(--f-impact); color: #fff; }
.qz-read { font: 800 20px/1 var(--f-ui); color: #ff8ad0; }
.qz-read span { margin-left: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--edge-soft); color: var(--cyan-hi); font-size: 13px; }
.qz-exp p { grid-column: 2; margin: 0; font: 700 20px/1.5 var(--f-ui); color: #dfe9ff; }
.qz-next { grid-column: 3; grid-row: 1 / span 2; padding: 10px 20px; border-radius: 999px; border: 1.5px solid var(--cyan); background: rgba(10, 40, 100, .9); color: #fff; font: 800 18px/1 var(--f-ui); cursor: pointer; }

/* ネコ（背景を抜いたアニメーション WebP）とコンボ */
.qz-cat { position: absolute; left: 0; bottom: 0; width: 270px; height: 324px; pointer-events: none; }
.qz-cat img { width: 100%; height: 100%; object-fit: contain; object-position: left bottom; display: block; }
.qz-combo { position: absolute; right: 40px; bottom: 30px; text-align: right; }
.qz-combo b { display: block; font: 700 64px/1 var(--f-num); color: #fff; text-shadow: 0 0 14px rgba(70, 190, 255, .6); }
.qz-count { position: absolute; left: 50%; top: 50%; translate: -50% -50%; font: 400 200px/1 var(--f-impact); color: #fff; text-shadow: 0 0 34px var(--cyan), 0 12px 0 #0b3a9c; pointer-events: none; white-space: nowrap; }
.qz-count.go { animation: bpop .3s ease-out; }

/* 結果 */
.qz-result { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(2, 6, 20, .72); }
.qz-rcard { width: 760px; padding: 30px 40px; display: grid; gap: 20px; justify-items: center; }
.qz-rtitle { font: 400 46px/1 var(--f-impact); color: #fff; letter-spacing: .1em; text-shadow: 0 0 18px rgba(70, 190, 255, .6); }
.qz-rhead { display: flex; align-items: center; gap: 30px; }
.qz-rbig b { font: 700 90px/1 var(--f-num); color: #fff; }
.qz-rbig small { font: 800 22px/1 var(--f-ui); color: var(--muted); margin-left: 6px; }
.qz-rsub { margin-top: 8px; font: 700 18px/1.4 var(--f-ui); color: #dfe9ff; }
.qz-rsub b { font: 700 24px/1 var(--f-num); color: var(--gold); }
.qz-rlist { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.qz-rlist li { padding: 6px 12px; border-radius: 999px; font: 800 15px/1 var(--f-ui); background: rgba(92, 240, 176, .12); border: 1px solid rgba(92, 240, 176, .5); color: #b9ffe0; }
.qz-rlist li::before { content: "◯ "; }
.qz-rlist li.ng { background: rgba(255, 90, 122, .1); border-color: rgba(255, 90, 122, .5); color: #ffb3c3; }
.qz-rlist li.ng::before { content: "✕ "; }
.qz-rbtns { display: flex; gap: 14px; }

/* タイトル: クイズの説明 */
.quiz-note { display: none; margin: 0; font: 700 16px/1.6 var(--f-ui); color: #dfe9ff; text-align: center; text-wrap: balance; word-break: auto-phrase; }
body.quiz-mode .quiz-note { display: block; }
body.quiz-mode .phone-note { display: none !important; }

/* ===== スマホ: 上から順に並べ、キーボードが出ても問題と解答欄が見えるようにする ===== */
body.phone #quiz { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100dvh); }
body.phone .qz-stage { position: static; width: 100%; height: 100%; transform: none; padding: 8px 10px; gap: 8px; }
body.phone .qz-top { gap: 8px; margin-bottom: 0; }
body.phone .qz-ctrl { margin-bottom: 0; }
body.phone .qz-mode { padding: 6px 10px; font-size: 13px; }
body.phone .qz-prog { gap: 3px; } body.phone .qz-prog i { width: auto; flex: 1; height: 6px; }
body.phone .qz-score { padding: 5px 10px; gap: 6px; } body.phone .qz-score .lbl { font-size: 9px; } body.phone .qz-score b { font-size: 18px; }
body.phone .qz-quit { padding: 6px 10px; font-size: 12px; }
body.phone .qz-qp { height: auto; flex: 1 1 auto; min-height: 150px; max-height: 260px; display: flex; flex-direction: column; }
body.phone .qz-qhead { padding: 7px 12px; } body.phone .qz-qno { font-size: 20px; } body.phone .qz-qno small { font-size: 12px; } body.phone .qz-chip { font-size: 11px; padding: 3px 9px; }
body.phone .qz-qtext { height: auto; flex: 1; padding: 10px 12px; font-size: 19px; line-height: 1.5; }
body.phone .qz-ask { font-size: 13px; margin-top: 4px; }
body.phone .qz-ans { gap: 8px; width: 100%; justify-content: center; }
body.phone .qz-timer { width: 54px; height: 54px; } body.phone .qz-timer b { font-size: 17px; } body.phone .qz-timer .bg, body.phone .qz-timer .fg { stroke-width: 9; }
body.phone .qz-boxes { gap: 4px; }
body.phone .qz-boxes span { width: min(44px, calc((100vw - 92px - (var(--n) - 1) * 4px) / var(--n))); height: 50px; border-radius: 8px; border-width: 2px; font-size: min(26px, calc(240px / var(--n))); }
body.phone .qz-boxes span small { font-size: 12px; }
body.phone .qz-ctrl { gap: 8px; font-size: 12px; }
body.phone .qz-btn { padding: 7px 14px; font-size: 14px; }
body.phone .qz-stamp b { font-size: 64px; -webkit-text-stroke-width: 7px; } body.phone .qz-stamp span { font-size: 18px; } body.phone .qz-stamp small { font-size: 20px; }
body.phone #quiz.ng .qz-stamp b { font-size: 48px; }
body.phone .qz-exp { left: 8px; right: 8px; bottom: 8px; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; padding: 8px 10px; }
body.phone .qz-term { font-size: 18px; } body.phone .qz-read { font-size: 13px; } body.phone .qz-read span { display: none; }
body.phone .qz-exp p { font-size: 12px; line-height: 1.45; }
body.phone .qz-next { grid-column: 1 / -1; grid-row: auto; justify-self: end; padding: 6px 14px; font-size: 13px; }
body.phone .qz-cat { width: 110px; height: 132px; }
body.phone .qz-combo { right: 12px; bottom: 12px; } body.phone .qz-combo b { font-size: 34px; } body.phone .qz-combo .lbl { font-size: 10px; }
body.phone.vv-short .qz-combo { display: none; }
/* キーボード表示中もネコは左下に小さく出す */
body.phone.vv-short .qz-cat { width: 70px; height: 84px; z-index: 2; }
/* ネコのぶん、時間の円とマス目を右に寄せる */
body.phone.vv-short .qz-ans, body.phone.vv-short .qz-ctrl { padding-left: 58px; }
body.phone.vv-short .qz-timer { width: 46px; height: 46px; } body.phone.vv-short .qz-timer b { font-size: 14px; }
body.phone.vv-short .qz-boxes span { width: min(40px, calc((100vw - 140px - (var(--n) - 1) * 4px) / var(--n))); height: 44px; }
body.phone.vv-short .qz-qp { min-height: 0; }
body.phone .qz-count { font-size: 110px; }
body.phone .qz-rcard { width: calc(100% - 20px); padding: 18px 14px; gap: 12px; }
body.phone .qz-rbig b { font-size: 56px; } body.phone .qz-rhead { gap: 16px; } body.phone .qz-rlist li { font-size: 12px; }
