/* ==========================================
   CONTENT LIBRARY — สร้างสื่อการสอน
   Desktop = สร้าง/ตรวจร่าง, Mobile = เลือกและสร้างให้จบทีละขั้น
   ========================================== */
:root { --export-word:#2563eb; --export-word-bg:#eff6ff; --export-word-border:#bfdbfe; --library-interactive:#6d5ce7; --library-interactive-bg:#f1efff; --library-interactive-border:#d9d2ff; --library-quiz:#3b82f6; --library-quiz-bg:#eff6ff; --library-quiz-border:#bfdbfe; --library-worksheet:#f59e0b; --library-worksheet-bg:#fffbeb; --library-worksheet-border:#fde68a; --library-plan:#8b5cf6; --library-plan-bg:#f5f3ff; --library-plan-border:#ddd6fe; }
.cl-hero { position:relative; overflow:hidden; display:flex; align-items:center; justify-content:center; min-height:220px; box-sizing:border-box; padding:34px 36px 30px; margin-bottom:18px; border-color:#cceee0; background:linear-gradient(125deg,#fff 0%,#f0fdf7 58%,#effbf7 100%); }
.cl-hero::after { content:''; position:absolute; right:-62px; top:-88px; width:240px; height:240px; border:34px solid rgba(29,158,117,.08); border-radius:50%; }
.cl-hero-copy { position:relative; z-index:1; width:100%; text-align:center; }
.cl-kicker { display:inline-flex; align-items:center; gap:6px; color:var(--primary); font-size:.8rem; font-weight:800; }
.cl-hero h2 { margin:7px 0 5px; color:var(--text-main); font-size:clamp(1.5rem,3vw,2rem); }
.cl-hero p { max-width:650px; margin:0 auto; color:var(--text-muted); line-height:1.65; }
.cl-hero-mark { display:none; }
.cl-section-head { display:flex; justify-content:space-between; align-items:end; gap:16px; margin:25px 0 12px; }
.cl-section-head h3 { margin:0; font-size:1.1rem; }
.cl-section-head p { margin:3px 0 0; color:var(--text-muted); font-size:.86rem; }
.cl-create-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:14px; }
.cl-create-card { position:relative; min-height:178px; padding:20px; overflow:hidden; text-align:left; border:1px solid var(--border-color); border-radius:18px; background:var(--bg-card); box-shadow:var(--shadow-sm); cursor:pointer; transition:var(--transition-normal); }
.cl-create-card::before,.cl-saved-card::before { position:absolute; inset:0 0 auto; height:5px; content:''; }
.cl-create-card.interactive::before { background:var(--library-interactive); }
.cl-create-card.quiz::before,.cl-saved-card.quiz::before { background:var(--library-quiz); }
.cl-create-card.worksheet::before { background:var(--library-worksheet); }
.cl-create-card.lesson-plan::before,.cl-saved-card.lesson-plan::before { background:var(--library-plan); }
.cl-create-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-md); }
.cl-create-card.interactive:hover { border-color:var(--library-interactive-border); }
.cl-create-card.quiz:hover { border-color:var(--library-quiz-border); }
.cl-create-card.worksheet:hover { border-color:var(--library-worksheet-border); }
.cl-create-card.lesson-plan:hover { border-color:var(--library-plan-border); }
.cl-create-card:focus-visible { outline:3px solid rgba(29,158,117,.25); outline-offset:2px; }
.cl-create-card.coming { cursor:default; opacity:.72; }
.cl-create-card.coming:hover { border-color:var(--border-color); transform:none; box-shadow:var(--shadow-sm); }
.cl-create-icon { display:grid; width:48px; height:48px; place-items:center; margin-bottom:17px; border-radius:15px; color:var(--primary); background:var(--primary-light); font-size:1.35rem; }
.cl-create-card.interactive .cl-create-icon { color:var(--library-interactive); background:var(--library-interactive-bg); }
.cl-create-card.quiz .cl-create-icon { color:var(--library-quiz); background:var(--library-quiz-bg); }
.cl-create-card.worksheet .cl-create-icon { color:var(--library-worksheet); background:var(--library-worksheet-bg); }
.cl-create-card.lesson-plan .cl-create-icon { color:var(--library-plan); background:var(--library-plan-bg); }
.cl-function-label { display:block; margin:-4px 0 4px; color:var(--text-muted); font-size:.7rem; font-weight:800; letter-spacing:.02em; text-transform:uppercase; }
.cl-create-card h4 { margin:0 0 5px; color:var(--text-main); font-size:1.03rem; }
.cl-create-card p { margin:0; color:var(--text-muted); font-size:.84rem; line-height:1.55; }
.cl-coming { position:absolute; top:14px; right:14px; padding:3px 8px; border-radius:99px; color:var(--text-muted); background:#f1f5f9; font-size:.7rem; font-weight:800; }
.cl-media-studio-status { opacity:0; transform:translateY(-3px); transition:opacity .16s ease,transform .16s ease; }
.cl-media-studio-entry { display:block; color:inherit; text-decoration:none; }
.cl-media-studio-entry:hover .cl-media-studio-status,.cl-media-studio-entry:focus-visible .cl-media-studio-status { opacity:1; transform:translateY(0); }
.cl-saved-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(270px,1fr)); gap:14px; }
.cl-library-section { margin-bottom:24px; }
.cl-library-toolbar { display:grid; grid-template-columns:minmax(280px,1fr) auto; align-items:center; gap:12px; padding:14px 0; margin-bottom:14px; border-top:1px solid var(--border-color); border-bottom:1px solid var(--border-color); }
.cl-library-search { display:flex; align-items:center; gap:9px; min-width:0; padding:10px 13px; border:1px solid var(--border-color); border-radius:12px; color:var(--text-muted); background:var(--bg-card); }
.cl-library-search:focus-within { border-color:var(--primary); box-shadow:0 0 0 3px rgba(29,158,117,.1); }
.cl-library-search i { flex:0 0 auto; font-size:1.05rem; }
.cl-library-search input { width:100%; min-width:0; padding:0; border:0; outline:0; color:var(--text-main); background:transparent; font:inherit; }
.cl-library-search input::placeholder { color:var(--text-muted); }
.cl-library-tabs { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:6px; }
.cl-library-tab { display:inline-flex; align-items:center; gap:6px; min-height:38px; padding:7px 11px; border:1px solid var(--border-color); border-radius:10px; color:var(--text-secondary); background:var(--bg-card); cursor:pointer; font:inherit; font-size:.82rem; font-weight:700; transition:var(--transition-normal); }
.cl-library-tab span { min-width:20px; padding:2px 5px; border-radius:99px; color:var(--text-muted); background:var(--bg-light); font-size:.7rem; text-align:center; }
.cl-library-tab:hover { border-color:var(--primary); color:var(--primary-deep); }
.cl-library-tab.active { border-color:var(--primary); color:var(--primary-deep); background:var(--primary-light); }
.cl-library-tab.active span { color:var(--primary-deep); background:var(--bg-card); }
.cl-saved-card { position:relative; width:100%; padding:0; border:1px solid var(--border-color); border-radius:16px; color:inherit; background:var(--bg-card); box-shadow:var(--shadow-sm); transition:var(--transition-normal); }
.cl-saved-card:hover { border-color:var(--library-quiz-border); transform:translateY(-2px); box-shadow:var(--shadow-md); }
.cl-saved-card-main { display:block; width:100%; padding:18px; border:0; border-radius:16px; color:inherit; background:transparent; cursor:pointer; text-align:left; font:inherit; }
.cl-saved-card-main:focus-visible { outline:3px solid rgba(29,158,117,.25); outline-offset:-3px; }
.cl-saved-delete { position:absolute; top:12px; right:12px; z-index:1; display:grid; width:32px; height:32px; place-items:center; border:1px solid var(--border-color); border-radius:9px; color:#b5473c; background:var(--bg-card); cursor:pointer; font-size:1rem; }
.cl-saved-delete:hover { border-color:#f0c8c3; background:#fffafa; }
.cl-saved-type { display:inline-flex; align-items:center; gap:5px; padding:4px 8px; border-radius:99px; color:var(--library-quiz); background:var(--library-quiz-bg); font-size:.72rem; font-weight:800; }
.cl-saved-card h4 { margin:10px 0 4px; font-size:1.03rem; }
.cl-saved-card p { margin:0; color:var(--text-muted); font-size:.83rem; }
.cl-saved-meta { display:flex; flex-wrap:wrap; gap:6px; margin-top:13px; }
.cl-saved-meta span { padding:3px 7px; color:var(--text-muted); background:var(--bg-light); border-radius:7px; font-size:.73rem; font-weight:700; }
.cl-saved-open { display:inline-flex; align-items:center; gap:4px; margin-top:15px; color:var(--primary-deep); font-size:.8rem; font-weight:800; }
.cl-saved-open i { font-size:1rem; }
.cl-empty-library { padding:30px 18px; text-align:center; border:1px dashed #bddfd1; border-radius:16px; color:var(--text-muted); background:#fbfffd; }
.cl-empty-library i { display:block; margin-bottom:7px; color:var(--primary); font-size:1.5rem; }
.cl-required { color:#d04b3f; font-style:normal; }
.cl-plan-type { color:var(--library-plan); background:var(--library-plan-bg); }
.cl-create-icon.lesson-plan { color:var(--library-plan); background:var(--library-plan-bg); }
.cl-worksheet-type { color:var(--library-worksheet); background:var(--library-worksheet-bg); }
.cl-create-icon.worksheet { color:var(--library-worksheet); background:var(--library-worksheet-bg); }
.cl-worksheet-preview { padding:24px; }
.cl-worksheet-preview > header { padding-bottom:18px; margin-bottom:18px; border-bottom:1px solid var(--border-color); }
.cl-worksheet-preview h2 { margin:12px 0 4px; font-size:1.35rem; }
.cl-worksheet-preview header p { margin:0; color:var(--text-muted); font-size:.84rem; }
.cl-worksheet-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.cl-worksheet-grid article { padding:16px; border:1px solid var(--border-color); border-radius:13px; background:#fbfffd; }
.cl-worksheet-grid article h3 { margin:0 0 9px; color:var(--library-worksheet); font-size:.92rem; }
.cl-worksheet-grid article p,.cl-worksheet-grid article ul { margin:0; color:var(--text-secondary); font-size:.84rem; line-height:1.7; }
.cl-worksheet-grid article ul { padding-left:19px; }
.cl-worksheet-grid article li + li { margin-top:5px; }
.cl-worksheet-wide { grid-column:1 / -1; }
.cl-worksheet-format-card { display:grid; grid-template-columns:minmax(0,1fr) minmax(260px,360px); align-items:end; gap:18px; margin:4px 0 22px; padding:18px; border:1px solid var(--library-worksheet-border); border-radius:14px; background:var(--library-worksheet-bg); }
.cl-worksheet-format-card h3 { margin:0 0 4px; color:var(--text-main); font-size:1rem; }
.cl-worksheet-format-card p { margin:0; color:var(--text-muted); font-size:.82rem; line-height:1.55; }
.cl-worksheet-options-card { margin:-4px 0 22px; padding:18px; border:1px solid #cceee0; border-radius:14px; background:#f4fcf8; }
.cl-worksheet-options-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:14px; }
.cl-worksheet-options-card h3 { margin:0 0 4px; color:var(--text-main); font-size:1rem; }
.cl-worksheet-options-card p { margin:0; color:var(--text-muted); font-size:.82rem; line-height:1.55; }
.cl-worksheet-guide-badge { display:inline-flex; align-items:center; gap:5px; flex:0 0 auto; padding:5px 9px; border-radius:99px; color:var(--primary-deep); background:var(--primary-light); font-size:.72rem; font-weight:800; }
.cl-field-hint { display:block; margin-top:5px; color:var(--text-muted); font-size:.76rem; line-height:1.45; }
.cl-count-custom { margin-top:8px; }
.cl-count-custom[hidden] { display:none; }
.cl-plan-asset-group + .cl-plan-asset-group { margin-top:20px; padding-top:20px; border-top:1px solid var(--border-color); }
.cl-plan-asset-group h4 { margin:0 0 3px; font-size:1rem; }
.cl-plan-asset-group h4 i { color:var(--primary); margin-right:5px; }
.cl-plan-linked-item.worksheet:hover { border-color:var(--library-worksheet-border); background:var(--library-worksheet-bg); }
.cl-plan-preview { padding:24px; }
.cl-plan-preview > header { padding-bottom:18px; margin-bottom:18px; border-bottom:1px solid var(--border-color); }
.cl-plan-preview h2 { margin:12px 0 4px; font-size:1.35rem; }
.cl-plan-preview header p { margin:0; color:var(--text-muted); font-size:.84rem; }
.cl-plan-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.cl-plan-grid article { padding:16px; border:1px solid var(--border-color); border-radius:13px; background:#fbfffd; }
.cl-plan-grid article h3 { margin:0 0 9px; color:var(--primary-deep); font-size:.92rem; }
.cl-plan-grid article p,.cl-plan-grid article ul { margin:0; color:var(--text-secondary); font-size:.84rem; line-height:1.7; }
.cl-plan-grid article ul { padding-left:19px; }
.cl-plan-grid article li + li { margin-top:5px; }
.cl-plan-wide { grid-column:1 / -1; }
.cl-plan-edit-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.cl-plan-meta-edit { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; padding:16px; margin-bottom:14px; border:1px solid var(--library-plan-border); border-radius:13px; background:var(--library-plan-bg); }
.cl-plan-meta-edit .full { grid-column:1 / -1; }
.cl-plan-edit-field { display:flex; flex-direction:column; gap:7px; padding:16px; border:1px solid var(--border-color); border-radius:13px; background:#fbfffd; color:var(--primary-deep); font-size:.92rem; font-weight:800; }
.cl-plan-edit-field small { color:var(--text-muted); font-size:.75rem; font-weight:600; }
.cl-plan-edit-field textarea { min-height:138px; resize:vertical; line-height:1.65; }
.cl-plan-detail-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:22px; margin-bottom:16px; }
.cl-plan-detail-head > div:first-child { min-width:0; flex:1 1 auto; }
.cl-plan-detail-head h2 { margin:10px 0 4px; font-size:1.4rem; }
.cl-plan-detail-head p { margin:0; color:var(--text-muted); }
.cl-plan-next { display:flex; align-items:center; gap:14px; padding:18px 20px; margin-bottom:16px; border-color:#cdeee0; background:#f4fcf8; }
.cl-plan-next-icon,.cl-plan-run-icon { display:grid; width:42px; height:42px; flex:0 0 auto; place-items:center; border-radius:13px; color:var(--primary); background:var(--primary-light); font-size:1.2rem; }
.cl-plan-next > div { min-width:0; flex:1; }
.cl-plan-next h3 { margin:0 0 3px; color:var(--primary-deep); font-size:1rem; }
.cl-plan-next p { margin:0; color:var(--text-secondary); font-size:.84rem; line-height:1.55; }
.cl-plan-detail-grid { display:grid; grid-template-columns:1fr; gap:16px; margin-bottom:16px; }
.cl-plan-detail-section { padding:20px; }
.cl-plan-section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:14px; }
.cl-plan-section-head h3 { margin:0 0 3px; font-size:1rem; }
.cl-plan-section-head p { margin:0; color:var(--text-muted); font-size:.8rem; line-height:1.5; }
.cl-plan-section-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; }
.cl-plan-linked-list,.cl-plan-run-list { display:grid; gap:9px; }
.cl-plan-linked-item { position:relative; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:9px 10px; width:100%; padding:12px; border:1px solid var(--border-color); border-radius:12px; color:var(--text-main); background:var(--bg-card); cursor:pointer; font:inherit; text-align:left; }
.cl-plan-linked-item:hover { border-color:var(--library-quiz-border); background:var(--library-quiz-bg); }
.cl-plan-linked-item strong { min-width:0; font-size:.86rem; }
.cl-plan-linked-item small { grid-column:2; color:var(--text-muted); font-size:.76rem; }
.cl-plan-linked-item > i { grid-column:3; grid-row:1 / span 2; color:var(--primary); }
.cl-plan-empty-link { display:flex; align-items:center; gap:9px; padding:15px; border:1px dashed var(--border-color); border-radius:12px; color:var(--text-muted); background:var(--bg-light); font-size:.82rem; }
.cl-plan-empty-link i { color:var(--primary); font-size:1.1rem; }
.cl-plan-soon { display:flex; align-items:flex-start; gap:8px; margin-top:11px; padding:10px 11px; border-radius:10px; color:var(--text-muted); background:var(--bg-light); font-size:.78rem; line-height:1.5; }
.cl-plan-soon i { color:var(--library-worksheet); }
.cl-plan-run { display:flex; align-items:center; gap:10px; padding:11px; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-card); }
.cl-plan-run > div { display:grid; gap:2px; min-width:0; flex:1; }
.cl-plan-run strong { font-size:.86rem; }
.cl-plan-run small { color:var(--text-muted); font-size:.76rem; }
.cl-run-status { padding:4px 8px; border-radius:99px; color:var(--primary-deep); background:var(--primary-light); font-size:.72rem; font-weight:800; white-space:nowrap; }
.cl-plan-detail-preview { margin-bottom:18px; }
.cl-plan-detail-preview > header h3 { margin:0; color:var(--text-main); font-size:1.06rem; }
.cl-modal-note { margin:0; color:var(--text-muted); font-size:.83rem; line-height:1.55; }
.cl-link-picker { display:grid; gap:8px; max-height:330px; overflow:auto; }
.cl-link-picker label { display:grid; grid-template-columns:22px minmax(0,1fr); align-items:center; gap:10px; padding:11px 13px; border:1px solid var(--border-color); border-radius:11px; cursor:pointer; }
.cl-link-picker label:has(input:checked) { border-color:#92dbbf; background:var(--primary-light); }
.cl-link-picker input { width:19px; height:19px; margin:0; justify-self:start; accent-color:var(--primary); }
.cl-link-picker span { display:grid; gap:2px; }
.cl-link-picker strong { color:var(--text-main); font-size:.86rem; }
.cl-link-picker small { color:var(--text-muted); font-size:.76rem; }

.cl-wizard { max-width:1120px; margin:0 auto; }
.cl-wizard-top { display:flex; align-items:center; justify-content:flex-start; gap:14px; margin-bottom:18px; }
.cl-wizard-top > .btn { order:-1; flex:0 0 auto; }
.cl-wizard-title { display:flex; align-items:center; gap:12px; min-width:0; }
.cl-wizard-title .cl-create-icon { flex:0 0 auto; margin:0; }
.cl-wizard-title h2 { margin:0; font-size:1.3rem; }
.cl-wizard-title p { margin:3px 0 0; color:var(--text-muted); font-size:.84rem; }
.cl-stepper { display:flex; gap:8px; margin:0 0 18px; }
.cl-step { display:flex; align-items:center; gap:7px; flex:1; padding:10px 12px; border:1px solid var(--border-color); border-radius:12px; color:var(--text-muted); background:var(--bg-card); font-size:.8rem; font-weight:800; }
.cl-step b { display:grid; width:22px; height:22px; place-items:center; border-radius:50%; color:var(--text-muted); background:var(--bg-light); font-size:.72rem; }
.cl-step.active { color:var(--primary-deep); border-color:#92dbbf; background:#f2fcf7; }
.cl-step.active b { color:#fff; background:var(--primary); }
.cl-form-card { padding:24px; }
.cl-form-card h3 { margin:0 0 4px; font-size:1.1rem; }
.cl-form-note { margin:0 0 18px; color:var(--text-muted); font-size:.86rem; }
.cl-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.cl-field { display:flex; flex-direction:column; gap:7px; min-width:0; font-size:.82rem; font-weight:800; color:var(--text-secondary); }
.cl-indicator-field-label { display:flex; flex-wrap:wrap; align-items:baseline; column-gap:.35em; }
.cl-indicator-selection-note { color:var(--text-muted); font-size:inherit; font-weight:600; }
.cl-field select,.cl-field input,.cl-field textarea { width:100%; box-sizing:border-box; }
.cl-field textarea { min-height:126px; resize:vertical; line-height:1.55; }
.cl-field.full { grid-column:1 / -1; }
.cl-context-card { display:flex; align-items:flex-start; gap:10px; padding:12px 14px; margin:18px 0; border:1px solid #cdeee0; border-radius:12px; color:#316655; background:#f4fcf8; font-size:.83rem; line-height:1.55; }
.cl-context-card i { margin-top:2px; color:var(--primary); font-size:1.1rem; }
.cl-source-tabs { display:flex; gap:8px; margin:0 0 16px; overflow-x:auto; }
.cl-source-tab { white-space:nowrap; padding:9px 12px; border:1px solid var(--border-color); border-radius:10px; color:var(--text-muted); background:#fff; cursor:pointer; font:inherit; font-size:.82rem; font-weight:800; }
.cl-source-tab.active { color:var(--primary-deep); border-color:#8cd9bd; background:var(--primary-light); }
.cl-choices { display:flex; flex-wrap:wrap; gap:8px; }
.cl-choice { position:relative; display:inline-flex; align-items:center; gap:7px; padding:9px 11px; border:1px solid var(--border-color); border-radius:10px; color:var(--text-secondary); background:#fff; cursor:pointer; font-size:.82rem; font-weight:700; }
.cl-choice input { width:auto; accent-color:var(--primary); }
.cl-indicator-table { overflow:hidden; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-card); }
.cl-indicator-table-head,.cl-indicator-row { display:grid; grid-template-columns:28px minmax(108px,auto) minmax(0,1fr); align-items:center; column-gap:11px; }
.cl-indicator-table-head { min-height:37px; padding:0 14px; color:var(--text-muted); border-bottom:1px solid var(--border-color); background:var(--bg-light); font-size:.74rem; font-weight:800; }
.cl-indicator-row { min-height:48px; padding:10px 14px; color:var(--text-main); border-bottom:1px solid var(--border-color); cursor:pointer; font-size:.86rem; line-height:1.48; transition:background .16s ease; }
.cl-indicator-row:last-child { border-bottom:0; }
.cl-indicator-row:hover { background:var(--primary-light); }
.cl-indicator-row:has(input:checked) { background:#f2fcf7; }
.cl-indicator-row input { width:20px; height:20px; margin:0; accent-color:var(--primary); cursor:pointer; }
.cl-indicator-row strong { color:var(--primary-deep); white-space:nowrap; font-size:.83rem; }
.cl-indicator-row > span { min-width:0; font-weight:400; }
.cl-indicator-empty { padding:16px; color:var(--text-muted); font-size:.84rem; }
.cl-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:22px; }
.cl-actions .btn { min-height:42px; }
.cl-processing { display:none; position:fixed; z-index:9800; inset:0; padding:20px; place-items:center; background:rgba(15,23,42,.46); backdrop-filter:blur(3px); }
.cl-processing.show { display:grid; }
.cl-processing-card { width:min(420px,100%); padding:30px 24px; text-align:center; border-radius:20px; background:#fff; box-shadow:0 16px 45px rgba(15,23,42,.22); }
.cl-processing-spinner { width:44px; height:44px; margin:0 auto 16px; border:4px solid #d9f4e8; border-top-color:var(--primary); border-radius:50%; animation:cl-spin .85s linear infinite; }
.cl-processing-card h3 { margin:0 0 6px; }
.cl-processing-card p { margin:0; color:var(--text-muted); line-height:1.6; }
@keyframes cl-spin { to { transform:rotate(360deg); } }

.cl-review-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; padding:20px 22px; margin-bottom:16px; }
.cl-review-head h3 { margin:0 0 4px; }
.cl-review-head p { margin:0; color:var(--text-muted); font-size:.84rem; }
.cl-quality-warning { display:flex; align-items:flex-start; gap:11px; padding:13px 15px; margin:0 0 16px; border:1px solid #f4c978; border-radius:12px; color:#7a5413; background:#fffaf0; line-height:1.55; }
.cl-quality-warning > i { margin-top:3px; color:#d58b14; font-size:1.2rem; }
.cl-quality-warning strong { display:block; }
.cl-quality-warning p { margin:2px 0 3px; font-size:.84rem; }
.cl-quality-warning small { color:#946b25; }
.cl-review-list { display:grid; gap:14px; }
.cl-question-card { padding:20px; }
.cl-question-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.cl-question-no { display:inline-flex; align-items:center; gap:7px; color:var(--primary-deep); font-size:.84rem; font-weight:800; }
.cl-question-no b { display:grid; width:25px; height:25px; place-items:center; border-radius:8px; color:#fff; background:var(--primary); font-size:.76rem; }
.cl-question-tools { display:flex; gap:6px; }
.cl-icon-btn { display:grid; width:34px; height:34px; place-items:center; border:1px solid var(--border-color); border-radius:9px; color:var(--text-muted); background:#fff; cursor:pointer; }
.cl-icon-btn:hover { color:var(--primary); border-color:#93dabe; background:#f3fcf7; }
.cl-question-card textarea { width:100%; min-height:76px; box-sizing:border-box; resize:vertical; }
.cl-option-list { display:grid; gap:8px; margin-top:12px; }
.cl-option { display:flex; align-items:center; gap:8px; }
.cl-option input[type="radio"] { accent-color:var(--primary); }
.cl-option input[type="text"] { flex:1; }
.cl-explanation { display:block; margin-top:13px; padding:10px 12px; border-radius:10px; color:#4d665d; background:#f6fbf8; font-size:.82rem; line-height:1.55; }
.cl-explanation strong { color:var(--primary-deep); }
.cl-explanation textarea { display:block; margin-top:7px; min-height:82px; font:inherit; color:var(--text-main); background:#fff; }
.cl-review-bottom { position:sticky; bottom:12px; display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:18px; padding:12px 14px; border:1px solid var(--border-color); border-radius:14px; background:rgba(255,255,255,.94); box-shadow:var(--shadow-md); backdrop-filter:blur(8px); }
.cl-review-bottom span { color:var(--text-muted); font-size:.82rem; font-weight:700; }
.cl-edit-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px 14px; margin:0 0 16px; border:1px solid #cdeee0; border-radius:13px; color:#316655; background:#f4fcf8; font-size:.82rem; font-weight:700; }
.cl-edit-toolbar span { display:inline-flex; align-items:center; gap:7px; }
.cl-edit-toolbar span i { color:var(--primary); font-size:1.05rem; }
.cl-edit-intro { padding:20px 22px; margin-bottom:20px; }
.cl-edit-section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:17px; }
.cl-edit-section-heading h3 { margin:9px 0 0; font-size:1.08rem; }
.cl-edit-section-note { color:var(--primary-deep); font-size:.78rem; font-weight:800; }
.cl-edit-meta-grid { display:grid; grid-template-columns:1fr; gap:15px; }
.cl-edit-meta-grid textarea { min-height:92px; resize:vertical; }
.cl-edit-context { margin:14px 0 0; color:var(--text-muted); font-size:.84rem; }
.cl-edit-questions-head { display:flex; align-items:end; justify-content:space-between; gap:12px; margin:0 0 12px; }
.cl-edit-questions-head h3 { margin:0 0 3px; font-size:1.12rem; }
.cl-edit-questions-head p { margin:0; color:var(--text-muted); font-size:.83rem; }
.cl-edit-questions-head > span { padding:5px 9px; border-radius:99px; color:var(--primary-deep); background:var(--primary-light); font-size:.78rem; font-weight:800; }
.cl-edit-bottom { display:flex; justify-content:flex-end; gap:9px; margin-top:18px; padding:12px 0; }
.cl-detail-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:22px; margin-bottom:16px; }
.cl-detail-head > div:first-child { min-width:0; flex:1 1 auto; }
.cl-detail-head h2 { margin:10px 0 4px; font-size:1.38rem; }
.cl-detail-head p { margin:0; color:var(--text-muted); }
.cl-detail-description { max-width:760px; margin:2px 0 10px !important; color:var(--text-secondary) !important; font-size:.98rem; line-height:1.58; }
.cl-detail-edit-btn { color:var(--primary-deep); border-color:#a7dfca; background:var(--primary-light); }
.cl-detail-edit-modal { position:fixed; z-index:10000; inset:0; display:grid; place-items:center; padding:20px; background:rgba(15,23,42,.58); backdrop-filter:blur(3px); }
.cl-detail-edit-dialog { width:min(560px,100%); overflow:hidden; border:1px solid rgba(255,255,255,.7); border-radius:18px; background:var(--bg-card); box-shadow:0 22px 70px rgba(15,23,42,.28); }
.cl-detail-edit-dialog-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:20px 22px; border-bottom:1px solid var(--border-color); background:#f8fbfa; }
.cl-detail-edit-dialog-head h3 { margin:10px 0 0; font-size:1.18rem; }
.cl-modal-close { display:grid; width:34px; height:34px; place-items:center; border:0; border-radius:9px; color:var(--text-muted); background:transparent; cursor:pointer; font-size:1.2rem; }
.cl-modal-close:hover { color:var(--text-main); background:var(--bg-light); }
.cl-detail-edit-form { display:grid; gap:15px; padding:22px; }
.cl-detail-edit-form label { display:grid; gap:6px; color:var(--text-secondary); font-size:.8rem; font-weight:800; }
.cl-detail-edit-form input,
.cl-detail-edit-form textarea { width:100%; box-sizing:border-box; }
.cl-detail-edit-form textarea { min-height:120px; resize:vertical; }
.cl-detail-edit-dialog-actions { display:flex; justify-content:flex-end; gap:9px; padding:0 22px 22px; }
.cl-detail-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.cl-export-btn { min-height:42px; font-weight:800; }
.cl-export-btn.word { color:var(--export-word); border-color:var(--export-word-border); background:var(--export-word-bg); }
.cl-export-btn.word:hover { color:#fff; border-color:var(--export-word); background:var(--export-word); }
.cl-export-btn:disabled { opacity:.7; cursor:wait; }
.cl-detail-indicators { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.cl-detail-indicators span { padding:3px 8px; border-radius:99px; color:var(--primary-deep); background:var(--primary-light); font-size:.73rem; font-weight:800; }
.cl-detail-list { display:grid; gap:13px; }
.cl-detail-question { padding:20px; }
.cl-detail-prompt { margin:0; color:var(--text-main); font-size:1rem; font-weight:700; line-height:1.62; }
.cl-detail-options { display:grid; gap:7px; margin:15px 0; padding:0; list-style:none; counter-reset:option; }
.cl-detail-options li { display:flex; gap:9px; align-items:flex-start; padding:9px 11px; border:1px solid var(--border-color); border-radius:9px; color:var(--text-secondary); font-size:.88rem; line-height:1.5; }
.cl-detail-options li::before { display:grid; width:20px; height:20px; flex:0 0 auto; place-items:center; border-radius:50%; color:var(--text-muted); background:var(--bg-light); content:counter(option, upper-alpha); counter-increment:option; font-size:.71rem; font-weight:800; }
.cl-detail-options li.correct { border-color:#a1ddc5; color:var(--primary-deep); background:#f2fcf7; font-weight:700; }
.cl-detail-options li.correct::before { color:#fff; background:var(--primary); }
.cl-detail-answer { margin-top:14px; padding:10px 12px; border-radius:10px; color:var(--primary-deep); background:var(--primary-light); font-size:.85rem; }
.cl-detail-explanation { margin:9px 0 0; color:var(--text-muted); font-size:.83rem; line-height:1.58; }
.cl-detail-danger { display:flex; justify-content:flex-end; margin-top:20px; }
.cl-detail-danger .btn { color:#b5473c; border-color:#f0c8c3; background:#fffafa; }
.cl-danger-btn { color:#b5473c; border-color:#f0c8c3; background:#fffafa; }
.cl-danger-btn:hover { color:#fff; border-color:#b5473c; background:#b5473c; }

@media (max-width:768px) {
  .cl-hero { min-height:auto; padding:22px 19px; margin:-2px -2px 16px; }
  .cl-create-grid { grid-template-columns:1fr; }
  .cl-create-card { min-height:0; padding:17px; }
  .cl-create-icon { float:left; width:42px; height:42px; margin:0 13px 0 0; }
  .cl-create-card p { min-height:37px; }
  .cl-form-card { padding:18px; }
  .cl-library-toolbar { grid-template-columns:1fr; }
  .cl-library-tabs { justify-content:flex-start; overflow-x:auto; flex-wrap:nowrap; padding-bottom:2px; }
  .cl-library-tab { flex:0 0 auto; }
  .cl-form-grid { grid-template-columns:1fr; }
  .cl-field.full { grid-column:auto; }
  .cl-stepper { gap:5px; }
  .cl-step { justify-content:center; padding:8px; font-size:0; }
  .cl-step b { font-size:.72rem; }
  .cl-wizard-top { align-items:flex-start; }
  .cl-wizard-top .btn span { display:none; }
  .cl-review-head { flex-direction:column; padding:18px; }
  .cl-review-bottom { align-items:flex-start; flex-direction:column; }
  .cl-review-bottom .cl-actions { width:100%; margin:0; }
  .cl-review-bottom .btn { flex:1; justify-content:center; }
  .cl-edit-toolbar { align-items:flex-start; flex-direction:column; }
  .cl-edit-toolbar .btn { width:100%; justify-content:center; }
  .cl-edit-intro { padding:18px; }
  .cl-edit-meta-grid { grid-template-columns:1fr; }
  .cl-edit-bottom { position:sticky; bottom:8px; z-index:2; padding:10px; margin:14px -2px 0; border:1px solid var(--border-color); border-radius:13px; background:rgba(255,255,255,.94); box-shadow:var(--shadow-md); backdrop-filter:blur(8px); }
  .cl-edit-bottom .btn { flex:1; justify-content:center; }
  .cl-detail-head { flex-direction:column; padding:18px; }
  .cl-detail-actions { width:100%; }
  .cl-detail-actions .btn { flex:1; justify-content:center; }
  .cl-detail-question { padding:17px; }
  .cl-plan-grid,.cl-worksheet-grid { grid-template-columns:1fr; }
  .cl-plan-meta-edit { grid-template-columns:1fr; }
  .cl-plan-meta-edit .full { grid-column:auto; }
  .cl-worksheet-format-card { grid-template-columns:1fr; }
  .cl-worksheet-options-head { flex-direction:column; }
  .cl-worksheet-guide-badge { align-self:flex-start; }
  .cl-plan-wide { grid-column:auto; }
  .cl-worksheet-wide { grid-column:auto; }
  .cl-plan-edit-grid { grid-template-columns:1fr; }
  .cl-plan-detail-head,.cl-plan-next,.cl-plan-section-head { align-items:flex-start; flex-direction:column; }
  .cl-plan-detail-head .cl-detail-actions,.cl-plan-next > .btn { width:100%; }
  .cl-plan-detail-head .cl-detail-actions .btn,.cl-plan-next > .btn { justify-content:center; }
  .cl-plan-detail-grid { grid-template-columns:1fr; }
  .cl-plan-section-actions { width:100%; justify-content:flex-start; }
  .cl-plan-section-actions .btn { flex:1; justify-content:center; }
  .cl-indicator-table-head { display:none; }
  .cl-indicator-table { border-left:0; border-right:0; border-radius:0; }
  .cl-indicator-row { grid-template-columns:24px minmax(0,1fr); gap:4px 10px; padding:12px 4px; font-size:.83rem; }
  .cl-indicator-row input { grid-row:1 / span 2; width:19px; height:19px; }
  .cl-indicator-row strong { grid-column:2; }
  .cl-indicator-row > span { grid-column:2; color:var(--text-secondary); font-size:.8rem; }
}
/* Printable worksheet content; teacher controls remain outside the student sheet. */
.cl-student-sheet { max-width: 794px; margin: 0 auto; padding: 28px; background: var(--bg-card); color: var(--text-main); font-family: 'Sarabun',sans-serif; }
.cl-student-sheet header { text-align:center; border-bottom:2px solid var(--border-color); padding-bottom:18px; }
.cl-student-sheet p,.cl-sheet-key p { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.7; }
.cl-sheet-block { margin:24px 0; break-inside:avoid; }
.cl-sheet-block h3 { font-size:18px; margin-bottom:8px; }
.cl-sheet-table-scroll { overflow-x:auto; }
.cl-student-sheet table { width:100%; table-layout:fixed; border-collapse:collapse; }
.cl-student-sheet th,.cl-student-sheet td { border:1px solid var(--text-muted); padding:10px; vertical-align:top; overflow-wrap:anywhere; }
.cl-student-sheet th { background:var(--bg-light); }
.cl-sheet-answer-line { height:32px; border-bottom:1px dotted var(--text-muted); }
.cl-sheet-matching table { margin-bottom:8px; }
.cl-sheet-matching th,.cl-sheet-matching td { width:33.333%; }
.cl-sheet-match-blank { min-height:24px; border-bottom:1px dotted var(--text-muted); }
.cl-sheet-matching small { color:var(--text-muted); }
.cl-sheet-drawing-item { margin:18px 0 26px; break-inside:avoid; }
.cl-sheet-drawing-item h4 { margin:0 0 10px; font-size:1rem; }
.cl-sheet-drawing-box { min-height:190px; border:2px dashed var(--text-muted); border-radius:10px; background:var(--bg-light); margin-bottom:12px; }
.cl-sheet-field-line { display:flex; align-items:end; gap:8px; min-height:34px; }
.cl-sheet-field-line span { flex:0 0 auto; }
.cl-sheet-field-line i { flex:1; height:22px; border-bottom:1px dotted var(--text-muted); }
.cl-sheet-key { margin:24px auto 0; max-width:794px; padding:20px; border:1px solid var(--border-color); border-radius:12px; }
.cl-sheet-key summary { cursor:pointer; color:var(--primary-deep); font-weight:700; }
.cl-sheet-edit { display:grid; gap:16px; padding:20px; border:1px solid var(--border-color); border-radius:12px; }
@media(max-width:600px) { .cl-student-sheet { padding:8px; } .cl-student-sheet th,.cl-student-sheet td { padding:6px; font-size:14px; } }
.cl-worksheet-detail .cl-detail-actions { display:flex; flex-wrap:wrap; gap:10px; }
.cl-worksheet-detail .cl-detail-actions .btn { white-space:nowrap; flex-shrink:0; }
@media(max-width:600px) { .cl-worksheet-detail .cl-plan-detail-head { display:block; } .cl-worksheet-detail .cl-detail-actions { margin-top:16px; } }
