* { box-sizing: border-box }
[hidden] { display: none !important }
:root {
  font: 16px/1.42 -apple-system, BlinkMacSystemFont, "Inter", Arial, sans-serif;
  color: #101010; background: #fbfbfb; --surface: #fbfbfb; --line: #e5e5e5;
  --drawer-width: min(310px, 79vw); --pad: clamp(16px, 3vw, 32px);
}
body { margin: 0; overflow: hidden }
button, input, textarea { font: inherit; color: inherit }
input, textarea { font-size: 16px }
button { border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent }
button:focus-visible, input:focus-visible { outline: 2px solid #555; outline-offset: 2px }
button:disabled { opacity: .45; cursor: wait }
button:hover { background-color: #f0f0f0 }
.solid { background: #101010; color: white; border-radius: 999px }
.solid:hover { background: #333 }
.round, #compose {
  border: 1px solid #e4e4e4; border-radius: 999px;
  background: linear-gradient(155deg,#fff,#f7f7f7 50%,#fff);
  box-shadow: inset 0 0 0 2px #ffffffb3, 0 3px 12px #00000004;
}
.round, .plainIcon, #send { display: grid; place-items: center; flex: 0 0 auto }
.round { width: 46px; height: 46px; padding: 0 }
i { display: inline-block; position: relative; flex: 0 0 auto }
.menuIcon { width: 18px; height: 11px; border-top: 2px solid }
.menuIcon::after { content: ''; position: absolute; left: 0; bottom: 1px; width: 12px; border-top: 2px solid }
.bubble { width: 21px; height: 19px; border: 2px solid; border-radius: 52% }
.bubble::after { content: ''; position: absolute; left: 0; bottom: -2px; width: 5px; height: 4px; border-left: 2px solid; border-bottom: 2px solid; background: var(--surface); transform: skew(-18deg) }
.searchIcon { width: 17px; height: 17px; border: 2px solid; border-radius: 50%; margin: -3px 3px 0 0 }
.searchIcon::after { content:''; position:absolute; width:8px; border-top:2px solid; right:-6px; bottom:-3px; transform:rotate(48deg) }
#loginScreen, #studio { height: 100vh; height: var(--visible-height,100dvh); width: 100%; position: fixed; top: var(--visible-top,0px); left: 0 }
#loginScreen { background: #d0d0d0; display: grid; place-items: center; padding: 24px; overflow: auto }
.sheet { background: white; border-radius: 36px; width: min(100%,450px); padding: 42px 26px; margin: auto; box-shadow: 0 12px 60px #0000000a }
#loginForm { max-width: 380px; margin: auto }
.appMark { font: 42px/1 system-ui; text-align: center; margin-bottom: 16px }
h1 { font-size: 23px; font-weight: 550; text-align: center; letter-spacing: -.7px; margin: 0 0 8px }
#loginForm p { color: #636363; text-align: center; margin: 0 auto 28px; max-width: 305px }
#loginForm label { display: block; font-size: 12px; color: #747474; padding: 7px 12px; border: 1px solid #aaa; border-radius: 15px; margin: 10px 0 }
#loginForm label:focus-within { border-color: #111; box-shadow: inset 0 0 0 1px #111 }
#loginForm input { display: block; border: 0; width: 100%; padding: 0; line-height: 22px; background: transparent; outline: none; color: #111 }
.loginButton { width: 100%; min-height: 52px; margin-top: 12px; font-weight: 550 }
#studio { display: flex; overflow: hidden }
aside { width: var(--drawer-width); flex: none; display: flex; flex-direction: column; min-height: 0; padding: max(18px,env(safe-area-inset-top)) 22px max(20px,env(safe-area-inset-bottom)) }
.drawerHead, .drawerFoot { display: flex; align-items: center; justify-content: space-between }
.drawerHead b { font-size: 22px; letter-spacing: -.7px }
#search { width: 100%; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--line); margin-top: 14px; background: white }
nav { flex: 1; min-height: 0; overflow: auto; padding: 16px 0 }
nav button { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
nav .current { background: #ececec }
.historyEmpty { margin: 10px 8px; color: #777; font-size: 14px }
.drawerFoot { position: relative; padding-top: 8px }
.new { min-height: 46px; padding: 0 20px; font-weight: 580 }
.new span { font-size: 21px; vertical-align: middle; margin-right: 4px }
#avatar { display: grid; place-items: center; border-radius: 50%; background: #008e80; color: white; width: 30px; height: 30px; font-size: 14px }
.popup { position: absolute; z-index: 3; padding: 6px; background: white; border: 1px solid var(--line); box-shadow: 0 6px 28px #0001; border-radius: 16px }
.popup button, .popup strong { display: block; width: 100%; padding: 10px 13px; border-radius: 10px; text-align: left }
#account { right: 0; bottom: 55px; min-width: 140px }
.work { position: relative; flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; background: var(--surface) }
header { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; padding: max(14px,env(safe-area-inset-top)) var(--pad) 8px }
#scroll { overflow: auto; overscroll-behavior: contain }
#messages, .dock { width: min(100%,790px); margin: 0 auto; padding: 8px 18px }
article { padding: 12px 0 18px; line-height: 1.55 }
article > strong { display: block; margin-bottom: 5px; font-size: 12px; color: #696969 }
.messageBody { overflow-wrap:anywhere; min-width:0 }
.user .messageBody { white-space:pre-wrap }
article.user { margin: 12px 0 12px auto; background: #efefef; border-radius: 20px; padding: 10px 16px; max-width: 86%; width: fit-content }
article.user > strong { display: none }
article img { display: block; max-width: 100%; max-height: 64vh; border-radius: 16px; margin-top: 10px }
article.pending { color: #777 }
article.error, #error, #loginError { color: #9d3330 }
.dock { position: relative; padding-bottom: max(12px,env(safe-area-inset-bottom)) }
.composer-keyboard .dock { padding-bottom: 4px }
#compose { display: flex; align-items: flex-end; gap: 5px; border-radius: 25px; padding: 5px 7px; min-height: 48px }
#compose textarea { flex: 1; min-width: 0; align-self: center; line-height: 22px; background: transparent; border: 0; resize: none; margin: 0; padding: 5px 2px; max-height: min(160px,25dvh); outline: none }
#compose:focus-within { border-color: #d6d6d6 }
.plainIcon { width: 36px; height: 36px; border-radius: 50% }
.plusIcon, .plusIcon::after { width: 19px; height: 2px; border-radius: 2px; background: currentColor }
.plusIcon::after { content: ''; position: absolute; left: 0; transform: rotate(90deg) }
#send { width: 34px; height: 34px; align-self: flex-end; margin: 1px 0 }
.arrow { height: 16px; border-left: 2px solid white }
.arrow::before { content: ''; position: absolute; border-left: 2px solid; border-top: 2px solid; width: 8px; height: 8px; transform: rotate(45deg); top: 1px; left: -6px }
.micIcon { width: 10px; height: 15px; border: 2px solid; border-radius: 8px; margin-top: -6px }
.micIcon::before { content: ''; position: absolute; left: -6px; top: 7px; width: 14px; height: 9px; border: 2px solid; border-top: 0; border-radius: 0 0 10px 10px }
.micIcon::after { content: ''; position: absolute; top: 17px; left: 2px; height: 4px; border-left: 2px solid }
#mic[aria-pressed=true] { color: #b33932 }
#error:not(:empty), #loginError:not(:empty) { padding: 6px 4px; font-size: 14px }
#scrim { position: absolute; inset: 0; z-index: 4; background: transparent }
@media(max-width:720px) {
  #loginScreen { display: block; padding: max(40px,env(safe-area-inset-top)) 0 0 }
  .sheet { min-height: 100%; width: 100%; border-radius: 38px 38px 0 0; padding: clamp(32px,9vh,84px) 24px max(24px,env(safe-area-inset-bottom)) }
  aside { position: absolute; inset: 0 auto 0 0; padding-left: 24px; padding-right: 20px }
  #studio.open .work { transform: translateX(var(--drawer-width)); border-radius: 34px 0 0 34px; box-shadow: -6px 0 24px #0001; overflow: hidden }
  #studio.open header, #studio.open .dock { opacity: .55 }
  .dock { padding: 8px 11px max(10px,env(safe-area-inset-bottom)) }
  header { padding-left: 15px; padding-right: 15px }
}
nav button { width:100%; text-align:left; border-radius:10px; padding:12px 8px }
:root { color-scheme: light dark; --motion: cubic-bezier(.22,.8,.22,1); --ink-muted: #626266 }
.appMark { display:block; margin:0 auto 18px; border-radius:13px }
#chatTitle { text-align:center; font-size:16px; font-weight:600; margin:0 12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
#photoPreview { position:relative; width:74px; margin:0 0 7px 7px }
#photoPreview img { display:block; width:72px;height:72px;object-fit:cover;border-radius:15px }
#removePhoto { position:absolute; top:-5px; right:-6px; border-radius:50%; width:25px; height:25px; color:white; background:#242426; font-size:17px; line-height:1 }
#networkState { color:var(--ink-muted); margin:3px 10px 8px; font-size:14px }
.shareImage { display:block; margin:5px 0 0; padding:8px 4px; font-size:14px; color:var(--ink-muted) }
#installSheet { width:min(360px,90vw); padding:24px; border:1px solid var(--line); border-radius:26px; color:inherit; background:var(--surface) }
#installSheet h2 { margin:0; font-size:22px }
#installSheet button { width:100%; padding:12px }
#installSheet::backdrop { background:#0005; backdrop-filter:blur(4px) }
button { touch-action:manipulation; transition:transform 145ms var(--motion),background-color 180ms,opacity 180ms }
button:active:not(:disabled) { transform:scale(.95) }
#compose { transition:box-shadow .2s,border-color .2s }
#compose:focus-within { box-shadow:0 4px 18px #0000000c }
#compose textarea { -webkit-appearance:none }
article { animation:arrive .22s var(--motion) both }
article.pending .messageBody::after { content:''; display:inline-block; width:6px;height:6px; margin:0 0 2px 4px; background:currentColor; border-radius:50%; animation:breathe 1.2s ease-in-out infinite }
.popup, #photoPreview, #installSheet[open], article img { animation:arrive .2s var(--motion) both }
.sheet { animation:arrive .38s var(--motion) both }
@keyframes arrive { from { opacity:0; transform:translateY(7px) } to { opacity:1; transform:translateY(0) } }
@keyframes breathe { 50% { opacity:.25 } }
@media(max-width:720px) {
  .work { transition:transform 310ms var(--motion),border-radius .28s,box-shadow .28s; touch-action:pan-y pinch-zoom }
  .work header,.work .dock { transition:opacity .22s }
  #studio.dragging .work { transition:none; transform:translateX(var(--drag-offset)); border-radius:26px 0 0 26px }
  aside { padding-left:max(24px,env(safe-area-inset-left)) }
  header,.dock { padding-left:max(12px,env(safe-area-inset-left)); padding-right:max(12px,env(safe-area-inset-right)) }
}
@media(prefers-color-scheme:dark){
  :root { --surface:#171719; --line:#37373a; --ink-muted:#aaaab0; background:var(--surface);color:#f4f4f5 }
  #loginScreen {background:#09090a}.sheet,.popup,#search {background:#232325}
  .round,#compose {background:linear-gradient(160deg,#303033,#232326);border-color:#414145;box-shadow:inset 0 0 0 1px #ffffff08}
  button:hover,nav .current,article.user {background:#303033}.solid,#send{background:#f5f5f5;color:#171719}
  .arrow{border-color:currentColor}.arrow::before{border-color:currentColor}
  #loginForm input{color:#f4f4f5}#loginForm label{border-color:#555;color:#bbb}
  #loginForm label:focus-within {border-color:#eee;box-shadow:inset 0 0 0 1px #eee}
  #loginForm p,article > strong,.historyEmpty,article.pending{color:#b6b6ba}
  article.error,#error,#loginError {color:#ffa69a}
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important }
}
.chatPhoto { display:block; width:fit-content; max-width:100%; padding:0; margin-top:10px; border-radius:16px; overflow:hidden; cursor:zoom-in; background:transparent }
.chatPhoto img { margin:0 }
.chatGallery { --pswp-bg:#101012; color:#fff; color-scheme:dark }
.chatGallery .pswp__top-bar { top:env(safe-area-inset-top); padding-left:env(safe-area-inset-left); padding-right:env(safe-area-inset-right) }
.chatGallery .pswp__download { display:grid; place-items:center; min-height:44px; padding:0 12px; font-size:15px; font-weight:550; color:white; text-decoration:none; text-shadow:0 1px 5px #000 }
.chatGallery .pswp__button { touch-action:manipulation }
.historyRow { display:grid; grid-template-columns:minmax(0,1fr) 42px; align-items:center }
nav .removeChat { width:40px; height:44px; padding:0; position:relative; color:var(--ink-muted) }
.removeChat::before,.removeChat::after { content:''; position:absolute; left:50%; top:50%; transform:translate(-50%,-50%) }
.removeChat::before { width:10px; height:11px; margin-top:2px; border:1.5px solid; border-radius:0 0 3px 3px }
.removeChat::after { width:16px; height:2px; margin-top:-6px; border-radius:1px; background:currentColor; box-shadow:0 -2px 0 -0.5px currentColor; }
.removeChat:hover,.removeChat:focus-visible {color:#bd3434}
.settingsSheet { width:min(390px,calc(100vw - 32px)); max-height:80dvh; overflow:auto; border:1px solid var(--line); border-radius:24px; background:var(--surface); color:inherit; padding:24px }
.settingsSheet[open],#notice {animation:arrive .18s var(--motion) both}
.settingsSheet::backdrop {background:#0006; backdrop-filter:blur(4px)}
.settingsSheet h2 {font-size:22px; margin:0 0 12px; letter-spacing:-.5px}
.settingsSheet p {font-size:14px; color:var(--ink-muted); overflow-wrap:anywhere}
.settingsSheet label {display:block; margin:12px 0; font-size:14px}
.settingsSheet input:not([hidden]) {display:block; width:100%; margin:4px 0; padding:9px 12px; border:1px solid var(--line); background:transparent; border-radius:10px; color:inherit; font-size:16px}
.sheetActions {display:flex; gap:8px; margin-top:18px}
.sheetActions button {flex:1; min-height:44px; border-radius:999px; font-weight:550}
.sheetActions .cancel {border:1px solid var(--line)}
.sheetActions .danger {background:#c53735; color:white}
.formError {font-size:14px; color:#b33a37}
@media(prefers-color-scheme:dark){.formError {color:#ffa69a}}
#notice {position:fixed; bottom:max(84px,calc(74px + env(safe-area-inset-bottom))); left:0; right:0; margin:auto; z-index:5; width:fit-content; max-width:90vw; border-radius:99px; padding:8px 16px; background:#242426; color:white; pointer-events:none}

.assistant .messageBody > :first-child { margin-top:0 }
.assistant .messageBody > :last-child { margin-bottom:0 }
.messageBody :is(p,ul,ol,pre,blockquote,table) { margin:0 0 .8em }
.messageBody :is(h1,h2,h3,h4,h5,h6) { text-align:start; font-weight:650; letter-spacing:normal; line-height:1.25; margin:1em 0 .4em }
.messageBody h1 { font-size:1.5em } .messageBody h2 { font-size:1.3em } .messageBody h3 { font-size:1.12em }
.messageBody :is(ol,ul) { padding-inline-start:1.5em }
.messageBody li + li { margin-top:.25em }
.messageBody li > :last-child { margin-bottom:0 }
.messageBody blockquote { border-inline-start:3px solid var(--line); padding-inline-start:.85em; color:var(--ink-muted) }
.messageBody code { background:color-mix(in srgb,currentColor 8%,transparent); padding:.1em .28em; border-radius:4px; font: .9em ui-monospace,monospace }
.messageBody pre { overflow:auto; padding:12px; border-radius:10px; background:color-mix(in srgb,currentColor 6%,transparent); white-space:pre }
.messageBody pre code { padding:0; background:none }
.messageBody a { color:#165fbc; text-underline-offset:2px }
@media(prefers-color-scheme:dark){.messageBody a {color:#92bfff}}
.messageBody table { display:block; overflow-x:auto; border-collapse:collapse }
.messageBody :is(th,td) { border:1px solid var(--line); padding:.35em .65em; text-align:start }
