body { margin: 0; font-family: system-ui, sans-serif; background: #14161a; color: #e8e8e8; }
[hidden] { display: none !important; }
label { display: block; margin-bottom: 1rem; }
input { display: block; width: 100%; box-sizing: border-box; margin-top: 0.3rem; padding: 0.6rem; border: 1px solid #3a3f48; border-radius: 6px; background: #1d2026; color: inherit; }
select { padding: 0.4rem; border: 1px solid #3a3f48; border-radius: 6px; background: #1d2026; color: inherit; }
button { padding: 0.6rem 1.2rem; border: 0; border-radius: 6px; background: #4f8cff; color: #fff; cursor: pointer; font: inherit; }
button.secondary { background: #2a2e36; }
a { color: #8fb4ff; }
fieldset { border: 1px solid #3a3f48; border-radius: 6px; margin: 0 0 1rem; }
label.inline { display: inline-block; margin-right: 1.5rem; margin-bottom: 0; }
label.inline input { display: inline; width: auto; }
.logo { font-weight: 700; font-size: 1.4rem; letter-spacing: 0.04em; }
label.lang { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 0.9rem; }
#msg, #amsg, #smsg { color: #ff8a8a; min-height: 1.5rem; text-align: center; margin: 0.5rem 0; }
.hint { font-size: 0.85rem; opacity: 0.7; }

#auth { display: flex; flex-direction: column; min-height: 100vh; }
#auth .top { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; }
#auth main { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 1rem; }
#auth form { width: 100%; max-width: 22rem; }
.links { display: flex; justify-content: center; gap: 1.5rem; padding: 1rem; font-size: 0.85rem; }

#app:not([hidden]) { display: grid; grid-template-columns: 16rem minmax(0, 1fr); height: 100vh; }
#side { display: flex; flex-direction: column; gap: 0.6rem; padding: 1rem; background: #1a1d22; border-right: 1px solid #2a2e36; overflow: hidden; }
#side p { margin: 0; font-size: 0.85rem; }
#side .links { padding: 0.5rem 0 0; gap: 1rem; justify-content: flex-start; }
#convs { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 3rem; }
#convs li button { width: 100%; text-align: left; background: none; color: inherit; padding: 0.5rem; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#convs li.active button { background: #2a2e36; }

#chat:not([hidden]) { display: flex; flex-direction: column; min-height: 0; }
#chathead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.6rem 1rem; border-bottom: 1px solid #2a2e36; }
#chattitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#privbtn { background: #2a2e36; padding: 0.4rem 0.9rem; }
#privbtn.on { background: #8a5cff; }
#privbtn:disabled { cursor: default; opacity: 0.7; }
#log { flex: 1; overflow-y: auto; padding: 1rem; }
.m { max-width: 46rem; margin: 0 auto 0.8rem; padding: 0.6rem 0.8rem; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.m.user { background: #2a3550; }
.m.assistant { background: #1d2026; }
.m.wait { opacity: 0.6; }
details.think { max-width: 46rem; margin: 0 auto 0.4rem; padding: 0 0.8rem; font-size: 0.85rem; opacity: 0.75; }
details.think div { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0.4rem 0; }
#opts { display: flex; gap: 1rem; max-width: 46rem; width: 100%; margin: 0 auto; padding: 0 1rem 0.5rem; box-sizing: border-box; font-size: 0.85rem; }
#opts label { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
#send { display: flex; gap: 0.5rem; max-width: 46rem; width: 100%; margin: 0 auto; padding: 0 1rem; box-sizing: border-box; }
#send textarea { flex: 1; resize: none; padding: 0.6rem; border: 1px solid #3a3f48; border-radius: 6px; background: #1d2026; color: inherit; font: inherit; }
#notice { text-align: center; font-size: 0.8rem; opacity: 0.7; margin: 0.5rem 1rem; }

#settings:not([hidden]) { display: block; max-width: 30rem; padding: 2rem; }
#settings button { margin-right: 0.5rem; }

@media (max-width: 700px) {
  #app:not([hidden]) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  #side { max-height: 32vh; border-right: 0; overflow-y: auto; }
}
.doc { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; line-height: 1.55; }
.doc h2 { margin-top: 2rem; font-size: 1.15rem; }
.doc .draft { background: #4a3a10; border: 1px solid #8a6d1f; border-radius: 6px; padding: 0.6rem 0.8rem; }
#convs li { display: flex; align-items: center; }
#convs li button.title { flex: 1; min-width: 0; width: auto; }
#convs li button.del { width: auto; padding: 0.4rem 0.6rem; background: none; opacity: 0.6; }
#convs li button.del:hover { opacity: 1; }
#settings hr { border: 0; border-top: 1px solid #2a2e36; margin: 1.5rem 0; }
#settings h3 { margin: 0 0 0.8rem; font-size: 1rem; }
button.danger { background: #c0392b; }

/* layout: sidebar and page stay at window height, only list and chat scroll */
#app:not([hidden]) { height: 100dvh; overflow: hidden; }
@media (min-width: 701px) { #app:not([hidden]) { grid-template-rows: minmax(0, 1fr); } }
body:has(#app:not([hidden])) { overflow: hidden; }
#side { min-height: 0; height: 100%; }
#log { min-height: 0; }

/* popups */
dialog.dlg { background: #1a1d22; color: inherit; border: 1px solid #2a2e36; border-radius: 12px; padding: 0; width: min(32rem, 92vw); max-height: 90vh; }
dialog.dlg::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog.dlg[open] { display: flex; flex-direction: column; }
.dlghead { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid #2a2e36; }
.dlghead h2 { margin: 0; font-size: 1.1rem; }
.dlg .panel { padding: 1.2rem; overflow-y: auto; }
.dlg .panel h3 { margin: 0 0 0.6rem; font-size: 1rem; }
.tabs { display: flex; gap: 0.25rem; padding: 0 1.2rem; border-bottom: 1px solid #2a2e36; }
.tab { background: none; color: inherit; opacity: 0.7; border-radius: 6px 6px 0 0; padding: 0.6rem 1rem; border-bottom: 2px solid transparent; }
.tab.active { opacity: 1; border-bottom-color: #4f8cff; }
.dlgfoot { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 1rem 1.2rem; border-top: 1px solid #2a2e36; }
button.icon { background: none; padding: 0.2rem 0.6rem; font-size: 1.4rem; line-height: 1; }
#tab-security button { display: block; margin-bottom: 0.8rem; }
#pwmsg, #delmsg { color: #ff8a8a; min-height: 1.5rem; text-align: center; margin: 0.5rem 0; }
#smsg { padding: 0 1.2rem; }
#msg.ok, #amsg.ok, #smsg.ok, #pwmsg.ok, #delmsg.ok { color: #6fd18b; }

.legal { display: flex; gap: 1.5rem; font-size: 0.9rem; margin: 1.2rem 0 0; }

/* hidden sidebar: the chat takes the whole width */
#app.collapsed:not([hidden]) { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
#app.collapsed #side { display: none; }
#chattitle { flex: 1; min-width: 0; }

/* info box next to the learning question */
.consentinfo { background: rgba(127, 127, 127, 0.1); border-radius: 8px; padding: 0.6rem 0.9rem; margin: 0.5rem 0 0.8rem; }
.consentinfo p { margin: 0.3rem 0; }
.consentinfo ul { margin: 0.3rem 0; padding-left: 1.2rem; }

/* info box next to the learning question */
.consentinfo { background: rgba(127, 127, 127, 0.1); border-radius: 8px; padding: 0.6rem 0.9rem; margin: 0.5rem 0 0.8rem; }
.consentinfo p { margin: 0.3rem 0; }
.consentinfo ul { margin: 0.3rem 0; padding-left: 1.2rem; }

/* chat messages: Wilhelm on the left, the user on the right, in a centered reading column */
#log { display: flex; flex-direction: column; gap: 0.6rem; box-sizing: border-box; padding: 1rem max(1rem, calc((100% - 56rem) / 2)); }
#log .m { max-width: min(46rem, 85%); margin: 0; padding: 0.6rem 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
#log .m.user { align-self: flex-end; border-radius: 16px 16px 4px 16px; }
#log .m.assistant { align-self: flex-start; border-radius: 16px 16px 16px 4px; }
#log details.think { align-self: flex-start; max-width: min(46rem, 85%); margin: 0; }
.chathint { margin: 0.3rem 1rem 0.7rem; font-size: 0.78rem; opacity: 0.6; text-align: center; }

/* rename button next to the delete button in the chat list */
#convs .ren { font-size: 0.95rem; }

.linkbtn { background: none; border: 0; padding: 0; margin-top: 0.8rem; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; display: block; }
#r-code { text-transform: uppercase; letter-spacing: 0.15em; }

.cookienote { font-size: 0.85rem; opacity: 0.7; margin: 1.5rem 0 0.5rem; max-width: 28rem; }

.rate { display: flex; gap: 0.3rem; margin: -0.3rem 0 0.9rem; }
.rate button { background: none; border: 0; cursor: pointer; opacity: 0.4; font-size: 1rem; padding: 0.1rem 0.3rem; }
.rate button:hover { opacity: 0.85; }
.rate button.on { opacity: 1; }

/* memory list: one box per entry */
.memlist { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.memitem { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid rgba(128, 128, 128, 0.35); border-radius: 8px; }
.memacts { display: flex; gap: 12px; flex-shrink: 0; }

/* space below the last message (rating buttons) and above the input */
#log { padding-bottom: 2rem; }
#send { margin-top: 0.8rem; }

/* ---- design layer 1: calmer base look, same size for all settings tabs ---- */
body { line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { padding: 0.55rem 1rem; border-radius: 8px; transition: filter 0.15s, background 0.15s; }
button:hover:not(:disabled) { filter: brightness(1.12); }
button:disabled { opacity: 0.5; cursor: default; }
input, select, textarea { border-radius: 8px; transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #4f8cff; box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.25); }

/* sidebar */
#side { padding: 1rem 0.8rem; gap: 0.8rem; }
#new { width: 100%; }
#convs li button.title { padding: 0.55rem 0.7rem; }
#convs li:hover { background: #20242b; border-radius: 8px; }
#convs li.active { background: #2a2e36; border-radius: 8px; }
#convs li.active button, #convs li:hover button { background: none; }

/* chat */
#send textarea { border-radius: 14px; padding: 0.7rem 0.9rem; }
#send button { align-self: flex-end; border-radius: 12px; }
#log .m { border-radius: 16px; }
#log .m.user { border-radius: 16px 16px 4px 16px; }
#log .m.assistant { border-radius: 16px 16px 16px 4px; }
#opts select { padding: 0.3rem 0.5rem; }

/* all popups: same width, settings popup keeps one fixed size on every tab */
dialog.dlg { width: min(34rem, 92vw); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
#accdlg { height: min(36rem, 90vh); }
#accdlg .panel { flex: 1; }
.dlghead { padding: 1rem 1.4rem; }
.tabs { padding: 0 1.4rem; }
.dlg .panel { padding: 1.4rem; }
.dlgfoot { padding: 1rem 1.4rem; }
#memdlg > p, #memdlg > input { margin: 1rem 1.4rem 0; }
#memdlg > input { width: calc(100% - 2.8rem); }

/* thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: #3a3f48 transparent; }

/* ---- design layer 2: user menu, quota bar, greeting ---- */
#userwrap { position: relative; }
#userbtn { display: flex; align-items: center; gap: 0.7rem; width: 100%; padding: 0.5rem; background: none; text-align: left; border-radius: 10px; color: inherit; }
#userbtn:hover { background: #20242b; filter: none; }
#avatar { display: grid; place-items: center; width: 2rem; height: 2rem; flex-shrink: 0; border-radius: 50%; background: #4f8cff; color: #fff; font-weight: 600; }
.uinfo { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
#username { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#userplan { font-size: 0.78rem; opacity: 0.6; }
#usermenu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); display: flex; flex-direction: column; padding: 0.3rem; background: #20242b; border: 1px solid #2a2e36; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
#usermenu button { background: none; text-align: left; border-radius: 8px; color: inherit; }
#usermenu button:hover { background: #2a2e36; filter: none; }
#qbox { padding: 0 0.5rem; }
#qbar { height: 6px; border-radius: 3px; background: #2a2e36; overflow: hidden; }
#qfill { display: block; height: 100%; background: #4f8cff; border-radius: 3px; transition: width 0.3s; }
#qfill.full { background: #e0584c; }
#side #quota, #side #qnext { margin: 0.35rem 0 0; font-size: 0.78rem; opacity: 0.7; }
#greet:not([hidden]) { flex: 1; display: flex; align-items: center; justify-content: center; }
#greet h1 { margin: 0; padding: 0 1rem; font-size: 1.9rem; font-weight: 600; text-align: center; }

/* ---- design layer 3: smaller base font, login as a card ---- */
html { font-size: 93.75%; }
#auth { background: radial-gradient(ellipse at top, #1d2430 0%, #14161a 55%); }
#auth form { max-width: 24rem; padding: 1.8rem; background: #1a1d22; border: 1px solid #2a2e36; border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
#auth form input:not([type="radio"]):not([type="checkbox"]) { padding: 0.7rem 0.8rem; }
#auth form button[type="submit"] { width: 100%; margin-top: 0.4rem; padding: 0.7rem 1rem; }
#auth form label { font-size: 0.9rem; }
#auth form label.inline, #auth form label.check { font-size: 0.9rem; }
#auth .top .logo { font-size: 1.2rem; }
.cookienote { text-align: center; margin: 1.2rem auto 0.5rem; }

/* ---- design layer 4: chat view in the same style as the login card ---- */
.logo, #greet h1 { background: linear-gradient(90deg, #8fb4ff, #c4a8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
#side { background: #17191e; }
#chathead { border-bottom: 1px solid #22262d; padding: 0.7rem 1.2rem; }
#privbtn { border-radius: 999px; padding: 0.35rem 0.9rem; font-size: 0.85rem; }
#log .m.user { background: #3a6fd8; color: #fff; }
#log .m.assistant { background: #1a1d22; border: 1px solid #2a2e36; }
#log details.think { background: #1a1d22; border: 1px solid #2a2e36; border-radius: 12px; padding: 0.3rem 0.8rem; }
#send { align-items: flex-end; padding-bottom: 0.2rem; }
#send textarea { background: #1a1d22; border: 1px solid #2a2e36; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25); }
#send textarea:focus { border-color: #4f8cff; }
#opts { gap: 0.6rem; }
#opts select { border-radius: 999px; background: #1a1d22; border: 1px solid #2a2e36; padding: 0.25rem 0.7rem; }
.rate button { border-radius: 6px; }
.rate button:hover { background: #20242b; }

/* ---- design layer 5: send arrow inside the text field, sidebar that slides in ---- */
#send { position: relative; }
#send textarea { padding-right: 3.6rem; }
#send #sendbtn { position: absolute; right: 1.6rem; bottom: 0.75rem; width: 2.2rem; height: 2.2rem; padding: 0; border-radius: 50%; font-size: 0; display: grid; place-items: center; }
#send #sendbtn::before { content: "\2191"; font-size: 1.15rem; line-height: 1; }

#hotzone { display: none; position: fixed; left: 0; top: 0; bottom: 0; width: 10px; z-index: 19; }
@media (hover: hover) { #app.collapsed #hotzone { display: block; } }
#app.collapsed #side { display: flex; position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: 16rem; box-sizing: border-box; z-index: 20; transform: translateX(-105%); transition: transform 0.2s ease; }
#app.collapsed.peek #side { transform: none; box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5); }

/* ---- design layer 6: login brand, same font in all fields, calmer settings ---- */
#auth .top .logo { display: none; }
#auth .top { justify-content: flex-end; }
.authbrand { font-size: 2.4rem; margin-bottom: 1.4rem; text-align: center; }
input, select { font: inherit; }
.dlg label { font-size: 0.9rem; }
.tabs { overflow-x: auto; }
.tab { white-space: nowrap; }
button.icon:hover { background: #2a2e36; border-radius: 8px; }
#tab-general:not([hidden]) { display: flex; flex-direction: column; }
#tab-general .legal { margin-top: auto; padding-top: 1.2rem; }
#tab-security button { width: 100%; text-align: left; padding: 0.8rem 1rem; }
#tab-security button.danger { background: transparent; border: 1px solid #c0392b; color: #ff8a8a; }
#tab-security button.danger:hover { background: #c0392b; color: #fff; }
@media (max-width: 700px) {
  input, select, textarea { font-size: 16px; }
  #greet h1 { font-size: 1.5rem; }
}

/* ---- design layer 7: sidebar fits its box, phone view with a separate sidebar page ---- */
#side { box-sizing: border-box; }
.sidehead { display: flex; justify-content: space-between; align-items: center; }
#sideclose { display: none; }
@media (max-width: 700px) {
  #app:not([hidden]) { display: block; }
  #app #chat { height: 100%; }
  #app #side, #app.collapsed #side { display: none; position: static; transform: none; width: auto; height: 100%; max-height: none; box-shadow: none; }
  #app.mnav #side { display: flex; position: fixed; inset: 0; width: 100%; z-index: 20; border-right: 0; }
  #app.mnav #chat { display: none; }
  #sideclose { display: block; }
}

/* send button as stop square while Wilhelm answers */
#send #sendbtn.stop::before { content: "\25A0"; font-size: 0.85rem; }

/* ---- formatted answers and copy buttons ---- */
#log .m.md { white-space: normal; }
#log .m.md p { margin: 0 0 0.6rem; white-space: pre-wrap; }
#log .m.md ul, #log .m.md ol { margin: 0 0 0.6rem; padding-left: 1.3rem; }
#log .m.md li { margin: 0.15rem 0; }
#log .m.md .mdh { font-weight: 600; margin: 0.4rem 0; }
#log .m.md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; background: #14161a; padding: 0.1rem 0.35rem; border-radius: 6px; }
#log .m.md .codeblock { margin: 0.4rem 0 0.7rem; border: 1px solid #2a2e36; border-radius: 10px; background: #14161a; overflow: hidden; }
#log .m.md .codehead { display: flex; justify-content: space-between; align-items: center; padding: 0.2rem 0.4rem 0.2rem 0.8rem; font-size: 0.78rem; border-bottom: 1px solid #2a2e36; }
#log .m.md pre { margin: 0; padding: 0.7rem 0.9rem; overflow-x: auto; }
#log .m.md pre code { background: none; padding: 0; font-size: 0.85rem; white-space: pre; }
.copybtn { background: none; border: 0; color: inherit; padding: 0.15rem 0.5rem; font-size: 0.78rem; opacity: 0.55; border-radius: 6px; }
.copybtn:hover { opacity: 1; background: #20242b; }
#log .m.md > .copybtn { display: block; margin: 0.4rem 0 -0.2rem -0.5rem; }
#log .m.md > :last-child:not(.copybtn) { margin-bottom: 0; }

/* markdown extras: tables, links, rules */
.md .tablewrap { overflow-x: auto; margin: 10px 0; }
.md table { border-collapse: collapse; font-size: 0.92em; }
.md th, .md td { border: 1px solid rgba(127, 127, 127, 0.35); padding: 6px 10px; text-align: left; }
.md th { font-weight: 600; background: rgba(127, 127, 127, 0.12); }
.md a { color: inherit; text-decoration: underline; }
.md hr { border: 0; border-top: 1px solid rgba(127, 127, 127, 0.35); margin: 12px 0; }

#privhint { margin: 0; padding: 0.5rem 1rem; font-size: 0.85rem; background: rgba(138, 92, 255, 0.15); border-bottom: 1px solid #8a5cff; }

.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tool-chip { font-size: 12px; padding: 2px 8px; border-radius: 10px; opacity: .75; border: 1px solid currentColor; }

/* memory by category, bigger settings window */
#accdlg { width: min(46rem, 94vw); }
#memlist { max-height: 50vh; overflow-y: auto; }
.memhead { list-style: none; font-weight: 600; opacity: .8; margin-top: 12px; }
#memq-cat { width: 100%; margin-bottom: 8px; }

/* memory as documents, big settings window */
dialog#accdlg.dlg { width: min(60rem, 96vw); height: min(46rem, 92vh); max-height: 94vh; }
#accdlg .panel { min-height: 0; overflow-y: auto; }
.memcard { border: 1px solid #2a2e36; border-radius: 10px; padding: 10px 14px; margin: 0 0 12px 0; }
.memcardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.memcardhead h4 { margin: 0; }
.membody { margin-top: 8px; }
.membody.muted { opacity: .6; }
.memhead { font-weight: 600; margin-top: 10px; opacity: .85; }
.memline { margin: 2px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.memarea { width: 100%; min-height: 14rem; box-sizing: border-box; resize: vertical; font: inherit; line-height: 1.45;
  background: #14161a; color: inherit; border: 1px solid #2a2e36; border-radius: 8px; padding: 10px; }
.memedit { display: flex; gap: 8px; }
@media (max-width: 640px) {
  dialog#accdlg.dlg { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}

.memnone { padding: 6px 14px; opacity: .8; }
.memnone .memcardhead h4 { font-weight: 500; }

dialog#accdlg.dlg { width: min(72rem, 96vw); height: 96vh; max-height: 96vh; }
.memline { margin: 6px 0; }
.memarea { min-height: 45vh; }

/* bullet is drawn by CSS, wrapped lines hang under the text */

/* source chips of a web search are links */
a.tool-src { text-decoration: none; color: inherit; cursor: pointer; }
a.tool-src:hover { text-decoration: underline; }

/* model choice with a description for each model */
#modelwrap { position: relative; }
#modelbtn { font: inherit; color: inherit; cursor: pointer; border-radius: 999px; background: #1a1d22; border: 1px solid #2a2e36; padding: 0.25rem 0.7rem; }
#modelbtn::after { content: " \25BE"; }
#modellist { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20; min-width: 18rem; max-width: 26rem; background: #1d2026; border: 1px solid #2a2e36; border-radius: 12px; padding: 0.3rem; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
#modellist[hidden] { display: none; }
.modelitem { display: flex; flex-direction: column; gap: 0.15rem; width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-radius: 8px; padding: 0.5rem 0.7rem; cursor: pointer; }
.modelitem span { opacity: 0.65; font-size: 0.85em; }
.modelitem:hover, .modelitem.on { background: #262b33; }

/* one panel for model, thinking level and switches */
.pickrow { padding: 0.35rem 0.5rem; }
.pickrow > span:first-child { display: block; font-size: 0.75em; opacity: 0.6; margin-bottom: 0.25rem; }
#modelitems, #levelbtns { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.modelitem { width: auto; flex-direction: row; padding: 0.3rem 0.8rem; border: 1px solid #2a2e36; border-radius: 999px; }
.modelitem.on { background: #2b3a5a; border-color: #4f8cff; }
#switches { display: flex; flex-direction: column; gap: 0.3rem; }

/* switches as toggles */
#switches label { display: flex; align-items: center; gap: 0.7rem; cursor: pointer; }
#switches input[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 2.2rem; height: 1.25rem; margin: 0; border: 0; border-radius: 999px; background: #3a3f48; cursor: pointer; transition: background 0.15s; }
#switches input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.25rem - 4px); height: calc(1.25rem - 4px); border-radius: 50%; background: #fff; transition: transform 0.15s; }
#switches input[type="checkbox"]:checked { background: #4f8cff; }
#switches input[type="checkbox"]:checked::after { transform: translateX(0.95rem); }

#modelbtn span + span { margin-left: 0.45rem; }
#modelbtn .dim { opacity: 0.55; }
#switches label { gap: 1rem; }

/* wider input row */
#opts, #send { max-width: 60rem; }

/* row under the input: hint text on the left, model and level on the right, switches stay above the input */
#belowrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; max-width: 60rem; width: 100%; margin: 0 auto; padding: 0.3rem 1rem 0; box-sizing: border-box; }
#belowrow .chathint { flex: 1; margin: 0; text-align: left; }
#modelwrap { font-size: 0.85rem; }
#modellist { left: auto; right: 0; }
#opts:not(:has(#switches > *)) { display: none; }

/* spacing */
#opts { padding-bottom: 0.7rem; }
#switches label { padding: 0; border: 0; background: none; gap: 0.7rem; }
#belowrow { padding: 0.6rem 1rem 0.9rem; }

/* the app is as high as the visible area, also with the keyboard open */
#app:not([hidden]) { height: var(--appvh, 100dvh); }
