#smart-welcome {
  --walk-duration: 1.35s;
  --wai-duration: 1.1s;
  --stand-time: calc(var(--walk-duration) + var(--wai-duration));
  --speech-time: 2.1s;
  --menu-time: calc(var(--walk-duration) + var(--speech-time));
  --figure: min(210px, 42vw, 43dvh);
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none;
  padding: 0; margin: 0; overflow: hidden; border: 0; color: #392447;
  background-color: #f2edf8;
}
#smart-welcome:not([open]) { display: none; }
#smart-welcome[open] {
  background:
    radial-gradient(circle at 76% 28%, #fff2c9 0 3.4vmin, transparent 3.6vmin),
    radial-gradient(ellipse at 78% 31%, #ffedd788, transparent 48%),
    linear-gradient(165deg, #dcd6ef, #f6edf5 51%, #fff2df 80%);
}
#smart-welcome::backdrop { background: #eee8f4; }
.welcome-floor {
  position:absolute; inset:0; z-index:-1; overflow:hidden; pointer-events:none;
}
.welcome-floor::before,.welcome-floor::after {
  content:""; position:absolute; inset:0;
}
.welcome-floor::before {
  background:linear-gradient(175deg,#bcafcf 25%,#e4d8e4 82%);
  clip-path:polygon(0 51%,8% 47%,15% 49%,25% 40%,36% 50%,44% 48%,55% 58%,67% 49%,73% 51%,86% 38%,93% 42%,100% 39%,100% 100%,0 100%);
}
.welcome-floor::after {
  background:linear-gradient(171deg,#b7a5ca 25%,#e5d9eb 67%,#f6edf4 100%);
  clip-path:polygon(0 59%,10% 55%,23% 63%,35% 57%,46% 62%,58% 64%,72% 59%,83% 62%,94% 54%,100% 56%,100% 100%,0 100%);
}
.welcome-scene { position: absolute; inset: 0; pointer-events: none; }
.welcome-bubble {
  position: absolute; bottom: calc(29% + var(--figure)); left: 50%; margin: 0; width: max-content;
  max-width: calc(100% - 32px); text-align: center; padding: 15px 24px; border-radius: 22px;
  background: #fffdfb; color: #442951; box-shadow: 0 8px 28px #3f294422;
  font: 650 clamp(18px,2vw,27px)/1.5 Anuphan,Tahoma,sans-serif;
}
.welcome-bubble::after { content:""; position:absolute; top:99%; left:47%; border:10px solid transparent; border-top-color:#fffdfb; }
.welcome-track { position:absolute; inset-inline:0; bottom:29%; height:var(--figure); overflow:hidden; }
.welcome-traveler { position:absolute; inset:0; display:grid; place-items:center; }
.welcome-shadow { position:absolute; bottom:1%; width:calc(var(--figure)*.44); height:6%; border-radius:50%; background:#44362942; filter:blur(3px); }
.welcome-figure { width:var(--figure); height:var(--figure); position:relative; }
#smart-welcome[open] .welcome-figure {
  background: url("../img/nong-smart-game.webp") 0 center / 600% 100% no-repeat;
}

#smart-welcome[open] {
  display:flex; flex-direction:column; align-items:center; justify-content:safe center;
  overflow-y:auto; padding:16px; box-sizing:border-box; isolation:isolate;
}
.welcome-scene { position:relative; inset:auto; width:calc(100% + 32px); flex:none; }
.welcome-bubble { position:relative; inset:auto; margin:0 auto 14px; box-sizing:border-box; }
.welcome-track { position:relative; bottom:auto; }
#smart-welcome[open] .welcome-figure::after {
  content:""; position:absolute; inset:0;
  background:url("../img/nong-smart-gestures.webp") 0 0 / 200% 200% no-repeat;
  transform-origin:50% 94%;
  animation:smart-face-front 0s var(--walk-duration) backwards,
    smart-rest-poses 12s var(--stand-time) step-end infinite,
    smart-breathe 2.8s var(--stand-time) ease-in-out infinite;
}
@keyframes smart-face-front { from {visibility:hidden} to {visibility:visible} }
@keyframes smart-rest-poses {
  0%,35%,76%,100% {background-position:100% 0}
  23% {background-position:0 100%}
  61% {background-position:100% 100%}
}
@keyframes smart-breathe { 50% {transform:scale(1.008,.991) rotate(.55deg)} }
.welcome-traveler { animation:smart-arrive var(--walk-duration) linear both; }
@keyframes smart-arrive { from {transform:translateX(calc(-50% - var(--figure) / 2))} to {transform:translateX(0)} }
@keyframes smart-walk-cycle { from {background-position-x:0%} to {background-position-x:80%} }
#smart-welcome[open] .welcome-figure {animation:smart-walk-cycle .45s steps(4,end) 3, smart-stop 0s var(--walk-duration) forwards}
@keyframes smart-stop { to {background-size:0 0} }
.welcome-actions {position:relative;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:min(100%,480px);margin:18px auto 0}
.welcome-actions a,.welcome-actions button {display:grid;place-items:center;min-height:48px;padding:6px 10px;border:1px solid #ccb9d3;border-radius:12px;background:white;color:#472653;font:600 1rem/1.45 Anuphan,Tahoma,sans-serif;text-decoration:none;text-align:center;cursor:pointer}
.welcome-actions a:hover,.welcome-actions button:hover {background:#f6eff8}
.welcome-actions button {background:#552a68;color:white}
.welcome-actions button:hover {background:#412050}
.welcome-actions :focus-visible {outline:3px solid #723f88;outline-offset:2px}
@media (prefers-reduced-motion: no-preference) {
  #smart-welcome[open] .welcome-bubble {
    transform-origin:50% 100%;
    animation:smart-bubble-in .23s var(--walk-duration) ease-out backwards;
  }
  #smart-welcome[open] .welcome-bubble span {
    animation:smart-say .2s calc(var(--walk-duration) + var(--pause, 0s)) ease-out backwards;
  }
  .welcome-bubble span:nth-child(2) {--pause:.55s}
  .welcome-bubble span:nth-child(3) {--pause:.84s}
  .welcome-bubble span:nth-child(4) {--pause:1.33s}
  .welcome-bubble span:nth-child(5) {--pause:1.68s}
  #smart-welcome[open] .welcome-actions > * {
    animation:smart-option-in .42s calc(var(--menu-time) + var(--stagger, 0s)) ease-out backwards;
  }
  .welcome-actions > :nth-child(2) {--stagger:.09s}
  .welcome-actions > :nth-child(3) {--stagger:.18s}
  .welcome-actions > :nth-child(4) {--stagger:.27s}
}
@keyframes smart-say {from {opacity:0} to {opacity:1}}
@keyframes smart-bubble-in {
  from {opacity:0;transform:translateY(5px) scale(.97)}
  to {opacity:1;transform:none}
}
@keyframes smart-option-in {
  0% {visibility:hidden;opacity:0;transform:translateY(12px) scale(.95)}
  1% {visibility:visible}
  62% {opacity:1;transform:translateY(-3px) scale(1.02)}
  100% {visibility:visible;opacity:1;transform:none}
}
@media(prefers-reduced-motion:reduce){
  #smart-welcome[open] .welcome-traveler,#smart-welcome[open] .welcome-figure {animation:none}
  #smart-welcome[open] .welcome-figure {background-position-x:80%}
  #smart-welcome[open] .welcome-figure {background-image:none}
  #smart-welcome[open] .welcome-figure::after {animation:none;background-position:100% 0}
}
