/* Vexx workspace: one responsive shell, quiet surfaces and readable conversations.
   Component styles (JDUI, remote control, research) remain in styles.css. */
:root {
  --bg:#161618; --bg-elev:#1d1d21; --bg-elev-2:#222226; --panel:#1d1d21; --panel-2:#222226;
  --surface-1:#1b1b1e; --surface-2:#222226; --surface-3:#2b2b31;
  --text:#eeeef1; --text-1:#eeeef1; --text-2:#b7b7c0; --text-3:#a5a5b0;
  --muted:#aaaab5; --soft:#aaaab5; --purple:#b6a3ed; --purple-2:#9375dc; --purple-3:#7760ae;
  --rose:#b6a3ed; --accent:#b6a3ed; --accent-2:#9375dc; --line:#2b2b30;
  --line-strong:#3a3a42; --border-subtle:#2b2b30; --border-soft:#37373e;
  --glow-purple:rgba(182,163,237,.08); --glow-rose:rgba(182,163,237,.08);
  --app-height:100dvh;
}
html,body {height:100%;min-height:0;overflow:hidden}
body {display:block;padding:0;font-size:14px;letter-spacing:0;line-height:1.55;background:var(--bg)}
button,input,select,textarea {font:inherit}
button {touch-action:manipulation}
button:disabled {cursor:default;opacity:.5}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible {
  outline:2px solid var(--purple);outline-offset:3px;
}
.scene-glow,.app::before {display:none}
.app,.app-wide {width:100%;height:var(--app-height);min-height:0;max-height:var(--app-height);margin:0;
  padding:0;border:0;border-radius:0;box-shadow:none;background:var(--bg);overflow:hidden;isolation:isolate}
.main-col {height:100%;min-height:0;min-width:0;overflow:hidden}
.drawer {width:268px;height:100%;min-height:0;padding:16px 14px 12px;gap:5px;background:#111113;
  overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;border-right:1px solid var(--line)}
.drawer-head {min-height:40px;margin-bottom:8px}
.brand {gap:10px}
.brand-mark {width:30px;height:30px;min-width:30px;border-radius:9px;background:var(--text);box-shadow:none}
.brand-mark span {color:var(--bg);font-size:23px;letter-spacing:-2px;padding-right:2px;font-weight:600}
.brand strong {font-size:18px;letter-spacing:-.6px;font-weight:600}
.brand-ai {font-weight:400;color:var(--muted)}
.brand small {font-size:11px;font-weight:400;letter-spacing:0;text-transform:none;margin-top:2px}
.brand-dot {color:var(--purple)}
.icon-button {width:40px;height:40px;border:0;border-radius:9px;background:transparent;color:var(--muted)}
.icon-button:hover,.session-tool:hover,.session-x:hover {background:var(--surface-3)}
.drawer-profile {order:10;margin:6px 0 0;padding:10px 2px 0;border:0;border-top:1px solid var(--line);
  background:transparent;border-radius:0;gap:10px;flex-shrink:0}
.drawer-profile strong {font-size:13px;font-weight:500}
.drawer-profile small {font-size:12px}
.drawer-profile .profile-settings {flex:1;min-width:0;width:auto;padding:2px;gap:8px;justify-content:space-between;color:var(--text);background:none}
.profile-settings span {min-width:0;text-align:left}
.profile-settings strong,.profile-settings small {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.profile-avatar,.drawer-profile .profile-avatar {background:var(--surface-3);border-radius:50%;box-shadow:none;color:var(--text)}
.profile-avatar {flex-shrink:0}
.profile-card > div:not(.profile-avatar) {flex:1;min-width:0}
.profile-card strong,.profile-card #profileUser {display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.profile-card #profileUser {font-size:12px;margin-top:2px}
.profile-card .demo-tag {flex-shrink:0;font-size:10px}
.new-chat-cta {background:var(--surface-2);border:1px solid var(--line-strong);border-radius:10px;
  font-size:14px;font-weight:500;justify-content:flex-start;padding:11px 12px;flex-shrink:0}
.new-chat-cta:hover {background:var(--surface-3)}
.drawer-search {border:0;background:transparent;padding:9px 10px;margin:2px 0;flex-shrink:0}
.drawer-search input {font-size:13px;min-height:26px}
.drawer-caption {font-size:12px;text-transform:none;letter-spacing:0;font-weight:500;margin:9px 10px 4px}
.sidebar-library {flex:1;min-height:145px;overflow:auto;scrollbar-width:thin;overscroll-behavior:contain;padding-right:2px}
.drawer-caprow {min-height:32px}
.mini-toggle {min-width:34px;height:34px;border:0;background:transparent}
.session-list {max-height:none;min-height:0;overflow:visible;gap:3px;padding:0}
.session-item {padding:3px 5px 3px 10px;gap:2px;border:0;background:transparent;border-radius:8px;min-height:40px}
.session-item.active {background:#292930;border:0}
.session-item:hover {background:var(--surface-2)}
.session-open {flex:1;min-width:0;text-align:left;color:inherit;padding:7px 0;min-height:34px}
.session-title {font-size:13px;line-height:1.5}
.session-item small {font-size:11px}
.session-tools {gap:0}
.session-tool {width:34px;height:34px;font-size:20px;color:var(--muted)}
.session-pin {margin-right:4px}
.project-list {display:flex;flex-direction:column;gap:4px}
.project-heading {display:flex;align-items:center;gap:2px}
.project-toggle {flex:1;min-width:0;display:flex;align-items:center;gap:7px;color:var(--text-2);padding:8px;border-radius:8px;font-size:13px;text-align:left}
.project-toggle span {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.project-toggle small {margin-left:auto;color:var(--muted);font-size:11px}
.project-toggle svg {width:14px;height:14px;transition:transform .15s}
.project-toggle[aria-expanded="true"] svg {transform:rotate(90deg)}
.project-children {padding-left:10px;margin-left:12px;border-left:1px solid var(--line)}
.library-empty {font-size:12px;color:var(--muted);padding:8px 10px;line-height:1.6;margin:0}
.project-add {display:flex;align-items:center;gap:7px;width:100%;color:var(--muted);font-size:12px;padding:9px;border-radius:8px;text-align:left}
.project-add:hover,.project-toggle:hover {background:var(--surface-2)}
.project-add svg {width:15px;height:15px}
.drawer-nav {gap:2px}
.drawer-item {min-height:36px;padding:7px 10px;border:0;font-size:13px;font-weight:400;border-radius:8px}
.drawer-item.active {background:var(--surface-2);color:var(--text);border:0}
.drawer-hint {font-size:12px;font-weight:400}
.drawer-foot {margin:0;gap:5px;border:0;padding:6px 0;flex-shrink:0}
.drawer-connection summary {font-size:12px;color:var(--muted);padding:7px 10px;cursor:pointer}
.memory-card {background:none;border:0;padding:10px 6px;font-size:12px}
.memory-card strong {font-size:12px;font-weight:500}
.memory-card span {font-size:11px}
.drawer-model {padding:6px;font-size:12px}
.model-select {max-width:180px;background:var(--surface-2);font-size:12px;min-height:32px;border:1px solid var(--line);border-radius:7px}
.drawer-status {font-size:12px;padding:7px 6px}
.workspace-status {font-size:11px;color:var(--muted);margin:2px 8px;line-height:1.5}
.app-header {height:auto;min-height:64px;flex-shrink:0;padding:10px 24px;padding-top:calc(10px + var(--safe-top));
  border-bottom:1px solid var(--line);background:var(--bg);gap:8px}
.chat-title-wrap strong {font-size:14px;font-weight:500}
.chat-title-wrap small {font-size:12px;margin-top:2px}
.status-dot-btn {display:flex;align-items:center;gap:7px;width:auto;min-width:40px;min-height:40px;padding:8px;
  border:0;background:transparent;color:var(--muted);font-size:12px;border-radius:9px}
.status-dot-btn .status-dot {width:7px;height:7px;box-shadow:none}
.status-pop {right:20px;top:64px;max-width:calc(100% - 40px);border:1px solid var(--line-strong);background:var(--surface-1)}
.status-pop-row,.status-pop-row strong {font-size:13px}
.page {width:100%;min-width:0;padding:0 28px}
#page-chat {padding:0;min-height:0}
.page:not(#page-chat) {overflow-y:auto;overscroll-behavior:contain;padding-bottom:30px}
.page:not(#page-chat)>* {width:100%;max-width:900px;margin-left:auto;margin-right:auto}
.conversation {padding:24px max(24px,calc((100% - 760px)/2));scrollbar-width:thin;overflow-x:hidden;scroll-behavior:auto}
.conversation.is-empty {display:flex;flex-direction:column;justify-content:center;padding-top:30px;padding-bottom:30px}
.chat-date {font-size:12px;text-transform:none;letter-spacing:0;padding:0 0 24px}
.conversation.is-empty .chat-date {display:none}
.empty-chat {margin:0;padding:24px 0;border:0;background:none;color:var(--text);text-align:center}
.empty-chat .welcome-mark {display:block;font-size:48px;color:var(--purple);letter-spacing:-4px;font-weight:500;margin-bottom:16px}
.empty-chat p {font-size:14px;color:var(--muted);margin:0 0 8px}
.empty-chat h1 {font-size:clamp(24px,3vw,34px);letter-spacing:-1px;line-height:1.25;font-weight:500;margin:0 0 12px}
.empty-chat small {display:block;font-size:12px;color:var(--muted);max-width:390px;margin:12px auto 0}
.message {margin:0 0 28px;min-width:0;max-width:100%}
.message.user {margin-left:auto;max-width:85%}
.message.ai {width:100%;max-width:100%;padding:0}
.message-content {min-width:0}
.message.user .bubble {background:#29292f;color:var(--text);padding:12px 17px;border:0;border-radius:18px;
  box-shadow:none;font-size:15px;line-height:1.65}
.message.ai .bubble {font-size:15px;line-height:1.8;padding:0;border:0;background:none;overflow-wrap:anywhere}
.message.ai .bubble h1,.message.ai .bubble h2,.message.ai .bubble h3,.message.ai .bubble h4 {
  color:var(--text);font-weight:650;line-height:1.35;margin:24px 0 10px;letter-spacing:-.025em}
.message.ai .bubble h2 {font-size:22px}
.message.ai .bubble h3 {font-size:18px;margin-top:20px}
.message.ai .bubble h4 {font-size:16px;margin-top:16px;color:var(--text-2)}
.message.ai .bubble > :first-child {margin-top:0}
.bubble p {margin:10px 0;line-height:1.75}
.bubble ul,.bubble ol {margin:10px 0;padding-left:24px}
.bubble li {padding-left:3px;margin:6px 0;font-size:inherit;line-height:1.7}
.bubble li::marker {color:var(--purple)}
.bubble blockquote {margin:14px 0;padding:10px 14px;border-left:3px solid var(--purple);
  border-radius:0 10px 10px 0;background:rgba(182,163,237,.07);color:var(--text-2);font-style:normal}
.bubble code {background:rgba(182,163,237,.12);color:#d5c8fb;border:1px solid rgba(182,163,237,.12);
  padding:2px 6px;border-radius:6px;font-size:.9em}
.bubble .codeblock {margin:14px 0;border:1px solid var(--line-strong);border-radius:12px;
  overflow:hidden;background:#111114}
.bubble .codeblock pre {max-width:100%;overflow:auto;margin:0;padding:38px 16px 16px;font-size:13px;line-height:1.65}
.bubble .codeblock pre code {display:block;padding:0;border:0;background:none;color:#ddd5f5;
  font-size:12.5px;white-space:pre;word-break:normal;overflow-wrap:normal}
.bubble .code-lang {top:12px;left:14px}
.bubble .code-copy {top:8px;right:8px;min-height:30px;padding:4px 10px}
.table-wrap {max-width:100%;overflow:auto;margin:14px 0;border:1px solid var(--line-strong);
  border-radius:12px;background:var(--surface-1);overscroll-behavior-x:contain}
.bubble table {width:100%;border-collapse:separate;border-spacing:0;font-size:13px;line-height:1.55}
.bubble th,.bubble td {padding:10px 13px;text-align:left;vertical-align:top;border:0;
  border-bottom:1px solid var(--line)}
.bubble th {position:sticky;top:0;background:#24232a;color:var(--text);font-weight:600;white-space:nowrap}
.bubble tbody tr:nth-child(even) {background:rgba(255,255,255,.025)}
.bubble tbody tr:last-child td {border-bottom:0}
.bubble tbody tr:hover {background:rgba(182,163,237,.055)}
.bubble hr {border:0;border-top:1px solid var(--line-strong);margin:20px 0}
.bubble-avatar {background:none;color:var(--purple);box-shadow:none;font-size:20px;letter-spacing:-1px;margin:0;width:26px;height:30px}
.sender {font-size:13px;color:var(--text);font-weight:500;margin:0 0 8px}
.msg-time,.message-ack,.model-badge,.latency-tag,.msg-copy {font-size:11px;font-weight:400}
.message-ack.synced {color:var(--muted);font-weight:400}
.message.failed .bubble {border:1px solid var(--danger);padding:12px;border-radius:12px}
.message-retry,.stop-gen {font-size:13px;min-height:36px}
.suggestions {width:100%;max-width:800px;align-self:center;display:flex;justify-content:center;flex-wrap:wrap;
  padding:8px 24px 18px;gap:8px;flex-shrink:0}
.suggestion {display:flex;align-items:center;gap:8px;white-space:normal;font-size:13px;font-weight:400;
  min-height:42px;padding:10px 13px;border:1px solid var(--line-strong);background:transparent;border-radius:10px;color:var(--text-2)}
.suggestion:hover {background:var(--surface-2);color:var(--text)}
.suggestion svg {width:16px;height:16px}
.bottom-dock {width:100%;max-width:820px;align-self:center;padding:8px 28px calc(16px + var(--safe-bottom));
  background:var(--bg);border:0;backdrop-filter:none}
.composer {align-items:flex-end;gap:8px;padding:12px;border:1px solid var(--line-strong);border-radius:18px;background:#202023}
#messageInput {min-width:0;min-height:48px;max-height:160px;font-size:16px;line-height:1.55;padding:10px 4px}
.composer:focus-within {border-color:#79718c}
.composer-plus,.send-button {width:40px;height:40px;display:grid;place-items:center;border-radius:11px;opacity:1}
.composer-plus:hover {background:var(--surface-3)}
.send-button {color:var(--bg);background:var(--text)}
#messageInput:not(:placeholder-shown)+.send-button,.send-button:hover {color:var(--bg);background:var(--purple)}
.composer-hint {font-size:11px;min-height:16px;justify-content:center;margin:8px 0 0;color:var(--muted)}
.upload-status {font-size:13px;color:var(--text-2);padding:8px 4px 12px;overflow-wrap:anywhere}
.gen-bar {border:0;background:transparent;font-size:13px;padding:4px 0 12px;margin:0}
.stream-placeholder {color:var(--muted);letter-spacing:3px}
.citation {display:inline-block;font-size:.8em;padding:0 5px;border-radius:5px;background:var(--surface-3);text-decoration:none}
.refs {border-top:1px solid var(--line);padding-top:14px;margin-top:22px;font-size:12px;overflow-wrap:anywhere}
.reference-item {margin:8px 0;color:var(--muted)}
.image-unavailable {min-height:44px;border:1px dashed var(--line-strong);color:var(--muted)}
.jdui-slot {min-width:0;max-width:100%;overflow-wrap:anywhere}
.jdui-chart,.jdui-cmp {max-width:100%;overflow-x:auto}
.jdui-actions {flex-wrap:wrap}
.jdui-btn[aria-pressed="true"] {border-color:var(--purple);background:var(--surface-3)}
.jdui-chart [role="button"]:focus-visible {outline:2px solid var(--purple);outline-offset:3px}
@media(max-width:899px){.jdui-btn{min-height:44px}.jdui-field input,.jdui-field select{font-size:16px}}
#stopGen {min-height:36px;font-size:12px}
.scroll-fab {right:24px;bottom:12px;width:40px;height:40px;background:var(--surface-2);border:1px solid var(--line-strong);color:var(--text);border-radius:50%}
.research-bar {padding:10px 24px;font-size:13px;flex-wrap:wrap}
.research-panel {overflow:auto;max-height:40%;flex-shrink:0}
.research-panel h2 {font-size:14px}
.section-header {padding-top:28px}
.section-header h1 {font-weight:500;font-size:28px}
.intro-copy {font-size:14px;line-height:1.65}
.eyebrow,.section-caption {font-size:12px;font-weight:500}
.settings-group,.device-card,.access-card,.stat-card,.doc-item {background:var(--surface-1);border-color:var(--line);box-shadow:none}
.settings-row {min-height:64px}
.export-row {flex-wrap:wrap}
.export-row .subtle-button {flex:1 1 120px}
.settings-row strong,.device-name strong {font-size:14px;font-weight:500}
.settings-row span,.settings-note,.settings-row small,.device-name span,.access-card span {font-size:12px;line-height:1.6}
.settings-note {color:var(--muted)}
.settings-icon,.device-icon,.access-icon {background:var(--surface-2);color:var(--muted)}
.doc-list {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:16px}
.doc-item {padding:18px;font-size:14px}
.doc-item small,.doc-empty {font-size:13px}
.doc-actions {display:flex;flex-wrap:wrap;gap:8px}
.doc-actions button {font-size:12px;min-height:40px}
.stat-card span,.timeline-item,.memory-row,.mem-toggle {font-size:13px}
.fld,.setting-soon {font-size:12px}
.subtle-button,.action-pill,.primary-button {font-size:13px;min-height:40px}
.primary-button {background:var(--text);color:var(--bg);border:0;border-radius:9px;padding:10px 18px;font-weight:500}
.primary-button:hover {background:var(--purple)}
.login-overlay {background:var(--bg);padding:24px;overflow-y:auto}
.login-card {width:min(100%,400px);padding:32px;border:1px solid var(--line);background:var(--surface-1);box-shadow:none;border-radius:20px}
.login-symbol {width:42px;height:42px;background:var(--text);color:var(--bg);box-shadow:none;font-size:33px;letter-spacing:-3px;border-radius:12px;padding-right:3px}
.login-card h2 {font-size:25px;font-weight:500;letter-spacing:-.8px;line-height:1.3}
.login-card h2 span {color:var(--text)}
.login-card label {font-size:13px;font-weight:400;letter-spacing:0;text-transform:none}
.login-card input {min-height:48px;font-size:16px;border-radius:10px;background:var(--bg)}
.login-submit {background:var(--text);color:var(--bg);font-size:14px;font-weight:500;box-shadow:none;min-height:46px;border-radius:10px}
.login-card small,.login-switch button,.login-back button {font-size:12px;line-height:1.6}
.login-switch button,.login-back button {min-height:44px}
.login-error {font-size:13px}
.toast {font-size:13px;max-width:calc(100% - 32px);padding:12px 18px;bottom:calc(24px + var(--safe-bottom));border:1px solid var(--line-strong);background:var(--surface-2)}
.organize-dialog {width:min(460px,calc(100% - 32px));max-height:calc(100dvh - 40px);overflow:auto;color:var(--text);
  background:var(--surface-1);border:1px solid var(--line-strong);border-radius:18px;padding:24px;box-shadow:0 24px 70px #0006}
.organize-dialog::backdrop {background:#0009;backdrop-filter:blur(3px)}
.dialog-heading {display:flex;align-items:center;justify-content:space-between;gap:12px}
.dialog-heading h2 {font-size:20px;font-weight:500;margin:0}
.dialog-description {font-size:13px;color:var(--muted);margin:12px 0 20px;line-height:1.6}
.organize-dialog label {display:block;font-size:13px;margin:14px 0 6px}
.organize-dialog input:not([type=checkbox]),.organize-dialog select {width:100%;border:1px solid var(--line-strong);border-radius:9px;
  background:var(--bg);color:var(--text);font-size:16px;padding:11px;min-height:46px}
.dialog-switches {display:flex;gap:16px;flex-wrap:wrap;margin-top:10px}
.dialog-switches label {display:flex;align-items:center;gap:8px;min-height:32px}
.dialog-switches input {width:17px;height:17px;accent-color:var(--purple)}
.dialog-actions {display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-top:24px}
.dialog-actions .danger-link {margin-right:auto}
@media(min-width:900px){.drawer{position:relative;transform:none}.menu-button,#drawerClose{display:none}}
@media(max-width:899px){
  .drawer {width:min(86vw,320px);position:absolute;transform:translateX(-102%)}
  .drawer.open {transform:none}.drawer-scrim {z-index:40}
  .app-header {min-height:60px;padding-left:12px;padding-right:12px;gap:4px}
  .menu-button {display:grid;margin-right:4px}.chat-title-wrap strong {font-size:14px}
  .chat-title-wrap small {font-size:11px}.icon-button {width:40px;height:44px}
  #newChatTop {display:none}#connectionShort {display:none}
  .conversation {padding:22px 20px}.bottom-dock {padding:8px 14px calc(10px + var(--safe-bottom))}
  .suggestions {padding:8px 14px 14px;gap:8px}.suggestion {font-size:12px}
  .message.user {max-width:92%}.message.ai .bubble,.message.user .bubble {font-size:15px}
  .page {padding:0 20px}.empty-chat h1 {font-size:27px}
  .session-tool,.mini-toggle {width:40px;height:40px;min-width:40px}
  .session-open,.project-toggle,.project-add,.drawer-item {min-height:44px}
  .drawer-search input {font-size:16px}.drawer {padding-top:calc(14px + var(--safe-top))}
  .composer-plus,.send-button {width:44px;height:44px}.composer {gap:4px;padding:8px}
  .scroll-fab {right:18px}.login-card {padding:26px}
}
@media(max-width:360px){.app-header{padding-left:8px;padding-right:8px}.conversation{padding:20px 16px}.suggestion{padding:9px}.organize-dialog{padding:18px}.dialog-actions{gap:5px}.empty-chat h1{font-size:24px}}
@media(max-height:650px){.drawer{gap:4px;padding-top:10px}.drawer-head{margin:0}.sidebar-library{min-height:130px}.conversation.is-empty{padding-top:12px;padding-bottom:12px}.empty-chat{padding:8px}.empty-chat .welcome-mark{font-size:32px;margin-bottom:8px}.suggestions{padding-bottom:8px}.login-overlay{align-items:flex-start}.login-card{margin:auto}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}.project-toggle svg{transition:none}}
@media(pointer:coarse){.keyboard-hint{display:none}}
/* V5.3: scoped viewer; no global chat geometry changes. */
.model3d { min-width: 0; max-width: 100%; padding: 16px; border: 1px solid var(--border, #343744); border-radius: 18px; background: var(--surface, #191b24); }
.model3d h3 { margin: 0 0 8px; font-size: 1rem; }
.model3d p { overflow-wrap: anywhere; }
.model3d [hidden] { display: none !important; }
.m3-description, .m3-status { font-size: .85rem; color: var(--muted, #b0b4c4); }
.m3-preview { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; }
.m3-stage { width: 100%; height: 300px; background: radial-gradient(120% 90% at 50% 10%, #333a52 0%, #1d2130 55%, #14161f 100%); border: 1px solid #3a4158; border-radius: 14px; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.m3-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.m3-chip { display: inline-block; padding: 3px 10px; border: 1px solid #4a5270; border-radius: 999px; font-size: .72rem; letter-spacing: .02em; color: #cdd5ee; background: #232838; }
.m3-chip-muted { border-color: #3a4158; color: #aeb7cf; background: transparent; }
.m3-source { font-size: .75rem; color: #97a0ba; margin-top: 4px; }
.m3-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.m3-canvas:active { cursor: grabbing; }
.m3-tools { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; }
.model3d button { min-height: 44px; max-width: 100%; white-space: normal; }
.model3d .jdui-btn { background: #282d40; color: #e1e5f7; border: 1px solid #454d69; box-shadow: none; }
.model3d .jdui-btn:hover { background: #353d56; }
.m3-part { display: inline-block; background: transparent; color: inherit; border: 1px solid #626a86; border-radius: 8px; padding: 8px 12px; margin: 8px 6px 0 0; }
.m3-part[aria-pressed="true"] { background: #3b4569; }
.m3-details { padding-top: 8px; font-size: .9rem; }
.m3-expanded .m3-stage { height: min(65vh, 600px); }
.model3d :focus-visible { outline: 2px solid #b6c2ff; outline-offset: 3px; }
@media(max-width: 480px) { .model3d { padding: 10px; } .m3-stage { height: 260px; } .m3-tools button { flex: 1 0 28%; } }
/* V5.4: compact primary actions, contextual secondary operations. */
.model3d:has(.m3-lesson) .m3-stage { height: 350px; }
.m3-secondary { flex: 1 0 100%; }
.m3-secondary summary { cursor: pointer; padding: 12px; border-radius: 8px; color: #c7cee4; }
.m3-secondary-actions, .m3-lesson-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.m3-secondary-actions label, .m3-lesson label { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.m3-lesson { border-top: 1px solid #353b50; margin-top: 12px; padding-top: 10px; }
.m3-lesson select, .m3-secondary select { min-height: 44px; max-width: 100%; background: #202534; color: #e1e5f7; border: 1px solid #454d69; border-radius: 8px; font-size: 16px; padding: 6px; }
.m3-details > small { display: block; margin-top: 8px; color: #aeb7cf; }
.m3-details { max-height: 220px; overflow-y: auto; overscroll-behavior: contain; }
.m3-lesson-controls button { flex: 1; }
.model3d button:disabled { opacity: .45; cursor: default; }
@media(max-width: 480px) { .model3d:has(.m3-lesson) .m3-stage { height: 320px; } .m3-tools:has(.m3-secondary) > button:not([hidden]) { flex: 1 0 20%; font-size: .8rem; padding: 6px; } }
