:root{--studio-bg:#fff;--studio-side:#f7f7f5;--studio-text:#242422;--studio-line:#e6e5e1;--studio-panel:#fff;--studio-muted:#6b6a65;--studio-chip:#f4f3f0}
:root[data-ak-scheme=dark]{--studio-bg:#202120;--studio-side:#181918;--studio-text:#f4f3ef;--studio-line:#41423f;--studio-panel:#282927;--studio-muted:#b8b6b1;--studio-chip:#343532}
body,.app,main,header,.composer-area{background:var(--studio-bg);color:var(--studio-text)}
aside{background:var(--studio-side);border-color:var(--studio-line);gap:13px;padding:23px 15px}
aside .brand{margin:3px 6px 15px}.logo{background:var(--ak-solid,var(--accent));border-radius:11px}
.new,select,.header-pref,.mobile-menu,.suggestions button,.art-mode,.setup-card{color:var(--studio-text);background:var(--studio-panel);border-color:var(--studio-line)}
.new{box-shadow:0 1px 3px #00000007;font-weight:560}.aside-label{font-size:12px;color:var(--studio-muted);padding:8px 10px 0}
.history button,.quiet,.local{color:var(--studio-muted)}.history button.active,.history button:hover,.quiet:hover{color:var(--studio-text);background:var(--studio-chip)}
.aside-bottom{border-top:1px solid var(--studio-line);padding-top:9px;gap:0}.quiet{padding:7px 10px;border-radius:8px}.local{padding:5px 10px;font-size:12px}.mobile-close{display:none}
header{border-color:var(--studio-line);height:64px;padding:10px 22px;gap:8px}.header-pref{font-size:21px;border:1px solid var(--studio-line);width:40px;height:40px;border-radius:12px;line-height:1}.heading{color:var(--studio-text)}
.thread{scroll-behavior:auto;overscroll-behavior:contain}.welcome .mark{font-size:32px;color:var(--accent)}.welcome h1{color:var(--studio-text);line-height:1.12;font-size:clamp(32px,3.6vw,49px);letter-spacing:-.055em}.welcome p,.footnote{color:var(--studio-muted)}.suggestions{max-width:600px}.suggestions button{color:var(--studio-text);padding:13px 16px;border-radius:14px}.suggestions button:hover{background:var(--studio-chip);border-color:var(--accent)}
.composer-area{position:relative}.composer{background:var(--studio-panel);border-color:var(--studio-line);box-shadow:0 3px 19px #0000000b}.composer textarea{color:var(--studio-text)}.composer-label{display:none}.attach,.mic-btn,.message.user,.message pre{background:var(--studio-chip);color:var(--studio-text)}
.mic-btn{display:grid;place-items:center;border:0;border-radius:50%;width:43px;height:43px;margin-left:auto}.mic-btn[aria-pressed=true]{background:var(--ak-solid);color:white}.send{margin-left:0;background:var(--ak-solid,var(--accent));border-radius:20px}.attach{height:43px;width:43px}.message .copy{margin-right:13px;color:var(--studio-muted)}
#active-tool,.doc-actions button,.source-link{background:var(--studio-chip);color:var(--studio-text);border:1px solid var(--studio-line);border-radius:12px;font-size:13px;padding:8px 12px}.source-link{display:block;text-decoration:none;margin:6px 0;width:fit-content}.source-link:hover{text-decoration:underline}
#tool-list{position:absolute;left:max(24px,calc((100% - 820px)/2));bottom:calc(100% - 5px);z-index:6;background:var(--studio-panel);border:1px solid var(--studio-line);padding:7px;border-radius:17px;box-shadow:0 9px 40px #0002;min-width:235px;max-height:min(60dvh,460px);overflow:auto}
#tool-list button{display:block;text-align:left;width:100%;background:transparent;color:var(--studio-text);border-radius:10px;padding:9px 13px}#tool-list button:hover,#tool-list button:focus-visible{background:var(--studio-chip)}.doc-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin:12px 0}.studio-dialog{border:1px solid var(--studio-line);background:var(--studio-panel);color:var(--studio-text);border-radius:18px;max-width:min(920px,96vw);width:850px;padding:12px}.studio-dialog::backdrop{background:#16171a8c}.studio-dialog iframe{width:100%;height:65dvh;border:1px solid var(--studio-line);border-radius:8px}.studio-dialog .doc-actions{margin:3px 0 12px}.studio-dialog .modal-title{flex:1;font-weight:600;overflow-wrap:anywhere}.work-status{font-size:13px;color:var(--studio-muted)}.work-status:before{content:"";display:inline-block;width:.6em;height:.6em;border-radius:50%;background:var(--accent);margin-right:8px;animation:think 1.4s infinite}.studio-file{color:var(--accent);text-decoration:underline}.tool-inline{background:transparent;color:var(--accent);text-align:left;padding:5px}.composer:focus-within{border-color:color-mix(in srgb,var(--accent) 55%,var(--studio-line))}
@media(max-width:740px){.mobile-close{display:block}#model{max-width:93px;font-size:12px}#effort{max-width:100px}.header-pref{width:36px;height:36px}.studio-dialog{max-height:94dvh}.thread{padding:16px}#tool-list{left:13px}.welcome{padding:12px 0}.suggestions button{font-size:13px}.aside-bottom .quiet{min-height:34px}}
@media(max-width:440px){header{gap:5px;padding:8px}.footnote{font-size:10px}.connection{display:none}.composer-area{padding-bottom:max(7px,env(safe-area-inset-bottom))}}

/* Safari pans its visual viewport as the keyboard opens. Only the thread and
   the navigation rail should scroll; the document itself is an app shell. */
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.app {
  position: absolute;
  inset: var(--ak-viewport-top, 0px) 0 auto;
  height: var(--ak-viewport-height, 100dvh);
  grid-template-rows: minmax(0, 1fr);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.app > aside {
  min-height: 0;
  padding: 0;
  display: block;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar-pane {
  display: flex;
  flex-direction: column;
  gap: 13px;
  height: var(--ak-rail-height, 100%);
  min-height: min-content;
  padding: calc(23px + env(safe-area-inset-top, 0px)) 15px max(14px, env(safe-area-inset-bottom, 0px));
}
.sidebar-pane > :not(.history) { flex-shrink: 0; }
.sidebar-pane .history { min-height: 44px; }
.app main > header {
  flex: none;
  height: calc(60px + env(safe-area-inset-top, 0px));
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-bottom: 8px;
  background-color: var(--ak-page, var(--studio-bg));
}
.answer-mode {
  position: relative;
  display: inline-flex;
  flex: none;
  color: var(--ak-text, var(--studio-text));
}
.answer-mode #effort {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--ak-card, var(--studio-panel));
  color: inherit;
  padding-right: 26px;
}
.answer-mode::after {
  content: "";
  position: absolute;
  top: calc(50% - 4px);
  right: 11px;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
.header-pref svg { display: block; margin: auto; }
.composer-area {
  flex: none;
  min-width: 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}
.composer {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px max-content;
  column-gap: 5px;
  align-items: end;
  padding: 5px;
}
.composer-tools { display: contents; }
.composer .attachments { grid-area: 1 / 1 / auto / -1; }
.composer .attachments:not(:empty) { padding: 4px; }
.composer #active-tool {
  grid-area: 2 / 1 / auto / -1;
  justify-self: start;
  margin: 3px;
  max-width: calc(100% - 6px);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.composer :is(#toolbox,#dictate,#send) {
  grid-row: 3;
  height: 44px;
  min-height: 44px;
  margin: 0;
  align-self: end;
}
.composer #toolbox { grid-column: 1; width: 44px; }
.composer #dictate { grid-column: 3; width: 44px; }
.composer #send { grid-column: 4; }
.composer #prompt {
  grid-area: 3 / 2;
  align-self: center;
  min-width: 0;
  width: 100%;
  min-height: 40px;
  max-height: clamp(40px, calc(var(--ak-viewport-height, 100dvh) * .21), 134px);
  line-height: 24px;
  padding: 8px 3px;
  margin: 0;
  overflow-y: auto;
}
@supports (field-sizing: content) {
  .composer #prompt { field-sizing: content; height: auto; }
}
.composer-area .banner {
  margin: 0 4px 5px;
  padding: 2px 4px;
  max-height: 3.8em;
  overflow: auto;
  background: transparent;
  color: var(--ak-text, var(--studio-text));
  line-height: 1.35;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.composer-area .model-recovery {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  max-width: 820px;
  margin: 0 auto 8px;
  padding: 6px 10px;
  border: 1px solid var(--studio-line);
  border-radius: 14px;
  background: var(--studio-panel);
  color: var(--studio-text);
  font-size: 14px;
  line-height: 1.4;
  overflow: visible;
}
.model-recovery p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.model-recovery button {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
}
.model-recovery[hidden] { display: none; }
#tool-list { max-height: min(460px, calc(var(--ak-viewport-height, 100dvh) - 94px)); }
html[data-ak-keyboard] .composer-area { padding-top: 4px; padding-bottom: 4px; }
html[data-ak-keyboard] .footnote { display: none; }
@media(max-width:740px) {
  .app > aside { display: none; }
  .app.menu-open > aside {
    display: block;
    position: absolute;
    inset: 0 auto 0 0;
    max-width: calc(100% - 42px);
    padding-left: env(safe-area-inset-left, 0px);
  }
}
@media(max-width:360px) {
  .composer { column-gap: 1px; }
  .composer #send { padding-inline: 9px; }
}
.unchecked-picture{margin:.5rem 0}.unchecked-picture summary{cursor:pointer;padding:.55rem 0;color:var(--muted)}.unchecked-picture[open] summary{margin-bottom:.4rem}

.image-choice {width:min(440px,calc(100vw - 32px));height:auto;padding:22px;max-height:82dvh;overflow:auto}
.image-choice h2 {margin:0;font-size:1.35rem}
.image-choice .image-subject {font-weight:600;overflow-wrap:anywhere}
.image-choice label,.image-choice select {display:block}
.image-choice select {margin-top:5px;width:100%;min-height:42px;font-size:1rem}
.image-choice .image-privacy,.image-choice details p {color:var(--studio-muted);font-size:.9rem;line-height:1.42}
.image-choice .doc-actions {justify-content:flex-end}
.image-choice .doc-actions button:last-child {background:var(--ak-solid,var(--accent));color:white}
.image-choice details {border-top:1px solid var(--studio-line);padding-top:12px}
.image-choice summary {cursor:pointer}
.image-choice textarea {display:block;width:100%;margin-bottom:.6rem;font-size:1rem}
.image-choice details a {margin-left:10px}
.message img.artwork {width:auto;max-width:100%;max-height:70dvh;height:auto;object-fit:contain}

.answer-table{overflow-x:auto;max-width:100%;margin:.6em 0}.answer-table table{border-collapse:collapse}.answer-table th,.answer-table td{padding:.45em .7em;border:1px solid var(--border);text-align:start;vertical-align:top}.message .text+.text{margin-top:.6em}

.compact-sources{margin:.3rem 0;font-size:.74rem;color:var(--muted,#aaa)}
.compact-sources>summary{cursor:pointer;width:fit-content;padding:.2rem 0}
.compact-sources .source-link{display:block;width:fit-content;font-size:.78rem}

.reply-controls{display:flex;align-items:center;gap:.4rem}
.reply-controls .copy{margin:0}
.reply-speaker{background:transparent;border:0;padding:.35rem;cursor:pointer;font-size:1rem}

.reply-speaker{display:inline-flex;align-items:center;justify-content:center;color:inherit}

#tool-list button{display:flex;align-items:center;justify-content:space-between;gap:16px}
#tool-list button svg{width:17px;height:17px;flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
