:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #f4f1eb;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --border: rgba(148, 163, 184, 0.22);
  --text: #243042;
  --muted: #6b7280;
  --accent: #5b9df0;
  --accent-deep: #4b83d0;
  --accent-soft: rgba(91, 157, 240, 0.16);
  --warn: #d97706;
  --shadow: 0 22px 60px rgba(65, 77, 99, 0.14);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(103, 145, 255, 0.18), transparent 28%),
    radial-gradient(circle at right 20%, rgba(255, 212, 171, 0.28), transparent 24%),
    linear-gradient(180deg, #f7f3ed 0%, #efe8df 100%);
}

button,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.72;
  pointer-events: none;
  animation: floatBlob 12s ease-in-out infinite;
}

.ambient-a {
  width: 280px;
  height: 280px;
  top: 60px;
  left: -40px;
  background: rgba(118, 160, 255, 0.24);
}

.ambient-b {
  width: 360px;
  height: 360px;
  right: -80px;
  top: 120px;
  background: rgba(255, 207, 148, 0.22);
  animation-duration: 15s;
}

.ambient-c {
  width: 260px;
  height: 260px;
  bottom: 80px;
  left: 42%;
  background: rgba(194, 221, 255, 0.2);
  animation-duration: 18s;
}

.studio-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  overflow: hidden;
}

.glass-panel,
.glass-card,
.composer-frame,
.json-panel {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.memory-pane,
.device-shell {
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow);
}

.memory-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.58));
}

.brand-block {
  display: grid;
  gap: 12px;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-deep);
  background: rgba(91, 157, 240, 0.1);
  border: 1px solid rgba(91, 157, 240, 0.14);
}

h1,
h2,
h3,
p,
pre,
ol {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 2.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 1.05rem;
}

h3 {
  font-size: 1rem;
}

.intro-copy {
  max-width: 32ch;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.small {
  font-size: 0.82rem;
}

.tiny {
  font-size: 0.76rem;
}

.glass-card {
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.54);
  padding: 18px;
  box-shadow: 0 14px 32px rgba(79, 96, 128, 0.08);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mini-badge,
.count-pill,
.status-pill,
.registry-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.mini-badge {
  padding: 6px 10px;
  background: rgba(36, 48, 66, 0.06);
  color: #4b5563;
}

.flow-list {
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.prompt-list {
  display: grid;
  gap: 12px;
}

.prompt-chip,
.ghost-button,
#send-button,
.json-toggle-button,
.registry-item {
  border: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, opacity 180ms ease;
}

.prompt-chip:hover,
.ghost-button:hover,
#send-button:hover,
.json-toggle-button:hover,
.registry-item:hover {
  transform: translateY(-2px);
}

.prompt-chip {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(104, 164, 248, 0.12), rgba(255, 255, 255, 0.85));
  color: #274566;
  border: 1px solid rgba(91, 157, 240, 0.16);
  box-shadow: 0 10px 24px rgba(91, 157, 240, 0.1);
}

.ghost-button {
  padding: 10px 14px;
  border-radius: 14px;
  color: #4b5563;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.registry-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.count-pill {
  min-width: 32px;
  padding: 6px 10px;
  background: rgba(91, 157, 240, 0.14);
  color: var(--accent-deep);
}

.registry-list {
  display: grid;
  gap: 12px;
  max-height: min(42vh, 420px);
  overflow: auto;
  padding-right: 4px;
}

.registry-item {
  width: 100%;
  text-align: left;
  padding: 15px 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 249, 255, 0.84));
  border: 1px solid rgba(91, 157, 240, 0.12);
  box-shadow: 0 14px 26px rgba(79, 96, 128, 0.08);
}

.registry-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.registry-tag {
  padding: 4px 8px;
  background: rgba(91, 157, 240, 0.12);
  color: var(--accent-deep);
}

.registry-item code {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent-deep);
  font-size: 0.76rem;
}

.registry-footer {
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--accent-deep);
}

.stage-pane {
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.device-stage {
  position: relative;
  flex: 1;
  min-height: calc(100dvh - 48px);
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.device-shadow {
  position: absolute;
  inset: 11% 12% 8%;
  border-radius: 42px;
  background: radial-gradient(circle at top, rgba(91, 157, 240, 0.2), transparent 58%);
  filter: blur(42px);
  pointer-events: none;
}

.device-shell {
  position: relative;
  width: 100%;
  height: calc(100dvh - 48px);
  max-height: calc(100dvh - 64px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 42px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.device-shell::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 128px;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.3);
}

.device-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 18px 16px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.header-actions,
.locale-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compact-pane-switcher {
  display: none;
}

.compact-pane-button {
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: #4b5563;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.16);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.compact-pane-button:hover {
  transform: translateY(-1px);
}

.compact-pane-button[aria-pressed='true'] {
  background: linear-gradient(135deg, #66a6f4, #4f86d7);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 12px 20px rgba(91, 157, 240, 0.2);
}

.locale-button[aria-pressed='true'] {
  background: rgba(96, 165, 250, 0.16);
  color: #1d4ed8;
  border-color: rgba(96, 165, 250, 0.35);
}

.assistant-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.assistant-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, #6aa9f6, #4f86d7);
  box-shadow: 0 14px 26px rgba(91, 157, 240, 0.22);
}

.assistant-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  padding: 6px 10px;
}

.status-pill-ready {
  color: #1d4ed8;
  background: rgba(96, 165, 250, 0.16);
}

.status-pill-warn {
  color: #9a3412;
  background: rgba(251, 191, 36, 0.18);
}

.chat-list {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  padding: 24px 8px 18px;
  margin-top: 14px;
  scroll-behavior: smooth;
}

.chat-list::before {
  content: '';
  position: sticky;
  top: 0;
  height: 24px;
  margin-bottom: -24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
  z-index: 2;
  pointer-events: none;
}

.message {
  display: grid;
  gap: 8px;
  align-self: stretch;
  animation: messageRise 260ms ease;
}

.message.user {
  justify-items: end;
}

.message-role {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(75, 85, 99, 0.78);
  padding: 0 8px;
}

.message-body {
  position: relative;
  max-width: min(680px, 100%);
  border-radius: 24px;
  padding: 16px 18px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  box-shadow: 0 14px 28px rgba(79, 96, 128, 0.08);
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.assistant .message-body {
  border-top-left-radius: 10px;
}

.message.user .message-body {
  color: white;
  background: linear-gradient(135deg, #66a6f4, #4f86d7);
  border: none;
  border-top-right-radius: 10px;
  box-shadow: 0 16px 30px rgba(91, 157, 240, 0.24);
}

.message.system .message-body {
  background: rgba(255, 247, 237, 0.92);
  color: #9a3412;
  border-color: rgba(251, 191, 36, 0.28);
}

.runtime-event .message-body {
  font-size: 0.88rem;
}

.assistant-ui-message .message-body {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.pending-message .message-body {
  padding: 14px 16px;
}

.pending-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pending-bubble span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(91, 157, 240, 0.75);
  animation: pulseDot 1.2s ease-in-out infinite;
}

.pending-bubble span:nth-child(2) {
  animation-delay: 120ms;
}

.pending-bubble span:nth-child(3) {
  animation-delay: 240ms;
}

.message-ui-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.message-ui-caption {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.json-toggle-button {
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(91, 157, 240, 0.12);
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 700;
}

.surface-card {
  display: grid;
  gap: 12px;
}

.a2ui-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.a2ui-column {
  display: grid;
  gap: 12px;
}

.a2ui-card {
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #f6fbff);
  border: 1px solid rgba(91, 157, 240, 0.12);
  box-shadow: 0 12px 24px rgba(79, 96, 128, 0.08);
}

.a2ui-text-h1,
.a2ui-text-h2,
.a2ui-text-title {
  font-size: 1.22rem;
  font-weight: 700;
}

.a2ui-text-h3 {
  font-size: 1.06rem;
  font-weight: 700;
}

.a2ui-text-caption {
  font-size: 0.76rem;
  color: var(--muted);
}

.a2ui-text-body {
  font-size: 0.92rem;
  line-height: 1.68;
}

.a2ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
}

.a2ui-button-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #66a6f4, #4f86d7);
  color: #ffffff;
}

.a2ui-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.28);
}

.a2ui-divider-vertical {
  width: 1px;
  height: auto;
  min-height: 24px;
}

.a2ui-image {
  display: block;
  max-width: 100%;
  border-radius: 16px;
}

.a2ui-list {
  display: grid;
  gap: 12px;
}

.a2ui-list-horizontal {
  display: flex;
  gap: 12px;
  overflow-x: auto;
}

.a2ui-error {
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: #fff1f2;
  color: #b91c1c;
  padding: 12px 14px;
  font-size: 0.84rem;
  white-space: pre-wrap;
}

.native-host-shell {
  display: block;
}

.composer-shell {
  margin-top: auto;
  padding-top: 8px;
  flex-shrink: 0;
}

.composer-frame {
  border-radius: 28px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 16px 36px rgba(79, 96, 128, 0.08);
}

.composer-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 10px;
}

.hidden {
  display: none !important;
}

.composer-image-preview {
  margin-top: 12px;
}

.composer-image-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(248, 251, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.composer-image-thumb,
.chat-upload-image {
  display: block;
  max-width: 160px;
  max-height: 120px;
  border-radius: 14px;
  object-fit: cover;
}

.composer-image-meta {
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  word-break: break-word;
}

.composer-image-remove {
  flex-shrink: 0;
}

#chat-input {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(252, 253, 255, 0.92);
  padding: 14px 16px;
  color: var(--text);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

#chat-input:focus {
  border-color: rgba(91, 157, 240, 0.52);
  box-shadow: 0 0 0 4px rgba(91, 157, 240, 0.1);
}

.composer-toolbar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

#send-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  color: white;
  font-weight: 700;
  background: linear-gradient(135deg, #66a6f4, #4f86d7);
  box-shadow: 0 16px 28px rgba(91, 157, 240, 0.24);
}

#send-button:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

.send-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.46);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.44);
}

.json-panel {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(460px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 24px 60px rgba(65, 77, 99, 0.2);
  transform: translateX(calc(100% + 28px));
  transition: transform 220ms ease;
  z-index: 40;
}

.json-panel.open {
  transform: translateX(0);
}

.json-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.json-panel-content {
  flex: 1;
  overflow: auto;
  border-radius: 20px;
  background: #162133;
  color: #dbeafe;
  padding: 16px;
  font-size: 0.78rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.is-busy #chat-input {
  cursor: wait;
}

@keyframes floatBlob {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -18px, 0) scale(1.03);
  }
}

@keyframes messageRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseDot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (max-width: 1180px) {
  .studio-shell {
    grid-template-columns: 1fr;
  }

  .memory-pane {
    order: 2;
  }

  .device-stage {
    min-height: auto;
    height: auto;
    padding: 0;
  }

  .device-shell {
    width: 100%;
    height: calc(100dvh - 48px);
    max-height: calc(100dvh - 48px);
  }
}

@media (max-width: 720px) {
  .studio-shell {
    padding: 12px;
    gap: 14px;
  }

  .memory-pane,
  .device-shell {
    border-radius: 28px;
    padding: 18px;
  }

  .device-header,
  .composer-toolbar,
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .assistant-meta {
    align-items: flex-start;
  }

  .chat-list {
    min-height: 360px;
    padding-inline: 2px;
  }

.message-body {
    max-width: 100%;
  }

  .json-panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    height: min(62vh, 560px);
  }
}

.chat-upload-image {
  max-width: min(320px, 100%);
  max-height: 220px;
}


.studio-shell-single {
  display: block;
  height: 100%;
  max-width: 1080px;
  margin: 0 auto;
  overflow: hidden;
  padding: 0;
}

.device-stage-wide {
  min-height: 0;
  height: 100%;
  padding: 0;
}

.device-shell-wide {
  width: 100%;
  height: calc(100dvh - 48px);
  max-height: calc(100dvh - 48px);
  box-shadow: none;
}

.device-stage-wide .device-shadow {
  display: none;
}

.quick-actions-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 4px 0;
}

.compact-chip {
  width: auto;
  padding: 12px 16px;
  border-radius: 16px;
}

@media (max-width: 720px) {
  .device-stage-wide {
    padding: 0;
  }

  .quick-actions-strip {
    padding-top: 10px;
  }
}


/* Keep chat cards fixed: no internal scrolling or horizontal swiping */
.device-shell,
.chat-list,
.message,
.assistant-ui-message .message-body,
.surface-card,
.a2ui-card,
.native-host-shell {
  overscroll-behavior: contain;
}

.assistant-ui-message .message-body,
.surface-card,
.a2ui-card,
.native-host-shell {
  overflow: hidden;
  touch-action: pan-y;
}

.a2ui-list-horizontal {
  overflow-x: hidden;
  flex-wrap: wrap;
}

.component-dock {
  margin-top: 10px;
  padding: 16px 4px 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.component-dock-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.component-dock-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.component-empty-state {
  grid-column: 1 / -1;
}

.component-chip-card {
  border: 1px solid rgba(91, 157, 240, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(246, 250, 255, 0.92));
  border-radius: 18px;
  padding: 14px;
  text-align: left;
  box-shadow: 0 10px 24px rgba(79, 96, 128, 0.08);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.component-bar {
  gap: 8px;
}

.component-bar-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.component-bar-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
}

.component-bar-summary-hidden {
  display: none;
}

.component-pill-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.component-name-pill {
  border: 1px solid rgba(91, 157, 240, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 6px 16px rgba(79, 96, 128, 0.06);
}

.component-name-pill:hover {
  border-color: rgba(91, 157, 240, 0.28);
  box-shadow: 0 10px 20px rgba(79, 96, 128, 0.1);
}

.workspace-component-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 249, 255, 0.88));
  border: 1px solid rgba(91, 157, 240, 0.14);
  box-shadow: 0 12px 24px rgba(79, 96, 128, 0.08);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.workspace-component-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(79, 96, 128, 0.12);
  border-color: rgba(91, 157, 240, 0.26);
}

.workspace-component-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.workspace-component-top strong {
  font-size: 0.92rem;
  line-height: 1.4;
}

.workspace-component-meta {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  word-break: break-word;
}

.workspace-component-actions {
  display: flex;
  gap: 8px;
}

.component-bar .component-chip-card {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(79, 96, 128, 0.06);
}

.component-bar .component-chip-top {
  display: block;
}

.component-bar .component-chip-top strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.component-bar .component-chip-version,
.component-bar .component-chip-meta,
.component-bar .component-chip-actions {
  display: none;
}

.component-chip-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(79, 96, 128, 0.12);
  border-color: rgba(91, 157, 240, 0.26);
}

.component-chip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.component-chip-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(91, 157, 240, 0.12);
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 700;
}

.component-chip-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.component-chip-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.component-action-button {
  border: none;
  border-radius: 12px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #66a6f4, #4f86d7);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.component-action-button.secondary {
  background: rgba(91, 157, 240, 0.12);
  color: var(--accent-deep);
}

.preview-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.preview-modal.open {
  display: flex;
}

.preview-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
}

.preview-modal-card {
  position: relative;
  width: min(680px, calc(100vw - 32px));
  max-height: min(80vh, 820px);
  overflow: visible;
  border-radius: 28px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.54);
  box-shadow: 0 24px 60px rgba(65, 77, 99, 0.2);
}

.preview-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.preview-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-modal-meta:empty {
  display: none;
}

.preview-modal-body {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(248, 251, 255, 0.92);
  padding: 18px;
  max-height: calc(80vh - 150px);
  overflow: auto;
}

.preview-modal-body > * {
  display: block;
  margin-inline: auto;
  max-width: 100%;
}

.preview-json-panel {
  position: absolute;
  top: 0;
  left: calc(100% + 16px);
  width: min(360px, calc(100vw - 48px));
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 24px 60px rgba(65, 77, 99, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateX(24px);
  transition: transform 220ms ease, opacity 220ms ease;
}

.preview-json-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.preview-json-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-json-panel-header h4 {
  margin: 0;
  font-size: 1rem;
}

.preview-json-content {
  flex: 1;
  overflow: auto;
  border-radius: 18px;
  background: #162133;
  color: #dbeafe;
  padding: 14px;
  font-size: 0.76rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.community-pane {
  min-width: 0;
  min-height: calc(100dvh - 48px);
  height: calc(100dvh - 48px);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 22px 0;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  background:
    radial-gradient(circle at top right, rgba(91, 157, 240, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(251, 250, 247, 0.92), rgba(241, 236, 228, 0.9));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.community-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.community-feed {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  margin: 0 -34px -22px -18px;
  padding: 8px 0 0;
}

.community-feed::before,
.community-feed::after {
  content: none;
}

.community-feed::before {
  top: 0;
  background: linear-gradient(180deg, rgba(247, 243, 236, 0.98), rgba(247, 243, 236, 0));
}

.community-feed::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(239, 232, 223, 0.98), rgba(239, 232, 223, 0));
}

.community-compact-list {
  display: grid;
  gap: 12px;
}

.community-marquee {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 16px;
  padding: 0 12px 0 12px;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.3) 7%,
    rgba(0, 0, 0, 0.88) 14%,
    #000 20%,
    #000 80%,
    rgba(0, 0, 0, 0.88) 86%,
    rgba(0, 0, 0, 0.3) 93%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.3) 7%,
    rgba(0, 0, 0, 0.88) 14%,
    #000 20%,
    #000 80%,
    rgba(0, 0, 0, 0.88) 86%,
    rgba(0, 0, 0, 0.3) 93%,
    transparent 100%
  );
}

.community-lane {
  position: relative;
  overflow: hidden;
}

.community-lane-1 {
  transform: translateX(-24px);
}

.community-lane-3 {
  transform: translateX(20px);
}

.community-track {
  display: grid;
  gap: 16px;
  animation: communityFlowUp 36s linear infinite;
  will-change: transform;
}

.community-lane-1 .community-track {
  animation-delay: -7s;
}

.community-lane-2 .community-track {
  animation-delay: -19s;
}

.community-lane-3 .community-track {
  animation-delay: -13s;
}

.community-lane.reverse .community-track {
  animation-name: communityFlowDown;
  animation-duration: 42s;
}

.community-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  min-height: 240px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 245, 240, 0.92));
  border: 1px solid rgba(126, 151, 199, 0.16);
  box-shadow: 0 18px 44px rgba(79, 96, 128, 0.1);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.community-card:hover,
.community-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 24px 54px rgba(79, 96, 128, 0.15);
  border-color: rgba(91, 157, 240, 0.3);
  outline: none;
}

.community-card.compact {
  min-height: 208px;
}

.community-card.tall {
  min-height: 290px;
}

.community-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.community-card-header h3 {
  font-size: 1rem;
  line-height: 1.35;
}

.community-card-description {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  max-height: 2.4em;
  overflow: hidden;
}

.community-card-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(91, 157, 240, 0.12);
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.community-card-preview {
  min-height: 150px;
  max-height: 200px;
  overflow: hidden;
  padding: 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(247, 248, 251, 0.96), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(91, 157, 240, 0.08);
  pointer-events: none;
}

.community-card.compact .community-card-preview {
  min-height: 118px;
  max-height: 144px;
}

.community-card.tall .community-card-preview {
  min-height: 190px;
  max-height: 240px;
}

.community-card-preview > * {
  display: block;
  width: 100%;
  max-width: 100%;
}

.community-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
}

.community-card-meta span {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(36, 48, 66, 0.05);
}

.community-card-hint {
  margin-top: auto;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.runtime-preview-element {
  display: block;
  width: 100%;
  max-width: 100%;
}

@keyframes communityFlowUp {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-50%);
  }
}

@keyframes communityFlowDown {
  from {
    transform: translateY(-50%);
  }
  to {
    transform: translateY(0);
  }
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  html,
  body {
    overflow: auto;
  }

  .studio-shell {
    min-height: auto;
    height: auto;
    grid-template-columns: 1fr;
    padding: 16px;
    overflow: visible;
  }

  .device-stage,
  .community-pane {
    min-height: auto;
  }

  .device-shell {
    height: min(960px, calc(100dvh - 32px));
    max-height: none;
  }

  .community-pane {
    height: auto;
    max-height: none;
  }

  .community-feed {
    min-height: 680px;
    margin: 0 -22px -22px;
  }

  .community-marquee {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .community-lane-3 {
    display: none;
  }
}

@media (max-width: 720px) {
  .component-dock-list {
    grid-template-columns: 1fr;
  }

  .component-chip-actions {
    flex-wrap: wrap;
  }

  .preview-modal-card {
    width: calc(100vw - 20px);
    padding: 14px;
  }

  .preview-json-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: -12px;
    width: auto;
    height: min(52vh, 420px);
    transform: translateY(calc(100% + 12px));
  }

  .preview-json-panel.open {
    transform: translateY(0);
  }

  .component-pill-list {
    grid-template-columns: 1fr;
  }

  .workspace-component-actions,
  .preview-modal-actions {
    flex-wrap: wrap;
  }

  .community-feed {
    min-height: 520px;
    margin: 0 -16px -16px;
  }

  .community-marquee {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 10px;
  }

  .community-lane-1,
  .community-lane-2,
  .community-lane-3 {
    transform: none;
  }

  .community-lane-2,
  .community-lane-3 {
    display: none;
  }
}

html.compact-layout,
body.compact-layout {
  height: 100%;
  overflow: hidden;
}

body.compact-layout {
  overscroll-behavior: none;
}

body.compact-layout .ambient {
  display: none;
}

body.compact-layout .studio-shell {
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}

body.compact-layout .compact-pane-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.compact-layout .device-stage,
body.compact-layout .community-pane {
  min-height: 0;
  height: 100%;
}

body.compact-layout .device-shadow {
  display: none;
}

body.compact-layout .device-shell,
body.compact-layout .community-pane {
  min-height: 0;
  height: 100%;
  max-height: none;
  padding: 14px;
  border-radius: 24px;
}

body.compact-layout .device-shell::before {
  display: none;
}

body.compact-layout .device-header {
  gap: 12px;
  padding: 12px;
  border-radius: 20px;
}

body.compact-layout .assistant-avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
}

body.compact-layout .assistant-title-row {
  gap: 6px;
}

body.compact-layout #assistant-title {
  font-size: 1rem;
}

body.compact-layout .conversation-subtitle,
body.compact-layout #conversation-subtitle {
  line-height: 1.5;
}

body.compact-layout .header-actions {
  width: 100%;
  justify-content: space-between;
}

body.compact-layout .ghost-button,
body.compact-layout .compact-pane-button {
  padding: 9px 12px;
}

body.compact-layout .quick-actions-strip {
  gap: 6px;
  padding-top: 8px;
}

body.compact-layout .component-pill-list {
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: 88px;
  overflow: auto;
  padding-right: 2px;
}

body.compact-layout .workspace-component-card {
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
}

body.compact-layout .workspace-component-actions {
  flex-wrap: wrap;
}

body.compact-layout .chat-list {
  min-height: 0;
  gap: 12px;
  padding: 12px 2px 8px;
  margin-top: 8px;
}

body.compact-layout .message-body {
  border-radius: 20px;
  padding: 14px 15px;
}

body.compact-layout .composer-shell {
  margin-top: 0;
  padding-top: 8px;
}

body.compact-layout .composer-frame {
  padding: 14px;
  border-radius: 22px;
}

body.compact-layout #chat-input {
  min-height: 84px;
  max-height: 160px;
}

body.compact-layout .composer-toolbar {
  margin-top: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

body.compact-layout .composer-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

body.compact-layout #composer-hint {
  display: none;
}

body.compact-layout .community-pane {
  gap: 14px;
  padding-bottom: 14px;
}

body.compact-layout .community-header {
  gap: 10px;
}

body.compact-layout .community-feed {
  min-height: 0;
  margin: 0;
  padding: 2px 2px 10px;
  overflow: auto;
}

body.compact-layout .community-compact-list {
  padding-bottom: 12px;
}

body.compact-layout .community-card,
body.compact-layout .community-card.compact,
body.compact-layout .community-card.tall {
  min-height: auto;
  padding: 12px;
  border-radius: 20px;
}

body.compact-layout .community-card-preview,
body.compact-layout .community-card.compact .community-card-preview,
body.compact-layout .community-card.tall .community-card-preview {
  min-height: 120px;
  max-height: 180px;
  padding: 10px;
}

@media (max-width: 420px) {
  body.compact-layout .studio-shell {
    gap: 8px;
    padding: 8px;
  }

  body.compact-layout .device-shell,
  body.compact-layout .community-pane {
    padding: 12px;
  }

  body.compact-layout .device-header {
    padding: 10px;
  }

  body.compact-layout .assistant-meta {
    gap: 10px;
  }

  body.compact-layout .assistant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  body.compact-layout .status-pill {
    font-size: 0.68rem;
  }

  body.compact-layout .component-pill-list {
    max-height: 72px;
  }

  body.compact-layout .composer-frame {
    padding: 12px;
  }

  body.compact-layout #chat-input {
    min-height: 72px;
  }

  body.compact-layout .community-card-preview,
  body.compact-layout .community-card.compact .community-card-preview,
  body.compact-layout .community-card.tall .community-card-preview {
    min-height: 104px;
    max-height: 156px;
  }
}
