/* Pictalk AAC student page — visual layer only. No application logic. */
:root{
  --aac-pink:#e94d91;
  --aac-pink-dark:#cf367b;
  --aac-pink-soft:#fff0f6;
  --aac-blue:#78b9e8;
  --aac-blue-soft:#eef7ff;
  --aac-mint:#eaf8f1;
  --aac-ink:#34465a;
  --aac-muted:#8291a2;
  --aac-line:#e8edf3;
  --aac-card-shadow:0 8px 24px rgba(56,75,99,.065);
}

/* This page has no admin sidebar; neutralize the shared layout offset. */
html{scroll-behavior:smooth}
body{
  margin:0!important;
  padding-left:0!important;
  min-height:100vh;
  color:var(--aac-ink);
  background:
    radial-gradient(ellipse at 8% 0%,rgba(255,224,238,.52),transparent 34rem),
    radial-gradient(ellipse at 95% 18%,rgba(220,240,255,.58),transparent 31rem),
    #f8fafc;
  font-family:Kanit,sans-serif;
}

.top{
  position:sticky;top:0;z-index:100;
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  min-height:72px;padding:10px clamp(14px,3vw,34px)!important;
  background:rgba(255,255,255,.94)!important;
  border-bottom:1px solid rgba(226,233,241,.9)!important;
  box-shadow:0 4px 18px rgba(45,64,86,.045)!important;
  backdrop-filter:blur(14px);
}
.brand-wrap{display:flex;align-items:center;gap:14px;min-width:0}
.brand-logo{width:clamp(104px,12vw,142px)!important;height:48px!important;object-fit:contain;object-position:left center}
.brand-wrap .student{
  display:block;max-width:min(45vw,460px);padding:0!important;
  color:var(--aac-muted)!important;font-size:14px!important;line-height:1.35;
  white-space:normal!important;text-align:left!important;
}
.brand-wrap .student strong{color:#53677e!important;font-weight:600!important;font-size:15px!important}
.top>.form-select{
  width:auto;min-width:145px;max-width:240px!important;min-height:42px!important;
  border:1px solid #e6dce5!important;border-radius:12px!important;
  color:#586b80;background-color:#fff;font-size:14px!important;
}
.logout-circle{
  display:inline-flex!important;align-items:center;justify-content:center;gap:8px;
  width:auto!important;min-width:44px;height:44px!important;flex:0 0 auto;
  padding:0 13px!important;border:1px solid #f0dce6!important;border-radius:14px!important;
  background:#fff7fa!important;color:#b64b78!important;box-shadow:none!important;
  font:500 13px Kanit,sans-serif;cursor:pointer;
}
.logout-circle svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.logout-circle:hover{background:#ffedf4!important;border-color:#edc6d8!important}
.logout-label{white-space:nowrap}

.wrap{width:min(1160px,100%)!important;max-width:1160px!important;margin:0 auto!important;padding:26px clamp(14px,3vw,30px) 56px!important}
.aac-intro{
  display:flex;align-items:center;gap:16px;margin:0 0 22px;padding:20px 22px;
  border:1px solid #f3e3eb;border-radius:22px;
  background:linear-gradient(112deg,rgba(255,241,247,.96),rgba(246,250,255,.98) 72%);
  box-shadow:0 6px 22px rgba(72,82,105,.035);
}
.aac-intro-mark{
  display:grid;place-items:center;width:54px;height:54px;flex:0 0 54px;
  border-radius:18px;background:#fff;color:var(--aac-pink);font-size:26px;
  box-shadow:0 4px 12px rgba(211,93,143,.09);
}
.aac-eyebrow{margin:0 0 3px;color:#c36b91;font-size:10px;font-weight:600;letter-spacing:1.15px}
.aac-intro h1{margin:0;color:#35475c;font-size:clamp(21px,3vw,27px);font-weight:600;line-height:1.25}
.aac-intro-copy{margin:4px 0 0;color:#8290a0;font-size:13px;line-height:1.45}

/* Sentence builder */
.sentence{
  margin:0 0 24px!important;padding:12px!important;
  border:1px solid #f0dce6!important;border-radius:20px!important;
  background:rgba(255,255,255,.94)!important;box-shadow:var(--aac-card-shadow)!important;
}
.sentence-toggle{
  display:flex;align-items:center;gap:12px;width:100%;min-height:62px;
  padding:10px 13px!important;border:1px solid #f3dce7!important;border-radius:15px!important;
  background:linear-gradient(100deg,#fff5f9,#fff)!important;color:#68475a!important;
  text-align:left;cursor:pointer;transition:background .16s ease,border-color .16s ease;
}
.sentence-toggle:hover{background:#fff0f6!important;border-color:#eec7d9!important}
.toggle-symbol{display:grid;place-items:center;width:42px!important;height:42px!important;flex:0 0 42px;border-radius:13px!important;background:var(--aac-pink)!important;color:#fff!important}
.toggle-symbol svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.toggle-copy{display:flex;flex:1;flex-direction:column;min-width:0;line-height:1.3}
.toggle-copy strong{color:#68475a;font-size:16px;font-weight:600}
.toggle-copy small{margin-top:3px;color:#a08091;font-size:11px}
.count-pill{display:grid;place-items:center;min-width:32px;height:32px;padding:0 9px;border-radius:20px;background:#fce1ec;color:#bd4779;font-size:14px;font-weight:600}
.toggle-chevron{color:#bd7897;font-size:24px;line-height:1;transition:transform .18s ease}
.sentence-toggle[aria-expanded=true] .toggle-chevron{transform:rotate(180deg)}
.sentence-content{padding:17px 5px 5px}
.picker-heading{margin:5px 0 9px;color:#53677d;font-size:14px;font-weight:600}
.sentence-items{
  display:flex;align-items:flex-start;flex-wrap:wrap;gap:9px;min-height:104px;
  padding:10px!important;border:1px dashed #e8bfd1!important;border-radius:15px!important;
  background:#fffafd!important;
}
.sentence-items:empty{display:flex}
.sentence-chip{border:1px solid #f0d2df!important;border-radius:13px!important;background:#fff0f6!important;color:#68475a!important}
.sentence-chip img{width:62px!important;height:62px!important;object-fit:contain}
.sentence-chip span{font-size:13px;line-height:1.25}
.sentence-chip small{color:#b06c8b!important;font-size:10px}
.sentence-picker{display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:9px;max-height:300px;overflow:auto;padding:2px 2px 8px;overscroll-behavior:contain}
.sentence-pick{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  min-height:122px;padding:9px!important;border:1px solid var(--aac-line)!important;
  border-radius:14px!important;background:#fff!important;color:#53677d!important;
  box-shadow:0 2px 8px rgba(52,70,90,.035);cursor:pointer;
}
.sentence-pick:hover{border-color:#efbfd3!important;background:#fff8fb!important}
.sentence-pick img{width:70px!important;height:70px!important;object-fit:contain}
.sentence-pick span{font-size:13px;font-weight:500;text-align:center;line-height:1.25}
.sentence-pick small{color:#c05d89!important;font-size:10px}
.sentence-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;max-width:500px;margin:14px auto 2px}
.sentence-actions .action-btn{
  display:flex;align-items:center;justify-content:center;gap:9px;min-height:54px!important;
  padding:10px 14px!important;border-radius:14px!important;font-size:15px!important;font-weight:500;
}
.sentence-actions .action-btn span:first-child{font-size:20px;line-height:1}
.sentence-actions .speak-btn{grid-column:1/-1;min-height:60px!important;background:linear-gradient(120deg,#ee6da4,#df4388)!important;border-color:#df4388!important;color:#fff!important;box-shadow:0 5px 13px rgba(223,67,136,.16)!important}
.sentence-actions .clear-btn{background:#f5f7fa!important;border:1px solid #e4eaf0!important;color:#5e7185!important;box-shadow:none!important}
.sentence-actions .save-btn{background:#edf8f1!important;border:1px solid #d3eadb!important;color:#39805a!important;box-shadow:none!important}

/* Category and picture grids */
.category-bar[hidden],#categoryView[hidden]{display:none!important}
.category-bar{
  display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr))!important;
  gap:14px!important;align-items:stretch;padding:2px 0 20px!important;margin:0!important;
}
.category-bar::before{
  content:"เลือกหมวดหมู่ที่ต้องการ";grid-column:1/-1;display:block;
  margin:0 0 1px;padding:0 2px;color:#566b80;font-size:17px;font-weight:600;
}
.cat-btn{
  position:relative;display:flex!important;flex-direction:column;align-items:center;justify-content:center;
  width:100%;min-width:0;min-height:190px!important;gap:9px!important;padding:13px!important;
  overflow:hidden;border:1px solid var(--aac-line)!important;border-top:4px solid var(--category-color,#dce9f5)!important;
  border-radius:19px!important;background:#fff!important;color:#465d74!important;
  box-shadow:0 5px 16px rgba(52,70,90,.055)!important;
  font:500 15px Kanit,sans-serif!important;text-align:center;white-space:normal!important;
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;
}
.cat-btn:nth-child(3n+2){background:linear-gradient(160deg,#fff,#fff9fc)!important}
.cat-btn:nth-child(3n+3){background:linear-gradient(160deg,#fff,#f7fbff)!important}
.cat-btn:hover{transform:translateY(-3px);box-shadow:0 10px 22px rgba(52,70,90,.09)!important}
.cat-btn img{display:block;width:min(100%,148px)!important;height:124px!important;max-width:100%;object-fit:contain!important;border-radius:12px;background:transparent!important;padding:0!important}
.cat-btn .cat-emoji{display:grid;place-items:center;width:100%;height:124px;font-size:52px;line-height:1;color:#9aaec1}
.cat-btn span:last-child{max-width:100%;color:#465d74!important;font-size:15px!important;font-weight:600!important;line-height:1.3;overflow-wrap:anywhere}
.cat-btn.active{border:2px solid var(--aac-pink)!important;border-top:4px solid var(--aac-pink)!important;background:#fff3f8!important;color:#bd3977!important;box-shadow:0 0 0 3px rgba(233,77,145,.08)!important}

#categoryView>.d-flex{margin:0 0 14px!important;padding:10px 12px;border:1px solid var(--aac-line);border-radius:15px;background:rgba(255,255,255,.9)}
#activeCategoryTitle{color:#435b73;font-size:18px!important;font-weight:600}
.home-back-btn{
  display:inline-flex!important;align-items:center;justify-content:center;gap:7px;
  min-height:40px!important;padding:8px 13px!important;border:1px solid #f0dce6!important;
  border-radius:11px!important;background:#fff5f9!important;color:#b64b78!important;
  font:500 13px Kanit,sans-serif!important;box-shadow:none!important;
}
.home-back-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.grid{display:grid;grid-template-columns:repeat(var(--cols,3),minmax(0,1fr));gap:13px!important}
.picture{
  display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:8px;
  min-width:0;min-height:174px!important;padding:12px!important;
  border:1px solid var(--aac-line)!important;border-radius:17px!important;background:#fff!important;
  box-shadow:0 4px 13px rgba(52,70,90,.05)!important;cursor:pointer;
  transition:transform .14s ease,border-color .14s ease,box-shadow .14s ease;
}
.picture:hover{transform:translateY(-2px);border-color:#efc3d6!important;box-shadow:0 8px 18px rgba(52,70,90,.085)!important}
.picture:active{transform:scale(.985);background:#fff5f9!important;border-color:var(--aac-pink)!important}
.picture img{display:block;width:100%;height:clamp(112px,15vw,164px)!important;max-width:100%;object-fit:contain!important;border-radius:10px}
.picture .name{color:#435970!important;font-size:clamp(14px,1.5vw,17px)!important;font-weight:500!important;line-height:1.3;text-align:center;overflow-wrap:anywhere}
.empty{padding:28px!important;border:1px dashed #dfe7ef!important;border-radius:16px!important;background:#fff!important;color:#8291a2!important;text-align:center}
.scale-xl .picture{min-height:205px!important}
.scale-xl .picture img{height:clamp(140px,20vw,205px)!important}

/* Card detail dialog */
.aac-modal{position:fixed;inset:0;z-index:2000;display:none;align-items:center;justify-content:center;padding:16px;background:rgba(34,48,66,.48);backdrop-filter:blur(5px)}
.aac-modal.show{display:flex}
.aac-dialog{
  position:relative;display:flex;flex-direction:column;align-items:stretch;
  width:min(490px,calc(100vw - 28px))!important;max-height:90dvh!important;
  padding:20px!important;overflow-y:auto;border:1px solid #edf0f4!important;
  border-radius:22px!important;background:#fff!important;text-align:center;
  box-shadow:0 22px 65px rgba(27,42,60,.22)!important;
}
.modal-close{
  position:absolute;top:10px;right:10px;z-index:5;display:grid;place-items:center;
  width:40px!important;height:40px!important;padding:0!important;border:1px solid #e9edf2!important;
  border-radius:50%!important;background:#f7f9fb!important;color:#64778a!important;
  font:400 27px/1 Kanit,sans-serif!important;touch-action:manipulation;
}
.modal-picture{display:flex;align-items:center;justify-content:center;width:100%;height:clamp(180px,34dvh,285px)!important;margin:8px 0 12px!important;overflow:hidden}
.modal-picture img,#modalImage{display:block;width:auto!important;height:auto!important;max-width:100%!important;max-height:100%!important;object-fit:contain!important}
.aac-dialog h2,#modalTitle{margin:0 34px 5px!important;color:#34495e!important;font-size:clamp(23px,3vw,28px)!important;font-weight:600!important;line-height:1.25}
.modal-spoken{margin:0 0 13px!important;color:#78899b!important;font-size:16px!important;line-height:1.4}
.modal-spoken[hidden]{display:none!important}
.modal-actions{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr)!important;gap:9px!important;width:100%;margin:7px 0 0!important}
.modal-actions button{width:100%!important;min-width:0;min-height:52px!important;margin:0!important;padding:9px!important;border-radius:13px!important;font:500 14px Kanit,sans-serif!important}
#modalAudio{border:1px solid #e1e8ef!important;background:#f5f8fb!important;color:#566d82!important;box-shadow:none!important}
#modalConfirm{border:1px solid var(--aac-pink)!important;background:var(--aac-pink)!important;color:#fff!important;box-shadow:0 4px 12px rgba(233,77,145,.17)!important}

button:focus-visible,.cat-btn:focus-visible,.picture:focus-visible,.sentence-pick:focus-visible,.sentence-toggle:focus-visible,.logout-circle:focus-visible{
  outline:3px solid rgba(233,77,145,.35)!important;outline-offset:3px!important;
}
@media(min-width:900px){.grid{gap:15px!important}}
@media(max-width:760px){
  .top{min-height:62px;padding:8px 13px!important;gap:8px}
  .brand-wrap{gap:8px}
  .brand-logo{width:94px!important;height:40px!important}
  .brand-wrap .student{max-width:calc(100vw - 205px);font-size:11px!important}
  .brand-wrap .student strong{font-size:12px!important}
  .top>.form-select{min-width:110px;max-width:150px!important;font-size:12px!important}
  .logout-circle{width:40px!important;height:40px!important;min-width:40px;padding:0!important;border-radius:12px!important}
  .logout-label{display:none}
  .wrap{padding:17px 13px 38px!important}
  .aac-intro{gap:12px;margin-bottom:17px;padding:15px;border-radius:18px}
  .aac-intro-mark{width:45px;height:45px;flex-basis:45px;border-radius:14px;font-size:22px}
  .aac-intro h1{font-size:21px}
  .aac-intro-copy{font-size:12px}
  .category-bar{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .cat-btn{min-height:158px!important;padding:9px!important;gap:7px!important;border-radius:15px!important}
  .cat-btn img,.cat-btn .cat-emoji{height:100px!important}
  .cat-btn .cat-emoji{font-size:44px}
  .cat-btn span:last-child{font-size:13px!important}
  .grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}
  .picture{min-height:136px!important;padding:8px!important;border-radius:14px!important}
  .picture img{height:clamp(90px,27vw,126px)!important}
  .picture .name{font-size:13px!important}
  .sentence{padding:9px!important;margin-bottom:17px!important}
  .sentence-actions{max-width:100%}
}
@media(max-width:420px){
  .top{gap:5px}
  .brand-logo{width:78px!important;height:36px!important}
  .brand-wrap{flex:1 1 auto;gap:6px}
  .brand-wrap .student{max-width:calc(100vw - 245px);font-size:10px!important}
  .brand-wrap .student strong{font-size:11px!important}
  .top>.form-select{min-width:84px;max-width:100px!important;padding:6px 7px!important}
  .logout-circle{width:36px!important;height:36px!important;min-width:36px}
  .aac-intro{padding:12px;gap:9px}
  .aac-intro-mark{width:39px;height:39px;flex-basis:39px;font-size:19px}
  .aac-eyebrow{font-size:9px}
  .aac-intro h1{font-size:19px}
  .aac-intro-copy{font-size:11px}
  .cat-btn{min-height:140px!important}
  .cat-btn img,.cat-btn .cat-emoji{height:86px!important}
  .cat-btn .cat-emoji{font-size:39px}
  .sentence-toggle{gap:8px;padding:9px!important}
  .toggle-copy strong{font-size:14px}
  .toggle-copy small{font-size:10px}
  .sentence-actions{gap:7px}
  .sentence-actions .action-btn{min-height:49px!important;font-size:13px!important}
  .sentence-actions .speak-btn{min-height:54px!important}
  .modal-actions{grid-template-columns:1fr!important}
  .modal-actions button{min-height:48px!important}
}
@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{transition:none!important;animation:none!important}
}
.aac-intro-mark svg{width:29px;height:29px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
@media(max-width:600px){.aac-intro-mark svg{width:24px;height:24px}}

/* Child-friendly AAC palette: cheerful, calm, and easy to distinguish. */
:root{
  --aac-pink:#e65b98;
  --aac-pink-dark:#b93673;
  --aac-pink-soft:#fff0f6;
  --aac-blue:#5ca9df;
  --aac-blue-soft:#edf7ff;
  --aac-mint:#e8f7ef;
  --aac-ink:#30465d;
  --aac-muted:#64788d;
  --aac-line:#dfe8f0;
  --aac-card-shadow:0 7px 20px rgba(48,70,93,.075);
}
body{
  background:
    radial-gradient(ellipse at 4% 4%,rgba(255,211,230,.52),transparent 31rem),
    radial-gradient(ellipse at 96% 12%,rgba(194,231,255,.56),transparent 30rem),
    radial-gradient(ellipse at 80% 92%,rgba(211,245,225,.34),transparent 28rem),
    #f7fafc;
}
.top{border-bottom-color:#e5edf4!important;}
.brand-wrap .student strong{color:#354f68!important;}
.aac-intro{
  border:1px solid #f0d6e3;
  background:linear-gradient(112deg,#fff0f6 0%,#fff9e9 48%,#edf7ff 100%);
  box-shadow:0 8px 22px rgba(64,83,107,.06);
}
.aac-intro-mark{background:#fff;color:#d94d8b;box-shadow:0 5px 14px rgba(217,77,139,.13);}
.aac-eyebrow{color:#ad4d79;}
.aac-intro h1{color:#30465d;}
.aac-intro-copy{color:#5f7489;}
.sentence{border-color:#ead7e2!important;background:#fff!important;}
.sentence-toggle{border-color:#f0d2e0!important;background:linear-gradient(100deg,#fff0f6,#f0f8ff)!important;color:#3e5269!important;}
.toggle-copy strong{color:#3e5269;}
.toggle-copy small{color:#657b90;}
.count-pill{background:#ffe0ed;color:#96345f;}
.sentence-items{background:linear-gradient(135deg,#fff8fb,#f5fbff)!important;border-color:#e5bfd1!important;}
.sentence-pick{border-color:#dfe8f0!important;background:#fff!important;color:#354e66!important;}
.sentence-pick:nth-child(4n+1){background:#fff8fb!important;}
.sentence-pick:nth-child(4n+2){background:#f3f9ff!important;}
.sentence-pick:nth-child(4n+3){background:#f2fbf5!important;}
.sentence-pick:nth-child(4n){background:#fffaf0!important;}
.sentence-pick small{color:#8a5270!important;}
.sentence-actions .speak-btn{background:linear-gradient(120deg,#e65b98,#cb4382)!important;border-color:#cb4382!important;}
.sentence-actions .clear-btn{background:#edf5fc!important;border-color:#d7e7f4!important;color:#3e6687!important;}
.sentence-actions .save-btn{background:#e8f7ef!important;border-color:#c9e8d5!important;color:#286b49!important;}
.category-bar::before{color:#354e66;}
.cat-btn{
  border-color:#e1e9f0!important;
  border-top:5px solid var(--category-color,#9bc9e8)!important;
  box-shadow:0 6px 16px rgba(48,70,93,.065)!important;
}
.cat-btn:nth-child(6n+1){background:linear-gradient(155deg,#fff,#fff0f6)!important;--category-color:#e987b2;}
.cat-btn:nth-child(6n+2){background:linear-gradient(155deg,#fff,#edf7ff)!important;--category-color:#70b8e7;}
.cat-btn:nth-child(6n+3){background:linear-gradient(155deg,#fff,#eef9f1)!important;--category-color:#7bc99b;}
.cat-btn:nth-child(6n+4){background:linear-gradient(155deg,#fff,#f5f0ff)!important;--category-color:#a995e5;}
.cat-btn:nth-child(6n+5){background:linear-gradient(155deg,#fff,#fff8e8)!important;--category-color:#edc15e;}
.cat-btn:nth-child(6n){background:linear-gradient(155deg,#fff,#fff1e9)!important;--category-color:#e99b75;}
.cat-btn span:last-child{color:#344e67!important;}
.cat-btn.active{border-color:#d94d8b!important;border-top-color:#d94d8b!important;background:#ffeaf3!important;color:#91345f!important;box-shadow:0 0 0 3px rgba(217,77,139,.13)!important;}
#categoryView>.d-flex{border-color:#dfe8f0;background:#fff;}
#activeCategoryTitle{color:#344e67;}
.home-back-btn{background:#edf6ff!important;border-color:#d6e7f5!important;color:#35688f!important;}
.picture{border-color:#e0e9f1!important;box-shadow:0 5px 14px rgba(48,70,93,.055)!important;}
.picture:nth-child(6n+1){background:#fffafd!important;}
.picture:nth-child(6n+2){background:#f8fbff!important;}
.picture:nth-child(6n+3){background:#f8fdf9!important;}
.picture:nth-child(6n+4){background:#fbf9ff!important;}
.picture:nth-child(6n+5){background:#fffdf6!important;}
.picture:nth-child(6n){background:#fffaf7!important;}
.picture .name{color:#344e67!important;}
.empty{border-color:#d6e4ef!important;background:#fafdff!important;color:#536b82!important;}
.aac-dialog{border-color:#e1eaf2!important;}
.aac-dialog h2,#modalTitle{color:#30465d!important;}
.modal-spoken{color:#536b82!important;}
#modalAudio{background:#edf6ff!important;border-color:#d6e7f5!important;color:#35688f!important;}
#modalConfirm{background:#df528f!important;border-color:#df528f!important;}
button:focus-visible,.cat-btn:focus-visible,.picture:focus-visible,.sentence-pick:focus-visible,.sentence-toggle:focus-visible,.logout-circle:focus-visible{outline-color:rgba(64,139,195,.55)!important;}


/* Final student-friendly refinements: readable Thai text and safe category-image fallback */
body, button, input, select, textarea {
  font-family: Kanit, "Noto Sans Thai", Tahoma, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.cat-btn {
  min-height: 198px !important;
  padding: 15px !important;
}
.cat-btn img {
  width: min(100%, 156px) !important;
  height: 128px !important;
  object-fit: contain !important;
}
.cat-btn .cat-emoji {
  display: grid;
  place-items: center;
  width: 100%;
  height: 128px;
  border-radius: 16px;
  background: rgba(255,255,255,.68);
  color: #54718b;
  font-size: 58px;
}
.cat-btn span:last-child {
  font-size: 16px !important;
  line-height: 1.45 !important;
}
@media (max-width: 760px) {
  .cat-btn { min-height: 160px !important; }
  .cat-btn img, .cat-btn .cat-emoji { height: 102px !important; }
  .cat-btn .cat-emoji { font-size: 46px; }
  .cat-btn span:last-child { font-size: 14px !important; }
}


/* ==========================================================
   Pictalk playful AAC redesign — visual layer only
   Keeps all existing PHP, data, links, and interaction hooks.
   ========================================================== */
:root{
  --aac-pink:#ef4f9a;
  --aac-pink-deep:#d93683;
  --aac-blue:#43b6ef;
  --aac-mint:#42cba5;
  --aac-lavender:#ad83e9;
  --aac-yellow:#f6c94f;
  --aac-peach:#ff9a73;
  --aac-navy:#123d78;
  --aac-text:#244665;
  --aac-shadow:0 9px 24px rgba(37,89,135,.10);
}
html,body{min-height:100%;font-family:Kanit,"Noto Sans Thai",Tahoma,sans-serif!important}
body{
  background:
    radial-gradient(ellipse at 7% 8%,rgba(255,206,230,.55),transparent 28rem),
    radial-gradient(ellipse at 94% 9%,rgba(194,232,255,.58),transparent 30rem),
    linear-gradient(180deg,#fffafd 0%,#f7fbff 58%,#fffdf5 100%)!important;
  color:var(--aac-text)!important;
}
.top{
  min-height:78px!important;
  padding:11px clamp(14px,4vw,48px)!important;
  background:linear-gradient(100deg,rgba(255,241,248,.97),rgba(255,255,255,.97),rgba(239,249,255,.97))!important;
  border-bottom:2px solid #f8d8e8!important;
  box-shadow:0 5px 18px rgba(56,94,132,.07)!important;
}
.brand-logo{width:clamp(105px,15vw,160px)!important;height:52px!important}
.brand-wrap .student{color:#54718f!important;font-size:14px!important}
.brand-wrap .student strong{color:var(--aac-navy)!important;font-size:17px!important}
.top>.form-select{
  min-height:48px!important;border:2px solid #f3cfe2!important;
  border-radius:17px!important;background:#fff!important;
  color:var(--aac-navy)!important;font-weight:500!important;
}
.logout-circle{
  min-height:46px!important;border:2px solid #f5c7dd!important;
  border-radius:17px!important;background:#fff!important;
  color:#d63f83!important;font-size:14px!important;font-weight:600!important;
}
.wrap{max-width:1440px!important;padding:28px clamp(16px,3.5vw,48px) 72px!important}
.aac-intro{
  position:relative;isolation:isolate;overflow:hidden;
  min-height:150px;margin:0 0 28px!important;padding:24px 28px!important;
  border:2px solid #f8d7e8!important;border-radius:30px!important;
  background:linear-gradient(105deg,#ffeaf4 0%,#fff8fb 48%,#eaf7ff 100%)!important;
  box-shadow:var(--aac-shadow)!important;
}
.aac-intro:after{
  content:"";position:absolute;z-index:-1;right:4%;bottom:-66px;
  width:250px;height:150px;border-radius:50%;
  background:radial-gradient(ellipse,#f5b9d8 0 48%,transparent 50%);
  opacity:.55;
}
.aac-intro-mark{
  width:76px!important;height:76px!important;flex-basis:76px!important;
  border-radius:24px!important;background:linear-gradient(145deg,#f75ca4,#df3988)!important;
  color:#fff!important;box-shadow:0 8px 16px rgba(220,57,133,.22)!important;
}
.aac-intro-mark svg{width:39px!important;height:39px!important}
.aac-eyebrow{font-size:12px!important;letter-spacing:1px!important;color:#b4497d!important}
.aac-intro h1{font-size:clamp(27px,3.5vw,39px)!important;color:var(--aac-navy)!important;font-weight:700!important}
.aac-intro-copy{font-size:clamp(14px,1.6vw,19px)!important;color:#577493!important}
.sentence{
  border:2px solid #f3d4e4!important;border-radius:25px!important;
  padding:14px!important;background:rgba(255,255,255,.96)!important;
  box-shadow:var(--aac-shadow)!important;
}
.sentence-toggle{
  min-height:76px!important;padding:12px 17px!important;
  border:2px solid #f5d5e5!important;border-radius:20px!important;
  background:linear-gradient(100deg,#fff0f7,#eff8ff)!important;
}
.toggle-symbol{
  width:54px!important;height:54px!important;flex-basis:54px!important;
  border-radius:18px!important;background:linear-gradient(145deg,#f45ba0,#dc3c87)!important;
}
.toggle-symbol svg{width:29px!important;height:29px!important}
.toggle-copy strong{font-size:19px!important;color:var(--aac-navy)!important}
.toggle-copy small{font-size:13px!important;color:#607d99!important}
.count-pill{min-width:40px!important;height:40px!important;background:#ffe0ee!important;color:#a62c69!important;font-size:17px!important}
.category-bar{
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:18px!important;padding:4px 0 26px!important;
}
.category-bar:before{
  content:"เลือกหมวดหมู่ที่ต้องการ"!important;
  margin:0 0 2px!important;color:var(--aac-navy)!important;
  font-size:clamp(21px,2.3vw,28px)!important;font-weight:700!important;
}
.cat-btn{
  display:grid!important;
  grid-template-columns:minmax(112px,42%) minmax(0,1fr)!important;
  grid-template-rows:1fr!important;
  align-items:center!important;justify-items:center!important;
  min-height:190px!important;aspect-ratio:auto!important;
  gap:10px!important;padding:14px 16px!important;
  border:2px solid rgba(255,255,255,.95)!important;
  border-top:8px solid var(--category-color,#8cc9ed)!important;
  border-radius:28px!important;
  background:var(--category-bg,#f6fbff)!important;
  box-shadow:0 7px 0 var(--category-shadow,#dceefa),var(--aac-shadow)!important;
  color:var(--aac-navy)!important;
  font:600 clamp(18px,2vw,25px) Kanit,sans-serif!important;
  text-align:center!important;
  transition:transform .16s ease,box-shadow .16s ease!important;
}
.cat-btn:nth-child(6n+1){--category-color:#f05b9e;--category-bg:linear-gradient(135deg,#ffe5f0,#fff4f8);--category-shadow:#f8c8dc}
.cat-btn:nth-child(6n+2){--category-color:#39b5f0;--category-bg:linear-gradient(135deg,#def4ff,#f0faff);--category-shadow:#c6eaff}
.cat-btn:nth-child(6n+3){--category-color:#43c9a3;--category-bg:linear-gradient(135deg,#def8ef,#f0fff9);--category-shadow:#c3ecdd}
.cat-btn:nth-child(6n+4){--category-color:#b18be9;--category-bg:linear-gradient(135deg,#f0e7ff,#faf6ff);--category-shadow:#e1d2f8}
.cat-btn:nth-child(6n+5){--category-color:#f2c64d;--category-bg:linear-gradient(135deg,#fff3c9,#fffbed);--category-shadow:#f8e5a6}
.cat-btn:nth-child(6n){--category-color:#ff9a72;--category-bg:linear-gradient(135deg,#ffe8dc,#fff6f0);--category-shadow:#f8d2bf}
.cat-btn img,.cat-btn .cat-emoji{
  grid-column:1!important;grid-row:1!important;
  width:100%!important;max-width:160px!important;height:132px!important;
  object-fit:contain!important;border-radius:18px!important;
  background:rgba(255,255,255,.42)!important;
}
.cat-btn .cat-emoji{font-size:68px!important}
.cat-btn span:last-child{
  grid-column:2!important;grid-row:1!important;
  justify-self:start!important;text-align:left!important;
  color:var(--aac-navy)!important;font-size:clamp(19px,2.1vw,27px)!important;
  font-weight:700!important;line-height:1.3!important;
}
.cat-btn:hover{transform:translateY(-4px)!important;box-shadow:0 10px 0 var(--category-shadow),0 13px 24px rgba(37,89,135,.12)!important}
.cat-btn.active{
  outline:4px solid rgba(239,79,154,.24)!important;
  border-color:var(--aac-pink)!important;background:#fff0f7!important;
}
#categoryView>.d-flex{
  min-height:58px!important;padding:10px 15px!important;
  border:2px solid #dcecf7!important;border-radius:18px!important;
  background:#fff!important;box-shadow:0 4px 12px rgba(37,89,135,.06)!important;
}
#activeCategoryTitle{font-size:22px!important;color:var(--aac-navy)!important}
.home-back-btn{
  min-height:46px!important;border:2px solid #d6eafa!important;
  border-radius:15px!important;background:#edf8ff!important;
  color:#236d9f!important;font-size:15px!important;font-weight:600!important;
}
.grid{gap:16px!important}
.picture{
  min-height:195px!important;padding:14px!important;
  border:2px solid #e4edf5!important;border-radius:22px!important;
  background:#fff!important;box-shadow:0 6px 0 #e8f0f6,0 9px 18px rgba(37,89,135,.07)!important;
}
.picture:nth-child(6n+1){background:#fff5fa!important}
.picture:nth-child(6n+2){background:#f1faff!important}
.picture:nth-child(6n+3){background:#f1fcf7!important}
.picture:nth-child(6n+4){background:#f8f4ff!important}
.picture:nth-child(6n+5){background:#fffbed!important}
.picture:nth-child(6n){background:#fff5ef!important}
.picture img{height:clamp(120px,16vw,175px)!important}
.picture .name{font-size:clamp(16px,1.7vw,20px)!important;font-weight:600!important;color:var(--aac-navy)!important}
.sentence-items{border:2px dashed #efc3d9!important;border-radius:20px!important;background:#fff9fc!important}
.sentence-pick{min-height:135px!important;border:2px solid #e5edf4!important;border-radius:18px!important;font-size:15px!important}
.sentence-pick img{width:82px!important;height:82px!important}
.sentence-actions .action-btn{min-height:58px!important;border-radius:17px!important;font-size:16px!important;font-weight:600!important}
.sentence-actions .speak-btn{background:linear-gradient(120deg,#f45ca1,#d93683)!important}
.aac-dialog{border:2px solid #f5d5e5!important;border-radius:28px!important}
.modal-actions button{min-height:58px!important;border-radius:17px!important;font-size:16px!important}
button:focus-visible,.cat-btn:focus-visible,.picture:focus-visible,.sentence-pick:focus-visible,.sentence-toggle:focus-visible,.logout-circle:focus-visible{
  outline:4px solid rgba(44,151,215,.55)!important;outline-offset:4px!important;
}
@media(max-width:900px){
  .category-bar{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .cat-btn{min-height:160px!important;grid-template-columns:minmax(88px,40%) minmax(0,1fr)!important;padding:10px!important;border-radius:22px!important}
  .cat-btn img,.cat-btn .cat-emoji{height:108px!important}
  .cat-btn .cat-emoji{font-size:54px!important}
  .cat-btn span:last-child{font-size:clamp(17px,2.5vw,22px)!important}
}
@media(max-width:560px){
  .top{min-height:62px!important;padding:8px 12px!important}
  .brand-logo{width:82px!important;height:38px!important}
  .brand-wrap .student{max-width:calc(100vw - 220px)!important;font-size:10px!important}
  .brand-wrap .student strong{font-size:12px!important}
  .top>.form-select{min-width:92px!important;max-width:125px!important;min-height:38px!important;font-size:11px!important}
  .logout-circle{width:38px!important;height:38px!important;min-width:38px!important;padding:0!important}
  .logout-label{display:none!important}
  .wrap{padding:15px 12px 42px!important}
  .aac-intro{min-height:100px!important;padding:14px!important;border-radius:21px!important;gap:11px!important}
  .aac-intro-mark{width:48px!important;height:48px!important;flex-basis:48px!important;border-radius:15px!important}
  .aac-intro-mark svg{width:26px!important;height:26px!important}
  .aac-intro h1{font-size:22px!important}
  .aac-intro-copy{font-size:12px!important}
  .category-bar{gap:11px!important}
  .category-bar:before{font-size:19px!important}
  .cat-btn{
    min-height:138px!important;grid-template-columns:minmax(60px,38%) minmax(0,1fr)!important;
    gap:5px!important;padding:8px!important;border-top-width:6px!important;border-radius:18px!important;
  }
  .cat-btn img,.cat-btn .cat-emoji{height:84px!important;border-radius:12px!important}
  .cat-btn .cat-emoji{font-size:39px!important}
  .cat-btn span:last-child{font-size:14px!important;line-height:1.25!important}
  .grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .picture{min-height:145px!important;padding:8px!important;border-radius:16px!important}
  .picture img{height:clamp(92px,27vw,130px)!important}
  .picture .name{font-size:14px!important}
  .sentence-toggle{min-height:62px!important}
  .toggle-symbol{width:43px!important;height:43px!important;flex-basis:43px!important}
  .toggle-copy strong{font-size:15px!important}
  .toggle-copy small{font-size:10px!important}
  .sentence-actions .action-btn{min-height:50px!important;font-size:13px!important}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;animation:none!important}}
