/* ============================================================
   Baht Busters — worksheets (screen chrome + A4 print)
   One .sheet-page = one A4 sheet, exactly 10 questions.
   ============================================================ */

/* ---------- screen chrome (hidden when printing) ---------- */
.ws-menu {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: rgba(255, 248, 236, .94); backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--ink); flex-wrap: wrap;
}
.ws-menu .logo { font-size: 20px; font-weight: 900; }
.ws-menu nav { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-menu a.mlink {
  text-decoration: none; color: var(--ink); font-weight: 800; font-size: 14.5px;
  border: 2.5px solid var(--ink); border-radius: 999px; padding: 6px 14px; background: #fff;
  box-shadow: 0 3px 0 rgba(38,36,58,.85); transition: transform .06s ease, box-shadow .06s ease, background .15s;
}
.ws-menu a.mlink:hover { background: #fff3c9; }
.ws-menu a.mlink.on { background: var(--teal); color: #fff; }

.printbar {
  max-width: 214mm; margin: 16px auto 0; padding: 0 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.printbar .grow { flex: 1; font-weight: 900; font-size: 17px; min-width: 200px; }

/* ---------- A4 sheet (screen preview) ---------- */
.sheet-page {
  width: 210mm; min-height: 296mm; margin: 18px auto;
  background: #fff; border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 8px 0 rgba(38,36,58,.85);
  padding: 9mm 10mm; display: flex; flex-direction: column;
}

.ws-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 3px solid var(--ink); padding-bottom: 7px; margin-bottom: 12px; flex-wrap: wrap; }
.ws-title { font-weight: 900; font-size: 20px; letter-spacing: .3px; }
.ws-meta span { font-weight: 800; font-size: 12.5px; margin-left: 20px; opacity: .85; }

.page-heading {
  background: #fff3c9; border: 2.5px solid var(--ink); border-radius: 12px;
  padding: 6px 14px; font-size: 16px; display: inline-block; margin: 0 0 12px;
}

/* ---------- questions ---------- */
.qs { list-style: none; margin: 0; padding: 0; flex: 1; }
.q { display: flex; gap: 8px; padding: 7.5px 0; border-bottom: 1.5px dashed #ddd3bd; break-inside: avoid; page-break-inside: avoid; }
.q:last-child { border-bottom: none; }
.qnum { font-weight: 900; font-size: 14.5px; min-width: 26px; color: #b3541e; padding-top: 2px; }
.q-body { flex: 1; min-width: 0; }

.q-text { margin: 2px 0; font-size: 13.5px; font-weight: 700; line-height: 1.5; }
.q-text.wp { line-height: 1.55; }
.hint { opacity: .6; font-size: 12px; }

.qi-emoji { font-size: 26px; margin-right: 6px; vertical-align: -4px; }
.qi-emoji.big { font-size: 34px; display: block; line-height: 1.15; }
.q-item { font-size: 15px; font-weight: 900; margin-bottom: 5px; }

.opts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.opt {
  border: 2.5px solid var(--ink); border-radius: 12px; padding: 6px 14px;
  font-weight: 800; font-size: 13.5px; background: #fffdf5; display: inline-flex; align-items: center; gap: 7px;
}
.opt-circle { width: 62px; height: 62px; border-radius: 50%; justify-content: center; font-size: 15.5px; padding: 0; }
.opt-tf { width: 42px; height: 42px; border-radius: 50%; justify-content: center; font-size: 18px; padding: 0; }
.opts-mcq { gap: 8px 10px; }

.cmp { display: flex; align-items: stretch; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.opt-cmp { flex-direction: column; text-align: center; min-width: 132px; padding: 10px 16px; gap: 2px; font-size: 14.5px; }
.vs { align-self: center; font-weight: 900; font-size: 18px; color: #b3541e; }

.blank-num {
  display: inline-block; min-width: 86px; height: 30px; margin-left: 6px;
  border: 2.5px solid var(--ink); border-radius: 10px; background: #fffdf5;
  vertical-align: middle; text-align: center; line-height: 24px; font-weight: 900; color: #b3541e;
}
.uline { display: inline-block; width: 160px; border-bottom: 2.5px solid var(--ink); height: 17px; vertical-align: bottom; }
.uline.long { width: 300px; max-width: 60vw; }

.write-row { font-size: 13.5px; font-weight: 800; margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.answer-line { margin-top: 5px; font-size: 13.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.order-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 30px; font-size: 13.5px; font-weight: 800; }
.order-list li { display: flex; align-items: center; gap: 9px; }
.numbox { width: 26px; height: 26px; border: 2.5px solid var(--ink); border-radius: 8px; flex: none; background: #fffdf5; }

/* ---------- price list box (grade 4) ---------- */
.pricelist { border: 2.5px solid var(--ink); border-radius: 12px; background: #f2fbff; padding: 8px 12px 6px; margin-bottom: 10px; }
.pricelist b { font-size: 13.5px; }
.pricelist table { width: 100%; border-collapse: collapse; font-size: 12px; font-weight: 700; margin-top: 4px; }
.pricelist td { padding: 2.5px 6px; border-bottom: 1px dashed #cfe3ea; }
.pl-price { text-align: right; font-weight: 900; white-space: nowrap; width: 70px; }

/* ---------- footer ---------- */
.ws-foot { margin-top: auto; padding-top: 8px; text-align: center; font-size: 11px; font-weight: 700; opacity: .6; border-top: 2px dashed #e0d7c3; }

/* ---------- teacher key tables ---------- */
.ref-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-weight: 700; margin-bottom: 12px; }
.ref-table td { padding: 4px 8px; border-bottom: 1.5px dashed #e0d7c3; }
.ref-table .thai { opacity: .65; width: 130px; }

.key-note { font-size: 12.5px; font-weight: 700; line-height: 1.55; background: #fff3c9; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 14px; }

.key-table { width: 100%; border-collapse: collapse; font-size: 12px; font-weight: 700; }
.key-table th, .key-table td { text-align: left; padding: 5.5px 8px; border-bottom: 1.5px dashed #e0d7c3; vertical-align: top; line-height: 1.4; }
.key-table thead th { background: #fff3c9; border-bottom: 2.5px solid var(--ink); font-size: 12.5px; }
.key-table .qn { width: 34px; font-weight: 900; color: #b3541e; }
.key-table .qa { font-weight: 900; color: #1e7d43; }

/* ---------- hub page (worksheets index) ---------- */
.ws-hero { text-align: center; padding: 34px 16px 26px; margin-top: 14px; border: 3px solid var(--ink); border-radius: 28px; box-shadow: var(--shadow); background: linear-gradient(150deg, #fffdf5, #e9fbf7 60%, #fff3c9); }
.ws-hero h1 { font-size: clamp(30px, 5.4vw, 48px); margin-bottom: 6px; }
.ws-hero p { max-width: 620px; margin: 0 auto; font-weight: 700; opacity: .8; }

.grade-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.grade-card { text-align: center; padding: 24px 16px; transition: transform .1s ease; display: block; text-decoration: none; color: var(--ink); }
.grade-card:hover { transform: translateY(-5px) rotate(-.6deg); background: #fffdf5; }
.grade-card .g-emoji { font-size: 44px; }
.grade-card h3 { margin: 8px 0 2px; }
.grade-card p { font-weight: 700; opacity: .72; font-size: 14.5px; min-height: 40px; }
.grade-card .go { display: inline-block; margin-top: 10px; font-weight: 900; background: #fff3c9; border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 16px; }
.key-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: #eefaff; padding: 18px 22px; }
.key-banner h3 { margin: 0; font-size: 20px; }

/* ---------- print: A4, one sheet per page ---------- */
@page { size: A4; margin: 10mm 11mm; }
@media print {
  body { background: #fff !important; }
  .no-print, .ws-menu, .printbar { display: none !important; }
  .sheet-page {
    width: auto; min-height: 0; margin: 0; padding: 0;
    border: none; border-radius: 0; box-shadow: none;
    break-after: page; page-break-after: always;
  }
  .sheet-page:last-child { break-after: auto; page-break-after: auto; }
  .q, .pricelist, tr { break-inside: avoid; page-break-inside: avoid; }
}
