/* นิ้วน้อยต่อจุด — ใช้ร่วมกับ ../bit/bit.css (แถบด่าน ปุ่ม ฯลฯ) */
.ty-top{background:linear-gradient(135deg,#8F5300,#B5730A)}
.ty-top .crumbs-dark{color:#FFE9C2}
.ty-top .stage small{color:#FFE9C2}
.ty-top .lvb.cur{box-shadow:0 0 0 3px #8F5300,0 0 0 5px #fff}
.ty-sub{color:#FFF4D6}
.ty-grid{display:grid;grid-template-columns:minmax(0,2.3fr) minmax(0,1fr);gap:20px;align-items:start}
.say .mode{display:inline-block;align-self:flex-start;font-size:13px;font-weight:700;color:#8A6200;background:#FFF4D6;border-radius:999px;padding:1px 10px}
.ty-strip{display:flex;flex-wrap:wrap;gap:4px;margin:0 0 8px}
.ty-strip span{min-width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border-radius:9px;background:#F6F4F9;border:1.5px solid var(--line);font-family:var(--head);font-weight:600;font-size:19px;color:var(--ink-2)}
.ty-strip span.done{background:#E3F4EA;border-color:#B9E3C8;color:#1E7A4C}
.ty-strip span.now{background:#FFC94D;border-color:#E8A300;color:#2B2235;transform:scale(1.12)}
.ty-stage{display:block;width:100%;height:auto;aspect-ratio:8/5;background:#FFFDF6;border:2px solid #F0E3C4;border-radius:18px;touch-action:none;user-select:none;-webkit-user-select:none;cursor:pointer}
.ty-stage.m-fill,.ty-stage.m-studio{background:#fff}
.ty-stage.m-studio{cursor:crosshair}
.ty-bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:10px}
.ty-bar .prog{margin-left:auto;font-family:var(--head);font-weight:600;color:#8A6200}
.status.hint{color:#8A6200}

/* เป่าฟอง */
.bnum{font-family:var(--head);font-weight:700;fill:#fff;paint-order:stroke;stroke:#2B2235;stroke-width:5px;pointer-events:none}
.bub>*{transform-box:fill-box;transform-origin:center}
.bub.pop>*{animation:ty-pop .35s ease-out forwards}
.bub.nope>*{animation:ty-shake .45s}
.bub.glow>circle:first-child{animation:ty-glow 1s 3}
.burst circle{animation:ty-burst .5s ease-out forwards}
@keyframes ty-pop{to{transform:scale(1.5);opacity:0}}
@keyframes ty-shake{20%{transform:translateX(-10px)}40%{transform:translateX(9px)}60%{transform:translateX(-6px)}80%{transform:translateX(4px)}}
@keyframes ty-glow{50%{stroke:#FFC94D;stroke-width:14px}}
@keyframes ty-burst{to{transform:translate(var(--tx),var(--ty));opacity:0}}

/* ลากใส่กล่อง */
.zone-label{font-family:var(--head);font-weight:600;font-size:26px;fill:#2B2235}
.zone-num{font-family:var(--head);font-weight:700;font-size:96px;fill:#C99A2E;opacity:.55}
.zone rect.nope{animation:ty-zone .6s}
@keyframes ty-zone{30%,70%{stroke:#E53935}}
.drag-item{cursor:grab}
.drag-item.held{cursor:grabbing;filter:drop-shadow(0 8px 8px rgba(0,0,0,.28))}

/* ลากตามรอย */
.pulse{animation:ty-pulse 1.1s infinite}
@keyframes ty-pulse{50%{stroke-width:14px;stroke:#FFC94D}}

/* ต่อจุด */
.dlabel{font-family:var(--head);font-weight:700;font-size:28px;fill:#2B2235;paint-order:stroke;stroke:#FFFDF6;stroke-width:6px;pointer-events:none}
.dlabel.th{font-size:30px}
.dot .ring{stroke:transparent;stroke-width:0}
.dot.next .ring{fill:#FFF0C2;stroke:#E8A300;stroke-width:3px}
.dot.reached circle:nth-child(2){fill:#E8833A}
.dot.glow .ring{animation:ty-ring 1s 3}
@keyframes ty-ring{50%{stroke:#E53935;stroke-width:10px}}
.dline{stroke:#E8833A;stroke-width:9;stroke-linecap:round}
.dline.closing{stroke-dasharray:1000;stroke-dashoffset:1000;animation:ty-draw .6s forwards}
@keyframes ty-draw{to{stroke-dashoffset:0}}
.rubber{stroke:#E8833A;stroke-width:6;stroke-dasharray:10 10;stroke-linecap:round;opacity:.8}
.reveal{transition:opacity .9s .4s}
.reveal.show{opacity:.85}
.fade{transition:opacity .9s;opacity:.25}

/* ระบายสี */
.region{cursor:pointer}
.region:hover{stroke:#8E44AD}
.region.nope{animation:ty-zone .6s}
.region.poured{animation:ty-pour .35s}
@keyframes ty-pour{from{opacity:.4}}
.ty-model{display:block;width:100%;height:auto;background:#fff;border:1px solid var(--line);border-radius:10px}
.ty-model .glow{animation:ty-glow 1s 3}
.ty-pal{display:flex;flex-wrap:wrap;gap:8px}
.ty-pal .sw{width:44px;height:44px;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 2px var(--line);cursor:pointer}
.ty-pal .sw.white{box-shadow:0 0 0 2px #B9B2C6}
.ty-pal .sw.on{box-shadow:0 0 0 3px #2B2235;transform:scale(1.08)}

/* หมวด เลือกภาพเอง */
.ty-views button[aria-selected="true"]{color:#8F5300}
.ty-sets{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 14px}
.ty-sets button{display:flex;flex-direction:column;align-items:flex-start;min-height:52px;padding:6px 16px;border-radius:12px;border:2px solid var(--line);background:#fff;cursor:pointer;font-family:var(--body);color:var(--ink)}
.ty-sets button b{font-family:var(--head);font-weight:600}
.ty-sets button span{font-size:14px;color:var(--muted)}
.ty-sets button.on{border-color:#E8A300;background:#FFF4D6}
.ty-picgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.ty-pic{display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px 8px 10px;border-radius:16px;border:2px solid #F0E3C4;background:#FFFDF6;cursor:pointer;font-family:var(--body);color:var(--ink)}
.ty-pic svg{width:100%;height:auto;display:block}
.ty-pic b{font-family:var(--head);font-weight:600;font-size:18px}
.ty-pic:hover{border-color:#E8A300}
.reveal-line{stroke-dasharray:4000;stroke-dashoffset:4000;animation:ty-draw 1.2s ease-out forwards}
.fade-out{transition:opacity .8s;opacity:0}

/* ผืนผ้าใบวาดภาพ (ซ้อนบนพื้นที่เล่น) */
.ty-board{position:relative}
.ty-paint{position:absolute;inset:0;width:100%;height:100%;box-sizing:border-box;border:2px solid #F0E3C4;border-radius:18px;background:#fff;touch-action:none;cursor:crosshair}
.ty-tools{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
.ty-tools .tb{display:flex;flex-direction:column;align-items:center;gap:2px;min-height:58px;padding:6px 2px;border-radius:12px;border:2px solid var(--line);background:#fff;color:var(--ink-2);cursor:pointer;font-family:var(--head);font-size:13px;font-weight:500}
.ty-tools .tb.on{border-color:#2B2235;background:#FFF4D6;color:#2B2235}
.ty-sub{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-top:10px;padding-top:10px;border-top:1px dashed var(--line)}
.ty-sub .shp{width:48px;height:46px}
.ty-solid{display:inline-flex;align-items:center;gap:4px;margin-left:4px}
.ty-gal .gw img{width:100%;height:auto;border-radius:6px;border:1px solid #F0EDF4;display:block}
.ty-gal .nothumb{display:flex;align-items:center;justify-content:center;aspect-ratio:8/5;background:#F6F4F9;border-radius:6px;color:var(--muted)}
.gw-acts{display:flex;gap:4px;align-items:center}

/* กรอบเครื่องมือแบบโปรแกรม Paint (เปิดเมื่อวาดภาพ) — ซ่อนแผงด้านข้างไว้ด้านล่าง ผืนผ้าใบกว้างเต็มหน้า */
.ty-grid.painting{grid-template-columns:minmax(0,1fr)}
.ty-grid.painting>aside{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:16px;align-items:start}
.ty-grid.painting>aside>*{margin-top:0}
.ty-grid.painting .ty-gal{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));max-height:none}
.ty-pframe.on{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-areas:"top top" "left board" "bottom bottom";gap:8px;background:#F3EFE6;border:1px solid #E6DCC6;border-radius:18px;padding:8px}
.ty-pframe.on .pf-top{grid-area:top;display:flex;flex-wrap:wrap;align-items:center;gap:8px;justify-content:space-between;background:#fff;border-radius:12px;padding:6px 8px;min-height:52px}
.ty-pframe.on .pf-left{grid-area:left;display:flex;flex-direction:column;gap:10px;background:#fff;border-radius:12px;padding:6px}
.ty-pframe.on .ty-board{grid-area:board;width:100%;max-width:calc((100vh - 310px) * 1.6);min-width:min(100%,480px);justify-self:center;align-self:start}
.ty-pframe.on .pf-bottom{grid-area:bottom;display:flex;align-items:center;gap:10px;background:#fff;border-radius:12px;padding:6px 8px}
.ty-pframe.on>*{min-width:0}
.pf-tools{display:flex;flex-direction:column;gap:6px}
.pf-tools .tb{display:flex;flex-direction:column;align-items:center;gap:1px;width:74px;min-height:50px;padding:5px 2px;border-radius:12px;border:2px solid var(--line);background:#fff;color:var(--ink-2);cursor:pointer;font-family:var(--head);font-size:12.5px;font-weight:500}
.pf-tools .tb.on{border-color:#2B2235;background:#FFF4D6;color:#2B2235}
.pf-sizes{display:grid;grid-template-columns:repeat(2,34px);gap:6px;justify-content:center;border-top:1px dashed var(--line);padding-top:8px}
.pf-opts .sz{width:46px;height:42px;border-radius:10px;border:2px solid var(--line);background:#fff;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;flex:0 0 auto}
.pf-sizes .sz{width:34px;height:34px;border-radius:9px;border:2px solid var(--line);background:#fff;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
.pf-sizes .sz i{display:block;border-radius:50%;background:#2B2235;max-width:24px;max-height:24px}
.pf-sizes .sz.on,.pf-opts .sz.on{border-color:#2B2235;background:#FFF4D6}
.pf-opts{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}
.pf-hint{font-size:15px;color:var(--muted);padding-left:4px}
.pf-acts{display:flex;flex-wrap:wrap;gap:6px}
.pf-acts .btn svg{flex:0 0 auto}
.pf-cur{width:44px;height:44px;border-radius:10px;border:3px solid #2B2235;flex:0 0 auto;box-shadow:inset 0 0 0 3px #fff}
.pf-pal{display:flex;flex-wrap:wrap;gap:6px}
.pf-pal .sw{width:38px;height:38px;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 2px var(--line);cursor:pointer}
.pf-pal .sw.white{box-shadow:0 0 0 2px #B9B2C6}
.pf-pal .sw.on{box-shadow:0 0 0 3px #2B2235}
@media (max-width:700px){
  .ty-grid.painting>aside{grid-template-columns:minmax(0,1fr)}
  .ty-pframe.on{grid-template-columns:minmax(0,1fr);grid-template-areas:"top" "left" "board" "bottom";padding:6px;gap:6px}
  .ty-pframe.on .pf-left{flex-direction:row;overflow-x:auto;gap:6px}
  .pf-tools{flex-direction:row}
  .pf-sizes{display:flex;border-top:0;border-left:1px dashed var(--line);padding:0 0 0 6px;align-items:center}
  .pf-sizes .sz{width:40px;height:40px;flex:0 0 auto}
  .pf-tools .tb{width:58px;min-height:50px;font-size:11px}
  .ty-pframe.on .pf-top{flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:6px;min-height:0}
  .pf-opts,.pf-acts{flex-wrap:nowrap;overflow-x:auto;padding-bottom:2px}
  .pf-hint{display:none}
  .ty-pframe.on .pf-bottom{overflow-x:auto}
  .pf-pal{flex-wrap:nowrap}
  .pf-pal .sw{width:34px;height:34px;flex:0 0 auto}
  .ty-pframe.on .ty-board{min-width:0}
}

/* สมุดวาดภาพ */
.ty-sizes{display:flex;flex-wrap:wrap;gap:8px}
.ty-sizes .sz{width:52px;height:48px;border-radius:12px;border:2px solid var(--line);background:#fff;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.ty-sizes .sz i{display:block;border-radius:50%;background:#2B2235}
.ty-sizes .sz.on{border-color:#2B2235;background:#FFF4D6}
.ty-sizes .stk{width:56px;height:56px}
.ty-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}
.ty-gal{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-height:330px;overflow:auto}
.ty-gal .gw{border:1px solid var(--line);border-radius:10px;padding:6px;display:flex;flex-direction:column;gap:4px;font-size:13.5px}
.ty-gal svg{width:100%;height:auto;border-radius:6px;background:#fff;border:1px solid #F0EDF4}

/* ความคืบหน้าและรางวัล */
.ty-prog{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) auto;gap:8px;align-items:center;font-size:14.5px;margin:4px 0}
.ty-prog .bar{height:9px;border-radius:9px;background:#F1ECF7;overflow:hidden}
.ty-prog .bar i{display:block;height:100%;background:#E8A300;border-radius:9px}
.ty-sticker{display:flex;justify-content:center}
.ty-sticker svg{max-width:100%;height:auto;background:#FFFDF6;border-radius:16px;border:2px solid #F0E3C4}
.confetti rect{animation:ty-fall 2.2s ease-in forwards}
@keyframes ty-fall{to{transform:translate(var(--dx),560px) rotate(540deg);opacity:.2}}
@media (prefers-reduced-motion:reduce){.pulse,.confetti rect,.bub.glow>circle:first-child{animation:none}}
.ty-tools-top{display:none}
@media (max-width:900px){
  .ty-grid{grid-template-columns:minmax(0,1fr)}
  .ty-tools-top:not([hidden]){display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin-bottom:10px}
  .ty-tools-top .prog-card{margin-top:0}
  .ty-tools-top .ty-model{max-width:220px;margin:0 auto}
  .ty-tools-top .ty-pal .sw{width:40px;height:40px}
  #side .tools-dup{display:none}
  /* กล่องเครื่องมือวาดบนมือถือ: เหลือแถวเดียวต่อเรื่อง เลื่อนข้างได้ เพื่อให้เห็นผืนผ้าใบโดยไม่ต้องเลื่อนลง */
  .ty-tools-top .ty-box{padding:8px}
  .ty-tools-top .ty-box .side-head{display:none}
  .ty-tools-top .ty-tools .tb{min-height:46px;font-size:11.5px;padding:4px 2px}
  .ty-tools-top .ty-box .ty-sizes,.ty-tools-top .ty-box .ty-pal,.ty-tools-top .ty-box .ty-sub{flex-wrap:nowrap;overflow-x:auto;margin-top:6px;padding:2px 2px 4px}
  .ty-tools-top .ty-box .ty-pal .sw{width:34px;height:34px;flex:0 0 auto}
  .ty-tools-top .ty-box .sz{flex:0 0 auto;width:42px;height:38px}
  .ty-tools-top .ty-box .sz i{max-width:26px;max-height:26px}
  .ty-tools-top .ty-box .ty-acts{margin-top:6px}
}
