/* รายการข้อสอบวิชาไวยากรณ์สำหรับใช้สอบจริง (/page/exam_blank/)
   ออกแบบใหม่ ๘ ต.ค. ๒๕๖๙ ให้เข้าชุดกับ /exam-bank: พื้นสว่าง ธีมคราม #4f46e5 · ฟอนต์ Sarabun
   แถบย้อนกลับลอกหน้าตาจาก app/css/exam-bank/shell.css (.eb-backbar) — ไม่ได้ include ไฟล์ของ thunder
   ⚠ ไฟล์นี้เป็นพื้นฐานของ /page/exam_tutor/ ด้วย (ตัวแปร --eb-* · .eb-backbar · .eb-head · .eb-btn · สถานะโหลด/ผิดพลาด)
   แก้แล้วต้องดูทั้งสองหน้า และขยับ $version ทั้งสองหน้า */
@font-face {
	font-family: 'THSarabunPali';
	src: url('/assets/fonts/THSarabunPali.ttf') format('truetype');
	font-display: swap;
}

:root {
	--eb-primary: #4f46e5;
	--eb-primary-dim: #4338ca;
	--eb-primary-soft: #e0e7ff;
	--eb-primary-wash: #eef2ff;
	--eb-essay: #0f766e;          /* อัตนัย = เขียวน้ำทะเล แยกจากเติมคำ (คราม) */
	--eb-essay-dim: #115e59;
	--eb-essay-wash: #f0fdfa;
	--eb-ink: #1e293b;
	--eb-ink-soft: #475569;
	--eb-ink-muted: #64748b;
	--eb-line: #e2e8f0;
	--eb-line-strong: #cbd5e1;
	--eb-surface: #f8fafc;
	--eb-surface-2: #f1f5f9;
	--eb-error: #b91c1c;
	--eb-error-soft: #fef2f2;
	/* ชื่อเดิมที่หน้า exam_tutor ยังอ้างถึง */
	--eb-text: var(--eb-ink);
	--eb-text-soft: var(--eb-ink-soft);
	--eb-answer: var(--eb-primary-dim);
	--eb-answer-soft: var(--eb-primary-wash);
	font-size: 16px;
}

[v-cloak] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }

::selection { background: #c7d2fe; color: var(--eb-ink); }

.eb-body {
	margin: 0;
	background: var(--eb-surface);
	color: var(--eb-ink);
	font-family: 'Sarabun', system-ui, sans-serif;
	font-size: 1rem;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; }

/* ── แถบย้อนกลับ (หน้าตาเดียวกับ .eb-backbar ของ /exam-bank) ── */
.eb-backbar { background: rgba(255, 255, 255, .85); border-bottom: 1px solid #e0e7ff; }
.eb-backbar-inner {
	max-width: 1040px; margin: 0 auto; padding: .55rem 1rem;
	display: flex; align-items: center; gap: .75rem; min-width: 0;
}
.eb-back-link {
	display: inline-flex; align-items: center; gap: .45rem; flex-shrink: 0;
	padding: .38rem .8rem; border-radius: 999px; border: 1px solid #c7d2fe;
	background: #fff; color: var(--eb-primary); font-size: .85rem; font-weight: 700;
	text-decoration: none; transition: background-color .15s, border-color .15s;
}
.eb-back-link:hover { background: var(--eb-primary-wash); border-color: var(--eb-primary); color: var(--eb-primary); }
.eb-backbar-sub { min-width: 0; color: var(--eb-ink-soft); font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.eb-shell { max-width: 1040px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }

/* ── หัวหน้า: h1 คำเน้นสีเดียว + บรรทัดเดียว (แบบ .gq-head) ── */
.eb-head { margin: .3rem 0 1.1rem; }
.eb-head h1 { margin: 0; font-size: clamp(1.5rem, 4.4vw, 2rem); font-weight: 800; line-height: 1.25; color: var(--eb-ink); letter-spacing: -.01em; }
.eb-head h1 span { color: var(--eb-primary); margin-left: .3rem; }
.eb-head p { margin: .3rem 0 0; max-width: 62rem; font-size: .9rem; color: var(--eb-ink-soft); line-height: 1.6; }
.eb-head p strong { color: var(--eb-ink); font-weight: 600; }

/* ── พื้นผิวหลัก ── */
.eb-exam-panel {
	background: #fff;
	border: 1px solid var(--eb-line);
	border-radius: 16px;
	padding: .35rem 1.1rem;
	margin-bottom: 1rem;
}

/* คำอธิบายแบบข้อสอบ ๒ แบบ — สีเดียวกับกลุ่มปุ่มในแต่ละแถว */
.eb-legend {
	display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.1rem;
	padding: .65rem 0 .7rem;
	border-bottom: 1px solid var(--eb-line);
	font-size: .82rem; color: var(--eb-ink-soft);
}
.eb-legend-item { display: inline-flex; align-items: baseline; gap: .35rem; }
.eb-legend-item::before { content: ''; flex: none; width: .55rem; height: .55rem; border-radius: 3px; align-self: center; background: var(--eb-primary); }
.eb-legend-item.is-essay::before { background: var(--eb-essay); }
.eb-legend-item b { color: var(--eb-ink); font-weight: 700; }
.eb-set-count {
	margin-left: auto; padding: .1rem .6rem; border-radius: 999px;
	background: var(--eb-surface-2); color: var(--eb-ink-soft);
	font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ── รายการข้อสอบ ── */
.eb-exam-list { list-style: none; margin: 0; padding: 0; }

.eb-exam-row {
	display: grid;
	grid-template-columns: 2rem minmax(0, 1fr) auto;
	align-items: center;
	gap: .5rem .85rem;
	padding: .8rem 0;
	border-bottom: 1px solid var(--eb-line);
}
.eb-exam-row:last-child { border-bottom: none; }

.eb-exam-no {
	width: 2rem; height: 2rem;
	display: grid; place-items: center;
	background: var(--eb-primary-wash); color: var(--eb-primary);
	border-radius: 9px;
	font-size: .95rem; font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.eb-exam-content { min-width: 0; }
.eb-exam-content h3 { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.35; color: var(--eb-ink); }
.eb-exam-meta { margin: .05rem 0 0; color: var(--eb-ink-muted); font-size: .8rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
.eb-nowrap { white-space: nowrap; }

.eb-downloads { display: flex; align-items: stretch; gap: .5rem; min-width: 0; }

/* กลุ่มปุ่มต่อแบบข้อสอบ: ป้าย (เติมคำ/อัตนัย + คะแนน) · ข้อสอบ = ปุ่มหลักสีทึบ · เฉลย = ปุ่มรองขอบบาง */
.eb-dl-group {
	--g: var(--eb-primary);
	--g-dim: var(--eb-primary-dim);
	--g-wash: var(--eb-primary-wash);
	display: flex; align-items: center; gap: .55rem;
	min-width: 0;
	padding: .3rem .3rem .3rem .65rem;
	border: 1px solid var(--eb-line);
	border-left: 3px solid var(--g);
	border-radius: 12px;
	background: var(--eb-surface);
}
.eb-dl-group.is-essay { --g: var(--eb-essay); --g-dim: var(--eb-essay-dim); --g-wash: var(--eb-essay-wash); }

.eb-dl-label { display: grid; min-width: 4.6rem; line-height: 1.2; }
.eb-dl-label b { font-size: .84rem; font-weight: 800; color: var(--g); }
.eb-dl-label small { font-size: .72rem; color: var(--eb-ink-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.eb-dl-btns { display: flex; align-items: center; gap: .3rem; }

.eb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .4rem;
	min-height: 2.25rem;
	padding: .35rem .8rem;
	border: 1px solid transparent;
	border-radius: 10px;
	font-size: .86rem;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}

/* ปุ่มหลัก (ใบสอบ) */
.eb-btn-question, .eb-btn-essay { background: var(--g, var(--eb-primary)); color: #fff; }
.eb-btn-question:hover:not(:disabled), .eb-btn-essay:hover:not(:disabled) { background: var(--g-dim, var(--eb-primary-dim)); }
/* ปุ่มรอง (เฉลย) */
.eb-btn-answer, .eb-btn-essay-answer { background: #fff; color: var(--g, var(--eb-primary)); border-color: var(--eb-line-strong); }
.eb-btn-answer:hover:not(:disabled), .eb-btn-essay-answer:hover:not(:disabled) { background: var(--g-wash, var(--eb-primary-wash)); border-color: var(--g, var(--eb-primary)); }
.eb-btn-outline { background: #fff; color: var(--eb-primary); border-color: #c7d2fe; }
.eb-btn-outline:hover:not(:disabled) { background: var(--eb-primary-wash); border-color: var(--eb-primary); }

.eb-btn:focus-visible,
.eb-back-link:focus-visible {
	outline: 3px solid #a5b4fc;
	outline-offset: 2px;
}

.eb-btn:active:not(:disabled) { box-shadow: inset 0 2px 4px rgba(15, 23, 42, .18); }
.eb-btn:disabled { opacity: .5; cursor: wait; }

/* ── โหลด / ว่าง / ผิดพลาด ── */
.eb-skeletons { display: grid; gap: .5rem; padding: .8rem 0; }

.eb-skeleton {
	height: 3.4rem;
	border-radius: 12px;
	background: var(--eb-surface-2);
	overflow: hidden;
	position: relative;
}

.eb-skeleton::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, .75) 45%, transparent 65%);
	transform: translateX(-100%);
	animation: eb-loading 1.4s ease-in-out infinite;
}

@keyframes eb-loading { to { transform: translateX(100%); } }

.eb-state {
	display: flex;
	align-items: center;
	gap: .7rem;
	margin: .8rem 0;
	padding: .9rem 1rem;
	background: var(--eb-primary-wash);
	border-radius: 12px;
	color: var(--eb-primary-dim);
}

.eb-state > i { font-size: 1.3rem; }
.eb-state div { flex: 1; min-width: 0; }
.eb-state strong, .eb-state span { display: block; }
.eb-state span { font-size: .84rem; line-height: 1.6; }
.eb-state-error { background: var(--eb-error-soft); color: var(--eb-error); }

.eb-footnote {
	display: flex;
	align-items: flex-start;
	gap: .45rem;
	max-width: 78ch;
	margin: .4rem auto 0;
	color: var(--eb-ink-muted);
	font-size: .78rem;
	line-height: 1.6;
}

.eb-footnote i { margin-top: .25em; color: var(--eb-primary); }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* จอกลาง: กลุ่มปุ่มลงไปบรรทัดล่างใต้ชื่อหัวข้อ เรียงคู่กัน */
@media (max-width: 860px) {
	.eb-exam-row { grid-template-columns: 2rem minmax(0, 1fr); }
	.eb-downloads { grid-column: 2; display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
	.eb-dl-group { justify-content: space-between; }
}

/* มือถือ: ปุ่มกว้างเต็มกลุ่ม แตะง่าย */
@media (max-width: 560px) {
	.eb-backbar-inner { padding: .5rem .75rem; }
	.eb-shell { padding: 1rem .75rem 2rem; }
	.eb-exam-panel { padding: .2rem .8rem; border-radius: 14px; }
	.eb-legend { gap: .25rem .8rem; }
	.eb-set-count { display: none; }
	.eb-exam-row { gap: .5rem .65rem; padding: .75rem 0; }
	.eb-downloads { grid-column: 1 / -1; grid-template-columns: 1fr; gap: .4rem; }
	/* ป้ายซ้ายยืดได้ ปุ่มกว้างคงที่ — ปุ่มของเติมคำกับอัตนัยตรงคอลัมน์กัน */
	.eb-dl-group { display: grid; grid-template-columns: minmax(0, 1fr) 11.25rem; gap: .4rem; padding-left: .55rem; }
	.eb-dl-label { min-width: 0; }
	.eb-dl-label small { white-space: normal; }
	.eb-dl-btns { display: grid; grid-template-columns: 1fr 1fr; }
	.eb-btn { min-height: 2.5rem; padding-inline: .5rem; }
}

@media print { .no-print { display: none !important; } }
