/* Motion: smooth in-page scrolling, a route progress bar and a gentle page fade. */
@media (prefers-reduced-motion: no-preference) {
  html {scroll-behavior: smooth}
  .route-view {animation: route-fade .32s cubic-bezier(.2, .65, .2, 1) both}
}
@keyframes route-fade {from {opacity: 0; transform: translateY(8px)} to {opacity: 1; transform: none}}
section[id] {scroll-margin-top: 24px}
.route-progress {position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 120; pointer-events: none; background: linear-gradient(90deg, var(--k-f3344d), var(--k-c5a7ed)); transform: scaleX(0); transform-origin: left; opacity: 0; transition: opacity .3s ease}
.route-progress.active {opacity: 1; animation: route-progress 1.6s cubic-bezier(.2, .7, .2, 1) forwards}
@keyframes route-progress {0% {transform: scaleX(0)} 40% {transform: scaleX(.55)} 100% {transform: scaleX(.9)}}
.scroll-top {position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 40; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--k-5b3f6e); border-radius: 50%; background: rgba(16, 11, 23, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--k-f0dcff); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .25s ease, transform .25s ease}
.scroll-top.visible {opacity: 1; transform: none; pointer-events: auto}
.scroll-top:hover {background: var(--k-24112e); border-color: var(--k-b586df)}
.scroll-top .icon {width: 20px; height: 20px}
.icon-button.flip .icon {transform: rotate(180deg)}

/* Landing videos: slot videos cover like the images; the showcase slider scrolls sideways. */
.landing-video {width: 100%; height: 100%; object-fit: cover; display: block; background: var(--k-09060d)}
.hero-art .landing-video {object-position: 62% 44%}
.showcase {max-width: 1800px; margin: 0 auto; padding: 0 44px 84px}
.showcase-heading {display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px}
.showcase-heading .eyebrow {display: block; margin-bottom: 14px}
.showcase-heading h2 {font-size: 37px; font-weight: 500}
.showcase-heading p {font-size: 14px; color: var(--k-9a8da5); margin-top: 8px; max-width: 520px}
.showcase-nav {display: flex; gap: 8px}
.showcase-nav .icon-button {width: 44px; height: 44px; justify-content: center; border-color: var(--k-4a3558)}
.showcase-track {display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 36px) / 3); gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; padding-bottom: 10px; overscroll-behavior-x: contain}
.showcase-track > div {scroll-snap-align: start; min-width: 0}
.showcase-card {margin: 0; position: relative; aspect-ratio: 9 / 16; max-height: 640px; width: 100%; overflow: hidden; background: var(--k-140d1b); border: 1px solid var(--k-3e2647)}
.showcase-card video {width: 100%; height: 100%; object-fit: cover; display: block}
.showcase-card figcaption {position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 10px 12px; font-size: 13px; color: var(--k-eadcf3); background: rgba(10, 7, 16, .5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(101, 66, 105, .8)}
@media (max-width: 1100px) {.showcase-track {grid-auto-columns: calc((100% - 18px) / 2)}}
@media (max-width: 760px) {.showcase {padding: 0 20px 48px} .showcase-heading h2 {font-size: 28px} .showcase-track {grid-auto-columns: 78%; gap: 12px}}
.showcase-admin-list {list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 12px}
.showcase-admin-list li {display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--k-35283e); background: var(--k-0d0a11)}
.showcase-admin-list video {width: 72px; height: 96px; object-fit: cover; background: var(--k-140d1b)}
.showcase-admin-list .field {margin: 0}
.showcase-admin-actions {display: flex; gap: 4px}

/* Studio as a chat: history above, composer pinned to the bottom of the screen. */
.studio-chat {display: flex; flex-direction: column; min-height: calc(100vh - 84px); padding-top: 28px; max-width: 960px}
.chat-head {display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px}
.chat-head h1 {font-size: 30px; font-weight: 500}
.chat-head .eyebrow {display: block; margin-bottom: 8px}
.chat-feed {flex: 1; display: flex; flex-direction: column; gap: 22px; padding-bottom: 24px}
.chat-older {align-self: center}
.chat-exchange {display: flex; flex-direction: column; gap: 10px}
.chat-bubble {max-width: min(620px, 88%); border: 1px solid var(--k-35283f); padding: 14px 16px; background: var(--k-100d15)}
.chat-bubble.user {align-self: flex-end; background: var(--k-1c1026); border-color: var(--k-553566); border-radius: 14px 14px 2px 14px}
.chat-bubble.reply {align-self: flex-start; border-radius: 14px 14px 14px 2px}
.chat-bubble.user img {width: 100%; max-width: 220px; max-height: 220px; object-fit: cover; border-radius: 8px; margin-bottom: 10px}
.chat-prompt {color: var(--k-eadcf3); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden}
.chat-meta {display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px}
.chat-meta span {display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--k-cbb8d8); background: var(--k-2a1a35); padding: 2px 8px; border-radius: 999px}
.chat-meta .icon {width: 12px; height: 12px}
.chat-bubble.reply video {width: 100%; max-width: 520px; max-height: 60vh; border-radius: 8px; background: var(--k-000000); display: block}
.chat-status {display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--k-d7c8e2); flex-wrap: wrap}
.chat-actions {display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 10px; font-size: 12px}
.chat-actions a {color: var(--k-d2a6ed); display: inline-flex; align-items: center; gap: 5px}
.chat-actions .link-button {display: inline-flex; align-items: center; gap: 5px}
.chat-actions .icon {width: 14px; height: 14px}
.chat-bubble.welcome strong {display: block; font-size: 17px; font-weight: 500; margin-bottom: 6px}
.chat-bubble.welcome ul {margin: 10px 0 12px; padding-left: 18px; color: var(--k-a18eae); font-size: 13px}
.chat-bottom {height: 1px}
.composer-dock {position: sticky; bottom: 0; z-index: 30; padding: 12px 0 calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, rgba(8, 8, 11, 0), var(--k-08080b) 28%)}
.composer {display: flex; flex-direction: column; gap: 8px}
.composer .inline-note {margin: 0}
.composer .form-feedback:empty {display: none}
.composer-notice {display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--k-543265); background: var(--k-1f1128); color: var(--k-d5b9e8); font-size: 13px}
.composer-notice > span {flex: 1}
.composer-notice .icon {width: 16px; height: 16px}
.composer-box {border: 1px solid var(--k-4a3558); background: var(--k-100c16); border-radius: 16px; padding: 10px 12px; transition: border-color .2s, box-shadow .2s; box-shadow: 0 10px 40px var(--k-00000077)}
.composer-box:focus-within {border-color: var(--k-b586df)}
.composer-box.dragover {border-color: var(--k-f3344d); background: var(--k-170c22)}
.composer-box textarea {min-height: 48px; max-height: 220px; margin: 0; border: 0; background: transparent; resize: none; padding: 6px 4px; font-size: 15px}
.composer-box textarea:focus-visible {outline: none}
.composer-attachment {display: flex; align-items: center; gap: 10px; padding: 6px; margin-bottom: 6px; border: 1px solid var(--k-3c2d48); border-radius: 10px; background: var(--k-160f1e); max-width: 100%}
.composer-attachment img {width: 48px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0}
.composer-attachment span {display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap}
.composer-attachment small {font-size: 11px}
.composer-bar {display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--k-2a2033)}
.composer-bar .icon-button.attach {cursor: pointer; width: 38px; height: 38px; justify-content: center; border-color: var(--k-3c2d48); border-radius: 50%}
.pill-button {display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--k-5b3f6e); border-radius: 999px; background: var(--k-1c1026); color: var(--k-e8d3f6); font-size: 13px}
.pill-button:hover:not(:disabled) {border-color: var(--k-b586df)}
.pill-button .icon {width: 16px; height: 16px}
.option-pill select {margin: 0; height: 36px; padding: 0 26px 0 12px; border-radius: 999px; background: var(--k-140f1a); border-color: var(--k-3c2d48); font-size: 13px; width: auto; max-width: 150px}
.composer-cost {margin-left: auto; font-size: 12px; color: var(--k-d5a2f5); white-space: nowrap}
.send-button {width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--k-f3344d); color: var(--k-ffffff); flex-shrink: 0}
.send-button:hover:not(:disabled) {background: var(--k-ff5067)}
.send-button .icon {width: 19px; height: 19px}
.composer-status {display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--k-a18eae); padding: 0 6px}
.composer-enhanced {display: flex; align-items: center; gap: 12px}
.composer-enhanced .negative-prompt {margin: 0}

/* Filter rows scroll inside their container instead of widening the page. */
.toolbar > *, .filter-row {min-width: 0; max-width: 100%}
.admin-heading > div {min-width: 0}
.admin-shell {align-content: start}

/* Tablets. */
@media (max-width: 1024px) {
  .admin-shell {grid-template-columns: 190px minmax(0, 1fr); gap: 22px}
  .toolbar {flex-direction: column; align-items: stretch}
  .search-field {flex: 1 1 auto; min-width: 0}
  .admin-heading-actions {width: 100%}
}
@media (max-width: 900px) {
  .admin-shell {grid-template-columns: 1fr}
  .admin-nav {overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none}
  .admin-nav::-webkit-scrollbar {display: none}
  .admin-nav-link {flex-shrink: 0; white-space: nowrap}
}

/* Phones. */
@media (max-width: 600px) {
  .chat-head h1 {font-size: 24px}
  .chat-head .eyebrow {display: none}
  .chat-bubble {max-width: 94%; padding: 12px}
  .chat-bubble.user img {max-width: 160px; max-height: 160px}
  .composer-box {padding: 8px 10px; border-radius: 14px}
  .composer-bar {gap: 6px}
  .hide-sm {display: none}
  .pill-button {width: 36px; padding: 0; justify-content: center}
  .option-pill select {max-width: 112px; font-size: 12px; padding: 0 22px 0 10px; height: 34px}
  .composer-cost {width: 100%; order: 10; margin-left: 0; text-align: right}
  .send-button {margin-left: auto}
  .admin-heading h1 {font-size: 24px}
  .admin-heading-actions .button {flex: 1 1 auto; justify-content: center}
  .filter-row {flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch}
  .filter-row::-webkit-scrollbar {display: none}
  .filter {flex-shrink: 0}
  dialog {padding: 20px; width: calc(100vw - 20px)}
  .dialog-head h2 {font-size: 20px}
  .showcase-admin-list li {grid-template-columns: 56px minmax(0, 1fr)}
  .showcase-admin-list video {width: 56px; height: 74px}
  .showcase-admin-actions {grid-column: 1 / -1; justify-content: flex-end}
  .scroll-top {right: 14px; width: 40px; height: 40px}
  .job-footer {flex-wrap: wrap}
  .button-row .button {flex: 1 1 auto; justify-content: center}
  .alert-list .inline-note {flex-direction: column; align-items: flex-start}
}

.daily-reward {margin-bottom: 24px; background: linear-gradient(120deg,var(--k-201125),var(--k-11101a));}
.daily-days {display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:10px;margin:18px 0;}
.daily-day {display:flex;flex-direction:column;align-items:center;gap:8px;padding:14px 8px;border:1px solid var(--k-44334c);border-radius:12px;min-width:0;}
.daily-day.today {border-color:var(--k-c879ef);background:var(--k-3b1c48);}
.daily-day input {width:100%;min-width:0;}
.community-links {display:inline-flex;flex-wrap:wrap;gap:16px;}
.illustrated-error {display:grid;grid-template-columns:1fr 1fr;align-items:center;gap:48px;min-height:65vh;}
.illustrated-error img {width:100%;height:65vh;object-fit:cover;border-radius:0;mask-image:linear-gradient(to bottom,black 75%,transparent);}
.illustrated-error .button {margin:8px 8px 0 0;}
.error-code {font-size:clamp(80px,14vw,180px);font-weight:800;letter-spacing:-.06em;color:var(--k-bf75ea);}
@media(max-width:650px){.daily-days{grid-template-columns:repeat(4,minmax(0,1fr));}.illustrated-error{grid-template-columns:1fr;gap:24px;}.illustrated-error img{height:36vh;}}

/* Keep creation controls on screen; only conversation and oversized forms scroll. */
.studio-shell {height: 100dvh; display: flex; flex-direction: column; overflow: hidden;}
.studio-shell .site-header {flex-shrink: 0;}
.studio-shell #main {flex: 1; min-height: 0; overflow: hidden;}
.studio-shell .route-view {height: 100%; min-height: 0; animation: none;}
.studio-shell .studio-chat {height: 100%; min-height: 0; padding-top: 16px; margin: 0 auto;}
.studio-shell .chat-head {flex-shrink: 0; margin-bottom: 12px;}
.studio-shell .chat-feed {min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 2px 4px 16px;}
.studio-shell .chat-feed > * {flex-shrink: 0;}
.studio-shell .composer-dock {position: relative; flex-shrink: 0; max-height: 55%; overflow-y: auto; overscroll-behavior: contain; padding-top: 8px;}
@media (max-height: 600px) {
  .studio-shell .studio-chat {padding-top: 8px;}
  .studio-shell .chat-head h1 {font-size: 22px;}
  .studio-shell .chat-head .eyebrow {display: none;}
  .studio-shell .composer-dock {max-height: 65%;}
  .studio-shell .composer-box textarea {max-height: 100px;}
}

/* Thai combining marks need natural spacing and a font with Thai glyphs. */
html:lang(th) {--font: Tahoma, 'Noto Sans Thai', sans-serif; --display: Tahoma, 'Noto Sans Thai', sans-serif;}
html:lang(th) h1, html:lang(th) h2, html:lang(th) h3, html:lang(th) .eyebrow {letter-spacing: normal; line-height: 1.5;}

.notification-button {position:relative;flex-shrink:0;}
.notice-count {position:absolute;right:-5px;top:-6px;background:var(--k-e64d80);color:white;font-size:10px;border-radius:10px;padding:0 4px;}
.notice-list {list-style:none;padding:0;display:flex;flex-direction:column;gap:12px;max-height:60dvh;overflow:auto;}
.notice-list li {padding:12px;border:1px solid var(--k-553566);border-radius:8px;overflow-wrap:anywhere;}
.notice-list li.read {opacity:.65;}
.draft-note {display:flex;gap:12px;justify-content:space-between;}
.template-picker {display:flex;align-items:center;gap:12px;font-size:12px;}
.template-picker select {margin:0;max-width:280px;font-size:12px;padding:6px 12px;}
.expiry-warning {color:var(--k-ffcb86);}
.favorite-filter {display:flex;gap:8px;align-items:center;margin:12px 0;}
.job-actions [aria-pressed=true] {color:var(--k-f3c95a);}
