html, body { height: 100%; overflow: hidden; }
.shell { display: grid; grid-template-columns: 276px 1fr auto; height: 100dvh; gap: 0; }

/* ================= Sidebar — แผงควบคุมกระจก ================= */
.side {
  margin: 10px 0 10px 10px; border-radius: 20px; display: flex; flex-direction: column; padding: 16px 12px; gap: 10px; min-height: 0;
  background: linear-gradient(180deg, rgba(var(--n-30-52-104), .62), rgba(var(--n-12-26-60), .72));
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 10px; }
.new-task { width: 100%; justify-content: flex-start; padding: 11px 14px; }
.side-nav { display: flex; flex-direction: column; }
.nav-item, .chat-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); text-align: left; font-size: 14px; width: 100%; position: relative; transition: .15s; }
.nav-item:hover, .chat-item:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.side-label { padding: 12px 10px 4px; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.chat-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item.active { background: linear-gradient(90deg, rgba(var(--neon-rgb), .10), rgba(var(--neon-rgb), 0)); color: var(--text); border-color: rgba(var(--neon-rgb), .14); }
.chat-item.active::before { content: ''; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--neon); box-shadow: 0 0 10px var(--neon); }
.chat-item .del { opacity: 0; width: 26px; height: 26px; }
.chat-item:hover .del { opacity: 1; }
.chat-item .live { width: 7px; height: 7px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 10px var(--neon); animation: led 1.4s ease-in-out infinite; flex: none; }
@keyframes led { 50% { opacity: .35; } }
.side-bottom { display: flex; flex-direction: column; gap: 8px; }

/* มาตรวัดเครดิต — แผงอะคริลิก */
.credit-box { padding: 14px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.credit-box::after { content: ''; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--neon-rgb), .18), transparent 70%); pointer-events: none; }
.credit-box .row { display: flex; justify-content: space-between; align-items: center; }
.credits { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.1; }
.credits #creditNum { background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.credits small { font-size: 12px; color: var(--text-3); font-family: var(--font); font-weight: 400; margin-left: 4px; }
.meter { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--neon-grad); box-shadow: 0 0 10px var(--neon); border-radius: inherit; transition: width .6s; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid transparent; background: transparent; border-radius: 12px; color: var(--text-2); }
.user-row:hover { background: rgba(255, 255, 255, .04); border-color: var(--line); }
.u-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 9px; background: var(--chrome-soft); color: #0B1A3D; display: grid; place-items: center; font-weight: 700; font-size: 13px; font-family: var(--font-display); box-shadow: 0 0 0 1px rgba(255,255,255,.3), 0 0 12px rgba(var(--neon-rgb),.2); }

/* ================= Main ================= */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.topbar { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 20px; flex: none; }
.topbar .title { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); letter-spacing: .02em; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.sys-status { font-family: var(--font-display); font-size: 11px; letter-spacing: .18em; color: var(--text-3); display: flex; align-items: center; gap: 8px; text-transform: uppercase; }
.sys-status .led { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.thread { flex: 1; overflow-y: auto; padding: 16px 20px 12px; scroll-behavior: smooth; }
.msgs { max-width: 840px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Empty: สะพานเดินเรือ ---------- */
.empty { max-width: 860px; margin: 3vh auto 0; text-align: center; }
.emblem { position: relative; width: 132px; height: 132px; margin: 0 auto 22px; display: grid; place-items: center; }
.emblem img { width: 76px; height: 76px; position: relative; z-index: 2; filter: drop-shadow(0 0 22px rgba(var(--neon-rgb), .35)); }
.emblem .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(170, 195, 255, .16); }
.emblem .ring.r2 { inset: 14px; border-color: rgba(var(--neon-rgb), .25); border-style: dashed; animation: rot 24s linear infinite; }
.emblem .ring.r3 { inset: -14px; border: 1px solid transparent; border-top-color: rgba(var(--neon-rgb), .7); border-right-color: rgba(143, 168, 255, .4); animation: rot 6s linear infinite; filter: drop-shadow(0 0 6px rgba(var(--neon-rgb), .6)); }
.empty h1 { font-size: clamp(28px, 4vw, 40px); margin-bottom: 10px; }
.empty h1 span { background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.templates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 30px; text-align: left; }
.tpl { padding: 16px; cursor: pointer; transition: .2s; display: flex; flex-direction: column; gap: 6px; }
.tpl:hover { transform: translateY(-2px); box-shadow: var(--shadow), 0 0 0 1px rgba(var(--neon-rgb), .4), 0 0 28px rgba(var(--neon-rgb), .12); }
.tpl .ti { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--neon); background: rgba(var(--neon-rgb), .07); border: 1px solid rgba(var(--neon-rgb), .22); margin-bottom: 4px; }
.tpl:hover .ti { box-shadow: 0 0 14px rgba(var(--neon-rgb), .35); }
.tpl b { font-weight: 500; }
.tpl .tiny { line-height: 1.5; color: var(--text-3); }

/* ---------- Messages ---------- */
.msg-user { align-self: flex-end; max-width: 78%; padding: 11px 16px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; word-break: break-word;
  background: linear-gradient(180deg, rgba(var(--n-70-100-160), .55), rgba(var(--n-40-64-118), .55)); border: 1px solid var(--line-2); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.msg-user .atts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.msg-user .atts img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.agent-turn { display: flex; gap: 12px; align-items: flex-start; }
.agent-turn > .av { width: 28px; height: 28px; flex: none; margin-top: 2px; filter: drop-shadow(0 0 8px rgba(var(--neon-rgb),.3)); }
.agent-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.bubble { line-height: 1.75; word-break: break-word; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin: 0; }
.bubble b { color: #fff; }
.bubble code { background: rgba(var(--neon-rgb),.08); color: var(--neon); padding: 1px 6px; border-radius: 6px; font-size: 13px; font-family: var(--font-mono); }
.bubble ul, .bubble ol { margin: 4px 0 8px; padding-left: 22px; }
.bubble li::marker { color: var(--neon); }
.bubble.err { color: var(--red); }
.caret::after { content: ''; display: inline-block; width: 8px; height: 1em; vertical-align: -2px; margin-left: 2px; background: var(--neon); box-shadow: 0 0 8px var(--neon); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; font-family: var(--font-display); letter-spacing: .06em; }

/* แผนภารกิจ */
.plan-card { padding: 14px 16px; border-radius: 14px; background: rgba(var(--n-10-22-52), .6); border: 1px solid var(--line); position: relative; overflow: hidden; }
.plan-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: linear-gradient(180deg, var(--neon), var(--neon-2)); box-shadow: 0 0 12px var(--neon); }
.plan-card h5 { margin: 0 0 10px; font-size: 11px; color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 10px; font-family: var(--font-display); letter-spacing: .2em; text-transform: uppercase; }
.plan-card h5 .prog { flex: 1; height: 2px; background: rgba(255,255,255,.06); border-radius: 2px; overflow: hidden; }
.plan-card h5 .prog i { display: block; height: 100%; background: var(--neon); box-shadow: 0 0 8px var(--neon); }
.plan-card ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.plan-card li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text-2); }
.plan-card li.done { color: var(--text-3); }
.plan-card li.running { color: var(--text); }
.plan-card .dot { width: 14px; height: 14px; flex: none; transform: rotate(45deg); border: 1px solid var(--line-2); border-radius: 3px; display: grid; place-items: center; }
.plan-card li.done .dot { background: var(--neon); border-color: var(--neon); box-shadow: 0 0 8px var(--neon); }
.plan-card li.done .dot::after { content: ''; width: 4px; height: 4px; background: #03161A; border-radius: 1px; }
.plan-card li.running .dot { border-color: var(--neon); animation: pulseDot 1.2s ease-in-out infinite; }
@keyframes pulseDot { 50% { box-shadow: 0 0 12px var(--neon); } }

/* การ์ดเครื่องมือ = โมดูลบนแผงควบคุม */
.tool { border-radius: 14px; background: rgba(var(--n-14-30-66), .6); border: 1px solid var(--line); overflow: hidden; backdrop-filter: blur(10px); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.tool.running { border-color: rgba(var(--neon-rgb), .35); box-shadow: 0 0 22px rgba(var(--neon-rgb), .08), inset 0 1px 0 rgba(255,255,255,.05); }
.tool.running .tool-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--neon), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: scan 1.6s linear infinite; }
@keyframes scan { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.tool-head { display: flex; align-items: center; gap: 12px; padding: 11px 14px; font-size: 14px; cursor: pointer; user-select: none; position: relative; }
.tool-head .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--neon); background: rgba(var(--neon-rgb), .07); border: 1px solid rgba(var(--neon-rgb), .2); flex: none; }
.tool-head .ic svg.i { width: 16px; height: 16px; }
.tool-head .nm { font-weight: 500; }
.tool-head .st { margin-left: auto; font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 7px; white-space: nowrap; font-family: var(--font-display); }
.tool-head .st.ok { color: var(--green); } .tool-head .st.bad { color: var(--red); }
.tool-head .st.ok::before, .tool-head .st.bad::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.tool-args { padding: 0 14px 10px 56px; font-size: 12.5px; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--font-mono); line-height: 1.55; }
.tool.open .tool-args { -webkit-line-clamp: unset; }
.tool-err { padding: 0 14px 10px 56px; font-size: 13px; color: var(--red); }
.tool-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; padding: 0 14px 14px; }
.tool-assets.single { grid-template-columns: minmax(0, 540px); }
.tool-assets:empty { display: none; }
.asset { position: relative; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--line-2); cursor: zoom-in; transition: .2s; }
.asset:hover { box-shadow: 0 0 0 1px rgba(var(--neon-rgb), .5), 0 0 24px rgba(var(--neon-rgb), .15); }
.asset img, .asset video { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; background: #000; }
.asset.audio { cursor: default; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: rgba(var(--n-10-22-52), .7); }
.asset.audio audio { width: 100%; filter: invert(.92) hue-rotate(180deg) saturate(.6); border-radius: 999px; }
.asset .a-bar { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: .15s; }
.asset:hover .a-bar { opacity: 1; }
.asset.audio .a-bar { position: static; opacity: 1; justify-content: flex-end; }
.a-bar button, .a-bar a { width: 30px; height: 30px; border-radius: 9px; border: 1px solid rgba(255,255,255,.15); background: rgba(var(--n-8-18-44), .72); color: #fff; display: grid; place-items: center; backdrop-filter: blur(8px); }
.a-bar button:hover, .a-bar a:hover { border-color: rgba(var(--neon-rgb),.6); color: var(--neon); }
.a-bar svg.i { width: 15px; height: 15px; }
.a-bar button.on { color: var(--neon); border-color: var(--neon); box-shadow: 0 0 10px rgba(var(--neon-rgb),.5); }
.skeleton { aspect-ratio: 16/10; border-radius: 12px; border: 1px solid rgba(var(--neon-rgb),.15); background:
  linear-gradient(100deg, transparent 30%, rgba(var(--neon-rgb), .10) 50%, transparent 70%) 0 0 / 200% 100%,
  repeating-linear-gradient(0deg, rgba(140, 175, 255,.04) 0 1px, transparent 1px 4px), rgba(var(--n-10-22-52), .8);
  animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0, 0 0, 0 0; } }

/* ================= Composer — แคปซูลกระจก ================= */
.composer-wrap { padding: 8px 20px 14px; flex: none; }
.suggest { max-width: 840px; margin: 0 auto 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.suggest button { border: 1px solid rgba(var(--neon-rgb),.25); background: rgba(var(--neon-rgb),.05); color: var(--text-2); padding: 6px 13px; border-radius: 999px; font-size: 13px; transition: .15s; }
.suggest button:hover { border-color: var(--neon); color: var(--text); box-shadow: 0 0 14px rgba(var(--neon-rgb),.2); }
.composer { max-width: 840px; margin: 0 auto; padding: 12px 12px 10px 16px; border-radius: 22px; transition: .2s; background: rgba(var(--n-18-36-78), .7); }
.composer:focus-within { box-shadow: var(--shadow), 0 0 0 1px rgba(var(--neon-rgb), .45), 0 0 36px rgba(var(--neon-rgb), .12); }
.composer textarea { width: 100%; background: transparent; border: 0; outline: none; resize: none; padding: 4px 0 8px; max-height: 220px; line-height: 1.6; font-size: 15px; }
.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.composer-bar .left, .composer-bar .right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.composer-bar .left { flex: 1; } .composer-bar .right { flex: none; }
.modes { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 10px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.modes button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: rgba(255,255,255,.02); color: var(--text-3); padding: 5px 11px; border-radius: 9px; font-size: 12.5px; white-space: nowrap; transition: .15s; }
.modes button svg.i { width: 14px; height: 14px; }
.modes button:hover { color: var(--text); border-color: var(--line-2); }
.modes button.on { border-color: rgba(var(--neon-rgb),.55); color: var(--neon); background: rgba(var(--neon-rgb), .07); box-shadow: 0 0 12px rgba(var(--neon-rgb),.15); }
/* ปุ่มส่ง = แผ่นโลหะขัดเงา */
.send { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--sapphire); color: #fff; display: grid; place-items: center; flex: none; transition: .15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -2px 0 rgba(10,30,80,.35), 0 0 0 1px rgba(190,215,255,.55), 0 4px 14px rgba(10,30,80,.5); }
.send:not(:disabled):hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 0 0 1px rgba(var(--neon-rgb),.8), 0 0 20px rgba(var(--neon-rgb),.45); }
.send svg.i { stroke-width: 2.2; }
.send:disabled { opacity: .3; box-shadow: none; }
.send.stop { background: rgba(255, 85, 119, .15); color: var(--red); box-shadow: 0 0 0 1px rgba(255,85,119,.6), 0 0 16px rgba(255,85,119,.3); }
.attach-row { display: flex; gap: 8px; flex-wrap: wrap; }
.attach-row:not(:empty) { margin-bottom: 8px; }
.att { position: relative; width: 60px; height: 60px; }
.att img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-2); }
.att button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--chrome-soft); color: #000; font-size: 11px; line-height: 1; }
.att .spin { position: absolute; inset: 0; margin: auto; }
.foot-note { text-align: center; margin-top: 9px; }
#micBtn.rec { color: var(--red); border-color: rgba(255,85,119,.6); box-shadow: 0 0 14px rgba(255,85,119,.4); animation: led 1.2s infinite; }
.voice-btn { gap: 8px; }
.orb-mini { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #5FE3FF 45%, #2a6fa8 100%); box-shadow: 0 0 10px var(--neon); }

/* ================= Gallery ================= */
.gallery { width: 0; overflow: hidden; display: flex; flex-direction: column; transition: width .25s, margin .25s; margin: 10px 0; border-radius: 20px;
  background: linear-gradient(180deg, rgba(var(--n-30-52-104), .6), rgba(var(--n-12-26-60), .72)); backdrop-filter: var(--blur); border: 1px solid transparent; }
.shell.gal-open .gallery { width: 320px; margin: 10px 10px 10px 0; border-color: var(--line); box-shadow: var(--shadow); }
.gal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 18px; }
.gal-head h3 { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.gal-grid { flex: 1; overflow-y: auto; padding: 4px 12px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.gal-grid .g, .lib-grid .g { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: rgba(var(--n-10-22-52), .8); border: 1px solid var(--line); cursor: pointer; position: relative; display: grid; place-items: center; color: var(--neon); transition: .15s; }
.gal-grid .g:hover, .lib-grid .g:hover { border-color: rgba(var(--neon-rgb), .5); box-shadow: 0 0 16px rgba(var(--neon-rgb), .15); }
.gal-grid .g img, .gal-grid .g video, .lib-grid .g img, .lib-grid .g video { width: 100%; height: 100%; object-fit: cover; }
.gal-grid .g svg.i, .lib-grid .g svg.i { width: 28px; height: 28px; filter: drop-shadow(0 0 6px rgba(var(--neon-rgb),.5)); }
.gal-grid .g .k { position: absolute; bottom: 5px; left: 5px; font-size: 10px; padding: 1px 7px; border-radius: 6px; background: rgba(0, 0, 0, .65); color: var(--text-2); font-family: var(--font-display); letter-spacing: .08em; border: 1px solid rgba(255,255,255,.08); }

/* ================= Library ================= */
.lib-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.lib-tabs button { border: 1px solid var(--line); background: transparent; color: var(--text-2); padding: 6px 14px; border-radius: 10px; font-size: 13px; }
.lib-tabs button.on { color: var(--neon); border-color: rgba(var(--neon-rgb),.55); background: rgba(var(--neon-rgb),.07); box-shadow: 0 0 12px rgba(var(--neon-rgb),.15); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }

/* ================= Lightbox ================= */
.lb { position: relative; width: min(1100px, 100%); max-height: 94vh; display: flex; flex-direction: column; gap: 12px; }
.lb .close { position: absolute; top: -8px; right: -8px; z-index: 2; background: rgba(var(--n-14-30-66),.9); border-color: var(--line-2); }
.lb-media { display: grid; place-items: center; min-height: 0; }
.lb-media img, .lb-media video { max-width: 100%; max-height: 78vh; border-radius: 14px; box-shadow: 0 0 0 1px var(--line-2), 0 30px 80px rgba(0,0,0,.6); }
.lb-media audio { width: min(560px, 100%); }
.lb-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 12px; }
.lb-prompt { flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--font-mono); }
.lb-actions { display: flex; gap: 6px; align-items: center; }

/* ================= Account ================= */
.mem-list { display: flex; flex-direction: column; gap: 6px; }
.mem-list .m { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; background: rgba(var(--n-6-16-42),.4); border: 1px solid var(--line); padding: 8px 10px; border-radius: 10px; }
.ledger { max-height: 200px; overflow: auto; font-size: 13px; }
.ledger div { display: flex; justify-content: space-between; padding: 6px 2px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.ledger .p { color: var(--green); font-family: var(--font-display); } .ledger .n { color: var(--text); font-family: var(--font-display); }
.modal h2 { font-size: 24px; }
.modal h4 { font-family: var(--font-display); font-size: 13px; letter-spacing: .02em; color: var(--text-2); font-weight: 500; }

/* ================= Voice — แกนพลังงานของยาน ================= */
.voice-overlay { position: fixed; inset: 0; z-index: 150; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 24px; text-align: center;
  background: radial-gradient(circle at 50% 42%, rgba(var(--neon-rgb), .10), transparent 45%), radial-gradient(circle at 50% 42%, #1A3470, #081530 72%); }
.voice-overlay.open { display: flex; animation: fade .3s ease; }
.voice-overlay .eyebrow { position: absolute; top: 28px; left: 0; right: 0; }
.orb { width: 240px; height: 240px; position: relative; display: grid; place-items: center; }
.orb .o-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(170, 195, 255, .14); }
.orb .o-ring.a { border-top-color: rgba(var(--neon-rgb), .9); border-bottom-color: rgba(143, 168, 255, .6); animation: rot 5s linear infinite; filter: drop-shadow(0 0 8px rgba(var(--neon-rgb),.7)); }
.orb .o-ring.b { inset: 22px; border-style: dashed; border-color: rgba(var(--neon-rgb), .28); animation: rot 18s linear infinite reverse; }
.orb .o-ring.c { inset: -26px; border-color: rgba(170, 195, 255, .07); }
.orb-core { width: 128px; height: 128px; border-radius: 50%; position: relative; z-index: 1; transition: transform .1s;
  background: radial-gradient(circle at 34% 28%, #FFFFFF 0%, #DDE7F2 12%, #8E9AAB 38%, #2B3444 70%, #0C1119 100%);
  box-shadow: inset 0 -12px 30px rgba(0,0,0,.6), inset 0 6px 16px rgba(255,255,255,.25), 0 0 0 1px rgba(255,255,255,.15), 0 0 60px rgba(var(--neon-rgb), .35); }
.orb-core::after { content: ''; position: absolute; inset: 34%; border-radius: 50%; background: radial-gradient(circle, #E9FFFF, #5FE3FF 45%, transparent 72%); filter: blur(2px); opacity: .9; animation: breathe 2.6s ease-in-out infinite; }
.orb.listening .orb-core { box-shadow: inset 0 -12px 30px rgba(0,0,0,.6), inset 0 6px 16px rgba(255,255,255,.25), 0 0 0 1px rgba(var(--neon-rgb),.6), 0 0 90px rgba(var(--neon-rgb), .5); }
.orb.thinking .o-ring.a { animation-duration: 1.2s; }
.orb.speaking .orb-core::after { animation-duration: .7s; }
@keyframes breathe { 50% { transform: scale(1.25); opacity: .6; } }
.voice-state { font-family: var(--font-display); font-size: 22px; letter-spacing: .04em; }
.voice-text { max-width: 640px; color: var(--text-2); min-height: 50px; font-size: 17px; }
.voice-actions { display: flex; gap: 10px; }

.only-mobile { display: none; }
@media (max-width: 1100px) { .shell.gal-open .gallery { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 100dvh; }
  .side { position: fixed; inset: 0 auto 0 0; margin: 0; border-radius: 0 20px 20px 0; width: 284px; z-index: 50; transform: translateX(-105%); transition: transform .25s; }
  .shell.side-open .side { transform: none; }
  .gallery { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; margin: 0 !important; border-radius: 20px 0 0 20px; }
  .shell.gal-open .gallery { width: min(320px, 88vw); }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 0 12px; } .sys-status { display: none; }
  .thread { padding: 12px 14px; } .composer-wrap { padding: 6px 12px 12px; }
  .templates { grid-template-columns: 1fr 1fr; }
  .btn.voice-btn { padding: 0; width: 38px; height: 38px; font-size: 0; gap: 0; }
  .voice-btn .orb-mini { width: 16px; height: 16px; }
  .msg-user { max-width: 90%; }
  .agent-turn > .av { display: none; }
  .tool-args, .tool-err { padding-left: 14px; }
}
/* ในสตูดิโอ ลดความเด่นของโครงข่ายเส้นเพื่อไม่ให้รบกวนผลงาน */
body::before { opacity: .55; }

/* OTP / verify */
.input.otp { text-align: center; font-family: var(--font-display); font-size: 30px; letter-spacing: .5em; padding: 14px 0 14px .5em; }
.verify-bar { max-width: 840px; margin: 0 auto 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 14px;
  background: rgba(255, 213, 138, .08); border: 1px solid rgba(255, 213, 138, .4); font-size: 14px; }
.verify-bar b { color: var(--amber); }
.tool .upgrade-cta { margin: 0 14px 12px 56px; }
.tool-head .st .t { font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { .tool .upgrade-cta { margin-left: 14px; } }

.model-sel { max-width: 150px; background: rgba(var(--neon-rgb),.06); border: 1px solid rgba(var(--neon-rgb),.3); color: var(--text-2); border-radius: 9px; padding: 5px 8px; font-size: 12.5px; font-family: var(--font); outline: none; flex: none; }
.model-sel.pref { color: var(--neon); border-color: var(--neon); }
.model-sel.has-new { box-shadow: 0 0 0 1px var(--amber), 0 0 12px rgba(255,213,138,.35); }
.model-sel option, .model-sel optgroup { background: var(--surface-solid); color: var(--text); }
.help-link { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 6px 10px; border-radius: 10px; }
.help-link:hover { color: #06C755; background: rgba(6,199,85,.08); }
.orb { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.topups { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.topup .tag { display: inline-block; white-space: nowrap; font-size: 10.5px; padding: 1px 7px; border-radius: 6px; background: var(--amber); color: #3a2600; margin: 0 0 4px; font-weight: 600; }
.credits .inf { font-size: 30px; }
@media (max-width: 820px) { .model-sel { max-width: 92px; } }

.admin-side { color: var(--neon, #5FE3FF); }
.admin-side:hover { color: #fff; background: rgba(var(--neon-rgb),.1); }
.model-sel { max-width: 220px; }
@media (max-width: 820px) { .modes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .modes::-webkit-scrollbar { display: none; } .model-sel { max-width: 150px; } .voice-btn { padding-inline: 10px; } }
.asset.game { aspect-ratio: 16/10; cursor: pointer; }
.game-cover { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; padding: 12px; background: radial-gradient(circle at 30% 20%, rgba(var(--neon-rgb),.35), transparent 55%), linear-gradient(135deg, #1b3f8f, #0c1f4d 60%, #3a1d6e); }
.game-cover svg.i { width: 44px; height: 44px; color: var(--neon); filter: drop-shadow(0 0 10px rgba(var(--neon-rgb),.7)); }
.game-cover b { font-size: 15px; } .game-cover span { font-size: 12px; color: var(--neon); border: 1px solid rgba(var(--neon-rgb),.5); padding: 3px 10px; border-radius: 99px; }
.game-frame { width: min(92vw, 1100px); height: min(72vh, 720px); border: 0; border-radius: 14px; background: #000; display: block; }
.game-acts { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.terms-ok { display: flex !important; flex-direction: row !important; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.terms-ok[hidden] { display: none !important; }
.terms-ok input { margin-top: 4px; accent-color: var(--neon); }
.btn.danger { color: #ff9a9a; } .btn.danger:hover { border-color: #ff9a9a; }

/* ---------- KWAY Studio: การ์ดสตอรี่บอร์ด ---------- */
.sb { margin: 0 14px 14px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line-2); background: linear-gradient(180deg, rgba(var(--neon-rgb),.05), rgba(var(--n-20-38-82),.35)); display: grid; gap: 12px; }
.sb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sb-title { flex: 1; min-width: 160px; background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--text); font: 600 17px var(--font-display); padding: 4px 6px; }
.sb-title:not(:disabled):hover, .sb-title:focus { border-color: var(--line-2); outline: none; }
.sb-log { margin: 0; color: var(--text-2); font-size: 13.5px; }
.sb-prog { display: grid; gap: 6px; } .sb-prog .meter { height: 6px; }
.sb-chars { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sb-char { display: grid; justify-items: center; gap: 4px; font-size: 12px; }
.sb-char img, .sb-char .sb-ph { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-2); background: var(--surface-2); }
.sb-music { flex: 1; min-width: 240px; display: grid; gap: 4px; } .sb-music audio { width: 100%; height: 36px; }
.lyrics summary { cursor: pointer; font-size: 12.5px; color: var(--neon); padding: 4px 8px; }
.lyrics pre { white-space: pre-wrap; font: 13px/1.7 var(--font); color: var(--text-2); margin: 0; padding: 4px 10px 10px; max-height: 260px; overflow: auto; }
.sb-scenes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.sb-scene { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(var(--n-8-18-44),.45); display: grid; }
.sb-kf { position: relative; aspect-ratio: var(--ar, 16/9); background: #000; }
.sb-kf img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.sb-kf .sb-ph { height: 100%; display: grid; place-items: center; color: var(--text-3); font-size: 12px; }
.sb-no, .sb-ok { position: absolute; top: 6px; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(5,10,25,.7); }
.sb-no { left: 6px; } .sb-ok { right: 6px; color: var(--green); }
.sb-fields { padding: 8px; display: grid; gap: 6px; }
.sb-fields textarea, .sb-fields input:not([type]), .sb-fields select { width: 100%; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font: 12.5px/1.5 var(--font); padding: 6px 8px; resize: vertical; }
.sb-fields select { width: auto; padding: 3px 6px; }
.sb-shot { color: var(--text-3); }
.sb-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.sb-row label { display: inline-flex; gap: 5px; align-items: center; color: var(--text-2); }
.sb-foot { display: grid; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.sb-q { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.sb-q label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; }
.sb-q label.on, .sb-q label:has(input:checked) { border-color: var(--neon); box-shadow: 0 0 12px rgba(var(--neon-rgb),.2); }
.sb-q b { color: var(--neon); }
.sb-out video { width: 100%; max-height: 520px; border-radius: 12px; background: #000; display: block; margin-bottom: 8px; }
.asset.audio .lyrics { grid-column: 1 / -1; }
@media (max-width: 640px) { .sb { margin: 0 8px 10px; padding: 10px; } .sb-scenes { grid-template-columns: 1fr 1fr; } }
.sb-music audio { filter: invert(.92) hue-rotate(180deg) saturate(.6); border-radius: 999px; }

.song-title { display: flex; align-items: center; gap: 8px; font: 600 15px var(--font-display); color: var(--text); }
.song-title svg.i { width: 16px; height: 16px; color: var(--neon); }
.song-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.song-acts .btn svg.i { width: 14px; height: 14px; }
.tool-assets > .asset { align-self: start; }
