/*
 * Corehex: ตัวอย่างแอปโรงเรียน (วาดกราฟิกเองทั้งหมด) + รายการฟีเจอร์ + ปรับส่วน "Schools using Corehex apps"
 * ทุกอย่างใน .ap-scene ผูกกับ --p (0→1) จาก assets/scrub.js
 * ขนาดในโทรศัพท์ใช้หน่วย em เพื่อให้ย่อ/ขยายพร้อมกันทั้งเครื่อง
 */
@property --n { syntax: "<integer>"; inherits: true; initial-value: 0; }

.corehex-page .ap-scene :is(h2, h2 span, p, span, b, small, em, i, u) { font-family: "Anuphan", sans-serif !important; }
.ap-scene { position: relative; height: 480svh; background: #0d0a2a; color: #fff; }
.ap-stage {
  position: sticky; top: 0; height: 100svh; min-height: 600px; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center;
  gap: clamp(16px, 3vw, 56px); padding: 92px clamp(22px, 6vw, 96px) 32px; box-sizing: border-box; isolation: isolate;
}
.ap-vis {
  --in: clamp(0, (var(--p, 0) - var(--a)) / .05, 1);
  --out: clamp(0, (var(--p, 0) - var(--b)) / .05, 1);
  opacity: calc(var(--in) * (1 - var(--out) * (1 - var(--last, 0))));
}
.ap-scr { --q: clamp(0, (var(--p, 0) - var(--a)) / .23, 1); }

/* พื้นหลังคลื่นสีม่วง-ชมพู */
.ap-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(60% 50% at 78% 8%, #ff3d8b55, transparent 65%), radial-gradient(50% 60% at 8% 92%, #5b3df066, transparent 65%), linear-gradient(160deg, #0b0828, #1b1050 60%, #2a1262); }
.ap-bg i { position: absolute; display: block; border-radius: 50%; }
.ap-bg .w1 { left: -25%; top: 48%; width: 150%; height: 70%; background: linear-gradient(90deg, #ff3d8b99, #7a3df099); rotate: calc(-10deg + var(--p, 0) * 8deg); translate: calc(var(--p, 0) * -6%) 0; filter: blur(1px); }
.ap-bg .w2 { right: -30%; top: -35%; width: 110%; height: 70%; background: linear-gradient(120deg, #7a3df088, #ff3d8b66); rotate: calc(12deg - var(--p, 0) * 10deg); }
.ap-bg .w3 { left: 20%; top: 8%; width: 60%; height: 60%; background: radial-gradient(closest-side, #2a62ff44, transparent); }

.ap-copy { position: relative; z-index: 2; }
.ap-tag { margin: 0 0 18px; font-size: 12px; letter-spacing: .34em; color: #ff8fc2; }
.ap-steps { position: relative; min-height: clamp(280px, 46svh, 420px); }
.ap-step {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  transform: translateY(calc((1 - var(--in)) * 44px - var(--out) * 30px * (1 - var(--last, 0))));
}
.ap-n { margin: 0 0 12px; font-size: 13px; letter-spacing: .26em; color: #ffffff88; }
.corehex-page .ap-step h2 { margin: 0 0 18px; font-size: clamp(36px, 5.2vw, 84px); line-height: 1.04; font-weight: 800; letter-spacing: -.02em; color: #fff; }
.ap-step h2 .w { display: block; }
.ap-step h2 .o { display: block; color: transparent !important; -webkit-text-stroke: 2px #fff; }
.ap-step h2 .o span { color: transparent !important; -webkit-text-stroke: 2px #fff; }
.ap-p { margin: 0; max-width: 29em; font-size: clamp(15px, 1.4vw, 19px); line-height: 1.75; color: #d9d2f2; }
.ap-dots { display: flex; gap: 8px; margin: 0; }
.ap-dots i { --f: clamp(0, (var(--p, 0) - var(--a)) / (var(--b) - var(--a)), 1); width: 38px; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, #fff calc(var(--f) * 100%), #ffffff2e 0); }

/* ---- โทรศัพท์ ---- */
.ap-device { position: relative; display: grid; place-items: center; height: 100%; min-height: 0; z-index: 1;
  font-size: clamp(8px, min(calc((100svh - 176px) / 47), 1.25vw), 14px); }
.ap-phone { position: relative; width: 22em; height: 46em; padding: .7em; box-sizing: border-box; border-radius: 3.5em;
  background: linear-gradient(145deg, #4a4f9a, #15173f 55%, #2a2d6a);
  box-shadow: inset 0 0 0 .14em #8a90e0aa, 0 3.4em 6em #0009, 0 0 9em #ff3d8b44;
  rotate: calc(3deg - var(--p, 0) * 6deg); }
.ap-phone .btn { position: absolute; left: -.22em; width: .28em; border-radius: .2em; background: #6a70c0; }
.ap-phone .b1 { top: 7em; height: 2em; } .ap-phone .b2 { top: 10.4em; height: 3.4em; } .ap-phone .b3 { top: 14.4em; height: 3.4em; }
.ap-wrap { position: relative; width: 100%; height: 100%; border-radius: 2.9em; overflow: hidden; background: #0b0b14; }
.ap-wrap .isl { position: absolute; z-index: 10; top: .9em; left: 50%; translate: -50% 0; width: 6.6em; height: 1.9em; border-radius: 1em; background: #000; }
.ap-scr { position: absolute; inset: 0; color: #111; }
.ap-scr :is(b, small, span, div, p, em) { box-sizing: border-box; }
.crest { width: 2.4em; height: 2.4em; flex: none; }
.av { display: block; }
.ph-ava { position: absolute; left: 50%; top: -2.8em; translate: -50% 0; width: 5.8em; height: 5.8em; border-radius: 50%;
  background: linear-gradient(#cfe3f6, #e9f2fa); border: .2em solid #fff; overflow: hidden; }
.ph-ava .av { position: absolute; left: 50%; top: .1em; width: 6.4em; height: auto; translate: -50% 0; }
.ph-ava.sm { width: 4.6em; height: 4.6em; top: -2.5em; }
.ph-ava.sm .av { width: 5.2em; }

/* หน้าจอ 1: หน้าแรก */
.s1 .ph-sky { position: absolute; inset: 0;
  background: radial-gradient(40% 9% at 22% 17%, #fffb, transparent 72%), radial-gradient(34% 8% at 82% 26%, #fff9, transparent 72%), radial-gradient(60% 12% at 38% 66%, #ffffff66, transparent 72%),
    linear-gradient(#4a97ea, #9fcff6 38%, #dcecf5 68%, #b9d8c4); }
.s1 .ph-head { position: absolute; top: 3.6em; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: .6em; color: #0f2f5c; text-align: left; }
.s1 .ph-head b { display: block; font-size: .95em; letter-spacing: .02em; } .s1 .ph-head small { font-size: .72em; opacity: .75; }
.s1 .ph-clock { position: absolute; top: 7.2em; left: 0; right: 0; text-align: center; color: #fff; text-shadow: 0 .1em .7em #0a2a5a55; }
.s1 .ph-clock b { display: block; font-size: 5.6em; font-weight: 300; line-height: 1; letter-spacing: -.03em; }
.s1 .ph-clock small { display: block; margin-top: .3em; font-size: 1.05em; }
.s1 .ph-profile { position: absolute; left: 1em; right: 1em; top: 19.6em; height: 9.2em; padding-top: 3.5em; border-radius: 1.6em; text-align: center; color: #fff;
  background: linear-gradient(#2a2b34f2, #16171d); box-shadow: 0 .8em 1.6em #0a1a3a55;
  opacity: clamp(0, var(--q) * 9, 1); transform: translateY(calc((1 - clamp(0, var(--q) * 9, 1)) * 3em)); }
.s1 .ph-profile b { display: block; font-size: 1.3em; font-weight: 700; } .s1 .ph-profile small { opacity: .75; font-size: .85em; }
.s1 .star { position: absolute; right: 1.1em; top: .9em; width: 1em; height: 1em; background: #ffd23f; clip-path: polygon(50% 0, 62% 36%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 36%); }
.s1 .ph-tiles3 { position: absolute; left: 1em; right: 1em; top: 30.2em; display: grid; grid-template-columns: repeat(3, 1fr); gap: .6em; }
.s1 .tl { --g: clamp(0, (var(--q) - var(--d)) * 9, 1); height: 5.8em; border-radius: 1.2em; background: #ffffffd2; backdrop-filter: blur(8px); color: #232323;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3em; opacity: var(--g); scale: calc(.55 + var(--g) * .45); }
.s1 .tl b { font-size: 1.5em; font-weight: 700; line-height: 1; } .s1 .tl small { font-size: .72em; opacity: .7; text-align: center; }
.s1 .cnt { --n: calc(clamp(0, var(--q) * 3, 1) * 18); }
.cnt::before, .cnt2::before { counter-reset: v var(--n); content: counter(v); }
.s1 .heart { width: 2em; height: 1.8em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 21S2 14 2 7.500A5.500 5.500 0 0112 5a5.500 5.500 0 0110 2.500C22 14 12 21 12 21z' fill='%23ff6b8f'/%3E%3C/svg%3E") center/contain no-repeat; }
.s1 .ph-bottom { position: absolute; left: 1em; right: 1em; top: 37.2em; display: grid; grid-template-columns: 1fr 1fr; gap: .7em; }
.s1 .bt { --g: clamp(0, (var(--q) - var(--d)) * 9, 1); height: 7.4em; border-radius: 1.4em; padding: .9em; display: flex; flex-direction: column; justify-content: space-between;
  opacity: var(--g); transform: translateY(calc((1 - var(--g)) * 2.4em)); }
.s1 .bt small { font-size: .78em; opacity: .75; } .s1 .bt b { font-size: .9em; }
.s1 .bt.dark { background: #16171d; color: #fff; } .s1 .bt.light { background: #fff; color: #222; }
.s1 .bt span { display: flex; gap: .1em; } .gi { width: 3.4em; height: 3.4em; }

/* หน้าจอ 2: ใบเสร็จ */
.s2 .ph-dim { position: absolute; inset: 0; background: radial-gradient(60% 30% at 70% 18%, #8fa4c8aa, transparent), linear-gradient(#2c3a55, #1b2236 55%, #27402f); }
.s2 .rc-card { position: absolute; right: -1.6em; bottom: 5em; width: 9.4em; height: 5.8em; border-radius: .9em; background: linear-gradient(135deg, #f6f8fc, #c9d3e6);
  display: flex; align-items: center; justify-content: center; gap: .4em; rotate: -9deg; box-shadow: 0 1em 2em #0008;
  opacity: clamp(0, (var(--q) - .5) * 6, 1); translate: calc((1 - clamp(0, (var(--q) - .5) * 6, 1)) * 4em) 0; }
.s2 .rc-card b { font-size: .7em; color: #c52f43; letter-spacing: .04em; } .s2 .rc-card i { width: 1.6em; height: 1.6em; border-radius: 50%; background: #c52f43; }
.s2 .rc { --u: clamp(0, var(--q) * 4, 1); position: absolute; left: 1.4em; top: 4.6em; width: 17.2em; padding: 1.4em 1.1em 1.9em; color: #262626; background: #fdfdfa; box-shadow: 0 1.4em 2.6em #0009;
  transform: translateY(calc((1 - var(--u)) * 38em)) rotate(calc(-4deg + (1 - var(--u)) * 12deg));
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/1.1em 52% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top/1.1em 52% repeat-x;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/1.1em 52% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top/1.1em 52% repeat-x; }
.s2 .rc-top { display: flex; flex-direction: column; align-items: center; gap: .15em; text-align: center; }
.s2 .rc-top b { font-size: .95em; letter-spacing: .04em; } .s2 .rc-top small { font-size: .62em; letter-spacing: .2em; opacity: .7; }
.s2 .rc-h, .s2 .rc p.r { display: grid; grid-template-columns: 3em 1fr 4.6em; }
.s2 .rc-h { margin-top: .9em; padding: .55em 0; font-size: .6em; letter-spacing: .08em; border-top: .12em dashed #8b8b8b; border-bottom: .12em dashed #8b8b8b; }
.s2 .rc-h span:last-child, .s2 .rc > p b { text-align: right; }
.s2 .rc > p { margin: 0; display: grid; grid-template-columns: 3em 1fr 4.6em; font-size: .78em; padding: .5em 0; opacity: clamp(0, (var(--q) - .2 - var(--d)) * 10, 1);
  transform: translateX(calc((1 - clamp(0, (var(--q) - .2 - var(--d)) * 10, 1)) * -2em)); }
.s2 .rc > p em { font-style: normal; opacity: .7; }
.s2 .rc-sum { margin-top: .7em; padding-top: .6em; border-top: .12em dashed #8b8b8b; display: grid; gap: .3em; opacity: clamp(0, (var(--q) - .5) * 8, 1); }
.s2 .rc-sum p { margin: 0; display: flex; justify-content: space-between; font-size: .68em; letter-spacing: .03em; }
.s2 .rc-bal { margin-top: .8em; padding-top: .6em; border-top: .16em solid #262626; display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 1.02em;
  opacity: clamp(0, (var(--q) - .55) * 8, 1); }
.s2 .rc-bal b { background: linear-gradient(transparent 58%, #ffe27a 58%) no-repeat left / calc(clamp(0, (var(--q) - .6) * 6, 1) * 100%) 100%; padding: 0 .2em; }

/* หน้าจอ 3: แต่งตัวละคร */
.s3 { background: #f3f3f6; }
.s3 .av-top { position: absolute; z-index: 3; top: 3.6em; left: 1em; right: 1em; display: flex; justify-content: space-between; }
.s3 .av-top span, .s3 .av-top b { padding: .55em 1.3em; border-radius: 2em; font-size: .95em; font-weight: 600; color: #fff; background: #3a3a42cc; }
.s3 .av-top b { background: #1b78ff; }
.s3 .room { position: absolute; left: 0; right: 0; top: 0; height: 58%; background: #c9ccd3; overflow: hidden; }
.s3 .wall { position: absolute; top: 0; height: 72%; }
.s3 .wall.l { left: 0; width: 50%; background: linear-gradient(#eceef2, #d3d6dd); clip-path: polygon(0 0, 100% 10%, 100% 100%, 0 100%); }
.s3 .wall.r { left: 50%; width: 50%; background: linear-gradient(#b9bdc6, #a9aeb8); clip-path: polygon(0 10%, 100% 0, 100% 100%, 0 100%); }
.s3 .floor { position: absolute; left: 0; right: 0; top: 66%; bottom: 0; background: linear-gradient(#f3f3f5, #dedfe4); }
.s3 .table { position: absolute; right: 7%; bottom: 20%; width: 8.4em; height: 5.2em; }
.s3 .table .top { position: absolute; left: 0; right: 0; top: 0; height: 1em; background: #d99f60; transform: skewX(-18deg); border-radius: .25em; box-shadow: 0 .3em 0 #a9733d; }
.s3 .table .leg { position: absolute; top: 1em; width: .6em; height: 4em; background: #a9733d; } .s3 .table .a { left: .8em; } .s3 .table .b { right: .8em; }
.s3 .table .clock { position: absolute; left: 1.2em; top: -1.4em; width: 2.6em; height: 1.5em; border-radius: .35em; background: #34373e; }
.s3 .table .ped { position: absolute; right: 1.4em; top: -2.8em; width: 1.9em; height: 1.4em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 21S2 14 2 7.500A5.500 5.500 0 0112 5a5.500 5.500 0 0110 2.500C22 14 12 21 12 21z' fill='%23ff6b8f'/%3E%3C/svg%3E") center/contain no-repeat; }
.s3 .table .ped u { position: absolute; left: .3em; right: .3em; top: 100%; height: .9em; background: #9a6a3e; border-radius: .2em; }
.s3 .avs { position: absolute; left: 13%; bottom: 9%; width: 7.6em; height: 12.2em; }
.s3 .avs .av { position: absolute; inset: 0; width: 100%; height: 100%; }
.s3 .a-skin { opacity: clamp(0, (.33 - var(--q)) * 20, 1); }
.s3 .a-crew { opacity: calc(clamp(0, (var(--q) - .31) * 20, 1) * (1 - clamp(0, (var(--q) - .65) * 20, 1))); }
.s3 .a-messy { opacity: clamp(0, (var(--q) - .64) * 20, 1); }
.s3 .pts { position: absolute; right: .8em; bottom: .8em; padding: .35em .7em; border-radius: .7em; background: #1d1d24; color: #fff; font-size: .82em; }
.s3 .pts i { margin-right: .3em; padding: 0 .35em; border-radius: .3em; background: #ff8a1f; font-style: normal; }
.s3 .tabs { position: absolute; top: 58%; left: 0; right: 0; height: 4.2em; display: flex; justify-content: space-around; align-items: center; background: #fff; border-bottom: .1em solid #e3e3ea; color: #7a7a86; }
.s3 .tb svg { width: 1.8em; height: 1.8em; display: block; } .s3 .tb.on { color: #111; }
.s3 .items { position: absolute; top: calc(58% + 4.2em); bottom: 0; left: 0; right: 0; padding: .8em; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 6.6em; gap: .6em; background: #f3f3f6; align-content: start; }
.s3 .it { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5em; border-radius: .9em; background: #fff; color: #333; text-align: center; }
.s3 .it small { font-size: .74em; line-height: 1.15; padding: 0 .3em; }
.s3 .it.lk b { position: absolute; top: .4em; left: .4em; padding: .15em .5em; border-radius: .5em; background: #2a2a30; color: #ff9a3f; font-size: .7em; }
.s3 .hp { display: block; width: 3.4em; height: 2.4em; }
.s3 .h-skin { background: #a4a9b1; border-radius: 50% 50% .4em .4em / 90% 90% .4em .4em; }
.s3 .h-crew { background: #15151d; border-radius: 45% 45% .5em .5em / 80% 80% .5em .5em; }
.s3 .h-messy { background: #4a2c1c; clip-path: polygon(0 100%, 4% 40%, 20% 52%, 30% 14%, 48% 40%, 66% 10%, 76% 44%, 100% 30%, 100% 100%); }
.s3 .sel { position: absolute; left: .8em; top: .8em; width: calc((100% - 1.6em - 1.2em) / 3); height: 6.6em; border: .22em solid #5e5e68; border-radius: .9em; pointer-events: none;
  translate: calc(round(down, clamp(0, var(--q) * 3, 2.99), 1) * (100% + .6em)) 0; transition: translate .35s cubic-bezier(.3, 1.3, .5, 1); }

/* หน้าจอ 4: โอนเงิน */
.s4 .tf-bg { position: absolute; inset: 0; background: radial-gradient(60% 28% at 28% 18%, #6a4bff99, transparent), radial-gradient(50% 30% at 82% 60%, #ff3d8b66, transparent), #0e0f20; }
.s4 .tf-people { position: absolute; top: 6.6em; left: .8em; right: .8em; display: flex; align-items: center; justify-content: space-between; }
.s4 .pp { --g: clamp(0, var(--q) * 8, 1); position: relative; width: 8.4em; padding: 3.1em .4em .9em; border-radius: 1.4em; background: #23242fee; color: #fff; text-align: center; opacity: var(--g); }
.s4 .pp:first-child { translate: calc((1 - var(--g)) * -4em) 0; } .s4 .pp:last-child { translate: calc((1 - var(--g)) * 4em) 0; }
.s4 .pp b { display: block; font-size: 1.1em; } .s4 .pp small { font-size: .7em; opacity: .6; }
.s4 .arr { display: flex; } .s4 .arr i { width: .9em; height: .9em; margin-left: -.35em; border-top: .26em solid #4f9dff; border-right: .26em solid #4f9dff; rotate: 45deg; animation: ap-chev 1.1s infinite; }
.s4 .arr i:nth-child(2) { animation-delay: .15s; } .s4 .arr i:nth-child(3) { animation-delay: .3s; }
@keyframes ap-chev { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.s4 .tf-num { position: absolute; top: 18em; left: 0; right: 0; text-align: center; color: #fff; }
.s4 .cnt2 { --n: calc(203 - clamp(0, (var(--q) - .15) * 3, 1) * 36); display: block; font-size: 6.4em; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.s4 .tf-num small { display: block; font-size: .95em; margin-top: .4em; } .s4 .tf-num em { font-style: normal; color: #7fd6ff; font-weight: 700; } .s4 .tf-num .dim { opacity: .55; font-size: .8em; }
.s4 .tf-ok { position: absolute; top: 29.4em; left: 50%; translate: -50% 0; display: flex; align-items: center; gap: .4em; padding: .55em 1.2em; border-radius: 2em; background: #1f9a5c; color: #fff; font-weight: 600;
  opacity: clamp(0, (var(--q) - .72) * 8, 1); scale: calc(.8 + clamp(0, (var(--q) - .72) * 8, 1) * .2); }
.s4 .tf-ok svg { width: 1.3em; height: 1.3em; }
.s4 .keys { position: absolute; left: 0; right: 0; bottom: 0; height: 12.6em; padding: 1em 1.2em; display: grid; grid-template-columns: repeat(3, 1fr); gap: .7em; border-radius: 2em 2em 0 0; background: #181924; }
.s4 .ky { --h: clamp(0, (var(--q) - var(--d)) * 24, 1) * (1 - clamp(0, (var(--q) - var(--d) - .05) * 24, 1)); display: grid; place-items: center; font-size: 1.9em; font-weight: 600; color: #fff; border-radius: 50%;
  background: color-mix(in srgb, #4f9dff calc(var(--h) * 100%), #2a2b39); }

/* ของลอยรอบโทรศัพท์ */
.ap-props { position: absolute; inset: -2% -14%; pointer-events: none; }
.ap-props .pr { position: absolute; width: 8em; translate: calc((1 - var(--in)) * var(--dx, -6em)) calc((1 - var(--in)) * var(--dy, 0em)); rotate: calc(var(--r, 0deg) + (1 - var(--in)) * 30deg); animation: ap-float 5s ease-in-out infinite; }
.ap-props .pr .gi { width: 100%; height: auto; filter: drop-shadow(0 .5em .7em #0007); }
.p3 .x1 { left: 6%; top: 10%; --r: -12deg; --dy: -5em; animation-delay: -1s; } .p3 .x2 { left: 0; top: 46%; --r: -8deg; animation-delay: -2s; }
.p3 .x3 { right: 0; top: 40%; --r: 10deg; --dx: 6em; animation-delay: -3s; } .p3 .x4 { right: 6%; bottom: 8%; --r: -6deg; --dx: 6em; --dy: 4em; animation-delay: -1.500s; }
.p3 .x5 { right: 10%; top: 8%; --r: 12deg; --dy: -5em; width: 6.5em; animation-delay: -.5s; }
.p4 .c1 { left: 4%; top: 28%; width: 7em; --r: 0deg; --dx: -6em; } .p4 .c2 { right: 4%; bottom: 14%; width: 6em; --dx: 6em; animation-delay: -2s; }
.p4 .coin { width: 100%; height: auto; filter: drop-shadow(0 .5em .7em #0007); }
.p4 .bn { position: absolute; width: 9em; height: 4.4em; border-radius: .5em; display: grid; place-items: center; rotate: calc(var(--r) + (1 - var(--in)) * 24deg); box-shadow: 0 .6em 1.2em #0007, inset 0 0 0 .2em #ffffff44;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 65%, #fff)); animation: ap-float 6s ease-in-out infinite; }
.p4 .bn b { font-size: 2em; color: #ffffffcc; } .p4 .bn i { position: absolute; left: .7em; top: 50%; width: 2.2em; height: 2.2em; translate: 0 -50%; border-radius: 50%; border: .18em solid #ffffff66; }
.p4 .bn[data-n="1"] { left: -4%; top: 6%; translate: calc((1 - var(--in)) * -6em) calc((1 - var(--in)) * -4em); }
.p4 .bn[data-n="2"] { right: -6%; top: 20%; translate: calc((1 - var(--in)) * 6em) calc((1 - var(--in)) * -4em); animation-delay: -2s; }
.p4 .bn[data-n="3"] { left: -6%; bottom: 8%; translate: calc((1 - var(--in)) * -6em) calc((1 - var(--in)) * 4em); animation-delay: -4s; }
@keyframes ap-float { 0%, 100% { margin-top: 0; } 50% { margin-top: -.7em; } }
.ap-device .art-caption { bottom: -3.2em; font-size: 11px !important; color: #fff; }

/* ---- รายการฟีเจอร์ ---- */
.ap-bento { padding: clamp(70px, 10vw, 140px) clamp(22px, 6vw, 96px); background: linear-gradient(#0d0a2a, #190f45); color: #fff; }
.ap-bento-in { max-width: 1160px; margin: 0 auto; }
.corehex-page .ap-bento h2 { margin: 0 0 38px; max-width: 14em; font-size: clamp(30px, 4.4vw, 62px); line-height: 1.1; font-weight: 800; letter-spacing: -.01em; }
.ap-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.ap-grid li { --g: clamp(0, (var(--p, 0) - .08 - var(--i) * .03) / .14, 1); grid-column: span 3; min-height: 8.6em; padding: 1.3em; border-radius: 1.5em; display: flex; flex-direction: column; justify-content: space-between; gap: 1.2em;
  background: linear-gradient(145deg, #ffffff17, #ffffff06); border: 1px solid #ffffff24; opacity: var(--g); transform: translateY(calc((1 - var(--g)) * 46px)) rotate(calc((1 - var(--g)) * (var(--i) - 4.5) * .6deg)); font-size: 15px; }
.ap-grid li.wide { grid-column: span 6; } .ap-grid li.full { grid-column: span 12; min-height: 6em; flex-direction: row; align-items: center; }
.ap-grid li:first-child { background: linear-gradient(135deg, #ff3d8b55, #7a3df044); border-color: #ff8fc255; }
.ap-grid .ic { display: grid; place-items: center; width: 2.9em; height: 2.9em; border-radius: .9em; background: #ffffff14; color: #ff8fc2; }
.ap-grid .ic svg { width: 1.6em; height: 1.6em; }
.ap-grid b { font-size: 1.2em; font-weight: 700; line-height: 1.3; }
.ap-fine { margin: 26px 0 0; font-size: 13px; color: #bdb4de; }

/* ---- Schools using Corehex apps: ปรับให้น่าเชื่อถือและมีชีวิตขึ้น ---- */
.school-apps { position: relative; overflow: hidden; }
.school-apps::before { content: ""; position: absolute; inset: -30% -10%; pointer-events: none;
  background: radial-gradient(34% 26% at calc(10% + var(--p, 0) * 70%) 24%, #2aa8ff40, transparent 70%), radial-gradient(30% 22% at calc(90% - var(--p, 0) * 60%) 80%, #7a5cff30, transparent 70%); }
.school-apps-inner { position: relative; z-index: 1; }
.school-apps .sa-live { display: inline-flex; align-items: center; gap: .7em; margin: 0 0 22px; padding: .55em 1.1em; border: 1px solid #2fe29a66; border-radius: 99px; background: #0b2a24; color: #86ffc9; font-size: .74rem; letter-spacing: .16em; }
.school-apps .sa-live i { width: 8px; height: 8px; border-radius: 50%; background: #2fe29a; box-shadow: 0 0 0 0 #2fe29a99; animation: sa-pulse 2s infinite; }
@keyframes sa-pulse { 70% { box-shadow: 0 0 0 10px #2fe29a00; } 100% { box-shadow: 0 0 0 0 #2fe29a00; } }
.school-option { position: relative; overflow: hidden; transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .3s, box-shadow .3s; }
.school-option:hover { transform: translateY(-4px); }
.school-option::after { content: ""; position: absolute; right: 16px; top: 16px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #52647a; transition: .3s; }
.school-option[aria-pressed="true"]::after { border-color: #76dfff; background: #76dfff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2309182a' stroke-width='3.500' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.500l4.500 4.500L19 7.500'/%3E%3C/svg%3E") center/70% no-repeat; }
.school-option[aria-pressed="true"]::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, #ffffff22 50%, transparent 65%); translate: -120% 0; animation: sa-shine 1.2s .1s both; }
@keyframes sa-shine { to { translate: 120% 0; } }
.school-option span { padding-right: 34px; }
.school-stores a.swap { animation: sa-swap .5s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes sa-swap { from { opacity: 0; transform: translateY(12px) scale(.94); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .school-apps.is-visible .school-stores a { animation: sa-swap .7s .55s cubic-bezier(.2, .8, .2, 1) backwards; }
  .school-apps.is-visible .school-stores a + a { animation-delay: .7s; }
  .school-apps.is-visible .sa-live { animation: sa-swap .6s backwards; }
}

/* ---- มือถือ ---- */
@media (max-width: 900px) {
  .ap-scene { height: 440svh; }
  .ap-stage { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 4px; padding: 82px 18px 10px; min-height: 0; align-items: start; }
  .ap-steps { min-height: 196px; }
  .corehex-page .ap-step h2 { font-size: 28px; margin-bottom: 8px; }
  .ap-step h2 .o { -webkit-text-stroke-width: 1.5px; }
  .ap-n { margin-bottom: 6px; } .ap-tag { margin-bottom: 8px; }
  .ap-p { font-size: 13px; line-height: 1.55; }
  .ap-dots { display: none; }
  .ap-device { font-size: max(7px, calc((100svh - 376px) / 47)); align-items: start; }
  .ap-props { display: none; }
  .ap-device .art-caption { display: none; }
  .ap-grid li, .ap-grid li.wide { grid-column: span 6; min-height: 7.2em; }
  .ap-grid li.full { grid-column: span 12; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-scene { height: auto; }
  .ap-stage { position: relative; height: auto; min-height: 100svh; }
  .ap-steps { min-height: 0; }
  .ap-step { position: relative; opacity: 1; transform: none; margin-bottom: 26px; }
  .ap-phone { rotate: 0deg; }
}

/* กระดานดำ: เอาแถวไอคอนแอป/สโตร์ออกแล้ว เหลือพื้นที่ให้โทรศัพท์ */
.cs-school-art { padding-bottom: 28px; }

/* โทรศัพท์บนกระดานดำ: ใช้หน้าตาเดียวกับตัวอย่างแอป */
.cs-phone-screen.mini { position: relative; padding: 30px 12px 12px; background: none; color: #0f2f5c; align-items: center; text-align: center; }
.mini-sky { position: absolute; inset: 0; z-index: 0; background: radial-gradient(40% 9% at 24% 20%, #fffb, transparent 72%), linear-gradient(#4a97ea, #9fcff6 42%, #dcecf5 72%, #b9d8c4); }
.cs-phone-screen.mini > :not(.mini-sky) { position: relative; z-index: 1; }
.cs-phone-screen.mini small { font-size: 8px; letter-spacing: .14em; color: #0f2f5c; }
.cs-phone-screen.mini strong { font-size: 40px; font-weight: 300; color: #fff; line-height: 1; text-shadow: 0 2px 10px #0a2a5a55; margin-bottom: 8px; }
.mini-card { position: relative; width: 100%; margin-top: 18px; padding: 30px 8px 10px; border-radius: 14px; background: #1d1e26; color: #fff; font-size: 11px; }
.mini-ava { position: absolute; left: 50%; top: -22px; translate: -50% 0; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: #dbe9f6; border: 2px solid #fff; }
.mini-ava .av { position: absolute; left: 50%; top: 1px; width: 52px; translate: -50% 0; }
.mini-tiles { margin-top: 14px; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mini-tiles i { display: block; height: 44px; border-radius: 10px; background: #ffffffc4; }
