/* ห้องลองชุด (try-on.js · 9 ต.ค. · design-briefs/92-try-on) — กระดาษครีม ขอบทอง ชุดเดียวกับการ์ดไอเทม (ui-icard.css)
   คอม: กล่องกลางจอ เหนือการ์ดไอเทม/หน้าต่าง (z แบบเดียวกับ .icard) · จอสัมผัส: เต็ม Safe Area ชั้น Popup (--z-popup) เหนือ Screen ที่เปิดอยู่
   ปิด = กลับหน้าเดิมข้างใต้ (ไม่ผ่าน ui.open — Router ไม่ปิดหน้าต่างเดิม) */

.tryon { --to-ink: #4a3520; --to-mute: #7a6548; --to-line: #e3d2a8;
  position: fixed; inset: 0; z-index: 9100; display: grid; place-items: center; background: rgba(14, 22, 30, .5); }
.tryon[hidden] { display: none; }
.tryon .to-box { width: min(760px, 94vw); height: min(500px, 90vh); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); overflow: hidden;
  box-sizing: border-box; border-radius: 16px; border: 2px solid #d9b56a; background: linear-gradient(#fffaf0, #f8eed8);
  box-shadow: 0 0 0 1px #fff8 inset, 0 0 0 4px #f3e3bd, 0 0 0 5px #caa45e, 0 12px 30px rgba(40, 28, 8, .4);
  color: var(--to-ink); font-size: 14px; line-height: 1.4; }

/* เวที: พื้นอุ่นแบบห้องลองชุดร้าน · เงาวงรีใต้เท้า */
.tryon .to-stagewrap { position: relative; min-height: 0; display: flex; flex-direction: column;
  background: radial-gradient(ellipse 30% 5% at 50% 80%, #c9a26a66, #c9a26a00 100%), radial-gradient(circle at 50% 40%, #fffdf4, #efe0bd 78%);
  border-right: 1px solid var(--to-line); }
.tryon .to-stage { position: relative; flex: 1; min-height: 0; }
.tryon .to-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.tryon .to-hint { position: absolute; top: 8px; left: 10px; font-size: 12px; color: var(--to-mute); background: #fffaf0cc; padding: 2px 8px; border-radius: 10px; pointer-events: none; }
.tryon .to-ctl { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; padding: 8px; }

.tryon .to-seg { display: inline-flex; border: 1px solid #d8c49a; border-radius: 12px; overflow: hidden; background: #fffdf6; }
.tryon .to-seg button { min-height: 36px; min-width: 52px; padding: 0 10px; border: 0; border-left: 1px solid #ead9b2; background: none; color: var(--to-ink); font: inherit; font-size: 13px; cursor: pointer; }
.tryon .to-seg button:first-child { border-left: 0; }
.tryon .to-seg button.on { background: linear-gradient(#3f9195, #2f6f73); color: #fff; }
.tryon .to-seg.wide { display: flex; }
.tryon .to-seg.wide button { flex: 1; }

/* ข้อมูลข้าง */
.tryon .to-info { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.tryon .to-head { display: grid; grid-template-columns: 56px 1fr 30px; gap: 10px; align-items: center; }
.tryon .to-ic { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; font-size: 30px; border: 2px solid #d8c49a; background: radial-gradient(circle at 50% 40%, #fffdf6, #efe2c4); }
.tryon .to-ic img { width: 48px; height: 48px; object-fit: contain; }
.tryon .to-ttl { min-width: 0; display: flex; flex-direction: column; }
.tryon .to-ttl b { font-size: 16px; color: #3a2814; overflow-wrap: anywhere; }
.tryon .to-ttl small { color: var(--to-mute); font-size: 12px; }
.tryon .to-ttl em { font-style: normal; font-weight: 700; }
.tryon .to-x { width: 30px; height: 30px; border-radius: 50%; border: 1px solid #d8c49a; background: #fffdf6; color: var(--to-mute); font-size: 18px; line-height: 1; cursor: pointer; align-self: start; }
.tryon .to-tag { margin: 0; padding: 5px 9px; border-radius: 10px; background: #e6f2ef; color: #24585b; font-size: 12.5px; }
.tryon .to-warn { margin: 0; padding: 6px 9px; border-radius: 10px; background: #fbe3dc; color: #8a2f1c; font-size: 13px; font-weight: 600; }
.tryon .to-warn.soft { background: #fdf1d8; color: #7a5410; font-weight: 500; }
.tryon .to-muted { margin: 0; color: var(--to-mute); font-size: 12.5px; }
.tryon .to-desc { margin: 0; color: #5b4a36; font-size: 13px; }
.tryon .to-alts { display: flex; flex-direction: column; gap: 6px; }
.tryon .to-alts button { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px; border-radius: 12px; border: 1px solid #d8c49a; background: #fffdf6; color: var(--to-ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.tryon .to-alts button.on { border-color: #2f6f73; background: linear-gradient(#f2fbf8, #d7efe9); box-shadow: 0 0 0 2px #bfe3dc inset; }
.tryon .to-aic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; font-size: 22px; }
.tryon .to-aic img { width: 36px; height: 36px; object-fit: contain; }
.tryon .to-close { margin-top: auto; min-height: 40px; border-radius: 12px; border: 1px solid #d8c49a; background: linear-gradient(#fffdf6, #f1e3c2); color: var(--to-ink); font: inherit; font-weight: 600; cursor: pointer; }
.tryon .r-good { color: #2f78b5; } .tryon .r-rare { color: #8a4fc8; } .tryon .r-epic, .tryon .r-legend { color: #b8760e; } .tryon .r-style { color: #c0507a; }
.tryon .to-ic.r-good { border-color: #9fc4e3; } .tryon .to-ic.r-rare { border-color: #c9a8ea; } .tryon .to-ic.r-epic, .tryon .to-ic.r-legend { border-color: #e8b64a; } .tryon .to-ic.r-style { border-color: #eab0c6; }

/* จอสัมผัส: เต็ม Safe Area ชั้น Popup */
html.touch-ui .tryon { z-index: var(--z-popup); background: rgba(14, 22, 30, .55); }
html.touch-ui .tryon .to-box { position: fixed; inset: var(--sa-t, 0px) var(--sa-r, 0px) var(--sa-b, 0px) var(--sa-l, 0px); width: auto; height: auto; border-radius: 0; border-width: 0; box-shadow: none; }
html.touch-ui .tryon .to-seg button { min-height: 44px; }
html.touch-ui .tryon .to-x { width: 40px; height: 40px; }
html.touch-ui .tryon .to-head { grid-template-columns: 48px 1fr 40px; }
html.touch-ui .tryon .to-ic { width: 48px; height: 48px; }
html.touch-ui .tryon .to-ic img { width: 40px; height: 40px; }
html.touch-ui .tryon .to-close { min-height: 44px; }
@media (max-height: 420px) {
  .tryon .to-ctl { padding: 4px 6px 6px; gap: 4px 6px; }
  .tryon .to-seg button { min-width: 44px; padding: 0 8px; font-size: 12.5px; }
  .tryon .to-info { padding: 8px 10px; gap: 6px; }
  .tryon .to-desc { display: none; }
  .tryon .to-alts { gap: 4px; }
  .tryon .to-alts button { min-height: 40px; }
}
/* จอแคบมาก (โทรศัพท์แนวตั้ง/คอมย่อหน้าต่าง): เวทีบน ข้อมูลล่าง */
@media (max-width: 560px) {
  .tryon .to-box { grid-template-columns: none; grid-template-rows: minmax(0, 1.2fr) minmax(0, 1fr); }
  .tryon .to-stagewrap { border-right: 0; border-bottom: 1px solid var(--to-line); }
}

/* ── ปุ่ม "👁 ลองสวม" ตามจุดต่าง ๆ ── */
.icard .ic-try { align-self: flex-start; margin-top: 3px; min-height: 30px; padding: 0 10px; border-radius: 10px; border: 1px solid #2f6f73; background: linear-gradient(#f2fbf8, #d7efe9); color: #24585b; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.icard .ic-try:hover { filter: brightness(1.04); }
html.touch-ui .icard .ic-try { min-height: 40px; padding: 0 14px; }
#windows .sd-tryon { align-self: flex-start; min-height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid #2f6f73; background: linear-gradient(#f2fbf8, #d7efe9); color: #24585b; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
html.touch-ui #windows .sd-tryon { min-height: 44px; }
/* เช็คอิน: ตาเล็กบนกล่องวันที่ 7 · ปุ่มลองบนตัวเลือก · ปุ่มใต้ของประจำเดือน */
#windows .win[data-win="checkin"] .ck-day[data-tryon] { cursor: pointer; }
#windows .win[data-win="checkin"] .ck-eye { position: absolute; top: 26px; right: 6px; z-index: 1; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; background: #fffaf0; border: 1px solid #2f6f73; }
#windows .win[data-win="checkin"] .ck-optw { position: relative; display: grid; min-width: 0; }
#windows .win[data-win="checkin"] .ck-try { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 1px solid #2f6f73; background: #fffaf0; font-size: 13px; line-height: 1; cursor: pointer; box-shadow: 0 1px 0 #1d4a4d55; }
html.touch-ui #windows .win[data-win="checkin"] .ck-try { min-width: 0; min-height: 0; width: 28px; height: 28px; }   /* กฎปุ่ม 44px ของจอสัมผัส — ใช้พื้นที่แตะจาก ::after แทน */
#windows .win[data-win="checkin"] .ck-try::after { content: ""; position: absolute; inset: -8px; }   /* พื้นที่แตะ 44px โดยไม่บังภาพของ */
#windows .win[data-win="checkin"] .ck-mtry { min-height: 34px; padding: 0 12px; border-color: #e8b64a; color: #ffe7a6; font-size: 13px; }
#windows .sd-char .shop-stage:not(.sd-ride) { cursor: zoom-in; }
