/* Scratch HKICO — ปรับโทนครูผึ้ง (เสริมจาก /assets/portal.css ของเว็บหลัก) */
.scr-app{
  --honey:#F0A500; --honey-dark:#C97E00; --comb:#3A2315; --cream:#FFFBF0;
  --card:#FFFFFF; --line:#EEE2C8; --ink:#3A2315; --ink-muted:#8A7A5C;
  --green:#1C6B3F; --green-bg:#E4F5EA; --red:#B3261E; --red-bg:#FBE7E2;
  padding-block:18px 56px;
}
.scr-app, .scr-app *{box-sizing:border-box;}
.scr-app{font-family:'Sarabun',system-ui,sans-serif; color:var(--ink);}
.scr-app h1,.scr-app h2,.scr-app h3{font-family:'Kanit',sans-serif;}
.scr-app a{color:inherit;}

/* ---- hero banner (เหมือนหัวการ์ด ครูผึ้งพาฝึก TOI-Zero) ---- */
.scr-hero{
  background:linear-gradient(135deg,#FFD24A,#F0A500); border-radius:20px; padding:18px 20px;
  margin-bottom:16px; color:#3A2315; box-shadow:0 6px 18px rgba(201,126,0,.25);
}
.scr-hero-top{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap;}
.scr-hero-id{display:flex; align-items:center; gap:12px; min-width:0;}
@keyframes scrBob{0%,100%{transform:translateY(0) rotate(-3deg);}50%{transform:translateY(-5px) rotate(3deg);}}
.scr-hero-avatar{width:56px; height:56px; flex:none; background:#fff; border-radius:50%; display:flex; align-items:center; justify-content:center; box-shadow:0 2px 0 rgba(58,35,21,.25); animation:scrBob 2.6s ease-in-out infinite;}
.scr-hero-avatar svg{width:40px; height:40px;}
.scr-hero-text h1{margin:0; font-size:21px; line-height:1.25; color:#3A2315;}
.scr-hero-text p{margin:3px 0 0; font-size:12.5px; color:#6b4a28; line-height:1.5;}
.scr-hero-nav{display:flex; gap:6px; flex-wrap:wrap;}
.scr-hero-nav a{font-size:11.5px; font-weight:600; color:#3A2315; background:rgba(255,255,255,.55); border-radius:99px; padding:6px 12px; text-decoration:none; white-space:nowrap;}
.scr-hero-nav a:hover{background:#fff;}
.scr-hero-honey{display:inline-flex; align-items:center; gap:7px; background:rgba(255,255,255,.7); border-radius:14px; padding:8px 14px; margin-top:12px; font-family:'Kanit',sans-serif; font-weight:600; font-size:13px;}
.scr-hero-honey b{font-size:17px; font-variant-numeric:tabular-nums;}

/* ---- เลเวล / แถบ XP (เกมมิฟาย) ---- */
.scr-xp{display:flex; align-items:center; gap:10px; background:rgba(255,255,255,.7); border-radius:14px; padding:8px 14px; margin-top:8px; flex-wrap:wrap;}
.scr-xp-badge{font-family:'Kanit',sans-serif; font-weight:700; font-size:13px; white-space:nowrap;}
.scr-xp-bar{flex:1; min-width:90px; height:10px; background:rgba(58,35,21,.15); border-radius:99px; overflow:hidden;}
.scr-xp-fill{height:100%; background:linear-gradient(90deg,#FFE28A,#F0A500); border-radius:99px; transition:width .4s ease;}
.scr-xp-label{font-size:11px; color:#6b4a28; white-space:nowrap;}

/* ---- แถบป้ายด่าน (เลื่อนดูได้ทุกด่าน) ---- */
.scr-levels{display:flex; gap:8px; overflow-x:auto; padding:2px 2px 8px; margin-bottom:10px; -webkit-overflow-scrolling:touch;}
.scr-level{flex:none; display:flex; flex-direction:column; align-items:center; gap:3px; min-width:68px; padding:8px 10px; border-radius:12px; background:var(--card); border:1px solid var(--line); text-decoration:none; color:var(--ink-muted); font-size:10px; text-align:center; transition:transform .12s;}
.scr-level:hover{transform:translateY(-2px);}
.scr-level .n{width:22px; height:22px; border-radius:50%; background:#F4ECD8; display:flex; align-items:center; justify-content:center; font-family:'Kanit',sans-serif; font-weight:700; font-size:11px; color:var(--ink);}
.scr-level .nm{font-weight:600; max-width:72px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink);}
.scr-level .c{color:var(--ink-muted);}
.scr-level.cur{border-color:var(--honey); box-shadow:0 0 0 2px #FDE6B0;}
.scr-level.cur .n{background:var(--honey); color:#fff;}
.scr-level.done{background:#FFF6DC; border-color:var(--honey);}
.scr-level.done .n{background:var(--honey-dark); color:#fff;}
.scr-level.locked{opacity:.55;}

/* ---- top stats ---- */
.scr-stats{display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:20px;}
.scr-stat{background:var(--card); border:1px solid var(--line); border-radius:14px; padding:14px; text-align:center;}
.scr-stat b{font-family:'Kanit',sans-serif; font-size:24px; display:block; color:var(--honey-dark); font-variant-numeric:tabular-nums;}
.scr-stat span{font-size:11.5px; color:var(--ink-muted);}

/* ---- legend ---- */
.scr-legend{display:flex; flex-wrap:wrap; gap:14px; margin:4px 0 16px; font-size:11.5px; color:var(--ink-muted);}
.scr-legend span{display:inline-flex; align-items:center; gap:6px;}
.scr-legend i{width:11px; height:11px; border-radius:3px; display:inline-block;}
.scr-legend .lg-done{background:var(--honey);}
.scr-legend .lg-cur{background:#FDF2CE; border:2px solid var(--comb);}
.scr-legend .lg-open{background:#FDF2CE; border:1px solid var(--line);}
.scr-legend .lg-lock{background:#EFE7D6;}

/* ---- honeycomb overview: ตาราง 1 ก้อน ไม่แยกแถวตามหน่วย — เรียง Day 1-30 ต่อกันแนวนอน สูงสุด 8 ต่อแถว ---- */
.scr-comb{display:grid; grid-template-columns:repeat(4,1fr); gap:10px 8px; margin-bottom:4px;}
@media (min-width:480px){ .scr-comb{grid-template-columns:repeat(5,1fr);} }
@media (min-width:640px){ .scr-comb{grid-template-columns:repeat(6,1fr);} }
@media (min-width:900px){ .scr-comb{grid-template-columns:repeat(8,1fr);} }
.scr-hexwrap{position:relative; scroll-margin-top:84px;}
html{scroll-behavior:smooth;}
@keyframes scrPopIn{from{opacity:0; transform:scale(.7);}to{opacity:1; transform:scale(1);}}
.scr-hex{
  width:100%; aspect-ratio:1/0.92;
  clip-path:polygon(25% 2%,75% 2%,100% 50%,75% 98%,25% 98%,0% 50%);
  background:#FDF2CE; border:none; cursor:pointer; display:flex; flex-direction:column; align-items:center; justify-content:center;
  color:var(--ink); font-family:'Kanit',sans-serif; position:relative; padding:4px 6px; transition:transform .15s;
  animation:scrPopIn .22s ease both;
}
.scr-hex:hover{transform:translateY(-3px) scale(1.05) rotate(-1deg);}
.scr-hex:active{transform:scale(.95);}
.scr-hex .d{font-weight:700; font-size:20px;}
.scr-hex .t{font-size:10.5px; line-height:1.2; text-align:center; max-width:92%; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; color:var(--ink-muted); margin-top:2px;}
.scr-hex.done{background:var(--honey); color:#fff;}
.scr-hex.done .t{color:#fff8e6;}
.scr-hex.locked{background:#EFE7D6; color:#7f6e50; cursor:pointer;}   /* 2026-11-16: เดิม #b8a98a อ่านยาก (1.9:1) → เข้มขึ้นให้ ≥3:1 แต่ยังดูเป็นสีจาง/ล็อก */
.scr-hex.locked .d{color:#7f6e50;}
.scr-hex.locked .t{color:#7f6e50;}
.scr-hex .lock{position:absolute; top:6px; right:14px; font-size:12px;}
.scr-hex .medal{position:absolute; top:2px; right:9px; font-size:13px; filter:drop-shadow(0 1px 0 rgba(0,0,0,.15));}
.scr-hex.current{box-shadow:0 0 0 3px var(--comb) inset; animation:scrPopIn .22s ease both, scrPulse 1.8s ease-in-out .3s infinite;}
@keyframes scrPulse{0%,100%{box-shadow:0 0 0 3px var(--comb) inset;}50%{box-shadow:0 0 0 3px var(--comb) inset, 0 0 0 6px rgba(240,165,0,.35);}}
.scr-hexwrap .tag{position:absolute; top:-8px; left:50%; transform:translateX(-50%); z-index:2; background:var(--comb); color:#fff; font-size:8.5px; font-weight:700; padding:2px 8px; border-radius:99px; white-space:nowrap; pointer-events:none;}

/* ---- จุดสีบอกด่าน มุมซ้ายบนของแต่ละเหลี่ยม (กลุ่มตามหน่วย ไม่ทำให้ตารางขึ้นบรรทัดใหม่/หน้ายาว) ---- */
.scr-udot{position:absolute; top:3px; left:9px; width:7px; height:7px; border-radius:50%; z-index:2; box-shadow:0 0 0 1.5px rgba(255,255,255,.8); pointer-events:none;}

/* ---- day view ---- */
.scr-back{background:none; border:none; color:var(--ink-muted); font-size:13px; cursor:pointer; padding:0; margin-bottom:10px;}
.scr-back:hover{color:var(--ink);}
.scr-eyebrow{font-size:12px; color:var(--honey-dark); font-weight:600; text-transform:uppercase; letter-spacing:.03em;}
.scr-daytitle{font-size:21px; margin:6px 0 10px;}
.scr-blocks{display:flex; flex-wrap:wrap; gap:6px; margin-bottom:14px;}
.scr-chip{font-size:11px; padding:4px 9px; border-radius:99px; color:#fff; font-weight:600;}

.scr-tabs{display:flex; gap:4px; border-bottom:1px solid var(--line); margin-bottom:18px;}
.scr-tab{flex:1; text-align:center; padding:11px 4px; font-family:'Kanit',sans-serif; font-weight:600; font-size:13.5px; color:var(--ink-muted); background:none; border:none; cursor:pointer; border-bottom:2.5px solid transparent;}
.scr-tab.on{color:var(--honey-dark); border-color:var(--honey);}
.scr-tab .tag{display:inline-block; margin-left:5px; font-size:9.5px; padding:1px 5px; border-radius:99px; background:#F4ECD8; color:var(--ink-muted); font-weight:600;}
.scr-tab.on .tag{background:var(--honey); color:#fff;}

.scr-lesson p{font-size:15px; line-height:1.85; margin:0 0 14px; padding:14px 16px; background:var(--card); border:1px solid var(--line); border-radius:12px;}
.scr-lesson p strong{color:var(--honey-dark);}
.scr-nextbar{display:flex; justify-content:space-between; gap:10px; margin-top:18px;}

.btn{font-family:'Kanit',sans-serif; font-weight:600; font-size:13.5px; padding:10px 18px; border-radius:10px; border:1px solid var(--line); background:var(--card); color:var(--ink); cursor:pointer;}
.btn.primary{background:var(--honey); color:#fff; border-color:var(--honey-dark);}
.btn:disabled{opacity:.4;}

.scr-q{background:var(--card); border:1px solid var(--line); border-radius:14px; padding:18px; margin-bottom:14px;}
.scr-q .num{font-family:'Kanit',sans-serif; font-size:12px; color:var(--ink-muted); font-weight:600;}
.scr-q p.text{font-size:15.5px; font-weight:600; line-height:1.5; margin:8px 0 14px;}
.scr-choice{display:flex; gap:10px; align-items:flex-start; width:100%; text-align:left; padding:11px 13px; margin-bottom:8px; border-radius:10px; border:1.5px solid var(--line); background:var(--cream); cursor:pointer; font-size:14px; line-height:1.5; color:var(--ink);}
.scr-choice .ltr{width:22px; height:22px; border-radius:50%; background:#F4ECD8; flex:none; display:flex; align-items:center; justify-content:center; font-size:11.5px; font-weight:700; font-family:'Kanit',sans-serif;}
.scr-choice.correct{background:var(--green-bg); border-color:var(--green);}
.scr-choice.correct .ltr{background:var(--green); color:#fff;}
.scr-choice.wrong{background:var(--red-bg); border-color:var(--red);}
.scr-choice.wrong .ltr{background:var(--red); color:#fff;}
.scr-explain{margin-top:8px; padding:11px 13px; border-radius:10px; background:#F8F1DC; font-size:13.5px; line-height:1.6; color:var(--ink-muted);}
.scr-quizsum{background:var(--card); border:1px solid var(--honey); border-radius:14px; padding:20px; text-align:center; margin-bottom:16px;}
.scr-quizsum .sc{font-family:'Kanit',sans-serif; font-size:36px; font-weight:700; color:var(--honey-dark);}

.scr-proj{background:var(--card); border:1px solid var(--line); border-radius:14px; padding:18px;}
.scr-proj h3{font-size:17px; margin:0 0 4px;}
.scr-proj .goal{font-size:13.5px; color:var(--ink-muted); margin:0 0 14px;}
.scr-label{font-family:'Kanit',sans-serif; font-size:12px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; color:var(--ink-muted); margin:14px 0 8px;}
.scr-steps{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px;}
.scr-steps li{display:flex; gap:10px; font-size:14px; line-height:1.6; padding:10px 12px; background:var(--cream); border:1px solid var(--line); border-radius:10px;}
.scr-steps .n{font-family:'Kanit',sans-serif; font-weight:700; font-size:11.5px; color:#fff; background:var(--honey); width:20px; height:20px; border-radius:50%; flex:none; display:flex; align-items:center; justify-content:center;}
.scr-used{display:flex; flex-wrap:wrap; gap:6px;}
.scr-check{display:flex; gap:10px; align-items:flex-start; font-size:14px; line-height:1.5; cursor:pointer; padding:9px 10px; border-radius:9px;}
.scr-check:hover{background:#FBF6E5;}
.scr-check input{margin-top:3px; width:16px; height:16px; accent-color:var(--honey);}
.scr-check.on span{color:var(--ink-muted); text-decoration:line-through;}

/* ---- locked / paywall ---- */
.scr-gate{background:linear-gradient(180deg,#FFF6DC,#FFEFC2); border:1px solid #F3DD98; border-radius:16px; padding:26px 20px; text-align:center;}
.scr-gate .pot{font-size:40px; margin-bottom:8px;}
.scr-gate h2{margin:0 0 6px; font-size:19px;}
.scr-gate p{font-size:14px; color:var(--ink-muted); line-height:1.6; margin:0 0 16px;}
.scr-gate .btn.primary{display:inline-block; text-decoration:none;}

/* ---- toast: ได้นาทีหน้าจอ ---- */
.scr-toast{
  position:fixed; left:50%; bottom:18px; transform:translate(-50%,16px);
  z-index:9999; background:var(--comb); color:#FFF6DC;
  border:1px solid var(--honey-dark); border-radius:14px; padding:12px 18px;
  font-size:13.5px; line-height:1.5; text-align:center; box-shadow:0 8px 24px rgba(0,0,0,.25);
  opacity:0; transition:opacity .25s, transform .25s; max-width:90vw;
}
.scr-toast.show{opacity:1; transform:translate(-50%,0);}
.scr-toast b{color:var(--honey); font-family:'Kanit',sans-serif;}
.scr-toast-bal{display:block; font-size:11px; color:#D8C79A; margin-top:3px;}
.scr-toast .spark{position:absolute; bottom:4px; font-size:14px; opacity:0; animation:scrSpark 1.1s ease-in forwards; pointer-events:none;}
@keyframes scrSpark{0%{opacity:0; transform:translateY(0) scale(.4) rotate(0deg);}20%{opacity:1;}100%{opacity:0; transform:translateY(-32px) scale(1) rotate(90deg);}}

@media (max-width:420px){
  .scr-hex .d{font-size:16px;}
  .scr-hex .t{font-size:8.5px;}
}
@media (max-width:480px){
  .scr-stats{gap:8px;}
  .scr-stat b{font-size:18px;}
  .scr-hero{padding:16px;}
  .scr-hero-text h1{font-size:18px;}
  .scr-hero-avatar{width:48px; height:48px;}
  .scr-hero-avatar svg{width:34px; height:34px;}
}

/* ===== บล็อก Scratch สีจริง (วาดโดย assets/blocks.js) ===== */
.sb-block{display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px;vertical-align:middle;margin:2px 1px;padding:4px 9px;
  font:600 12.5px/1.3 "Sarabun",system-ui,sans-serif;color:#fff;border-radius:5px;border:1px solid rgba(0,0,0,.18);
  box-shadow:0 1px 0 rgba(0,0,0,.12);max-width:100%;white-space:normal;text-align:left}
.sb-block .sb-block{margin:0;padding:2px 7px;font-size:12px;box-shadow:none}
.sb-hat{border-radius:16px 16px 5px 5px;padding-top:7px}
.sb-reporter{border-radius:999px}
.sb-boolean{border-radius:0;border:0;padding-inline:13px;
  clip-path:polygon(9px 0,calc(100% - 9px) 0,100% 50%,calc(100% - 9px) 100%,9px 100%,0 50%)}
.sb-in{display:inline-block;min-width:16px;padding:1px 8px;border-radius:999px;background:#fff;color:#575e75;font-weight:600;font-size:12px;line-height:1.35}
.sb-in.sb-empty{min-width:22px;min-height:16px}
.sb-dd{display:inline-block;padding:1px 7px;border-radius:5px;background:rgba(0,0,0,.16);color:#fff;font-size:12px}
.sb-bslot{display:inline-block;width:30px;height:16px;background:rgba(0,0,0,.2);
  clip-path:polygon(7px 0,calc(100% - 7px) 0,100% 50%,calc(100% - 7px) 100%,7px 100%,0 50%)}
.sb-param{font-weight:600}
.sb-code{font:600 12.5px/1.3 ui-monospace,Menlo,Consolas,monospace;background:#f4ecd8;color:#3a2315;padding:1px 6px;border-radius:5px}

.sb-motion{--sb:#4C97FF;--sbd:#3373CC}
.sb-looks{--sb:#9966FF;--sbd:#774DCB}
.sb-sound{--sb:#CF63CF;--sbd:#BD42BD}
.sb-events{--sb:#FFBF00;--sbd:#CC9900}
.sb-control{--sb:#FFAB19;--sbd:#CF8B17}
.sb-sensing{--sb:#5CB1D6;--sbd:#2E8EB8}
.sb-operators{--sb:#59C059;--sbd:#389438}
.sb-variables{--sb:#FF8C1A;--sbd:#DB6E00}
.sb-lists{--sb:#FF661A;--sbd:#E64D00}
.sb-myblocks{--sb:#FF6680;--sbd:#FF3355}
.sb-pen{--sb:#0FBD8C;--sbd:#0B8E69}
.sb-block{background:var(--sb,#999);border-color:var(--sbd,#777)}
/* โจทย์ "อยู่หมวดใด" ก่อนตอบ: ไม่ให้สีบอกใบ้ */
.sb-neutral,.sb-neutral [class*="sb-"]{--sb:#9a9a9a;--sbd:#7d7d7d}

/* สคริปต์หลายบล็อก (มีปากตัว C) */
.sb-script{display:inline-flex;flex-direction:column;align-items:flex-start;vertical-align:top;margin:4px 2px;max-width:100%}
.sb-row{display:block;margin:0}
.sb-row>.sb-block{margin:0 0 1px}
.sb-c{display:flex;flex-direction:column;align-items:stretch;margin:0 0 1px;max-width:100%}
.sb-c-head{display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px;padding:4px 9px;border-radius:5px 5px 0 0;color:#fff;
  font:600 12.5px/1.3 "Sarabun",system-ui,sans-serif;align-self:flex-start;min-width:110px}
.sb-c-body{border-left:12px solid;padding:2px 0 2px 2px;min-height:14px}
.sb-c-foot{height:10px;width:60px;border-radius:0 0 5px 5px}
.sb-c-cap .sb-c-foot{border-radius:0 0 5px 5px}
.sb-c-gap{display:block;height:12px}
.sb-c-head,.sb-c-foot{background:var(--sb)}
.sb-c-body{border-left-color:var(--sb)}

.scr-blocks .sb-block{font-size:12px}
.scr-used .sb-block,.scr-used .sb-script{margin:3px}
.scr-quizsum.full .sc{color:#16a37f}
.scr-retry{margin-top:12px}
.scr-choice .sb-code{font-size:12px}

/* ปุ่มใบประกาศเมื่อเรียนจบ 30 วัน */
.scr-cert-cta{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin:14px 0;padding:14px 16px;border-radius:16px;
  background:linear-gradient(135deg,#fff1c2,#ffe08a);border:2px solid #f0a500}
.scr-cert-cta .ic{font-size:34px}
.scr-cert-cta .tx{flex:1;min-width:180px;display:flex;flex-direction:column;gap:2px;color:#3a2315}
.scr-cert-cta .tx span{font-size:13px;color:#5e4433}
.sb-cmouth{border-bottom-left-radius:0;box-shadow:inset 6px -3px 0 -3px rgba(0,0,0,.12)}
/* ครูผึ้งแบบเดียวกับหน้า TOI-Zero: ยืนบนพื้นเหลืองเลย ไม่มีวงกลมขาว */
.scr-hero-avatar{width:92px;height:92px;background:none;border-radius:0;box-shadow:none}
.scr-hero-avatar svg{width:92px;height:92px;filter:drop-shadow(0 3px 0 rgba(0,0,0,.15))}
@media (max-width:620px){.scr-hero-avatar,.scr-hero-avatar svg{width:70px;height:70px}}
.scr-cert-cta.locked{background:#fffaf0;border-style:dashed;border-color:#e3c77a}
.scr-cert-cta.locked .ic{filter:grayscale(.6);opacity:.75}
.scr-cert-cta .btn[aria-disabled]{opacity:.6;cursor:not-allowed}
.scr-retrybar{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:12px;padding:10px 14px;border-radius:12px;background:#fff1c2;font-size:14px}
.scr-retrybar .scr-retry{margin:0}
.scr-hero-honey{flex-wrap:wrap;max-width:100%}
.scr-hero-honey a{color:#8a5a00;text-decoration:underline}
/* ครูผึ้งบอกวิธีสร้างเอง (หน้าโปรเจกต์) */
.scr-howto{margin:6px 0 14px;padding:10px 12px;border-radius:14px;background:#fff8e1;border:1px dashed #f0a500}
.scr-howto .scr-label{margin-top:0}
.scr-howto details{background:#fff;border:1px solid #f1e3bf;border-radius:10px;margin:6px 0;padding:0 12px}
.scr-howto summary{cursor:pointer;padding:9px 0;font-weight:600;color:#3a2315}
.scr-howto ol{margin:0 0 10px;padding-left:22px;font-size:14px;line-height:1.7}
