/* ============================================================
   独自CBTシステム スタイルシート
   まなびポケット / MEXCBT連携アプリ / MEXCBT問題プレイヤーの
   実画面（マニュアル記載）に合わせた配色・レイアウト。
   ============================================================ */
:root {
    /* まなびポケット アプリシェル */
    --mp-navy: #3c4969;
    --mp-navy-dark: #2f3a54;
    --mp-blue: #2f6fed;
    --mp-blue-dark: #1f4fc4;
    --mp-blue-soft: #e8f0ff;
    --mp-border: #dfe3e8;
    --mp-footer-bg: #eaf2fb;
    --card-blue: #6ea3de;
    --card-blue-dark: #4d7fc0;

    /* MEXCBT本体（問題プレイヤー／結果画面） */
    --mexcbt-teal: #0b6a63;
    --mexcbt-teal-dark: #084e49;
    --mexcbt-teal-accent: #0f8a76;

    /* ログイン画面 */
    --login-slate: #5f6a7c;
    --login-form-bg: #f8f7f4;
    --btn-orange: #f0a25e;
    --btn-orange-dark: #e08a3c;
    --btn-red: #c2636d;

    /* 汎用 */
    --text: #2b2f36;
    --muted: #6b7280;
    --danger: #d6483a;
    --green-dark: #0b6e5d;
    --status-red: #d6483a;
    --status-green: #23a35d;
    --status-blue: #3b7dd8;
    --status-gray: #9aa1ab;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", "Yu Gothic", sans-serif;
    background: #eef1f5;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--mp-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ============================================================
   まなびポケット / MEXCBT連携アプリ 共通ロゴ部品
   ============================================================ */
.brand-mp { display: inline-flex; align-items: center; gap: 8px; }
.brand-mp .brand-mp-word { font-weight: 700; font-size: 15px; color: #333c4d; letter-spacing: .2px; }
.brand-mp.on-dark .brand-mp-word { color: #fff; }
.brand-mexcbt-img { display: inline-flex; align-items: center; }
.brand-mexcbt-img img { display: block; width: auto; max-width: 100%; }

/* ============================================================
   1) アプリシェル：まなびポケット/MEXCBT連携アプリ 画面
      （ハンバーガー＋右上メタ情報のトップバー、左からのドロワーメニュー、
       下部の「まなびポケット」フッターバンド）
   ============================================================ */
.mp-shell { min-height: 100vh; display: flex; flex-direction: column; }

.mp-topbar {
    background: #fff; border-bottom: 1px solid var(--mp-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px; height: 50px; flex-shrink: 0;
}
.mp-hamburger {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: none; cursor: pointer; color: #4b5563; padding: 6px 4px;
}
.mp-hamburger .bars { display: flex; flex-direction: column; gap: 3px; }
.mp-hamburger .bars span { width: 20px; height: 2px; background: #4b5563; display: block; }
.mp-hamburger .lbl { font-size: 10px; line-height: 1; }

.mp-topbar-right { display: flex; align-items: center; gap: 14px; }
.mp-meta { font-size: 11.5px; color: #55606e; white-space: nowrap; }
.mp-logout {
    display: flex; flex-direction: column; align-items: center; gap: 1px; color: #55606e; font-size: 9.5px;
}
.mp-logout svg { width: 18px; height: 18px; }
.mp-logout:hover { text-decoration: none; color: var(--mp-blue); }

/* ドロワー式メニュー */
.mp-drawer-backdrop {
    position: fixed; inset: 0; background: rgba(20, 26, 40, .35); z-index: 40;
    opacity: 0; pointer-events: none; transition: opacity .15s;
}
.mp-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.mp-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; width: 250px; background: var(--mp-navy);
    z-index: 50; transform: translateX(-100%); transition: transform .18s ease-out;
    display: flex; flex-direction: column; box-shadow: 6px 0 24px rgba(0,0,0,.18);
}
.mp-drawer.open { transform: translateX(0); }
.mp-drawer-brand { background: #fff; padding: 14px 18px; display: flex; align-items: center; }
.mp-drawer-nav { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.mp-drawer-nav a {
    color: #dfe4ef; font-size: 13.5px; padding: 11px 14px; border-radius: 6px;
}
.mp-drawer-nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.mp-drawer-nav a.active { background: #fff; color: var(--mp-navy); font-weight: 700; }
.mp-drawer-close {
    margin-left: auto; background: none; border: none; color: #cfd6e4; font-size: 20px; cursor: pointer; padding: 4px 8px;
}

.mp-content { flex: 1; max-width: 1100px; width: 100%; margin: 0 auto; padding: 24px 22px 50px; }
.mp-footerband {
    background: var(--mp-footer-bg); border-top: 1px solid #dbe6f4;
    display: flex; align-items: center; justify-content: center; padding: 14px 0; flex-shrink: 0;
}

.mp-page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.mp-page-title { font-size: 18px; font-weight: 700; margin: 0; }
.mp-page-header-note { font-size: 11.5px; color: var(--danger); text-align: right; margin-top: 4px; }
.mp-back-link { display: inline-block; font-size: 13px; margin-bottom: 14px; }

/* ---------------- ホーム画面：2つの大きなカード ---------------- */
.mp-hero-row { display: flex; gap: 22px; justify-content: center; margin: 46px 0 26px; flex-wrap: wrap; }
.mp-hero-card { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 220px; }
.mp-hero-icon {
    width: 92px; height: 92px; display: flex; align-items: center; justify-content: center;
}
.mp-hero-icon svg { width: 60px; height: 60px; }
.mp-hero-pill {
    display: inline-block; border: 1px solid #c7cedb; border-radius: 20px; background: #fff;
    padding: 8px 18px; font-size: 13px; font-weight: 600; color: #333c4d;
}
.mp-hero-card:hover .mp-hero-pill { border-color: var(--mp-blue); color: var(--mp-blue); }

/* ---------------- 生徒：テスト一覧カード ---------------- */
.test-card-row { display: flex; flex-wrap: wrap; gap: 14px; }
.test-card {
    background: var(--card-blue); color: #fff; border-radius: 6px; padding: 16px 16px 14px;
    width: 220px; min-height: 122px; display: flex; flex-direction: column; gap: 8px;
}
.test-card.disabled { background: #9aa3b5; }
.test-card .tc-title { font-weight: 700; font-size: 13.5px; line-height: 1.5; }
.test-card .tc-period { font-size: 11px; opacity: .92; line-height: 1.6; }
.test-card .tc-deadline { font-size: 11.5px; font-weight: 700; margin-top: auto; }
.test-card a.tc-btn {
    display: block; text-align: center; background: rgba(255,255,255,.16); color: #fff; border-radius: 4px;
    padding: 6px 0; font-size: 12.5px; font-weight: 600; margin-top: 6px;
}
.test-card a.tc-btn:hover { background: rgba(255,255,255,.3); text-decoration: none; }

/* ---------------- 共通：テーブル・ボタン・フォーム ---------------- */
table.cbt-table { width: 100%; border-collapse: collapse; background: #fff; }
table.cbt-table th, table.cbt-table td {
    border-bottom: 1px solid var(--mp-border); padding: 11px 12px; font-size: 12.5px; text-align: left; vertical-align: top;
}
table.cbt-table th { background: #f6f7fa; color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
table.cbt-table tr:hover td { background: #fafbfd; }
.cbt-empty { text-align: center; color: var(--muted); padding: 26px 0 !important; }
.table-panel { background: #fff; border: 1px solid var(--mp-border); overflow: visible; }
.cbt-card { background: #fff; border: 1px solid var(--mp-border); padding: 18px; margin-bottom: 16px; }

.cbt-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.cbt-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cbt-badge.before::before { background: var(--status-red); }
.cbt-badge.before { color: var(--status-red); }
.cbt-badge.during::before { background: var(--status-green); }
.cbt-badge.during { color: var(--status-green); }
.cbt-badge.after::before { background: var(--status-blue); }
.cbt-badge.after { color: var(--status-blue); }
.cbt-badge.off::before { background: var(--status-gray); }
.cbt-badge.off { color: var(--status-gray); }

.cbt-menu { position: relative; display: inline-block; }
.cbt-menu > summary { list-style: none; cursor: pointer; color: var(--mp-blue); font-size: 12.5px; user-select: none; }
.cbt-menu > summary::-webkit-details-marker { display: none; }
.cbt-menu > summary::after { content: "▾"; margin-left: 3px; font-size: 10px; }
.cbt-menu[open] > summary::after { content: "▴"; }
.cbt-menu-body {
    position: absolute; right: 0; top: 22px; background: #fff; border: 1px solid var(--mp-border);
    box-shadow: 0 6px 18px rgba(20,30,50,.12); min-width: 120px; z-index: 60; padding: 4px 0;
}
.cbt-menu-body a, .cbt-menu-body button {
    display: block; width: 100%; text-align: left; padding: 8px 14px; font-size: 12.5px; color: var(--text);
    background: none; border: none; cursor: pointer;
}
.cbt-menu-body a:hover, .cbt-menu-body button:hover { background: #f2f4f7; text-decoration: none; }
.cbt-menu-body a.danger, .cbt-menu-body button.danger { color: var(--danger); }

.cbt-btn {
    display: inline-block; background: var(--mp-blue); color: #fff; border: none; border-radius: 4px;
    padding: 9px 18px; font-size: 13.5px; cursor: pointer; font-weight: 600;
}
.cbt-btn:hover { opacity: .9; text-decoration: none; color: #fff; }
.cbt-btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--mp-border); }
.cbt-btn.danger { background: var(--danger); }
.cbt-btn.small { padding: 5px 12px; font-size: 12px; }
.cbt-btn-row { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; }
.cbt-btn.disabled {
    background: #c3c8d1; color: #7a8290; cursor: not-allowed;
    pointer-events: none; box-shadow: none;
}
.cbt-btn.disabled:hover { opacity: 1; }

/* ---------------- 問題バンク：フォルダ ---------------- */
.cbt-bank-layout { display: flex; gap: 16px; align-items: flex-start; }
.cbt-folder-side { width: 200px; flex-shrink: 0; border: 1px solid var(--mp-border); background: #fff; padding: 14px; }
.cbt-folder-nav { display: flex; flex-direction: column; gap: 2px; }
.cbt-folder-nav a {
    display: flex; justify-content: space-between; align-items: center; gap: 6px;
    padding: 7px 8px; border-radius: 4px; font-size: 13px; color: var(--text);
}
.cbt-folder-nav a:hover { background: #f4f6f8; text-decoration: none; }
.cbt-folder-nav a.active { background: var(--mp-blue-soft); color: var(--mp-blue-dark); font-weight: 700; }
.cbt-folder-count { font-size: 11px; color: var(--muted); }
.cbt-folder-nav a.active .cbt-folder-count { color: var(--mp-blue-dark); }
.cbt-folder-manage-link { display: block; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--mp-border); font-size: 12px; }

.cbt-form-row { margin-bottom: 14px; max-width: 560px; }
.cbt-form-row label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.cbt-form-row input[type=text], .cbt-form-row input[type=number], .cbt-form-row input[type=password],
.cbt-form-row input[type=datetime-local], .cbt-form-row select, .cbt-form-row textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--mp-border); border-radius: 4px; font-size: 13.5px;
    font-family: inherit;
}
.cbt-form-row textarea { min-height: 90px; resize: vertical; }
.cbt-section-title { font-size: 14px; font-weight: 700; margin: 26px 0 10px; border-left: 4px solid var(--mp-blue); padding-left: 8px; }
.cbt-hint { font-size: 11.5px; color: var(--muted); margin: -8px 0 14px; }
.cbt-error { background: #fbe9ea; color: var(--danger); padding: 10px 14px; border-radius: 4px; font-size: 13px; margin-bottom: 12px; }
.cbt-notice { background: #e4f6ee; color: var(--green-dark); padding: 10px 14px; border-radius: 4px; font-size: 13px; margin-bottom: 12px; }

.cbt-modal-card {
    background: #fff; border: 1px solid var(--mp-border); max-width: 720px; margin: 0 auto 24px; padding: 26px 30px;
}
.cbt-modal-card h1.cbt-modal-title { font-size: 16px; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--mp-border); }

.cbt-choice-editor-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.cbt-choice-editor-row input[type=text] { flex: 1; min-width: 140px; padding: 7px 9px; border: 1px solid var(--mp-border); border-radius: 4px; }
.cbt-choice-editor-row input[type=number] { padding: 7px 6px; border: 1px solid var(--mp-border); border-radius: 4px; }
.cbt-choice-img-upload {
    width: 40px; height: 40px; border: 1px dashed var(--mp-border); border-radius: 4px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; background: #f9fafb;
}
.cbt-choice-img-placeholder { font-size: 16px; opacity: .6; }
.cbt-choice-img-preview { width: 100%; height: 100%; object-fit: cover; }

.cbt-answer-row { border: 1px solid var(--mp-border); border-radius: 6px; padding: 14px 16px; margin-bottom: 12px; scroll-margin-top: 16px; background: #fff; }
.cbt-answer-row.correct { border-left: 5px solid var(--mexcbt-teal-accent); }
.cbt-answer-row.incorrect { border-left: 5px solid var(--danger); }
.cbt-answer-row.pending { border-left: 5px solid #e0a800; }
.cbt-answer-row.info { border-left: 5px solid var(--mp-border); }
.cbt-answer-row.answered { border-left: 5px solid var(--status-blue); }
.cbt-tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 8px; margin-left: 8px; }
.cbt-tag.correct { background: #e6f4ef; color: var(--green-dark); }
.cbt-tag.incorrect { background: #fbe9ea; color: var(--danger); }
.cbt-tag.pending { background: #fff7e0; color: #8a6300; }
.cbt-tag.info { background: #eef1f4; color: var(--muted); }
.cbt-tag.answered { background: #eaf2fb; color: var(--status-blue); }

/* ============================================================
   2) ログイン画面（まなびポケット）
   ============================================================ */
.login-outer {
    min-height: 100vh; background: var(--login-slate); display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card { width: 100%; max-width: 720px; }
.login-brand { text-align: right; margin-bottom: 14px; }
.login-panel { display: flex; background: var(--login-form-bg); min-height: 260px; }
.login-panel-left {
    flex: 0 0 42%; background: transparent; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 10px; padding: 20px; text-align: center;
}
.login-school-name { color: #fff; font-size: 15px; font-weight: 700; }
.login-school-code { color: #d7dbe3; font-size: 12px; letter-spacing: 1px; }
.login-back-link {
    margin-top: 18px; background: rgba(255,255,255,.12); color: #eef0f4; font-size: 11.5px;
    border-radius: 14px; padding: 6px 14px; border: none;
}
.login-support-link { color: #d7dbe3; font-size: 11px; margin-top: 10px; }
.login-panel-right { flex: 1; padding: 30px 34px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login-field { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #d8d6cf; padding-bottom: 10px; }
.login-field svg { width: 18px; height: 18px; color: #8a8f9c; flex-shrink: 0; }
.login-field input {
    border: none; background: none; outline: none; font-size: 14px; width: 100%; font-family: inherit; color: var(--text);
}
.login-guardian-btn {
    display: block; text-align: center; background: var(--btn-red); color: #fff; font-weight: 700; font-size: 13.5px;
    padding: 11px 0; border-radius: 4px; border: none; margin-top: 22px; cursor: default;
}
.login-submit-btn {
    display: block; width: 100%; text-align: center; background: var(--btn-orange); color: #fff; font-weight: 700; font-size: 14.5px;
    padding: 12px 0; border-radius: 22px; border: none; margin-top: 12px; cursor: pointer;
}
.login-submit-btn:hover { background: var(--btn-orange-dark); }
.login-teacher-note { text-align: center; font-size: 11.5px; color: #e3e6ec; margin-top: 16px; }
.login-error { background: #fbe4e6; color: #a5333f; padding: 9px 14px; border-radius: 4px; font-size: 12.5px; margin-bottom: 12px; }

/* ============================================================
   3) MEXCBT 問題プレイヤー／結果画面（新しいタブで開く体裁）
   ============================================================ */
body.is-player { background: #fff; margin: 0; }
.player-frame { max-width: none; width: 100%; margin: 0; background: #fff; box-shadow: none; min-height: 100vh; }
.player-topbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid #e4e7eb; }
.player-band { background: var(--mexcbt-teal); color: #fff; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.player-band .pb-title { font-size: 14.5px; font-weight: 700; }
.player-progress-track { height: 7px; width: 170px; background: rgba(255,255,255,.28); border-radius: 4px; overflow: hidden; }
.player-progress-fill { height: 100%; background: #fff; }
.player-band .pb-count { font-size: 12.5px; opacity: .9; white-space: nowrap; }
.player-body-pad { padding: 20px 22px 30px; }

.cbt-player { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.cbt-qpalette { border: 1px solid var(--mp-border); padding: 14px; position: sticky; top: 14px; }
.cbt-qpalette .qp-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.cbt-qpalette-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.cbt-qpalette-close { display: none; }

/* スマホでは問題一覧・拡大縮小・マーカーを解答の邪魔にならないよう
   メニュー（ドロワー）に格納し、ボタンを押したときだけ表示する */
.cbt-qpalette-toggle {
    display: none; align-items: center; gap: 6px; width: 100%; margin-bottom: 14px;
    background: #fff; border: 1px solid var(--mp-border); border-radius: 4px;
    padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer;
}
.cbt-qpalette-toggle svg { width: 18px; height: 18px; flex-shrink: 0; }
.cbt-qpalette-toggle .cbt-toggle-badge {
    margin-left: auto; background: var(--mexcbt-teal); color: #fff; border-radius: 10px;
    font-size: 11px; font-weight: 700; padding: 1px 8px;
}
.cbt-qpalette-backdrop { display: none; }
.qp-item {
    width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--mp-border);
    display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text);
    text-decoration: none; position: relative; background: #fff;
}
.qp-item:hover { text-decoration: none; }
.qp-item.answered { background: #2b2f36; border-color: #2b2f36; color: #fff; }
.qp-item.current { border-color: var(--mexcbt-teal-accent); box-shadow: 0 0 0 2px rgba(15,138,118,.25); }
.qp-item.bookmarked::after {
    content: "★"; position: absolute; top: -7px; right: -7px; font-size: 11px; color: #e0a800;
}
.cbt-qpalette-legend { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--mp-border); font-size: 11px; color: var(--muted); line-height: 1.9; }
.cbt-qpalette-section-title {
    width: 100%; font-size: 11px; font-weight: 700; color: var(--muted); margin: 10px 0 2px;
    padding-top: 8px; border-top: 1px dashed var(--mp-border);
}
.cbt-qpalette-grid > .cbt-qpalette-section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.qp-item.qp-info { border-style: dashed; color: var(--muted); font-style: italic; }
.qp-item.qp-info.answered { background: #6b7280; border-color: #6b7280; }
.cbt-qpalette-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--mp-border); margin-right: 6px; vertical-align: middle; }
.cbt-qpalette-legend .dot.filled { background: #2b2f36; border-color: #2b2f36; }
.cbt-qpalette-toolbar { display: flex; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--mp-border); }
.cbt-qpalette-toolbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: #f4f6f8; border: 1px solid var(--mp-border); border-radius: 4px; padding: 8px 4px;
    font-size: 10.5px; cursor: not-allowed; color: #9aa1ab;
}
.cbt-qpalette-toolbar button svg { width: 18px; height: 18px; stroke: #9aa1ab; }

.cbt-question-body { border: 1px solid var(--mp-border); padding: 24px; }
.cbt-question-num { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cbt-question-tag {
    display: inline-block; background: var(--mp-blue-soft, #eef6ff); color: var(--mexcbt-teal);
    border-radius: 10px; padding: 2px 10px; font-size: 11px; font-weight: 700; margin-right: 8px;
}
.cbt-question-text { font-size: 15.5px; line-height: 1.75; margin-bottom: 18px; }
.cbt-question-img { max-width: 100%; margin: 10px 0; border-radius: 4px; }
.cbt-choice {
    display: block; padding: 12px 14px; border: 1px solid var(--mp-border); border-radius: 4px;
    margin-bottom: 8px; cursor: pointer; font-size: 14px;
}
.cbt-choice:hover { border-color: var(--mexcbt-teal-accent); }
.cbt-choice input { margin-right: 10px; }

/* ---------------- 画像タイルのグリッド選択肢（qtype=single/multi, choice_layout=grid） ----------------
   認知機能評価テストのような「絵を見て選ぶ」問題向け。PCでは列数を多く、
   スマホでは列数を絞って指でタップしやすい大きさを保つ。 */
.cbt-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 12px;
    margin-bottom: 6px;
}
.cbt-choice-tile {
    display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    border: 2px solid var(--mp-border); border-radius: 8px; padding: 10px; cursor: pointer;
    text-align: center; background: #fff; position: relative;
}
.cbt-choice-tile:hover { border-color: var(--mexcbt-teal-accent); }
.cbt-choice-tile.selected,
.cbt-choice-tile:has(input:checked) { border-color: var(--mexcbt-teal-accent); background: var(--mp-blue-soft, #eef6ff); box-shadow: 0 0 0 2px rgba(15,138,118,.18); }
.cbt-choice-tile-img { max-width: 100%; max-height: 140px; object-fit: contain; border-radius: 4px; margin: 0 auto; }
.cbt-choice-tile-label { font-size: 13.5px; line-height: 1.4; word-break: break-word; }
/* 選択用のコントロール（チェックボックス／ラジオ）は画像の「下」に、はっきり見える大きさで独立して置く。
   どの画像がどのボタンに対応するかが一目でわかるようにするため（画像に重ねない）。 */
.cbt-choice-tile-control {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    border-top: 1px dashed var(--mp-border); padding-top: 8px; margin-top: auto;
}
.cbt-choice-tile-control input { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--mexcbt-teal-accent); }

/* ---------------- 並べ替え問題（qtype=order） ---------------- */
.cbt-order-tiles {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px;
}
.cbt-order-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
    border: 2px solid var(--mp-border); border-radius: 8px; padding: 14px 12px; min-width: 64px;
    background: #fff; cursor: pointer; font-size: 20px; font-weight: 700; position: relative;
}
.cbt-order-tile:hover { border-color: var(--mexcbt-teal-accent); }
.cbt-order-tile.selected { border-color: var(--mexcbt-teal-accent); background: var(--mp-blue-soft, #eef6ff); }
.cbt-order-tile .cbt-order-badge {
    position: absolute; top: -9px; right: -9px; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 10px; background: var(--mexcbt-teal); color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.cbt-order-tile .cbt-choice-tile-img { max-width: 90px; max-height: 90px; }
.cbt-order-tile .cbt-choice-tile-label { font-size: 15px; }

.cbt-player-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; }
.cbt-bookmark-btn { background: none; border: 1px solid var(--mp-border); border-radius: 4px; padding: 8px 14px; cursor: pointer; font-size: 13px; }
.cbt-bookmark-btn.on { background: #fff7e0; border-color: #e0a800; color: #8a6300; }
.cbt-nav-circle {
    width: 40px; height: 40px; border-radius: 50%; background: var(--mexcbt-teal); color: #fff; border: none;
    font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.cbt-nav-circle:hover { opacity: .88; }

/* ---------------- 結果詳細 ---------------- */
.result-summary-row { display: flex; gap: 30px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.result-score-pct { font-size: 30px; font-weight: 800; color: var(--mexcbt-teal); line-height: 1; }
.result-score-pct-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
.result-score-value { font-size: 22px; font-weight: 800; }

.cbt-result-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.cbt-result-side { border: 1px solid var(--mp-border); padding: 14px; position: sticky; top: 14px; }
.cbt-result-tabs { display: flex; border: 1px solid var(--mp-border); border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.cbt-result-tabs button {
    flex: 1; padding: 7px 0; font-size: 12.5px; border: none; background: #fff; cursor: pointer; color: var(--muted);
}
.cbt-result-tabs button.active { background: var(--mexcbt-teal); color: #fff; font-weight: 700; }
.cbt-result-qlist { display: flex; flex-direction: column; gap: 4px; }
.cbt-result-qlist a {
    display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 4px; font-size: 12.5px; color: var(--text);
}
.cbt-result-qlist a:hover { background: #f4f6f8; text-decoration: none; }
.cbt-result-qlist .mark { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; flex-shrink: 0; }
.cbt-result-qlist .mark.correct { background: var(--mexcbt-teal-accent); }
.cbt-result-qlist .mark.incorrect { background: var(--danger); }
.cbt-result-qlist .mark.pending { background: #e0a800; }
.cbt-result-qlist .mark.info { background: #9aa4ad; }
.cbt-result-qlist .mark.answered { background: var(--status-blue); }
body.cbt-filter-wrong .cbt-answer-row.correct { display: none; }
.cbt-mode-badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 600; vertical-align: middle; }
.cbt-mode-badge.test { background: #eef1f4; color: var(--muted); }
.cbt-mode-badge.survey { background: #eaf2fb; color: var(--status-blue); }
body.cbt-filter-wrong .cbt-result-qlist a.is-correct { display: none; }

/* ============================================================
   4) WYSIWYGエディタ（問題文・画面作成で共通・TinyMCE使用）
   ============================================================ */
.cbt-wysiwyg { border: 1px solid var(--mp-border); border-radius: 6px; overflow: hidden; background: #fff; }
.cbt-wysiwyg .tox-tinymce { border: none; border-radius: 0; }

/* 画像の角をドラッグして自由にリサイズするためのつまみ */
.cbt-img-resize-handle {
    position: fixed; z-index: 500; width: 14px; height: 14px; background: var(--mp-blue);
    border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* ---------------- 画面作成：一覧カード ---------------- */
.cbt-screen-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.cbt-screen-card {
    width: 240px; min-height: 150px; border-radius: 8px; color: #fff; display: flex; flex-direction: column;
    justify-content: space-between; padding: 14px; box-shadow: 0 2px 8px rgba(20,30,50,.12);
}
.cbt-screen-card-body { font-size: 13px; overflow: hidden; max-height: 90px; }
.cbt-screen-card-body img { max-width: 100%; }
.cbt-screen-card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.35); }
.cbt-screen-card-foot a { color: #fff; text-decoration: underline; }
.cbt-screen-card-title { font-weight: 700; }

/* ---------------- 生徒側：待機画面（フルスクリーン表示） ---------------- */
.cbt-waiting-screen {
    min-height: calc(100vh - 60px); display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #fff; text-align: center; padding: 40px 24px;
}
.cbt-waiting-screen-body { max-width: 640px; font-size: 16px; line-height: 1.8; }
.cbt-waiting-screen-body img { max-width: 100%; border-radius: 6px; }

/* ---------------- 動画・音声の埋め込み（1回限りの再生） ---------------- */
.cbt-media-played-note {
    background: #f4f6f8; border: 1px dashed var(--mp-border); border-radius: 6px; padding: 14px 16px;
    color: var(--muted); font-size: 13px;
}

/* ---------------- 話すことでの解答（音声入力） ---------------- */
.cbt-voice-btn {
    margin-top: 8px; background: #fff; border: 1px solid var(--mexcbt-teal-accent); color: var(--mexcbt-teal);
    border-radius: 20px; padding: 8px 16px; font-size: 13px; cursor: pointer; font-weight: 600;
}
.cbt-voice-btn:hover { background: var(--mp-blue-soft); }
.cbt-voice-btn.recording { background: #fbe4e6; border-color: var(--danger); color: var(--danger); }
.cbt-voice-btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 780px) {
    .cbt-result-layout { grid-template-columns: 1fr; }
    .cbt-result-side { position: static; }
    .login-panel { flex-direction: column; }
    .login-panel-left { padding: 26px 20px; }
    .mp-hero-row { gap: 14px; }
    .cbt-bank-layout { flex-direction: column; }
    .cbt-folder-side { width: 100%; }

    /* 問題一覧・拡大縮小・マーカーはメニューボタンから開くドロワーに格納し、
       解答エリアの邪魔にならないようにする */
    .cbt-player { grid-template-columns: 1fr; }
    .cbt-qpalette-toggle { display: flex; }
    .cbt-qpalette {
        position: fixed; top: 0; right: 0; height: 100%; width: 84%; max-width: 320px;
        z-index: 1001; background: #fff; overflow-y: auto;
        transform: translateX(100%); transition: transform .22s ease;
        box-shadow: -8px 0 24px rgba(20,30,50,.2); border: none;
    }
    .cbt-qpalette.open { transform: translateX(0); }
    .cbt-qpalette-close {
        display: flex; align-items: center; justify-content: center; margin-left: auto;
        width: 30px; height: 30px; border: none; background: #f4f6f8; border-radius: 50%;
        font-size: 16px; cursor: pointer; color: var(--text);
    }
    .cbt-qpalette-head { display: flex; align-items: center; margin-bottom: 8px; }
    .cbt-qpalette-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(20,30,50,.4); z-index: 1000;
        opacity: 0; pointer-events: none; transition: opacity .22s ease;
    }
    .cbt-qpalette-backdrop.open { opacity: 1; pointer-events: auto; }

    /* 画像タイル・並べ替えタイル：スマホでは列数を絞ってタップしやすいサイズを確保する */
    .cbt-question-body { padding: 16px; }
    .cbt-choice-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
    .cbt-choice-tile-img { max-height: 96px; }
    .cbt-order-tile { padding: 10px 8px; min-width: 56px; font-size: 17px; }
    .cbt-order-tile .cbt-choice-tile-img { max-width: 72px; max-height: 72px; }
}

@media (max-width: 420px) {
    .cbt-choice-grid { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 6px; }
    .cbt-choice-tile-img { max-height: 80px; }
    .cbt-choice-tile-label { font-size: 12px; }
}
