/* The embedded walkthrough reuses the real Studio DOM and design tokens. */
.studio-embed {
  --parchment: #f5f4ed;
  --ivory: #faf9f5;
  --warm-sand: #e8e6dc;
  --near-black: rgb(11, 11, 11);
  --dark-surface: rgb(248, 248, 246);
  --charcoal: rgb(17, 17, 17);
  --olive: rgb(17, 17, 17);
  --stone: rgb(123, 121, 116);
  --warm-silver: hsl(60, 2%, 69%);
  --border-cream: #f0eee6;
  --border-warm: #e8e6dc;
  --ring-warm: #d1cfc5;
  --terracotta: #c96442;
  --error: #b53333;
  --focus-blue: #3898ec;
  --green: #4a8a4a;
  --green-light: #6a9e6a;
  --sidebar-w: 280px;
  --session-font: "Playfair Display", Georgia, "Times New Roman", serif;
  position: relative;
  height: min(760px, 78svh);
  min-height: 620px;
  margin-top: 52px;
  overflow: hidden;
  border: 1px solid rgba(22, 34, 58, 0.16);
  border-radius: 16px;
  background: var(--dark-surface);
  color: var(--charcoal);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(22,34,58,.07), 0 30px 72px -26px rgba(22,34,58,.34);
}

.studio-embed[data-theme="dark"] {
  --parchment: #1a1916;
  --ivory: #201e1b;
  --warm-sand: #2a2825;
  --near-black: #f0eee6;
  --dark-surface: rgb(31, 31, 30);
  --charcoal: #d4d0c8;
  --olive: #d4d0c8;
  --stone: #8a867e;
  --warm-silver: #5e5d59;
  --border-cream: #2a2825;
  --border-warm: #322f2c;
  --ring-warm: #3a3a38;
  --terracotta: #d97757;
  --error: #e05555;
  --green: #5a9e5a;
  --green-light: #7ab87a;
}

.studio-embed *,
.studio-embed *::before,
.studio-embed *::after { box-sizing: border-box; }

.studio-embed button,
.studio-embed textarea { font: inherit; }

.studio-embed .layout {
  height: 100%;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  transition: grid-template-columns .22s ease;
}

.studio-embed .layout.collapsed { grid-template-columns: 44px minmax(0, 1fr); }

.studio-embed .sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border-warm);
  background: var(--dark-surface);
}

.studio-embed .sidebar-top {
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .375rem;
  padding: 0 .5rem 0 .875rem;
}

.studio-embed .logo {
  overflow: hidden;
  color: var(--near-black);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.studio-embed .logo-dot { color: var(--terracotta); }

.studio-embed .collapse-btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: .25rem;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--stone);
  cursor: pointer;
  transition: color .12s, background .12s;
}
.studio-embed .collapse-btn:hover { color: var(--charcoal); background: var(--warm-sand); }
.studio-embed .collapse-btn svg { width: 15px; height: 15px; transition: transform .22s ease; }
.studio-embed .layout.collapsed .collapse-btn svg { transform: rotate(180deg); }

.studio-embed .sidebar-nav {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 1px;
  padding: .5rem .5rem 0;
}

.studio-embed .nav-item {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4375rem .5rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--olive);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 400;
  text-align: left;
  transition: background .1s, color .1s;
}
.studio-embed .nav-item:hover,
.studio-embed .nav-item.active { background: var(--warm-sand); color: var(--near-black); }
.studio-embed .nav-item.active { font-weight: 500; }
.studio-embed .nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.studio-embed .nav-item.active svg { opacity: 1; }

.studio-embed .sidebar-body {
  flex: 1;
  overflow: auto hidden;
  padding: .5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-warm) transparent;
}

.studio-embed .group-label {
  overflow: hidden;
  padding: .625rem .875rem .25rem;
  color: var(--stone);
  font-size: .625rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.studio-embed .s-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 1px .375rem;
  padding: .5rem .625rem .5rem .875rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background .1s;
}
.studio-embed .s-item:hover,
.studio-embed .s-item.active { background: var(--warm-sand); }

.studio-embed .s-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.studio-embed .s-name {
  flex: 1;
  overflow: hidden;
  color: var(--olive);
  font-family: var(--session-font);
  font-size: 1.03rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-embed .s-item.active .s-name { color: var(--near-black); }

.studio-embed .s-model,
.studio-embed .s-ctx {
  flex-shrink: 0;
  color: var(--stone);
  font-size: .6rem;
  font-weight: 500;
}
.studio-embed .s-model { letter-spacing: .03em; text-transform: uppercase; }
.studio-embed .s-ctx { font-variant-numeric: tabular-nums; }
.studio-embed .s-ctx.high { font-weight: 700; }

.studio-embed .s-unread {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--focus-blue);
}

.studio-embed .sidebar-footer {
  flex-shrink: 0;
  padding: .75rem .875rem;
  border-top: 1px solid var(--border-warm);
  background: var(--dark-surface);
}
.studio-embed .sidebar-footer-actions {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
}
.studio-embed .theme-btn,
.studio-embed .shutdown-btn {
  appearance: none;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-warm);
  border-radius: 50%;
  background: none;
  color: var(--stone);
  cursor: pointer;
}
.studio-embed .theme-btn:hover { border-color: var(--charcoal); color: var(--near-black); }
.studio-embed .shutdown-btn:hover { border-color: var(--error); color: var(--error); }
.studio-embed .theme-btn svg,
.studio-embed .shutdown-btn svg { width: 15px; height: 15px; }
.studio-embed[data-theme="dark"] .theme-icon-moon,
.studio-embed:not([data-theme="dark"]) .theme-icon-sun { display: none; }
.studio-embed .conn-dot {
  width: 7px;
  height: 7px;
  margin-left: .3rem;
  border-radius: 50%;
  background: var(--green-light);
}

.studio-embed .layout.collapsed .logo,
.studio-embed .layout.collapsed .nav-item span,
.studio-embed .layout.collapsed .s-name,
.studio-embed .layout.collapsed .s-model,
.studio-embed .layout.collapsed .s-ctx,
.studio-embed .layout.collapsed .group-label,
.studio-embed .layout.collapsed .sidebar-footer { display: none; }
.studio-embed .layout.collapsed .sidebar-nav { padding: .5rem .25rem 0; }
.studio-embed .layout.collapsed .s-item { align-items: center; padding: .5rem 0; margin: 0; border-radius: 0; }

.studio-embed .panel {
  min-width: 0;
  display: flex;
  overflow: hidden;
  position: relative;
}
.studio-embed .panel-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.studio-embed .detail-header {
  position: absolute;
  top: .9rem;
  left: 1.25rem;
  right: 1.25rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .16rem;
  pointer-events: none;
}
.studio-embed .detail-title {
  overflow: hidden;
  color: color-mix(in srgb, var(--near-black) 72%, var(--stone));
  font-family: var(--session-font);
  font-size: 1.08rem;
  font-weight: 400;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-embed .detail-disclaimer {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  padding: .12rem .38rem;
  border: 1px solid var(--border-warm);
  border-radius: 999px;
  background: color-mix(in srgb, var(--dark-surface) 88%, var(--warm-sand));
  color: var(--stone);
  font-size: .56rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.studio-embed .detail-disclaimer i {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--terracotta);
}
.studio-embed .panel-body {
  flex: 1;
  overflow-y: auto;
  padding-top: 4rem;
  background: var(--dark-surface);
  scrollbar-width: thin;
  scrollbar-color: var(--border-warm) transparent;
}

.studio-embed .chat {
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
}
.studio-embed .cm-user {
  display: flex;
  justify-content: flex-end;
  margin: 1.25rem 0 .25rem;
}
.studio-embed .cm-user-inner {
  min-width: 0;
  max-width: 72%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.studio-embed .cm-user-bubble {
  max-width: 100%;
  padding: .625rem .875rem;
  border-radius: 16px 16px 3px 16px;
  background: var(--parchment);
  color: var(--near-black);
  font-family: Georgia, "Times New Roman", serif;
  font-size: .9375rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.studio-embed .cm-time {
  margin-top: .25rem;
  padding: 0 .125rem;
  color: var(--stone);
  font-size: .625rem;
}
.studio-embed .cm-assistant {
  display: flex;
  justify-content: flex-start;
  margin: 1.75rem 0 .5rem;
}
.studio-embed .cm-assistant-inner,
.studio-embed .cm-message-stack {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.studio-embed .cm-assistant-bubble {
  width: 100%;
  color: var(--near-black);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.studio-embed .cm-assistant-bubble p + p { margin-top: .7rem; }
.studio-embed .cm-assistant-bubble strong { color: var(--near-black); }
.studio-embed .cm-assistant-bubble code,
.studio-embed .preview-markdown code {
  padding: .1em .38em;
  border-radius: 4px;
  background: var(--warm-sand);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .82em;
}

.studio-embed .cm-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .05rem;
  margin: .95rem 0 .35rem;
}
.studio-embed .cm-tool-chip {
  appearance: none;
  width: min(100%, 680px);
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  column-gap: .65rem;
  overflow: hidden;
  padding: .04rem 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--stone);
  cursor: pointer;
  font-size: .86rem;
  line-height: 1.55;
  text-align: left;
  white-space: nowrap;
  transition: color .12s, opacity .12s;
}
.studio-embed .cm-tool-chip:hover { color: var(--olive); opacity: .86; }
.studio-embed .cm-tool-chip.muted { color: var(--stone); opacity: .62; }
.studio-embed .cm-tool-chip.skill .tool-name { color: var(--terracotta); }
.studio-embed .tool-name { color: var(--near-black); font-weight: 700; white-space: nowrap; }
.studio-embed .cm-tool-chip.muted .tool-name { color: var(--stone); }
.studio-embed .tool-arg {
  min-width: 0;
  overflow: hidden;
  color: var(--stone);
  text-overflow: ellipsis;
}

.studio-embed .md-file-link {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--terracotta);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--terracotta) 40%, transparent);
  text-underline-offset: .14em;
}
.studio-embed .md-file-link:hover { color: var(--olive); }
.studio-embed .md-image-preview {
  max-width: min(100%, 520px);
  display: block;
  overflow: hidden;
  margin: .6rem 0;
  border: 1px solid var(--border-warm);
  border-radius: 8px;
  background: var(--ivory);
}
.studio-embed .md-image-preview-link {
  appearance: none;
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: var(--warm-sand);
  cursor: zoom-in;
}
.studio-embed .md-image-preview img {
  width: 100%;
  max-height: 250px;
  object-fit: contain;
}
.studio-embed .md-image-preview figcaption {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .58rem .78rem .72rem;
  border-top: 1px solid var(--border-warm);
  background: var(--ivory);
  color: var(--stone);
  font-size: .78rem;
  line-height: 1.3;
}
.studio-embed .md-image-preview-title { color: var(--near-black); font-weight: 650; }
.studio-embed .md-image-preview-path {
  color: var(--stone);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .72rem;
}

.studio-embed .panel-input {
  flex-shrink: 0;
  padding: .75rem 2rem 1.25rem;
  background: var(--dark-surface);
}
.studio-embed .input-wrap { width: 100%; max-width: 780px; margin: 0 auto; }
.studio-embed .input-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1rem 1rem .75rem 1.25rem;
  border: 1px solid var(--border-warm);
  border-radius: 16px;
  background: var(--dark-surface);
  box-shadow: rgba(0,0,0,.04) 0 2px 12px;
}
.studio-embed .prompt-textarea {
  width: 100%;
  min-height: 28px;
  max-height: 80px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: none;
  color: var(--near-black);
  font-family: Georgia, serif;
  font-size: .9375rem;
  line-height: 1.6;
}
.studio-embed .prompt-textarea::placeholder { color: var(--stone); font-style: italic; }
.studio-embed .input-footer { display: flex; justify-content: flex-end; }
.studio-embed .send-btn {
  appearance: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--terracotta);
  color: #faf9f5;
  cursor: pointer;
}

.studio-embed .td-overlay,
.studio-embed .preview-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(20,20,19,.45);
  backdrop-filter: blur(3px);
}
.studio-embed .td-overlay[hidden],
.studio-embed .preview-overlay[hidden] { display: none; }
.studio-embed .td-modal,
.studio-embed .preview-modal {
  width: min(600px, 94%);
  max-height: 88%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-warm);
  border-radius: 14px;
  background: var(--ivory);
  box-shadow: rgba(0,0,0,.15) 0 12px 48px, rgba(0,0,0,.06) 0 2px 8px;
}
.studio-embed .preview-modal { width: min(780px, 94%); border-radius: 4px; }
.studio-embed .td-header,
.studio-embed .preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 12px;
}
.studio-embed .td-header-left,
.studio-embed .preview-header-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.studio-embed .td-tool-name,
.studio-embed .preview-title {
  color: var(--near-black);
  font-family: Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
}
.studio-embed .td-tool-arg,
.studio-embed .preview-path {
  overflow: hidden;
  color: var(--stone);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-embed .preview-context {
  color: var(--terracotta);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.studio-embed .td-close,
.studio-embed .preview-close {
  appearance: none;
  flex-shrink: 0;
  padding: 3px 5px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--stone);
  cursor: pointer;
}
.studio-embed .td-close:hover,
.studio-embed .preview-close:hover { color: var(--near-black); background: var(--warm-sand); }
.studio-embed .td-divider,
.studio-embed .preview-divider { height: 1px; margin: 0 20px; background: var(--border-cream); }
.studio-embed .td-body,
.studio-embed .preview-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 18px;
}
.studio-embed .td-section-label {
  margin: 8px 0 4px;
  color: var(--stone);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.studio-embed .td-code,
.studio-embed .preview-plaintext {
  overflow: auto;
  padding: 10px 14px;
  border: 1px solid var(--border-warm);
  border-radius: 8px;
  background: var(--parchment);
  color: var(--charcoal);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .78rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.studio-embed .preview-markdown {
  color: var(--charcoal);
  font-size: .94rem;
  line-height: 1.72;
}
.studio-embed .preview-markdown h2,
.studio-embed .preview-markdown h3 {
  margin: 1em 0 .3em;
  color: var(--near-black);
  font-family: Georgia, serif;
  font-weight: 500;
}
.studio-embed .preview-markdown ul { padding-left: 1.375rem; }
.studio-embed .preview-image-wrap { display: flex; justify-content: center; }
.studio-embed .preview-image { max-width: 100%; height: auto; border-radius: 4px; }

@media (max-width: 720px) {
  .studio-embed {
    --sidebar-w: 136px;
    height: 720px;
    min-height: 0;
    border-radius: 12px;
  }
  .studio-embed .sidebar-top { padding-left: .55rem; }
  .studio-embed .sidebar-nav { padding: .35rem .3rem 0; }
  .studio-embed .nav-item { padding: .4rem .35rem; font-size: .72rem; }
  .studio-embed .sidebar-body { padding-top: .25rem; }
  .studio-embed .group-label { padding: .45rem .5rem .15rem; font-size: .5rem; }
  .studio-embed .s-item { margin: 1px .2rem; padding: .42rem .45rem; }
  .studio-embed .s-name { font-size: .82rem; }
  .studio-embed .s-model,
  .studio-embed .s-ctx { display: none; }
  .studio-embed .sidebar-footer { padding: .5rem; }
  .studio-embed .chat { padding: 1rem .8rem 2rem; }
  .studio-embed .cm-user-inner { max-width: 90%; }
  .studio-embed .cm-user-bubble,
  .studio-embed .cm-assistant-bubble { font-size: .78rem; }
  .studio-embed .cm-tool-chip { font-size: .7rem; }
  .studio-embed .panel-input { padding: .55rem .7rem .75rem; }
}
