/* V9.7.1 Surgical — unified DIY and Banner. */
#calendarDiyPage{display:none;position:relative;min-height:70vh;--bg:#090b13;--panel:#151a29;--edge:#30364b;--pink:#e044c5;--muted:#a6aec2;color:#fff;font-family:'Sarabun',sans-serif;background:radial-gradient(ellipse at 80% 0%,#301535 0%,transparent 38%),#090b13}
body.diy-mode #calendarDiyPage{display:block!important}
body.diy-mode > :not(header):not(#calendarDiyPage):not(script):not(link){display:none!important}
body.diy-mode #globalExportButton{display:none!important}
body.diy-mode #calendarDiyPage{display:block!important}
#calendarDiyPage .diy-shell{max-width:1500px;margin:auto;padding:26px clamp(14px,3vw,50px) 70px}
#calendarDiyPage .diy-shell .toolbar{display:flex}
#calendarDiyPage dialog{position:fixed}
#calendarDiyPage .print-stage{position:absolute;left:-20000px;top:0;z-index:-1}
body.theme-light.diy-mode #calendarDiyPage,body.light-mode.diy-mode #calendarDiyPage{color:#fff}
body.banner-mode #tvsBannerPage{width:100%;max-width:none}
@scope (#calendarDiyPage){

 :scope{color-scheme:dark;--bg:#090b13;--panel:#151a29;--edge:#30364b;--pink:#e044c5;--muted:#a6aec2}*{box-sizing:border-box}:scope{margin:0;background:radial-gradient(ellipse at 80% 0%,#301535 0%,transparent 38%),var(--bg);color:#fff;font:14px 'Plus Jakarta Sans','Noto Sans Thai',sans-serif;min-height:100vh}.shell{max-width:1500px;margin:auto;padding:26px}.toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:18px}.toolbar h1{font-size:23px;margin:0 auto 0 0}.eyebrow{font-size:11px;letter-spacing:.16em;color:#f28ce2;font-weight:800}select,button,input{font:inherit}select,input{background:#151b2a;color:#fff;border:1px solid var(--edge);border-radius:10px;padding:11px}button{border:1px solid var(--edge);background:#22283b;color:#fff;border-radius:10px;padding:10px 14px;cursor:pointer}button:hover{border-color:#d77fdb}button:disabled{opacity:.45;cursor:wait}.primary{background:linear-gradient(115deg,#7c3aed,#d926a8);border:0;font-weight:800}.status{color:var(--muted);margin:8px 0 18px;min-height:22px}.week,.calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px}.week{margin-bottom:8px}.week span{text-align:center;color:var(--muted);font-size:11px;font-weight:800}.cell{min-width:0;min-height:142px;background:#171c2b;border:1px solid #2a3044;border-radius:14px;padding:8px;display:flex;flex-direction:column;gap:7px;text-align:left;overflow:hidden}.cell:hover{background:#242039}.cell .date{font-size:16px;font-weight:800;color:#ff7ad8}.cell .art{width:100%;height:68px;object-fit:cover;border-radius:7px;background:#262a37}.cell .title{font-weight:800;font-size:12px;line-height:1.35;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cell .meta{color:#b6bfd1;font-size:10px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.empty{border:0;background:transparent}.plus{margin:auto;color:#7c859e;font-size:24px}.tag{font-size:9px;color:#f5a8e8;letter-spacing:.05em;font-weight:800}dialog{border:1px solid #55516b;border-radius:18px;background:#131827;color:#fff;padding:22px;width:min(720px,calc(100vw - 24px));max-height:85vh;box-shadow:0 30px 100px #000c}dialog::backdrop{background:#000b}.modalhead{display:flex;align-items:center;justify-content:space-between;gap:12px}.modalhead h2{margin:0;font-size:20px}.filters{display:flex;gap:8px;margin:16px 0}.filters input{flex:1;min-width:0}.list{max-height:52vh;overflow:auto;display:grid;gap:8px}.option{text-align:left;width:100%;display:flex;gap:12px;align-items:center}.option img{width:60px;height:60px;object-fit:cover;border-radius:7px}.option strong{display:block;font-size:13px}.option small{color:#b6bfd1;display:block;margin-top:4px}.foot{margin-top:12px;display:flex;justify-content:flex-end}.hint{color:#b8c0d3;font-size:12px}.print-stage{position:fixed;left:-20000px;top:0;width:1123px}.printpage{width:1123px;height:794px;background:linear-gradient(135deg,#0a1020,#241028);padding:26px;color:white;overflow:hidden}.printpage h1{font-size:31px;margin:4px 0 10px;color:#ff75dc}.printpage .week{gap:5px}.printpage .calendar{gap:5px}.printpage .cell{height:101px;min-height:101px;border-radius:6px;padding:4px;gap:3px}.printpage .cell .art{height:49px}.printpage .cell .title{font-size:9px}.printpage .cell .date{font-size:11px}.printpage .cell .meta{font-size:8px}.printpage .plus{display:none}.printpage .tag{font-size:7px}.printpage .empty{background:transparent}.printpage .week span{font-size:10px}@media(max-width:700px){.shell{padding:12px}.toolbar h1{width:100%;font-size:19px}.calendar,.week{gap:3px}.cell{min-height:85px;padding:4px;border-radius:8px;gap:3px}.cell .date{font-size:12px}.cell .art{height:35px}.cell .title{font-size:9px}.cell .meta,.cell .tag{display:none}.plus{font-size:17px}} 
/* V2.1 Surgical visual and print refinements */
.cell{position:relative;min-height:166px;padding:0;gap:0;isolation:isolate;background:linear-gradient(145deg,#1b2337,#101522);border-radius:13px}
.cell.filled{background:#171d2e}.cell .art{position:absolute;inset:0;width:100%;height:100%;border-radius:0;object-fit:cover;z-index:0}
.cell.filled:after{content:"";position:absolute;inset:25% 0 0;background:linear-gradient(transparent,rgba(5,8,18,.65) 45%,rgba(5,8,18,.96));z-index:1;pointer-events:none}
.cell .date{position:relative;z-index:2;align-self:flex-start;width:max-content;background:linear-gradient(135deg,rgba(220,60,185,.72),rgba(111,66,193,.66));border:1px solid rgba(255,170,239,.38);border-radius:13px;box-shadow:0 0 16px rgba(230,69,192,.22),inset 0 1px 0 rgba(255,255,255,.22);font-size:32px;line-height:1;font-weight:800;color:white;letter-spacing:-.07em;padding:10px 12px;text-shadow:0 2px 8px #000c}
.cell .title{position:relative;z-index:2;font-size:13px;line-height:1.3;font-weight:800;margin:auto 10px 10px;color:white;text-shadow:0 2px 5px #000;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.cell .plus{font-size:25px}.cell .tag,.cell .meta{display:none}
.print-stage{position:absolute;left:-20000px;top:0;width:1123px;height:auto;pointer-events:none;opacity:1}
.printpage,.list-printpage{width:1123px;height:794px;overflow:hidden;position:relative;background:radial-gradient(ellipse at 95% 5%,#372042 0%,transparent 38%),linear-gradient(130deg,#080e1c,#181025 75%,#27112d);color:white;font-family:'Plus Jakarta Sans','Noto Sans Thai',sans-serif}
.printpage{padding:32px 35px 24px;display:flex;flex-direction:column}
.print-head{height:104px;flex:none}.print-kicker,.list-kicker{color:#ffa1e5;font-size:12px;font-weight:800;letter-spacing:.19em}
.printpage h1{font-size:37px;margin:7px 0 8px;color:#ff6cd7;line-height:1.1;letter-spacing:-.03em}.printpage h1 span{font-size:16px;color:#fff;letter-spacing:.14em;margin-left:10px}.print-rule{height:2px;background:linear-gradient(90deg,#ff5ad0,#9d5cf7,transparent)}
.printpage .week{height:24px;flex:none;gap:6px;margin:0 0 6px}.printpage .week span{font-size:11px}
.printpage .calendar{flex:1;min-height:0;grid-template-rows:repeat(var(--print-weeks,5),minmax(0,1fr));gap:6px}
.printpage .cell{height:auto;min-height:0;border-radius:8px}.printpage .cell .art{height:100%;width:100%}.printpage .cell .date{font-size:24px;padding:5px 10px;margin:6px 0 0 6px;border-radius:11px;box-shadow:0 0 13px rgba(233,72,194,.25)}.printpage .cell .title{font-size:10px;line-height:1.2;margin:auto 7px 7px;-webkit-line-clamp:3}.printpage .cell .plus{display:none}
.print-footer{flex:none;height:25px;display:flex;align-items:end;justify-content:space-between;color:#ff83dd;font-size:11px;font-weight:800;letter-spacing:.1em}.print-footer span{color:#c9c0d4}
.list-printpage{padding:33px 44px;display:flex;flex-direction:column}
.list-topline{display:flex;justify-content:space-between;font-size:11px;font-weight:800;letter-spacing:.15em;color:#ff89df}.list-topline span{color:#b9b2cb}
.list-head{padding:25px 0 21px}.list-head h1{font-size:42px;letter-spacing:-.05em;margin:3px 0;color:white}.list-head h1 span{color:#ff65d1}.list-head p{margin:0;color:#b8b2ca;font-size:13px}
.list-columns,.list-row{display:grid;grid-template-columns:105px minmax(0,1.65fr) minmax(0,1fr) minmax(0,1.25fr);column-gap:18px;align-items:center}
.list-columns{padding:11px 10px;background:linear-gradient(90deg,#b82a9c,#6230a4);border-radius:8px;color:white;font-size:10px;letter-spacing:.09em;font-weight:800}
.list-rows{flex:1}.list-row{min-height:57px;padding:7px 10px;border-bottom:1px solid #51445f;font-size:12px;overflow:hidden}.list-row:nth-child(even){background:#ffffff08}.list-row strong{display:block;font-weight:800;overflow-wrap:anywhere}.list-row span,.list-row small{display:block;color:#bdb4cc;font-size:11px;line-height:1.35}.list-date strong{color:#ff8cdb;font-size:23px;line-height:1}.list-date span{font-size:10px}.list-program strong{font-size:13px;line-height:1.25}.list-package{font-size:11px;line-height:1.3;overflow-wrap:anywhere;max-height:54px;overflow:hidden}
.list-bottom{display:flex;justify-content:space-between;padding-top:10px;border-top:2px solid #f05cce;font-size:10px;letter-spacing:.12em;font-weight:800;color:#c4bad3}.list-bottom span{color:#ff85df}
@media(max-width:700px){.cell{min-height:88px}.cell .date{font-size:20px;padding:5px}.cell .title{font-size:9px;margin:auto 4px 5px;-webkit-line-clamp:2}}

/* V2.4 Surgical — non-blocking visual continuity, blocking interaction during requests */
#diy-esc-loading{position:fixed;inset:0;z-index:9998;display:flex;align-items:center;justify-content:center;background:rgba(7,9,19,.42);backdrop-filter:blur(9px);-webkit-backdrop-filter:blur(9px);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .18s ease,visibility .18s ease}
#diy-esc-loading.is-active{opacity:1;visibility:visible;pointer-events:auto}
.esc-loading-panel{display:flex;align-items:center;flex-direction:column;gap:13px;min-width:230px;padding:29px 34px;border:1px solid rgba(239,123,219,.23);border-radius:20px;background:rgba(18,17,35,.86);box-shadow:0 22px 70px rgba(0,0,0,.35);text-align:center}
.esc-spinner{width:44px;height:44px;border:3px solid rgba(242,126,220,.19);border-top-color:#ff72da;border-right-color:#a77aff;border-radius:50%;animation:esc-spin .8s linear infinite;box-shadow:0 0 20px rgba(225,70,188,.13)}
@keyframes esc-spin{to{transform:rotate(360deg)}}
.esc-loading-label{font-weight:800;font-size:14px;color:#fff}.esc-loading-hint{font-size:11px;color:#bfb5d1}
@media(prefers-reduced-motion:reduce){.esc-spinner{animation-duration:2s}#diy-esc-loading{transition:none}}

/* V2.5 surgical: preserve native key-art ratio; separate opaque title strip. */
.cell.filled{--esc-title-height:49px;background:#101522}
.cell.filled .art{top:0;bottom:auto;left:0;right:0;width:100%;height:calc(100% - var(--esc-title-height));object-fit:contain;object-position:center;background:#101522;border-radius:0}
.cell.filled:after{inset:auto 0 var(--esc-title-height) 0;height:18px;background:linear-gradient(transparent,rgba(9,11,23,.32))}
.cell.filled .title{flex:none;align-self:stretch;box-sizing:border-box;height:var(--esc-title-height);min-height:0;margin:auto 0 0;padding:6px 9px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;background:#151a2a;color:#fff;text-shadow:none;border-top:1px solid rgba(255,255,255,.08);font-size:11px;line-height:1.15;overflow-wrap:anywhere}
.printpage .cell.filled{--esc-title-height:34px}
.printpage .cell.filled .art{height:calc(100% - var(--esc-title-height))}
.printpage .cell.filled .title{height:var(--esc-title-height);padding:4px 6px;font-size:9px;line-height:1.12;-webkit-line-clamp:3;margin:auto 0 0}
@media(max-width:700px){.cell.filled{--esc-title-height:34px}.cell.filled .title{height:var(--esc-title-height);font-size:9px;line-height:1.1;padding:4px 5px;-webkit-line-clamp:3}}

/* V2.6 Surgical — premium editorial folio treatment, PDF only. */
.printpage .cell .date{
  font-size:16px;
  line-height:1;
  font-weight:800;
  letter-spacing:-.045em;
  min-width:27px;
  padding:5px 7px;
  margin:6px 0 0 6px;
  border-radius:8px;
  border:1px solid rgba(255,193,241,.30);
  background:linear-gradient(135deg,rgba(172,48,151,.87),rgba(102,52,150,.85));
  box-shadow:0 2px 10px rgba(137,39,125,.22);
  text-shadow:0 1px 2px rgba(0,0,0,.3);
}

/* V3.2.5 — PDF PAGE ONE ONLY / editorial integrated cards.
   No website, directory-page, JavaScript or backend changes. */
.printpage .cell.filled{
  --esc-title-height:35px;
  position:relative;isolation:isolate;overflow:hidden;
  padding:0;gap:0;
  border:1px solid #353d55;border-radius:8px;
  background:#111827;box-shadow:none;
}
/* Image occupies a fixed art region, not the text region. No stretching or seam. */
.printpage .cell.filled .art{
  position:absolute;top:0;left:0;right:0;bottom:auto;
  display:block;width:100%;height:calc(100% - var(--esc-title-height));
  object-fit:cover;object-position:center;
  border:0;border-radius:0;background:#101522;transform:none;z-index:0;
}
/* Eliminate inherited artwork overlays (responsible for horizontal artifacts). */
.printpage .cell.filled::after{content:none!important;display:none!important}
.printpage .cell.filled .date{
  position:absolute;top:5px;left:5px;right:auto;bottom:auto;
  z-index:3;margin:0;min-width:25px;
  padding:4px 6px;border-radius:7px;
  font-size:15px;line-height:1.05;letter-spacing:-.03em;
  background:linear-gradient(135deg,#a33297,#703b9c);
  border:1px solid rgba(255,200,244,.3);
  box-shadow:0 2px 6px rgba(0,0,0,.22);
}
/* Flush integrated title strip: no floating box, no glowing outline.
   Subtle magenta tint at upper-right only; all edges stay within the card. */
.printpage .cell.filled .title{
  position:absolute;left:0;right:0;bottom:0;top:auto;
  box-sizing:border-box;display:block;
  width:100%;max-width:100%;height:var(--esc-title-height);min-height:0;
  margin:0;padding:5px 6px 5px;
  border:0;border-top:1px solid rgba(255,255,255,.08);border-radius:0;
  background:linear-gradient(115deg,#111827 0%,#131b2c 69%,#30203e 100%);
  box-shadow:none;color:#fff;text-shadow:none;
  font-size:9px;font-weight:800;line-height:1.16;
  white-space:normal;overflow:hidden;overflow-wrap:anywhere;
  -webkit-line-clamp:unset;z-index:2;
}
.printpage .cell.filled .title::before,
.printpage .cell.filled .title::after{content:none!important;display:none!important}

/* V1.3 — same-tab Home navigation */
.home-nav{display:inline-flex;align-items:center;justify-content:center;padding:10px 15px;border:1px solid #ffffff22;border-radius:10px;color:#e6d9fa;text-decoration:none;font-size:14px;white-space:nowrap;background:#ffffff07}.home-nav:hover{background:#ffffff12}.home-nav:focus-visible{outline:2px solid #d8b4fe;outline-offset:3px}

}

/* V9.7.2 Surgical UI — isolate DIY layout from shared legacy classes. */
#calendarDiyPage .diy-shell{width:100%;max-width:1840px;padding:26px clamp(12px,2vw,36px) 70px}
#calendarDiyPage .diy-shell > .toolbar{position:relative;top:auto;z-index:1;padding:16px 20px}
#calendarDiyPage #diy-calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-auto-flow:row;gap:8px;border:0;border-radius:0;background:transparent;overflow:visible}
/* Each leading placeholder consumes exactly one weekday, including in PDF. */
#calendarDiyPage .calendar > .empty{grid-column:auto;grid-row:auto;min-width:0;min-height:0;padding:0;margin:0;border:0;border-radius:0;background:transparent}
#calendarDiyPage #diy-calendar > .cell{min-height:210px}
#calendarDiyPage #diy-picker{inset:0;margin:auto;width:min(1100px,calc(100vw - 32px));max-width:none;height:min(860px,calc(100dvh - 40px));max-height:calc(100dvh - 40px);padding:24px;overflow:hidden}
#calendarDiyPage #diy-picker[open]{display:flex;flex-direction:column;gap:0}
#calendarDiyPage #diy-picker .modalhead,#calendarDiyPage #diy-picker .hint,#calendarDiyPage #diy-picker .filters,#calendarDiyPage #diy-picker .foot{flex-shrink:0}
#calendarDiyPage #diy-options{flex:1;min-height:0;max-height:none;overflow:auto;align-content:start;overscroll-behavior:contain}
#calendarDiyPage #diy-options .option{min-height:96px;padding:12px 16px}
#calendarDiyPage #diy-options .option img{flex:none;width:88px;height:72px}
#calendarDiyPage #diy-options .option > span{min-width:0;overflow-wrap:anywhere}
#calendarDiyPage #diy-options .option strong{font-size:16px;line-height:1.45}
#calendarDiyPage #diy-options .option small{font-size:13px;line-height:1.45;white-space:normal}
body.banner-mode #tvsBannerPage > h1{display:none}
body.banner-mode #tvsBannerPage{padding-top:0!important}
@media(max-width:700px){
 #calendarDiyPage .diy-shell{padding:16px 10px 40px}
 #calendarDiyPage .diy-shell > .toolbar{padding:12px;gap:8px}
 #calendarDiyPage #diy-calendar{gap:4px}
 #calendarDiyPage #diy-calendar > .cell{min-height:120px}
 #calendarDiyPage #diy-picker{width:calc(100vw - 16px);height:calc(100dvh - 24px);max-height:calc(100dvh - 24px);padding:16px}
 #calendarDiyPage #diy-options .option{min-height:88px;padding:10px;gap:10px}
 #calendarDiyPage #diy-options .option img{width:64px;height:64px}
 #calendarDiyPage #diy-options .option strong{font-size:15px}
 #calendarDiyPage #diy-picker .filters{flex-wrap:wrap}
 #calendarDiyPage #diy-search{flex:1 1 180px;width:auto}
}

/* V9.7.3 Surgical — elegant Calendar DIY heading, screen only. */
#calendarDiyPage .diy-shell > .eyebrow{font-family:'Plus Jakarta Sans','Sarabun',sans-serif;font-size:10px;font-weight:600;letter-spacing:.22em;color:#c4b0cb;margin:0 0 12px}
#calendarDiyPage .diy-shell > .toolbar{position:relative;background:linear-gradient(115deg,rgba(44,31,53,.65),rgba(18,22,34,.82));border:1px solid rgba(222,192,150,.16);border-radius:16px;padding:22px 26px;box-shadow:0 10px 32px rgba(0,0,0,.12);gap:12px}
#calendarDiyPage .diy-shell > .toolbar::after{content:'';position:absolute;bottom:-1px;left:26px;width:100px;height:1px;background:linear-gradient(90deg,#d9bd8b,rgba(217,189,139,0));pointer-events:none}
#calendarDiyPage .diy-shell > .toolbar h1{font-family:'Plus Jakarta Sans','Sarabun',sans-serif;font-size:clamp(25px,2.4vw,38px);font-weight:500;line-height:1.25;letter-spacing:-.055em;color:#f4e9da;margin:0 auto 0 0;padding:0;text-shadow:none}
@media(max-width:700px){
 #calendarDiyPage .diy-shell > .toolbar{padding:18px 16px;border-radius:13px;gap:10px}
 #calendarDiyPage .diy-shell > .toolbar h1{flex-basis:100%;font-size:29px;margin-bottom:5px}
 #calendarDiyPage .diy-shell > .toolbar::after{left:16px;width:80px}
 #calendarDiyPage .diy-shell > .eyebrow{font-size:9px;letter-spacing:.14em}
}

/* V9.7.6 Surgical — channel beneath title on DIY screen and exported cards. */
#calendarDiyPage #diy-calendar .cell.filled{--esc-title-height:68px}
#calendarDiyPage .cell.filled .title{display:flex;flex-direction:column;justify-content:center;gap:4px;-webkit-line-clamp:unset}
#calendarDiyPage .diy-card-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere;flex-shrink:0}
#calendarDiyPage .diy-card-channel{display:block;font-size:10px;font-weight:500;color:#d9c6e5;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:0}
#calendarDiyPage .printpage .cell.filled{--esc-title-height:43px}
#calendarDiyPage .printpage .cell.filled .title{display:flex;gap:2px;justify-content:center}
#calendarDiyPage .printpage .diy-card-channel{font-size:8px;line-height:1.15}
@media(max-width:700px){
 #calendarDiyPage #diy-calendar .cell.filled{--esc-title-height:53px}
 #calendarDiyPage #diy-calendar .diy-card-channel{font-size:8px}
}

/* V9.7.7 Surgical — html2canvas must retain its temporary rendering viewport.
   The DIY route's body-child visibility guard otherwise hides this iframe. */
body.diy-mode > iframe.html2canvas-container{display:block!important}
