/* ユーザー側の見た目一式（管理画面も、土台としてこのファイルを先に読み込む）。
   色は :root の変数。テーマカラーを変えると、layout.php が --c-theme 系を上書きする。
   文字の大きさは rem で書いてあり、html の fs-m / fs-l / fs-xl で全体が切り替わる。 */

/* ───── フォント（同梱。外部からは読み込まない） ───── */
@font-face {
  font-family: 'Zen Maru Gothic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/zen-maru-gothic-japanese-700-normal.woff2) format('woff2');
}
/* 英数字だけの小さいファイル。先に届くので、数字や記号の見出しがすぐ整う */
@font-face {
  font-family: 'Zen Maru Gothic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/zen-maru-gothic-latin-700-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* 尾崎咢堂クイズ：地の色は、藍紫のテーマカラーに合わせた青みのある灰色 */
  --c-bg: #F3F2F7;
  --c-ink: #181A26;
  --c-sub: #4A4F63;
  --c-card: #FFFFFF;
  --c-line: #CDCFDC;
  --c-line2: #D9DAE4;
  --c-line-strong: #9EA2B5;
  --c-track: #E3E3EC;
  --c-off: #7F8396;
  --c-theme: #197B4A;
  --c-theme-dark: #125C37;
  --c-theme-darker: #0C4428;
  --c-theme-pale: #EDF6F0;
  --c-theme-pale2: #DCEFE3;
  --c-theme-soft: #BFE3CD;
  --c-on-theme: #FFFFFF;
  /* 正解は朱、不正解は青（色だけに頼らず、○× と文字も必ず添える） */
  --c-ok: #C4401C;
  --c-ok-ink: #A83415;
  --c-ok-pale: #FBE7E0;
  --c-ng: #2A5DB0;
  --c-ng-pale: #E3ECF9;
  /* 注意・入力エラー（正誤の色とまぎれないよう、黄土色にする） */
  --c-warn: #8A5A00;
  --c-warn-pale: #FFF4D6;
  /* 王に挑戦（尾崎咢堂クイズでは「咢堂名人に挑戦」。夜の議事堂のような藍色） */
  --c-gold: #E9C46A;
  --c-gold-dark: #B8923A;
  --c-gold-pale: #F3DFA0;
  --c-king-bg: #1E2150;
  --c-king-deep: #161940;
  --c-king-line: #3C4282;
  --c-king-sub: #D9DBF0;
  --c-king-sub2: #BEC2DE;
  /* 桜（開催中の案内・桜の印） */
  --c-sakura: #C2456E;
  --c-sakura-pale: #FCEFF3;
  --c-sakura-line: #EDB3C5;
  --font-body: 'BIZ UDPGothic', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif;
  --font-head: 'Zen Maru Gothic', 'BIZ UDPGothic', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif;
}

/* ───── 土台 ───── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.fs-l { font-size: 112.5%; }
html.fs-xl { font-size: 131.25%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--c-theme-dark); }
a:hover { color: var(--c-theme-darker); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--c-ink); outline-offset: 2px; }
.ic { flex: none; display: inline-block; vertical-align: middle; }
.ic--ok { color: var(--c-ok); }
.ic--ng { color: var(--c-ng); }
.qz-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.qz-skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 10px; background: var(--c-ink); color: #FFFFFF; font-weight: 700; }
.qz-skip:focus { top: 8px; color: #FFFFFF; }
.qz-inlineform { display: inline; margin: 0; }
/* ふりがな：html.ruby-off のあいだは、ふりがなだけ隠す */
html.ruby-off rt, html.ruby-off rp { display: none; }
rt { font-size: 0.55em; }

/* ───── ヘッダー ───── */
.qz-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px; padding: 0 16px;
  background: #FFFFFF; border-bottom: 4px solid var(--c-theme); color: var(--c-ink);
}
.qz-logo { display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; color: var(--c-ink); text-decoration: none; }
.qz-logo:hover { color: var(--c-ink); }
.qz-logo__mark {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--c-theme); color: var(--c-on-theme);
  font-family: var(--font-head); font-weight: 900; font-size: 21px; line-height: 1;
}
.qz-logo__img { flex: none; width: 34px; height: 34px; border-radius: 10px; object-fit: contain; }
.qz-logo__name { font-family: var(--font-head); font-weight: 700; font-size: 1.125rem; line-height: 1.2; overflow-wrap: anywhere; }
/* 文字「大」「特大」でも、サイト名が1行に収まるように、ヘッダーの文字は本文ほど大きくしない。
   幅が足りないときは、右の名前（ログイン中のニックネーム）の方から縮めて「…」にする */
html.fs-xl .qz-logo__name { font-size: 0.9375rem; }
html.fs-xl .qz-userchip { font-size: 0.8125rem; padding: 0 10px; }
.qz-userchip {
  flex: 0 100 auto; min-width: 44px; display: flex; align-items: center; gap: 6px; max-width: 46%;
  min-height: 44px; padding: 0 12px; border-radius: 999px;
  background: var(--c-theme-pale); color: var(--c-theme-dark);
  font-size: 0.875rem; font-weight: 700; text-decoration: none;
}
.qz-userchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qz-userchip[aria-current="page"] { background: var(--c-theme); color: var(--c-on-theme); }
/* クイズ中のヘッダー：やめる／第N問／音 */
.qz-header--play { padding: 0 12px; }
.qz-quit {
  display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 10px;
  border: none; border-radius: 10px; background: transparent; color: var(--c-sub);
  font-size: 0.875rem; font-weight: 700; text-decoration: none; cursor: pointer;
}
.qz-count { display: flex; align-items: baseline; gap: 3px; font-family: var(--font-head); font-weight: 700; font-size: 0.875rem; color: var(--c-sub); }
.qz-count__n { font-size: 1.625rem; font-weight: 900; line-height: 1; color: var(--c-ink); }
.qz-iconbtn {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  border: 1.5px solid var(--c-line); border-radius: 12px; background: #FFFFFF; color: var(--c-theme-dark); cursor: pointer;
}
.qz-iconbtn[aria-pressed="false"] { color: var(--c-sub); }

/* ───── 本文の枠・見出し ───── */
.qz-main {
  flex: 1; display: flex; flex-direction: column; gap: 18px;
  width: 100%; max-width: 480px; margin: 0 auto; padding: 18px 20px 24px;
}
.qz-main--wide { max-width: 1180px; }
.qz-main--play { padding-top: 16px; }
.qz-h1 { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 1.375rem; line-height: 1.4; }
.qz-h2 { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 1.125rem; line-height: 1.4; }
.qz-label { margin: 0; font-size: 0.875rem; font-weight: 700; line-height: 1.5; color: var(--c-sub); }
.qz-sub { font-size: 0.8125rem; line-height: 1.5; color: var(--c-sub); }
.qz-section { display: flex; flex-direction: column; gap: 8px; }
.qz-section--gap { gap: 10px; }
.qz-section--tight { gap: 2px; }
.qz-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.qz-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ───── ボタン ───── */
.qz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 8px 18px;
  border: none; border-radius: 14px; background: var(--c-theme); color: var(--c-on-theme);
  font-family: var(--font-head); font-weight: 900; font-size: 1.125rem; line-height: 1.3;
  text-align: center; text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 0 var(--c-theme-dark);
}
.qz-btn:hover { color: var(--c-on-theme); }
.qz-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--c-theme-dark); }
.qz-btn--lg { min-height: 60px; font-size: 1.3125rem; letter-spacing: 0.08em; }
.qz-btn--block { display: flex; width: 100%; }
.qz-btn--sub {
  min-height: 48px; padding: 6px 12px; border: 1.5px solid var(--c-line-strong); border-radius: 12px;
  background: #FFFFFF; color: var(--c-ink);
  font-family: var(--font-body); font-weight: 700; font-size: 0.875rem; box-shadow: none;
}
.qz-btn--sub:hover { color: var(--c-ink); }
.qz-btn--sub:active { transform: none; box-shadow: none; background: var(--c-bg); }
.qz-btn--ok {
  min-height: 44px; padding: 4px 16px; border-radius: 10px; background: var(--c-ok); color: #FFFFFF;
  font-family: var(--font-body); font-weight: 700; font-size: 0.875rem; box-shadow: none;
}
.qz-btn--ok:hover { color: #FFFFFF; }
.qz-btn--ok:active { transform: none; box-shadow: none; }
.qz-btn--gold { background: var(--c-gold); color: var(--c-ink); box-shadow: 0 4px 0 var(--c-gold-dark); letter-spacing: 0.06em; }
.qz-btn--gold:hover { color: var(--c-ink); }
.qz-btn--gold:active { box-shadow: 0 2px 0 var(--c-gold-dark); }
.qz-btn--text {
  min-height: 44px; padding: 0 4px; border-radius: 8px; background: transparent; color: var(--c-theme-dark);
  font-family: var(--font-body); font-weight: 700; font-size: 0.875rem; text-decoration: underline; box-shadow: none;
}
.qz-btn--text:hover { color: var(--c-theme-darker); }
.qz-btn--text:active { transform: none; box-shadow: none; }
.qz-btn--quiet { color: var(--c-sub); font-weight: 400; font-size: 0.8125rem; }
.qz-btn--quiet:hover { color: var(--c-ink); }
.qz-btn[disabled], .qz-btn.is-disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }
.qz-btnrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.qz-btnstack { display: flex; flex-direction: column; gap: 16px; }

/* ───── 選択チップ（押して選ぶ。選ばれたら aria-pressed="true" か、チェックされた input の次） ───── */
.qz-chips { display: grid; gap: 8px; }
.qz-chips--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.qz-chips--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qz-chips--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.qz-chips--7 { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.qz-chip {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  position: relative; width: 100%; min-height: 44px; padding: 4px 6px;
  border: 1.5px solid var(--c-line); border-radius: 12px; background: #FFFFFF; color: var(--c-ink);
  font-size: 0.9375rem; line-height: 1.25; text-align: center; overflow-wrap: anywhere; cursor: pointer;
}
.qz-chip .ic { color: var(--c-theme-dark); }
.qz-chip[aria-pressed="true"], .qz-chip.is-on, .qz-chipwrap input:checked + .qz-chip {
  border-color: var(--c-theme); background: var(--c-theme); color: var(--c-on-theme); font-weight: 700;
}
.qz-chip[aria-pressed="true"] .ic, .qz-chip.is-on .ic, .qz-chipwrap input:checked + .qz-chip .ic { color: inherit; }
.qz-chip--lg { min-height: 48px; }
.qz-chip--level { flex-direction: column; gap: 4px; min-height: 64px; padding: 4px 0; }
.qz-chip__num { font-family: var(--font-head); font-weight: 900; font-size: 1.375rem; line-height: 1; }
.qz-chip__name { font-size: 0.8125rem; line-height: 1.2; }
.qz-chip--num { min-height: 48px; padding: 0; font-family: var(--font-head); font-weight: 700; font-size: 1.0625rem; }
.qz-chip--num[aria-pressed="true"], .qz-chipwrap input:checked + .qz-chip--num { font-weight: 900; }
.qz-chip[disabled], .qz-chip.is-disabled, .qz-chipwrap input:disabled + .qz-chip {
  border-style: dashed; border-color: var(--c-line-strong); background: transparent; color: var(--c-sub); cursor: not-allowed;
}
/* 「準備中」などの小さな札は、チップの右肩に重ねる（名前の幅をけずらない） */
.qz-chip__tag { position: absolute; top: -9px; right: 8px; padding: 0 6px; border-radius: 6px; background: var(--c-track); color: var(--c-sub); font-size: 0.6875rem; font-weight: 700; line-height: 1.6; white-space: nowrap; }
/* フォームの部品（radio / checkbox）で作るときは、label.qz-chipwrap の中に input と .qz-chip を並べる */
.qz-chipwrap { position: relative; display: block; }
.qz-chipwrap input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.qz-chipwrap input:disabled { cursor: not-allowed; }
.qz-chipwrap input:focus-visible + .qz-chip { outline: 3px solid var(--c-ink); outline-offset: 2px; }

/* ───── 2〜3択の切り替えと、オン・オフのスイッチ ───── */
.qz-seg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.qz-seg--fill { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.qz-seg__label { margin-right: 6px; font-size: 0.875rem; font-weight: 700; color: var(--c-sub); }
.qz-seg__btn {
  min-height: 44px; min-width: 52px; padding: 2px 12px;
  border: 1.5px solid var(--c-line); border-radius: 10px; background: #FFFFFF; color: var(--c-ink);
  font-size: 0.875rem; line-height: 1.3; cursor: pointer;
}
.qz-seg__btn[aria-pressed="true"], .qz-chipwrap input:checked + .qz-seg__btn {
  border-color: var(--c-theme); background: var(--c-theme); color: var(--c-on-theme); font-weight: 700;
}
.qz-seg--fill .qz-seg__btn { min-height: 48px; border-radius: 12px; font-size: 0.9375rem; }
.qz-switch {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0;
  border: none; background: transparent; color: var(--c-ink); cursor: pointer;
}
.qz-switch:disabled { cursor: not-allowed; opacity: 0.55; }
.qz-switch__label { font-size: 0.875rem; font-weight: 700; color: var(--c-sub); }
.qz-switch__track { flex: none; display: flex; width: 52px; height: 30px; padding: 3px; border-radius: 999px; background: var(--c-off); transition: background 0.15s; }
.qz-switch__knob { width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; transition: transform 0.15s; }
.qz-switch[aria-pressed="true"] .qz-switch__track { background: var(--c-theme); }
.qz-switch[aria-pressed="true"] .qz-switch__knob { transform: translateX(22px); }
.qz-switch[aria-pressed="true"] .qz-switch__label { color: var(--c-theme-dark); }
.qz-switch__on, .qz-switch[aria-pressed="true"] .qz-switch__off { display: none; }
.qz-switch[aria-pressed="true"] .qz-switch__on { display: inline; }

/* ───── カード ───── */
.qz-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 16px; background: #FFFFFF; border: 1.5px solid var(--c-line); color: var(--c-ink); }
.qz-card--ok { border: 2px solid var(--c-ok); }
.qz-card--message p { margin: 0; }
.qz-card p { margin: 0; }
.qz-linkcard {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 12px 16px; border-radius: 14px;
  background: #FFFFFF; border: 1.5px solid var(--c-line); color: var(--c-ink); text-decoration: none;
}
.qz-linkcard:hover { color: var(--c-ink); border-color: var(--c-theme); }
.qz-linkcard > .ic { color: var(--c-theme); }
.qz-linkcard__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qz-linkcard__title { font-family: var(--font-head); font-weight: 700; font-size: 1rem; line-height: 1.4; }
.qz-linkcard__sub { font-size: 0.8125rem; line-height: 1.5; color: var(--c-sub); }
.qz-linkcard--dashed { background: transparent; border: 1.5px dashed var(--c-line-strong); }
.qz-linkcard--dashed .qz-linkcard__title { font-family: var(--font-body); font-size: 0.9375rem; }
.qz-list { list-style: none; margin: 0; padding: 0; border-radius: 16px; background: #FFFFFF; border: 1.5px solid var(--c-line); }
.qz-list__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; min-height: 58px; padding: 6px 16px; border-bottom: 1px solid var(--c-line2); }
.qz-list__row:last-child { border-bottom: none; }
.qz-list__name { font-size: 0.9375rem; font-weight: 700; }
.qz-profile { flex-direction: row; align-items: center; gap: 14px; padding: 16px; }
.qz-avatar { flex: none; display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: var(--c-theme-pale2); color: var(--c-theme-dark); }
.qz-profile__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qz-profile__name { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; line-height: 1.3; overflow-wrap: anywhere; }

/* ───── フォーム ───── */
.qz-form { display: flex; flex-direction: column; gap: 16px; }
.qz-field { display: flex; flex-direction: column; gap: 6px; }
.qz-field__label { font-size: 0.875rem; font-weight: 700; }
.qz-input {
  width: 100%; min-height: 48px; padding: 0 14px;
  border: 1.5px solid var(--c-line-strong); border-radius: 10px; background: #FFFFFF; color: var(--c-ink);
}
textarea.qz-input { padding: 10px 14px; line-height: 1.6; resize: vertical; }
.qz-input--num { width: 6em; text-align: right; font-weight: 700; }
.qz-range { width: 170px; max-width: 100%; height: 44px; margin: 0; accent-color: var(--c-theme); }
.qz-check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 0.875rem; cursor: pointer; }
.qz-check input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--c-theme); }
.qz-help { margin: 0; font-size: 0.8125rem; line-height: 1.6; color: var(--c-sub); }
.qz-help--warn { color: var(--c-warn); font-weight: 700; }
.qz-error { margin: 0; font-size: 0.875rem; font-weight: 700; line-height: 1.5; color: var(--c-warn); }
.qz-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--c-track); }
.qz-tab {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 4px 6px; border-radius: 10px;
  color: var(--c-sub); font-size: 0.875rem; font-weight: 700; line-height: 1.3; text-align: center; text-decoration: none;
}
.qz-tab[aria-current="page"] { background: #FFFFFF; color: var(--c-theme-dark); box-shadow: 0 1px 2px rgba(24, 33, 28, 0.12); }
.qz-code {
  margin: 0; padding: 14px 8px; border: 2px dashed var(--c-theme); border-radius: 12px; background: var(--c-theme-pale);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.5rem; font-weight: 700; letter-spacing: 0.08em; text-align: center;
  -webkit-user-select: all; user-select: all;
}

/* ───── 通知 ───── */
.qz-flash { padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--c-line); background: #FFFFFF; font-size: 0.9375rem; font-weight: 700; line-height: 1.6; }
.qz-flash--success { border-color: var(--c-theme); background: var(--c-theme-pale); color: var(--c-theme-darker); }
.qz-flash--error, .qz-flash--warn { border-color: var(--c-warn); background: var(--c-warn-pale); color: #5F3B00; }
.qz-notice { padding: 12px 14px; border-radius: 12px; background: var(--c-theme-pale); border: 1.5px solid var(--c-theme-soft); font-size: 0.9375rem; line-height: 1.7; }
.qz-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px;
  background: var(--c-ink); color: #FFFFFF; font-size: 0.9375rem; font-weight: 700; line-height: 1.5;
}
.qz-overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(22, 24, 42, 0.55); }
.qz-overlay__box {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 34px; border-radius: 20px;
  background: #FFFFFF; border: 3px solid var(--c-ng); color: var(--c-ng);
  font-family: var(--font-head); font-weight: 900; font-size: 2.25rem; line-height: 1.3; text-align: center;
}

/* ───── 認定の印 ───── */
.qz-seal {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 76px; height: 76px; border-radius: 50%; background: #FFFFFF;
  border: 3px solid var(--c-ok); box-shadow: inset 0 0 0 3px #FFFFFF, inset 0 0 0 4.5px var(--c-ok);
  color: var(--c-ok); font-family: var(--font-head); font-weight: 900; font-size: 22px; line-height: 1; letter-spacing: 0.05em;
  transform: rotate(-8deg);
}
.qz-seal--sm { width: 52px; height: 52px; border-width: 2.5px; box-shadow: inset 0 0 0 2px #FFFFFF, inset 0 0 0 3.5px var(--c-ok); font-size: 15px; letter-spacing: 0; }
.qz-seal--lg { width: 92px; height: 92px; border-width: 3.5px; box-shadow: inset 0 0 0 3px #FFFFFF, inset 0 0 0 5px var(--c-ok); font-size: 26px; }
/* まだ取っていないランク：点線の丸に錠のアイコン */
.qz-seal--locked { border: 2px dashed var(--c-line-strong); box-shadow: none; background: transparent; color: var(--c-sub); transform: none; }
.qz-ranks {
  list-style: none; margin: 0; padding: 16px 4px 14px;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 2px;
  border-radius: 16px; background: #FFFFFF; border: 1.5px solid var(--c-line);
}
html.fs-xl .qz-ranks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qz-ranks__item { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--c-ink); text-align: center; text-decoration: none; }
.qz-ranks__name { font-size: 0.875rem; font-weight: 700; line-height: 1.2; }
.qz-ranks__state { font-size: 0.8125rem; line-height: 1.2; color: var(--c-sub); }
.qz-ranks__state.is-done { color: var(--c-ok-ink); }

/* ───── 進み具合 ───── */
.qz-steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.qz-steps > span { height: 6px; border-radius: 3px; background: var(--c-line); }
.qz-steps > span.is-done { background: var(--c-theme); }
.qz-steps--dense { gap: 1px; }
.qz-bar { height: 8px; border-radius: 4px; background: var(--c-track); overflow: hidden; }
.qz-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--c-theme); }
.qz-progress { list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; border-radius: 16px; background: #FFFFFF; border: 1.5px solid var(--c-line); }
.qz-progress__row { display: flex; flex-direction: column; gap: 4px; }
.qz-progress__head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.875rem; line-height: 1.5; }
.qz-progress__head strong { font-weight: 700; }

/* ───── 時計まわり（中身は clock.js が作る） ───── */
.qz-clock { display: flex; align-items: center; justify-content: center; gap: 24px; }
.qz-clock__svg { flex: none; width: 176px; height: 176px; max-width: 46vw; max-height: 46vw; }
.qz-clock__face { fill: #FFFFFF; stroke: var(--c-ink); stroke-width: 4; }
.qz-clock__rest { fill: var(--c-theme-soft); }
.qz-clock__tick { stroke: var(--c-ink); stroke-width: 2; stroke-linecap: round; }
.qz-clock__tick--major { stroke-width: 4; }
.qz-clock__top { stroke: var(--c-ok); stroke-width: 5; stroke-linecap: round; }
.qz-clock__hand { stroke: var(--c-ink); stroke-width: 6; stroke-linecap: round; }
.qz-clock__pin { fill: var(--c-ink); }
/* 幅を決めておく：残りが2けたから1けたになっても、時計の位置が動かない */
.qz-clock__digital { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 6.75rem; }
.qz-clock__label { font-size: 0.875rem; font-weight: 700; line-height: 1.4; color: var(--c-sub); }
.qz-clock__num { display: flex; align-items: baseline; gap: 4px; font-family: var(--font-head); font-weight: 900; }
.qz-clock__sec { font-size: 4.75rem; line-height: 1; font-variant-numeric: tabular-nums; }
.qz-clock__unit { font-size: 1.375rem; line-height: 1; }
.qz-clock__limit { font-size: 0.8125rem; line-height: 1.4; color: var(--c-sub); }
/* 残りわずか：扇形と数字の色が変わり、ラベルの言葉も変わる（色だけに頼らない） */
.qz-clock.is-warn .qz-clock__rest { fill: #F6C9BB; }
.qz-clock.is-warn .qz-clock__sec, .qz-clock.is-warn .qz-clock__unit, .qz-clock.is-warn .qz-clock__label { color: var(--c-ok-ink); }
.qz-clock.is-timeout .qz-clock__rest { fill: transparent; }
/* 王に挑戦の配色 */
.qz-clock--king { gap: 20px; }
.qz-clock--king .qz-clock__svg { width: 132px; height: 132px; }
.qz-clock--king .qz-clock__face { stroke: var(--c-gold); }
.qz-clock--king .qz-clock__rest { fill: var(--c-gold-pale); }
.qz-clock--king .qz-clock__tick { stroke-width: 2.5; }
.qz-clock--king .qz-clock__hand { stroke-width: 5; }
.qz-clock--king .qz-clock__digital { gap: 0; min-width: 5.75rem; }
.qz-clock--king .qz-clock__label { color: var(--c-gold); }
.qz-clock--king .qz-clock__sec { font-size: 4.25rem; color: #FFFFFF; }
.qz-clock--king .qz-clock__unit { font-size: 1.25rem; color: #FFFFFF; }
.qz-clock--king.is-warn .qz-clock__rest { fill: #F6C9BB; }
.qz-clock--king.is-warn .qz-clock__sec, .qz-clock--king.is-warn .qz-clock__unit, .qz-clock--king.is-warn .qz-clock__label { color: #FFB59E; }

/* ───── 問題と選択肢 ───── */
.qz-q { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 16px; background: #FFFFFF; border: 1.5px solid var(--c-line); color: var(--c-ink); }
.qz-q__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.8125rem; line-height: 1.4; color: var(--c-sub); }
.qz-qno {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 8px;
  background: var(--c-theme); color: var(--c-on-theme);
  font-family: var(--font-head); font-weight: 900; font-size: 1rem; line-height: 1;
}
.qz-q__body { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 1.375rem; line-height: 1.5; word-break: auto-phrase; overflow-wrap: anywhere; }
.qz-q--sm { padding: 16px; }
.qz-q--sm .qz-qno { min-height: 26px; padding: 0 9px; font-size: 0.9375rem; }
.qz-q--sm .qz-q__body { font-size: 1.0625rem; }
.qz-q__img { display: block; width: 100%; max-height: 260px; border-radius: 10px; background: var(--c-bg); object-fit: contain; }
.qz-choices { display: flex; flex-direction: column; gap: 12px; }
.qz-choice {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 66px; padding: 10px 16px;
  border: 1.5px solid var(--c-line); border-radius: 14px; background: #FFFFFF; color: var(--c-ink);
  box-shadow: 0 3px 0 var(--c-line); text-align: left; cursor: pointer;
}
.qz-choice:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--c-line); }
.qz-choice__key {
  flex: none; display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px;
  background: var(--c-ink); color: #FFFFFF; font-family: var(--font-head); font-weight: 900; font-size: 20px; line-height: 1;
}
.qz-choice__text { flex: 1; min-width: 0; font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; line-height: 1.4; overflow-wrap: anywhere; }
.qz-choice[disabled] { cursor: default; transform: none; }
.qz-choice.is-selected { border-color: var(--c-ink); box-shadow: 0 3px 0 var(--c-ink); }
.qz-choice.is-correct { border: 2px solid var(--c-ok); background: var(--c-ok-pale); box-shadow: none; }
.qz-choice.is-wrong { border: 2px solid var(--c-ng); background: var(--c-ng-pale); box-shadow: none; }
.qz-choice.is-dim { opacity: 0.55; box-shadow: none; }
.qz-choice.is-gone { visibility: hidden; }

/* ───── 正誤の表示（色＋記号＋文字） ───── */
.qz-verdict { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 16px; border: 2px solid var(--c-ok); background: var(--c-ok-pale); }
.qz-verdict > .ic { color: var(--c-ok); }
.qz-verdict__text { display: flex; flex-direction: column; min-width: 0; }
.qz-verdict__title { font-family: var(--font-head); font-weight: 900; font-size: 2rem; line-height: 1.2; color: var(--c-ok-ink); }
.qz-verdict__sub { font-size: 0.875rem; line-height: 1.4; }
.qz-verdict--ng { border-color: var(--c-ng); background: var(--c-ng-pale); }
.qz-verdict--ng > .ic, .qz-verdict--ng .qz-verdict__title { color: var(--c-ng); }
.qz-review { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.qz-review__item { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 4px 10px; border: 1.5px solid transparent; border-radius: 10px; background: var(--c-bg); color: var(--c-sub); font-size: 0.9375rem; line-height: 1.4; }
.qz-review__key { flex: none; width: 18px; font-family: var(--font-head); font-weight: 900; text-align: center; }
.qz-review__text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.qz-review__you { flex: none; font-size: 0.8125rem; font-weight: 700; }
.qz-review__item.is-correct { border-color: var(--c-ok); background: var(--c-ok-pale); color: var(--c-ink); font-weight: 700; }
.qz-review__item.is-correct .qz-review__you { color: var(--c-ok-ink); }
.qz-review__item.is-wrong { border-color: var(--c-ng); background: var(--c-ng-pale); color: var(--c-ink); }
.qz-review__item.is-wrong .qz-review__you { color: var(--c-ng); }
.qz-explain { display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 6px; border-radius: 16px; background: #FFFFFF; border: 1.5px solid var(--c-line); }
.qz-explain__text { margin: 0; font-size: 1rem; line-height: 1.7; word-break: auto-phrase; overflow-wrap: anywhere; }
.qz-source { display: flex; align-items: flex-start; gap: 6px; min-height: 44px; padding: 11px 0; font-size: 0.875rem; line-height: 1.5; overflow-wrap: anywhere; }
.qz-source .ic { margin-top: 3px; }
.qz-asof { font-size: 0.8125rem; line-height: 1.5; color: var(--c-sub); }
.qz-actions { display: flex; align-items: center; gap: 10px; }
.qz-actions .qz-btn:last-child { flex: 1; }

/* ───── 結果一覧 ───── */
.qz-score { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.qz-score__main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; font-family: var(--font-head); font-weight: 900; }
.qz-score__n { font-size: 4rem; line-height: 1; }
.qz-score__unit { font-size: 1.25rem; line-height: 1; }
.qz-score__total { font-size: 0.9375rem; font-weight: 700; line-height: 1; color: var(--c-sub); }
.qz-score__rate { display: flex; flex-direction: column; align-items: flex-end; font-size: 0.8125rem; line-height: 1.4; color: var(--c-sub); }
.qz-score__rate strong { font-family: var(--font-head); font-weight: 900; font-size: 1.75rem; line-height: 1.1; color: var(--c-ink); }
.qz-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.qz-tag { padding: 2px 10px; border-radius: 8px; background: var(--c-bg); font-size: 0.8125rem; line-height: 1.6; }
.qz-tag--ok { background: var(--c-ok-pale); color: var(--c-ok-ink); font-weight: 700; }
.qz-tag--ng { background: var(--c-ng-pale); color: var(--c-ng); font-weight: 700; }
.qz-certbox { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 16px; background: #FFFFFF; border: 2px solid var(--c-ok); }
.qz-certbox__text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.qz-certbox__lead { font-size: 0.8125rem; font-weight: 700; line-height: 1.5; color: var(--c-ok-ink); }
.qz-certbox__rank { margin: 0; font-family: var(--font-head); font-weight: 900; font-size: 1.5rem; line-height: 1.3; }
.qz-results { list-style: none; margin: 0; padding: 0; border-radius: 16px; background: #FFFFFF; border: 1.5px solid var(--c-line); overflow: hidden; }
.qz-results__item { border-bottom: 1px solid var(--c-line2); }
.qz-results__item:last-child { border-bottom: none; }
.qz-results__item.is-open { background: #F7F7FB; }
.qz-results__row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 8px 12px; border: none; background: transparent; color: var(--c-ink); text-align: left; cursor: pointer; }
.qz-results__no { flex: none; width: 20px; font-family: var(--font-head); font-weight: 700; font-size: 0.875rem; color: var(--c-sub); text-align: right; }
.qz-results__text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 0.9375rem; line-height: 1.5; word-break: auto-phrase; overflow-wrap: anywhere; }
.qz-results__row > .ic--down { color: var(--c-sub); transition: transform 0.15s; }
.qz-results__row[aria-expanded="true"] .qz-results__text { font-weight: 700; }
.qz-results__row[aria-expanded="true"] > .ic--down { transform: rotate(180deg); }
.qz-results__detail { display: flex; flex-direction: column; gap: 10px; padding: 2px 14px 10px; }
.qz-results__detail p { margin: 0; font-size: 0.9375rem; line-height: 1.7; word-break: auto-phrase; }
.qz-kv { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: center; font-size: 0.9375rem; line-height: 1.5; }
.qz-kv dt { justify-self: start; padding: 2px 8px; border-radius: 6px; background: var(--c-bg); font-size: 0.8125rem; font-weight: 700; }
.qz-kv dd { margin: 0; }
.qz-kv__you { background: var(--c-ng-pale) !important; color: var(--c-ng); }
.qz-kv__ans { background: var(--c-ok-pale) !important; color: var(--c-ok-ink); }
.qz-kv__ans + dd { font-weight: 700; }

/* ───── フッター ───── */
.qz-footer { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 20px 28px; border-top: 1.5px solid var(--c-line); font-size: 0.8125rem; line-height: 1.6; color: var(--c-sub); text-align: center; }
.qz-footer p { margin: 0; }
.qz-footer__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 4px; }
.qz-footer__nav a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; font-size: 0.875rem; font-weight: 700; }
.qz-footer__tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px; }
.qz-footer__note { max-width: 440px; }

/* ───── 「王に挑戦」の画面（濃い緑と金。body に is-king を付ける） ───── */
body.is-king { background: var(--c-king-bg); color: #FFFFFF; }
body.is-king .qz-footer { border-top-color: var(--c-king-line); color: var(--c-king-sub); }
body.is-king .qz-footer a, body.is-king .qz-footer .qz-seg__label, body.is-king .qz-footer .qz-switch__label { color: var(--c-king-sub); }
body.is-king :focus-visible { outline-color: var(--c-gold); }
.kg-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 60px; padding: 0 12px; background: var(--c-king-deep); border-bottom: 4px solid var(--c-gold); color: #FFFFFF; }
.kg-header .qz-quit { padding: 0 8px; color: var(--c-king-sub); }
.kg-header__gate { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: center; gap: 0 6px; font-family: var(--font-head); font-weight: 700; }
.kg-header__no { font-size: 0.875rem; color: var(--c-gold); }
.kg-header__name { font-size: 1.25rem; font-weight: 900; line-height: 1.2; }
.kg-header__count { min-width: 72px; font-family: var(--font-head); font-weight: 700; font-size: 0.875rem; color: var(--c-king-sub); text-align: right; }
.kg-kicker { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 700; line-height: 1.5; color: var(--c-gold); }
.kg-title { margin: 0; font-family: var(--font-head); font-weight: 900; font-size: 1.6875rem; line-height: 1.35; }
.kg-lead { margin: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--c-king-sub); }
.kg-gates { list-style: none; margin: 0; padding: 12px 6px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; border-radius: 14px; background: var(--c-king-deep); border: 1.5px solid var(--c-king-line); }
.kg-gates__item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.kg-gates__no { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--c-gold); color: var(--c-gold); font-family: var(--font-head); font-weight: 900; font-size: 15px; line-height: 1; }
.kg-gates__no--final { background: var(--c-gold); color: var(--c-ink); }
.kg-gates__name { font-size: 0.8125rem; font-weight: 700; line-height: 1.3; }
.kg-gates__lv { font-size: 0.75rem; line-height: 1.3; color: var(--c-king-sub2); }
.kg-rules { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: #FFFFFF; color: var(--c-ink); }
.kg-rules__title { margin: 0; font-family: var(--font-head); font-weight: 900; font-size: 1.125rem; line-height: 1.4; letter-spacing: 0.1em; }
.kg-rules__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.kg-rules__list li { display: flex; align-items: baseline; gap: 10px; font-size: 0.9375rem; line-height: 1.5; }
.kg-rules__no { flex: none; width: 18px; font-family: var(--font-head); font-weight: 900; color: var(--c-ok-ink); }
.kg-stats { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kg-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 12px; background: var(--c-king-deep); border: 1.5px solid var(--c-king-line); }
.kg-stats dt { font-size: 0.8125rem; line-height: 1.5; color: var(--c-king-sub2); }
.kg-stats dd { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 1rem; line-height: 1.5; }
.kg-note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 0.875rem; line-height: 1.5; color: var(--c-king-sub); }
.kg-note .ic { color: var(--c-gold); }
.kg-foot { margin: 0; font-size: 0.8125rem; line-height: 1.6; color: var(--c-king-sub); text-align: center; }
.kg-progress { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.kg-progress li { display: flex; flex-direction: column; gap: 4px; }
.kg-progress__bar { display: flex; height: 6px; border-radius: 3px; background: var(--c-king-line); overflow: hidden; }
.kg-progress__bar > span { height: 6px; border-radius: 3px; background: var(--c-gold); }
.kg-progress li.is-done .kg-progress__bar { background: var(--c-gold); }
.kg-progress__name { font-size: 0.8125rem; line-height: 1.3; color: var(--c-king-sub2); text-align: center; }
.kg-progress li.is-now .kg-progress__name { color: #FFFFFF; font-weight: 700; }
.kg-lives { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 6px 14px; border-radius: 12px; background: var(--c-king-deep); border: 1.5px solid var(--c-king-line); }
.kg-lives__icons { display: flex; align-items: center; gap: 6px; }
.kg-bird { flex: none; width: 34px; height: 30px; color: #FFFFFF; stroke-width: 2.6; }
.kg-bird.is-lost { color: #8C93B8; stroke-width: 1.6; stroke-dasharray: 2.5 3; }
.kg-lives__text { font-size: 0.875rem; font-weight: 700; line-height: 1.4; }
.kg-q { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 16px; background: #FFFFFF; color: var(--c-ink); }
.kg-q__meta { font-size: 0.8125rem; font-weight: 700; line-height: 1.5; color: var(--c-sub); }
.kg-q__body { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 1.1875rem; line-height: 1.55; word-break: auto-phrase; overflow-wrap: anywhere; }
.kg-choices { display: flex; flex-direction: column; gap: 10px; }
.kg-choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 14px; border: 1.5px solid var(--c-line); border-radius: 14px; background: #FFFFFF; color: var(--c-ink); font-size: 1.0625rem; font-weight: 700; line-height: 1.4; text-align: left; cursor: pointer; }
.kg-choice__key { flex: none; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--c-theme-pale); color: var(--c-theme-dark); font-family: var(--font-head); font-weight: 900; font-size: 15px; }
.kg-choice[disabled] { cursor: default; }
.kg-choice.is-correct { border: 2px solid var(--c-ok); background: var(--c-ok-pale); }
.kg-choice.is-wrong { border: 2px solid var(--c-ng); background: var(--c-ng-pale); }
.kg-choice.is-gone { visibility: hidden; }

/* ───── 動きをひかえる設定の人には、動かさない ───── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .qz-btn:active, .qz-choice:active { transform: none; }
}

/* ───── 画面の上の戻り先リンク（サイト情報管理の「戻り先リンク」） ───── */
.qz-backbar { background: var(--c-theme-darker); }
.qz-backbar a {
  display: flex; align-items: center; gap: 6px; max-width: 960px; min-height: 36px; margin: 0 auto; padding: 0 16px;
  color: #FFFFFF; font-size: 0.8125rem; font-weight: 700; line-height: 1.4; text-decoration: none;
}
.qz-backbar a span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qz-backbar a:hover span:last-child, .qz-backbar a:focus-visible span:last-child { text-decoration: underline; }

/* ───── 画面の下の「間違いを見つけたら」「問題を送る」 ───── */
.qz-contrib { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; width: 100%; max-width: 560px; }
.qz-contrib__item {
  display: flex; flex-direction: column; gap: 2px; min-height: 56px; padding: 10px 14px;
  border: 1.5px solid var(--c-line); border-radius: 12px; background: var(--c-card); color: var(--c-ink); text-align: left; text-decoration: none;
}
.qz-contrib__item:hover { border-color: var(--c-theme); color: var(--c-ink); }
.qz-contrib__item--submit { border-color: var(--c-theme-soft); background: var(--c-theme-pale); }
.qz-contrib__title { font-size: 0.9375rem; font-weight: 700; color: var(--c-theme-dark); }
.qz-contrib__note { font-size: 0.8125rem; color: var(--c-sub); }

/* ───── 連絡・投稿のフォーム ───── */
.qz-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.qz-fieldset { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: none; min-width: 0; }
.qz-subchoice { display: flex; align-items: center; gap: 10px; }
.qz-subchoice input[type="radio"] { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--c-theme); }
.qz-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
