/* Word test (単語テスト): the #quiz panel, the home button, the small button in the collection. Uses the tokens of app.css. */

/* ---- home button (the home view of the game) and the collection button */
.home-quiz { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: var(--ink); font: inherit;
  background: linear-gradient(120deg, #e4f3ff, #efe8ff); border: 2px solid var(--ink); border-radius: 14px; padding: 8px 12px; box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
.home-quiz:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.hq-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 20px; line-height: 1; box-shadow: 0 3px 0 var(--purple); }
.hq-t { display: grid; gap: 1px; min-width: 0; flex: 1; }
.hq-t b { font-size: 15px; font-weight: 900; }
.hq-t small { font-size: 11px; font-weight: 800; color: var(--ink-2); line-height: 1.35; }
.hq-badge { flex: none; background: var(--shu-deep); color: #fff; font-weight: 900; font-size: 12px; line-height: 1.5; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.qz-dexbtn { margin-left: 6px; }

/* ---- panel layout */
#quiz { outline: none; }
#quiz button { font-family: inherit; color: var(--ink); cursor: pointer; }
#quiz button:focus-visible, #quiz input:focus-visible, #quiz summary:focus-visible { outline: 3px solid #1f4fb8; outline-offset: 2px; }
.qz-wrap { width: min(100%, 640px); margin: 0 auto; display: grid; gap: 12px; align-content: start; }
.qz-body { overflow-x: hidden; }
.qz-foot { flex: none; background: #fff; border-top: 2px solid var(--ink); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  padding: 8px max(14px, calc((100% - 640px) / 2)) calc(8px + env(safe-area-inset-bottom, 0px)); }
.qz-go { flex: 1 1 220px; min-height: 48px; padding: 8px 20px; border: 3px solid var(--ink); border-radius: 14px; background: #2354c4; color: #fff !important; font-weight: 900; font-size: 18px;
  box-shadow: 0 4px 0 var(--ink); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.qz-go:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.qz-go[disabled] { background: #e4e2ea; color: var(--ink-2) !important; border-style: dashed; box-shadow: none; cursor: not-allowed; }
.qz-sec2 { min-height: 44px; padding: 6px 14px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 3px 0 var(--ink); overflow-wrap: anywhere; }
.qz-sec2:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.qz-sec2.on { background: var(--yellow); }
.qz-wide { flex: 1 1 100%; }
.qz-why { flex: 1 1 100%; text-align: center; font-weight: 800; font-size: 13px; color: var(--shu-deep); }
.qz-why[hidden] { display: none; }
.qz-keys { flex: 1 1 100%; text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.qz-empty, .qz-info { margin: 4px 0; font-weight: 800; overflow-wrap: anywhere; }
.qz-sec { display: grid; gap: 6px; }
.qz-sec h3 { margin: 4px 0 0; font-size: 13px; font-weight: 900; color: var(--ink-2); letter-spacing: 0.04em; }
.qz-sec .note { margin: 0; }
.qz-chips { justify-content: flex-start; }
.qz-chip small { margin-left: 6px; font-size: 11px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.qz-chip.off { border-style: dashed; color: var(--ink-2); box-shadow: none; cursor: not-allowed; }
.qz-lvd { margin: 2px 0 0; font-weight: 700; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.qz-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qz-segb { min-height: 46px; padding: 8px 6px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-weight: 900; font-size: 15px; box-shadow: 0 3px 0 var(--ink); overflow-wrap: anywhere; line-height: 1.25; }
.qz-segb[aria-pressed="true"] { background: var(--yellow); }

/* ---- learning record */
.qz-stats { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 10px 12px; box-shadow: 0 3px 0 var(--ink); display: grid; gap: 8px; }
.qz-stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; }
.qz-stat b { display: block; font-size: 22px; line-height: 1.1; font-weight: 900; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.qz-stat span { display: block; font-size: 11px; font-weight: 800; color: var(--ink-2); line-height: 1.25; }
.qz-fc-t { font-size: 11px; font-weight: 800; color: var(--ink-2); }
.qz-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; align-items: end; }
.qz-bar { display: grid; justify-items: center; gap: 2px; min-width: 0; }
.qz-bf { width: 100%; height: 34px; display: flex; align-items: flex-end; background: rgba(29, 27, 36, 0.07); border-radius: 4px; overflow: hidden; }
.qz-bf i { display: block; width: 100%; background: var(--purple); border-radius: 3px 3px 0 0; }
.qz-bar.today .qz-bf i { background: var(--pink); }
.qz-bn { font-size: 11px; font-weight: 900; font-variant-numeric: tabular-nums; }
.qz-bl { font-size: 11px; font-weight: 800; color: var(--ink-2); white-space: nowrap; }
.qz-srs summary { cursor: pointer; font-size: 12px; font-weight: 800; color: var(--link); }
.qz-srs p { margin: 6px 0 0; }

/* ---- loading */
.qz-loading { display: grid; justify-items: center; gap: 10px; padding: 40px 0; font-weight: 800; }
.qz-spin { width: 34px; height: 34px; border-radius: 50%; border: 4px solid rgba(29, 27, 36, 0.15); border-top-color: var(--ink); animation: qzSpin 800ms linear infinite; }
@keyframes qzSpin { to { transform: rotate(360deg); } }

/* ---- question */
.qz-phead { gap: 10px; }
.qz-prog { flex: 1; min-width: 0; display: grid; gap: 4px; }
.qz-prog-t { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; min-width: 0; }
.qz-fmt { font-size: 11px; font-weight: 800; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.qz-pbar { height: 8px; flex: none; }
.qz-quit.armed { background: var(--shu-deep); color: #fff !important; }
.qz-play { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "q" "c" "f"; align-items: start; }
.qz-q { grid-area: q; min-width: 0; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 12px 14px; box-shadow: 0 3px 0 var(--ink); display: grid; gap: 6px; justify-items: center; text-align: center; }
.qz-retry { font-size: 11px; font-weight: 800; color: #fff; background: var(--purple); border-radius: 999px; padding: 1px 10px; }
.qz-ask { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.qz-prompt { display: grid; gap: 6px; justify-items: center; max-width: 100%; min-width: 0; }
.qz-word { font-size: clamp(30px, 9vw, 46px); font-weight: 900; line-height: 1.1; overflow-wrap: anywhere; max-width: 100%; }
.qz-ipa { font-family: var(--ipa); font-size: 18px; color: var(--ink-2); overflow-wrap: anywhere; }
.qz-poss { display: flex; flex-wrap: wrap; gap: 0 2px; justify-content: center; }
.qz-pos { margin: 0; }
.qz-mean { font-size: clamp(20px, 5.6vw, 28px); font-weight: 900; line-height: 1.3; overflow-wrap: anywhere; max-width: 100%; }
.qz-def { font-size: 17px; font-weight: 700; line-height: 1.5; text-align: left; overflow-wrap: anywhere; hyphens: auto; max-width: 100%; }
.qz-blank { display: inline-block; min-width: 3em; text-align: center; border-bottom: 3px solid var(--ink); font-weight: 900; padding: 0 4px; line-height: 1.2; }
.qz-blank.shown { background: #dff5e8; color: #0b4a2a; border-bottom-color: #12683c; border-radius: 4px; }
.qz-pattern { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; font-size: 16px; color: var(--ink-2); letter-spacing: 0.04em; overflow-wrap: anywhere; }
.qz-listen { display: inline-flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 22px; border: 3px solid var(--ink); border-radius: 18px; background: #fff7d6; font-weight: 900; font-size: 17px; box-shadow: 0 4px 0 var(--ink); }
.qz-listen:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.qz-ico { font-size: 28px; line-height: 1; }
.qz-speak { min-height: 32px; padding: 2px 12px; font-size: 14px; }
.qz-speak[hidden] { display: none; }

.qz-choices { grid-area: c; display: grid; gap: 8px; min-width: 0; }
.qz-ch { display: grid; grid-template-columns: 26px minmax(0, 1fr) 22px; align-items: center; gap: 10px; text-align: left; min-height: 52px; padding: 8px 12px; background: #fff; border: 2px solid var(--ink); border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink); font-weight: 800; font-size: 16px; min-width: 0; }
.qz-num { width: 24px; height: 24px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 900; display: grid; place-items: center; }
.qz-tr { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qz-ct { overflow-wrap: anywhere; line-height: 1.3; min-width: 0; }
.qz-sub { display: block; margin-top: 2px; font-weight: 700; font-size: 12px; color: var(--ink-2); }
.qz-mark { font-weight: 900; font-size: 18px; text-align: center; }
@media (hover: hover) { .qz-choices:not(.answered) .qz-ch:hover { background: #fff8d8; } }
.qz-ch:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.qz-ch.ok { background: #dff5e8; border-color: #12683c; }
.qz-ch.ok .qz-mark { color: #0b5a32; }
.qz-ch.ng { background: #fde2df; border-color: #b3261b; }
.qz-ch.ng .qz-mark { color: #a11d12; }
.qz-ch.dim { background: #f3f2f6; box-shadow: none; }
.qz-ch.pop { animation: qzPop 220ms ease-out; }
.qz-ch.shake { animation: qzShake 260ms ease-out; }
@keyframes qzPop { 40% { transform: scale(1.03); } }
@keyframes qzShake { 20% { transform: translateX(-5px); } 60% { transform: translateX(5px); } }
html.reduce .qz-ch.pop, html.reduce .qz-ch.shake, html.reduce .qz-spin { animation: none; }
@media (prefers-reduced-motion: reduce) { .qz-ch.pop, .qz-ch.shake { animation: none; } }

.qz-type { grid-area: c; display: grid; gap: 8px; min-width: 0; }
.qz-input { width: 100%; min-width: 0; font: 800 22px var(--ui); border: 3px solid var(--ink); border-radius: 12px; padding: 10px 12px; text-align: center; background: #fff; color: var(--ink); }
.qz-input.ok { background: #dff5e8; border-color: #12683c; }
.qz-input.ng { background: #fde2df; border-color: #b3261b; }
.qz-hintnote { margin: 0; text-align: center; }

.qz-fb { grid-area: f; display: none; min-width: 0; border: 2px solid var(--ink); border-radius: 14px; padding: 10px 12px; background: #fff; gap: 6px; box-shadow: 0 3px 0 var(--ink); }
.qz-fb.on { display: grid; }
.qz-fb.ok { background: #eefaf3; border-color: #12683c; }
.qz-fb.ng { background: #fff1ef; border-color: #b3261b; }
.qz-verdict { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.qz-vi { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; background: #12683c; }
.qz-fb.ng .qz-vi { background: #b3261b; }
.qz-aw { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.qz-aw-w { font-size: 24px; font-weight: 900; overflow-wrap: anywhere; line-height: 1.2; }
.qz-aw-ipa { font-family: var(--ipa); color: var(--ink-2); font-size: 16px; }
.qz-aw-m { font-weight: 800; font-size: 16px; overflow-wrap: anywhere; }
.qz-nr { font-size: 12px; font-weight: 800; color: var(--ink-2); }
.qz-fb-act { display: flex; gap: 8px; flex-wrap: wrap; }
.qz-fb-act .qz-sec2 { min-height: 38px; padding: 4px 12px; font-size: 14px; }

/* ---- result */
.qz-score { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 14px; box-shadow: 0 3px 0 var(--ink); display: grid; gap: 4px; justify-items: center; text-align: center; }
.qz-big { font-size: clamp(26px, 8vw, 38px); font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.qz-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; font-weight: 800; color: var(--ink-2); }
.qz-gain { font-weight: 900; font-size: 14px; color: #0b5a32; }
.qz-done { background: #eefaf3; border: 2px solid #12683c; border-radius: 14px; padding: 10px 14px; display: grid; gap: 4px; text-align: center; overflow-wrap: anywhere; }
.qz-reward { font-weight: 800; font-size: 14px; color: #0b5a32; }
.qz-missed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.qz-missed li { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.qz-mrow { flex: 1; min-width: 0; display: grid; gap: 1px; text-align: left; padding: 6px 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; box-shadow: 0 3px 0 var(--ink); }
.qz-mw { font-size: 18px; font-weight: 900; overflow-wrap: anywhere; }
.qz-mm { font-size: 13px; font-weight: 700; color: var(--ink-2); overflow-wrap: anywhere; }
.qz-missed .qz-fav { flex: none; min-width: 44px; padding: 4px 10px; }
.qz-share { flex: 1 1 100%; }
.qz-sharespot { display: flex; justify-content: center; }
.qz-sharespot .share-save { font-weight: 800; font-size: 14px; color: #1f4fb8; padding: 10px 6px; }
.qz-res-btns { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.qz-res-btns > * { flex: 1 1 140px; }

/* ---- wide screens: two columns of choices */
@media (min-width: 560px) { .qz-choices { grid-template-columns: 1fr 1fr; } }

/* ---- low and landscape screens: question on the left, choices on the right, everything reachable */
@media (orientation: landscape) and (max-height: 520px) {
  #quiz .panel-head { padding-top: calc(4px + env(safe-area-inset-top, 0px)); padding-bottom: 4px; }
  .qz-wrap { width: min(100%, 940px); gap: 8px; }
  .qz-body { padding-top: 8px; padding-bottom: 10px; }
  .qz-play { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-areas: "q c" "f c"; gap: 8px 12px; }
  .qz-q { padding: 8px 12px; gap: 4px; }
  .qz-word { font-size: clamp(26px, 5vw, 36px); }
  .qz-mean { font-size: clamp(18px, 3.6vw, 24px); }
  .qz-def { font-size: 15px; line-height: 1.4; }
  .qz-choices { grid-template-columns: 1fr; gap: 6px; }
  .qz-ch { min-height: 44px; padding: 5px 10px; }
  .qz-go { min-height: 42px; padding: 4px 16px; font-size: 16px; }
  .qz-sec2 { min-height: 40px; padding: 4px 12px; }
  .qz-foot { padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px)); gap: 6px; }
  .qz-keys { display: none; }
  .qz-play.ans .qz-q .qz-ipa, .qz-play.ans .qz-q .qz-poss, .qz-play.ans .qz-q .qz-speak { display: none; }
  .qz-foot-res { flex-wrap: nowrap; }
  .qz-foot-res > .qz-go { flex: 2 1 0; min-width: 0; }
  .qz-foot-res > .qz-share { flex: 1.3 1 0; min-width: 0; }
  .qz-res-btns { flex-wrap: nowrap; flex: 2 1 0; }
  .qz-res-btns > * { flex: 1 1 0; min-width: 0; }
  .qz-stat b { font-size: 18px; }
  .qz-listen { min-height: 48px; padding: 4px 16px; }
  .qz-fb { padding: 8px 10px; }
  .qz-aw-w { font-size: 20px; }
}
@media (max-height: 600px) and (orientation: portrait) {
  .qz-stat b { font-size: 19px; }
  .qz-q { padding: 8px 12px; }
  .qz-ch { min-height: 46px; }
  .qz-bf { height: 26px; }
}
