/* Toonlight — an illustrated paper notebook turned into a macOS-style app.
   Thick black ink, warm paper, cut-out offset shadows, a few muted accents.
   Components: .btn (tactile button), .ink (outlined paper card), .hand (handwriting),
   .doodle (inline SVG sketches). The accent colour follows the selected character. */

@property --tint { syntax: '<color>'; inherits: true; initial-value: #EDB95E; }

:root {
  /* paper */
  --desk: #E9DFCC;
  --paper: #FBF6EC;
  --cream: #F4ECDD;
  --beige: #E6D8BF;
  --rule: #E3D6BE;
  --margin: #E9A69C;
  /* ink */
  --ink: #000;
  --shade: #000;          /* offset shadows */
  --on-tint: #111;        /* text on the pastel accent */
  --ink-soft: #3B3530;
  --muted: #6B6158;
  /* the character's muted accent (set from JS) */
  --tint-soft: color-mix(in srgb, var(--tint) 35%, var(--paper));
  /* macOS lights */
  --red: #FF5F57; --yellow: #FEBC2E; --green: #28C840;

  --line: 2.5px;
  --line-bold: 3px;
  --shadow: 4px 4px 0 var(--shade);
  --shadow-lift: 6px 6px 0 var(--shade);
  --shadow-big: 9px 10px 0 var(--shade);
  /* slightly uneven corners: looks drawn, not machined */
  --wobble: 14px 18px 13px 17px / 17px 13px 18px 14px;
  --wobble-sm: 10px 12px 9px 13px / 12px 9px 13px 10px;

  --display: 'Bricolage Grotesque', 'Arial Black', system-ui, sans-serif;
  --text: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --hand: 'Caveat', 'Segoe Print', 'Comic Sans MS', cursive;

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.2 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  transition: --tint 0.7s ease;
  color-scheme: light;
}

/* Black theme: a dark desk and charcoal paper, drawn with warm white chalk-like ink */
:root[data-theme='dark'] {
  --desk: #0F0F11;
  --paper: #1A1A1D;
  --cream: #222226;
  --beige: #3A3A40;
  --rule: #2A2A2F;
  --margin: #6E3A35;
  --ink: #F2EDE3;
  --ink-soft: #CFC8BB;
  --muted: #A1998D;
  --shade: #000;
  --tint-soft: color-mix(in srgb, var(--tint) 22%, var(--paper));
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.95 0 0 0 0 0.9 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}
/* in the dark, cut-out shadows are a soft lift of the ink colour so they stay visible */
:root[data-theme='dark'] { --shadow: 4px 4px 0 #4A4740; --shadow-lift: 6px 6px 0 #4A4740; --shadow-big: 9px 10px 0 #3B3934; --shade: #4A4740; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--text); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--grain), var(--desk);
  display: flex; flex-direction: column; min-height: 100dvh; overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.01em; margin: 0; }
.hand { font-family: var(--hand); font-weight: 700; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px dashed var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.doodle { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; position: absolute; pointer-events: none; }

/* ---------- tactile button ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; cursor: pointer;
  background: var(--paper); color: var(--ink);
  border: var(--line) solid var(--ink); border-radius: var(--wobble-sm);
  box-shadow: var(--shadow); font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.2s ease;
}
.btn:hover { transform: translate(-1px, -2px); box-shadow: var(--shadow-lift); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shade); }
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; box-shadow: var(--shadow); }
.btn-accent { background: var(--tint); color: var(--on-tint); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 0.9rem; box-shadow: 3px 3px 0 var(--shade); }
.btn-small:hover { box-shadow: 4px 5px 0 var(--shade); }
.btn-small:active { box-shadow: 0 0 0 var(--shade); transform: translate(3px, 3px); }
.btn-icon { width: 46px; padding: 0; }
.btn[aria-pressed='true'] { background: var(--ink); color: var(--paper); }

/* ---------- menu bar ---------- */

.menubar {
  display: flex; align-items: center; gap: 22px; height: 46px; padding: 0 18px; flex: none;
  background: var(--paper); border-bottom: var(--line-bold) solid var(--ink); position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand-mark svg { width: 26px; height: 26px; display: block; fill: var(--tint); stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.brand-mark svg circle { fill: var(--ink); stroke: none; }
.brand-mark svg path { fill: none; }
.menu { display: flex; gap: 4px; }
.menu-item {
  background: none; border: var(--line) solid transparent; border-radius: 9px; padding: 3px 10px; cursor: pointer; font-weight: 700;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.menu-item:hover { border-color: var(--ink); background: var(--cream); }
.menu-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn { width: 36px; height: 30px; display: grid; place-items: center; background: none; border: var(--line) solid transparent; border-radius: 9px; cursor: pointer; }
.icon-btn:hover { border-color: var(--ink); background: var(--cream); }
.icon-btn .ico-moon { display: block; } .icon-btn .ico-sun { display: none; }
:root:not([data-theme='light']) .icon-btn .ico-moon { display: none; } :root:not([data-theme='light']) .icon-btn .ico-sun { display: block; }
.clock { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- the desk & app window ---------- */

.desk { flex: 1; min-height: 0; display: flex; padding: 22px 26px 28px; }
.window {
  flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  margin: 0 auto; width: 100%;
  background: var(--paper); border: var(--line-bold) solid var(--ink); border-radius: 20px 22px 19px 23px / 22px 19px 23px 20px;
  box-shadow: var(--shadow-big); overflow: hidden;
  animation: window-in 0.55s cubic-bezier(.2,.9,.3,1.2) both;
}
@keyframes window-in { from { transform: translateY(18px) rotate(-0.6deg); } }
.titlebar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 54px; padding: 0 14px 0 18px; flex: none;
  background: var(--grain), var(--cream); border-bottom: var(--line-bold) solid var(--ink);
}
.lights { display: flex; gap: 9px; }
.lights span { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--ink); }
.l-red { background: var(--red); } .l-yellow { background: var(--yellow); } .l-green { background: var(--green); }
.window-title { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar .btn { justify-self: end; }

.panes { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(220px, 15%, 300px) minmax(0, 1fr) clamp(340px, 30%, 600px); }

/* ---------- sidebar: the cast ---------- */

.sidebar { border-right: var(--line-bold) solid var(--ink); background: var(--grain), var(--cream); padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; }
.side-label { margin: 0 4px; font-size: 1.3rem; line-height: 1.1; }
.cast { display: flex; flex-direction: column; gap: 10px; }
.cast-group { margin: 6px 4px 0; font-family: var(--hand); font-weight: 700; font-size: 1.05rem; color: var(--muted); }
.card {
  display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 10px; text-align: left; width: 100%;
  padding: 8px 10px; cursor: pointer; background: var(--paper);
  border: var(--line) solid var(--shade); border-radius: var(--wobble-sm); box-shadow: 3px 3px 0 var(--shade);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.25s ease;
}
.card:hover { transform: translate(-1px, -2px) rotate(-0.4deg); box-shadow: 5px 5px 0 var(--shade); }
.card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shade); }
.card[aria-pressed='true'] { background: var(--tint-soft); transform: rotate(-1deg); box-shadow: 5px 5px 0 var(--shade); }
.card .face { width: 52px; height: 52px; border-radius: 50%; border: var(--line) solid var(--ink); background: var(--cream) center / cover no-repeat; }
.card .who { font-family: var(--display); font-weight: 800; font-size: 1rem; line-height: 1.1; }
.card .what { font-size: 0.82rem; color: var(--muted); line-height: 1.25; display: block; margin-top: 2px; }
.side-foot { margin-top: auto; position: relative; padding: 10px 6px 0 38px; }
.side-foot p { margin: 0; font-size: 1.1rem; line-height: 1.15; color: var(--ink-soft); }
.d-heart { width: 30px; height: 30px; left: 2px; top: 10px; fill: var(--tint); }

/* ---------- stage ---------- */

.stage-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 18px 18px; gap: 12px; background: var(--paper); }
.modes { display: flex; gap: 8px; flex-wrap: nowrap; flex: none; overflow-x: auto; scrollbar-width: none; padding: 2px 4px 6px 2px; margin: -2px 0 -6px; }
.modes::-webkit-scrollbar { display: none; }
.mode { flex: none; white-space: nowrap; }
.mode {
  border: var(--line) solid var(--ink); background: var(--paper); border-radius: 999px; padding: 5px 14px; cursor: pointer; font-weight: 700; font-size: 0.92rem;
  box-shadow: 2px 2px 0 var(--shade); transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.2s ease;
}
.mode:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shade); }
.mode:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--shade); }
.mode[aria-selected='true'] { background: var(--ink); color: var(--paper); }

.stage {
  position: relative; flex: 1; min-height: 260px; overflow: hidden;
  border: var(--line-bold) solid var(--ink); border-radius: var(--wobble);
  background:
    radial-gradient(circle at 50% 62%, color-mix(in srgb, var(--tint) 30%, transparent), transparent 55%),
    radial-gradient(var(--beige) 1.3px, transparent 1.6px) 0 0 / 22px 22px,
    var(--grain), var(--cream);
  box-shadow: inset 0 -10px 0 color-mix(in srgb, var(--shade) 4%, transparent);
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.stage.dropping::after {
  content: 'Drop the model to try it'; position: absolute; inset: 12px; display: grid; place-items: center;
  border: 3px dashed var(--ink); border-radius: var(--wobble); background: color-mix(in srgb, var(--paper) 75%, transparent);
  font-family: var(--hand); font-size: 2rem; pointer-events: none;
}

/* the name: a sticky note held on with tape */
.sticky {
  position: absolute; top: 18px; left: 18px; max-width: 270px; padding: 16px 16px 14px;
  background: var(--tint-soft); border: var(--line) solid var(--ink); border-radius: 4px 6px 5px 3px;
  box-shadow: var(--shadow); transform: rotate(-2deg); z-index: 2;
}
.tape { position: absolute; top: -12px; left: 50%; width: 74px; height: 22px; transform: translateX(-50%) rotate(3deg); background: color-mix(in srgb, #fff 55%, var(--beige)); border: 2px solid var(--ink); opacity: 0.92; }
.sticky-kind { margin: 0; font-size: 1.15rem; line-height: 1; }
.sticky h1 { font-size: 1.55rem; line-height: 1.05; margin: 3px 0 5px; }
.sticky-tag { margin: 0; font-size: 0.9rem; line-height: 1.35; color: var(--ink-soft); }

.score {
  position: absolute; top: 18px; right: 18px; z-index: 2; display: grid; place-items: center; width: 88px; height: 88px;
  background: var(--paper); border: var(--line-bold) solid var(--ink); border-radius: 50% 46% 52% 48% / 48% 53% 47% 52%;
  box-shadow: var(--shadow); transform: rotate(6deg); line-height: 1;
}
.score .hand { font-size: 1.1rem; }
.score strong { font-family: var(--display); font-size: 1.5rem; }
.score.bump { animation: bump 0.45s ease; }
@keyframes bump { 40% { transform: rotate(-4deg) scale(1.15); } }

.thought {
  position: absolute; left: 56%; top: 16%; display: flex; gap: 6px; padding: 11px 15px; z-index: 2;
  background: var(--paper); border: var(--line) solid var(--shade); border-radius: 999px; box-shadow: 3px 3px 0 var(--shade);
}
.thought span, .typing .bubble span { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); animation: dot 1s infinite ease-in-out; }
.thought span:nth-child(2), .typing .bubble span:nth-child(2) { animation-delay: 0.15s; }
.thought span:nth-child(3), .typing .bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.d-star { width: 42px; height: 42px; right: 26px; bottom: 30px; fill: var(--tint); transform: rotate(12deg); }
.d-squiggle { width: 110px; height: 22px; left: 24px; bottom: 26px; }
.d-spiral { width: 38px; height: 38px; right: 120px; top: 22px; opacity: 0.8; }
.d-burst { width: 34px; height: 34px; left: 44%; top: 20px; opacity: 0.7; }
.stage .doodle { transition: transform 0.4s ease; }
.stage:hover .d-star { transform: rotate(32deg) scale(1.08); }
.stage:hover .d-spiral { transform: rotate(-25deg); }

.mode-setup {
  display: flex; align-items: center; gap: 10px; flex: none; padding: 10px 12px;
  background: var(--tint-soft); border: var(--line) solid var(--shade); border-radius: var(--wobble-sm); box-shadow: 3px 3px 0 var(--shade);
}
.mode-setup label { font-family: var(--hand); font-weight: 700; font-size: 1.25rem; white-space: nowrap; }
.mode-setup input, .mode-setup select { flex: 1; min-width: 0; height: 40px; padding: 0 12px; background: var(--paper); border: var(--line) solid var(--ink); border-radius: 10px; }

/* ---------- chat: a ruled notebook page ---------- */

.chat {
  display: flex; flex-direction: column; min-height: 0; border-left: var(--line-bold) solid var(--ink);
  background: linear-gradient(90deg, transparent 38px, var(--margin) 38px, var(--margin) 40px, transparent 40px), var(--grain), var(--paper);
}
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 10px 54px; border-bottom: var(--line) solid var(--ink); background: var(--grain), var(--cream); }
.chat-head h2 { font-size: 1.2rem; line-height: 1.1; }
.chat-head-text { min-width: 0; }
.chat-head .chat-mode { font-size: 1.1rem; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; }
.chat-mode { margin: 0; font-size: 1.25rem; white-space: nowrap; }

/* Chat only / Voice switch */
.seg { display: inline-flex; border: var(--line) solid var(--ink); border-radius: 999px; overflow: hidden; box-shadow: 2px 2px 0 var(--shade); flex: none; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--paper); padding: 4px 12px; cursor: pointer; font-weight: 700; font-size: 0.86rem; transition: background-color 0.15s ease; }
.seg button + button { border-left: var(--line) solid var(--ink); }
.seg button .ico { width: 16px; height: 16px; }
.seg button:hover { background: var(--cream); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }

/* Listen button under a reply */
.listen {
  display: inline-flex; align-items: center; gap: 5px; margin: 6px 0 0 2px; padding: 2px 10px 2px 7px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; cursor: pointer;
  font-size: 0.8rem; font-weight: 700; box-shadow: 2px 2px 0 var(--shade);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.listen .ico { width: 14px; height: 14px; }
.listen:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shade); }
.listen:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--shade); }
.listen[aria-pressed='true'] { background: var(--tint); color: var(--on-tint); }
.notice { margin: 12px 16px 0 54px; padding: 9px 12px; background: var(--tint-soft); border: 2px solid var(--ink); border-radius: var(--wobble-sm); font-size: 0.92rem; }

.messages {
  flex: 1; overflow-y: auto; margin: 0; padding: 18px 18px 10px 54px; list-style: none; display: flex; flex-direction: column; gap: 14px;
  background-image: repeating-linear-gradient(transparent 0 27px, var(--rule) 27px 28px); background-attachment: local;
}
.msg { max-width: 92%; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .who { font-family: var(--hand); font-weight: 700; font-size: 1.2rem; line-height: 1; margin: 0 0 3px 4px; }
.msg.bot .bubble { background: var(--paper); border: var(--line) solid var(--shade); border-radius: 4px 16px 14px 15px / 4px 14px 16px 13px; padding: 10px 14px; box-shadow: 3px 3px 0 var(--shade); }
.msg.user { align-self: flex-end; }
.msg.user .bubble { color: var(--on-tint); background: var(--tint); border: var(--line) solid var(--shade); border-radius: 16px 4px 15px 14px / 14px 4px 13px 16px; padding: 10px 14px; box-shadow: 3px 3px 0 var(--shade); }
.msg.system { align-self: center; max-width: 96%; text-align: center; }
.msg.system p { font-family: var(--hand); font-size: 1.15rem; line-height: 1.2; color: var(--ink-soft); }
.msg.new .bubble { animation: pop-in 0.28s cubic-bezier(.2,.9,.3,1.3); }
@keyframes pop-in { from { transform: translateY(6px) scale(0.97); } }
.typing .bubble { display: flex; gap: 5px; width: fit-content; padding: 14px 16px !important; }
.memo { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; font-family: var(--hand); font-weight: 700; font-size: 1.05rem; color: var(--ink-soft); }
.memo::before { content: ''; width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 3px; background: var(--tint); transform: rotate(-8deg); }
/* action cards: what a character prepared for you, confirmed with a button */
.action { margin: 8px 0 0; padding: 11px 13px 12px; max-width: 420px; background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--wobble-sm); box-shadow: 4px 4px 0 var(--shade); display: grid; gap: 4px; }
.action-kind { margin: 0; font-family: var(--hand); font-weight: 700; font-size: 1.05rem; line-height: 1; color: var(--ink-soft); }
.action-title { margin: 0; font-weight: 700; font-size: 1rem; overflow-wrap: anywhere; }
.action-detail, .action-note { margin: 0; font-size: 0.86rem; color: var(--ink-soft); }
.action-note { margin-top: 2px; font-size: 0.8rem; }
.action-body { margin: 4px 0 2px; width: 100%; padding: 8px 10px; font: inherit; font-size: 0.92rem; color: var(--ink); background: var(--cream); border: 2px solid var(--ink); border-radius: 8px; resize: vertical; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.action-buttons .btn { text-decoration: none; }
.contact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-items: end; margin-top: 4px; }
.contact-form .btn { grid-column: 1 / -1; justify-self: start; }
.sources { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.82rem; }
.sources a { color: var(--ink); background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; padding: 0 9px; text-decoration: none; }

.suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 16px 10px 54px; }
.suggest button {
  border: 2px dashed var(--ink); background: var(--paper); border-radius: 12px; padding: 5px 11px; cursor: pointer; text-align: left; font-size: 0.9rem;
  transition: transform 0.12s ease, background-color 0.2s ease, border-style 0s;
}
.suggest button:hover { background: var(--tint-soft); border-style: solid; transform: translate(-1px, -1px); }

.composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px 14px; border-top: var(--line) solid var(--ink); background: var(--grain), var(--cream); }
.composer textarea {
  flex: 1; resize: none; min-height: 46px; max-height: 150px; padding: 11px 13px; line-height: 1.4;
  background: var(--paper); border: var(--line) solid var(--shade); border-radius: var(--wobble-sm); box-shadow: inset 2px 2px 0 color-mix(in srgb, var(--shade) 8%, transparent);
}
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--tint); }
#mic[aria-pressed='true'] { background: var(--red); color: var(--shade); animation: listening 1.1s infinite; }
@keyframes listening { 50% { box-shadow: 4px 4px 0 var(--shade), 0 0 0 7px color-mix(in srgb, var(--red) 35%, transparent); } }

/* ---------- notebook drawer ---------- */

.scrim { position: fixed; inset: 0; background: color-mix(in srgb, var(--ink) 25%, transparent); z-index: 20; }
.notebook {
  position: fixed; top: 64px; right: 20px; bottom: 20px; width: min(440px, calc(100vw - 24px)); z-index: 21;
  display: flex; transform: translateX(calc(100% + 40px)) rotate(2deg); transition: transform 0.35s cubic-bezier(.2,.9,.3,1.1);
}
.notebook.open { transform: none; }
.nb-rings { width: 26px; display: flex; flex-direction: column; justify-content: space-evenly; align-items: center; margin-right: -13px; z-index: 1; }
.nb-rings span { width: 26px; height: 12px; border: var(--line) solid var(--ink); border-radius: 999px; background: var(--paper); }
.nb-page {
  flex: 1; overflow-y: auto; padding: 18px 22px 22px 30px;
  background: repeating-linear-gradient(transparent 0 29px, var(--rule) 29px 30px), var(--grain), var(--paper);
  border: var(--line-bold) solid var(--shade); border-radius: 6px 18px 16px 6px; box-shadow: var(--shadow-big);
}
.nb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.nb-head h2 { font-size: 1.6rem; }
.nb-section { padding: 14px 0; border-bottom: 2px dashed var(--ink); }
.nb-section:last-child { border-bottom: 0; }
.nb-section h3 { font-size: 1.05rem; margin-bottom: 4px; }
.nb-help { margin: 0 0 10px; font-size: 0.9rem; color: var(--ink-soft); }
.nb-empty { margin: 0 0 10px; font-size: 1.15rem; color: var(--muted); }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field span { font-family: var(--hand); font-weight: 700; font-size: 1.15rem; line-height: 1; }
.field input, .field textarea { padding: 9px 11px; background: var(--paper); border: var(--line) solid var(--ink); border-radius: 10px; resize: vertical; }
.facts { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 7px; }
.facts li { display: flex; align-items: flex-start; gap: 8px; padding: 7px 8px 7px 11px; background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; font-size: 0.92rem; }
.facts li span { flex: 1; }
.facts button { flex: none; width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 7px; background: var(--cream); cursor: pointer; line-height: 1; font-weight: 700; }
.facts button:hover { background: var(--red); color: var(--on-tint); }
.toggle-row { display: flex; align-items: flex-start; gap: 12px; }
.toggle-row .nb-help { margin: 0; }
.model-row { display: flex; flex-wrap: wrap; gap: 10px; }
.file-btn { cursor: pointer; }
code { font-size: 0.85em; background: var(--cream); border: 1.5px solid var(--ink); border-radius: 5px; padding: 0 4px; }

/* ---------- help card ---------- */

.pop {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%) rotate(-1deg); width: min(420px, calc(100vw - 32px)); z-index: 22;
  padding: 22px 22px 18px; background: var(--grain), var(--paper); border: var(--line-bold) solid var(--shade); border-radius: var(--wobble); box-shadow: var(--shadow-big);
}
.pop h2 { font-size: 1.35rem; margin-bottom: 8px; }
.pop ol { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 6px; }

/* ---------- tablet ---------- */

@media (max-height: 940px) { .side-foot { display: none; } }

@media (max-width: 1180px) {
  .panes { grid-template-columns: 92px minmax(0, 1fr) minmax(310px, 360px); }
  .sidebar { padding: 14px 10px; align-items: center; }
  .side-label, .side-foot, .cast-group { display: none; }
  .card { grid-template-columns: 52px; padding: 6px; justify-items: center; }
  .card .txt { display: none; }
}

/* ---------- phone ---------- */

@media (max-width: 820px) {
  body { overflow: auto; }
  .menubar { gap: 10px; height: 44px; padding: 0 12px; }
  .menu { display: none; }
  .desk { padding: 10px 10px 14px; }
  .window { border-radius: 16px 18px 15px 17px / 17px 15px 18px 16px; box-shadow: 5px 6px 0 var(--shade); }
  .titlebar { height: 46px; padding: 0 10px 0 12px; grid-template-columns: auto 1fr auto; gap: 10px; }
  .titlebar .btn span { display: none; }
  .titlebar .btn { width: 40px; padding: 0; }
  .lights span { width: 12px; height: 12px; }
  .window-title { font-size: 0.92rem; text-align: center; }
  .panes { display: flex; flex-direction: column; overflow-y: auto; }
  .panes > * { flex: none; }
  .sidebar { order: 2; border-right: 0; border-top: var(--line-bold) solid var(--ink); border-bottom: var(--line-bold) solid var(--ink); padding: 10px; overflow: visible; align-items: stretch; }
  .cast { flex-direction: row; overflow-x: auto; padding: 4px 4px 8px; scrollbar-width: none; gap: 10px; }
  .card { flex: none; width: auto; grid-template-columns: 44px; padding: 5px; }
  .card .face { width: 44px; height: 44px; }
  .stage-pane { order: 1; padding: 10px; gap: 10px; }
  .stage { min-height: 0; height: min(46dvh, 420px); flex: none; }
  .modes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; }
  .mode { flex: none; }
  .sticky { top: auto; bottom: 12px; left: 12px; max-width: 170px; padding: 11px 11px 8px; transform: rotate(-2.5deg); }
  .sticky h1 { font-size: 1.05rem; }
  .sticky-kind { font-size: 1rem; }
  .d-squiggle { display: none; }
  .sticky-tag { display: none; }
  .score { width: 66px; height: 66px; top: 12px; right: 12px; }
  .score strong { font-size: 1.15rem; }
  .d-spiral, .d-burst { display: none; }
  .chat { order: 3; border-left: 0; min-height: 70dvh; background: linear-gradient(90deg, transparent 22px, var(--margin) 22px, var(--margin) 24px, transparent 24px), var(--grain), var(--paper); }
  .chat-head, .messages, .suggest, .notice { padding-left: 34px; margin-left: 0; }
  .notice { margin: 10px 12px 0 34px; }
  .suggest { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .suggest button { flex: none; }
  .composer { position: sticky; bottom: 0; }
  .notebook { top: 54px; right: 8px; bottom: 8px; }
  .mode-setup { flex-wrap: wrap; }
  .mode-setup label { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}


/* ---------- saved chats sidebar ---------- */

.title-left { display: flex; align-items: center; gap: 14px; }
.panes.with-history { grid-template-columns: clamp(230px, 15%, 300px) 92px minmax(0, 1fr) clamp(330px, 30%, 600px); }
/* while the chats list is open, the cast shrinks to faces */
.panes.with-history .sidebar { padding: 14px 10px; align-items: center; }
.panes.with-history .side-label, .panes.with-history .side-foot, .panes.with-history .cast-group { display: none; }
.panes.with-history .card { grid-template-columns: 52px; padding: 6px; justify-items: center; }
.panes.with-history .card .txt { display: none; }
.panes:not(.with-history) .history { display: none; }
.history {
  display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 14px 12px 12px;
  border-right: var(--line-bold) solid var(--ink); background: var(--grain), var(--paper);
}
.new-chat { justify-content: center; width: 100%; }
.new-chat .ico { width: 18px; height: 18px; }
.chat-search { width: 100%; height: 36px; padding: 0 11px; background: var(--cream); border: var(--line) solid var(--ink); border-radius: 10px; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.chat-group { margin: 12px 4px 4px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.chat-group:first-child { margin-top: 2px; }
.chat-item { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 2px solid transparent; border-radius: 10px; cursor: pointer; background: none; text-align: left; }
.chat-item:hover { background: var(--cream); }
.chat-item[aria-current='true'] { background: var(--tint-soft); border-color: var(--ink); }
.chat-face { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--ink); background: var(--cream) center / cover no-repeat; }
.chat-text { flex: 1; min-width: 0; display: grid; }
.chat-title { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 0.76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-tools { display: none; gap: 2px; }
.chat-item:hover .chat-tools, .chat-item:focus-within .chat-tools, .chat-item[aria-current='true'] .chat-tools { display: flex; }
.chat-tools button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; cursor: pointer; color: var(--ink); }
.chat-tools button:hover { background: var(--paper); }
.chat-tools .ico { width: 15px; height: 15px; }
.chat-rename { flex: 1; min-width: 0; height: 28px; padding: 0 6px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); font-weight: 700; font-size: 0.9rem; }
.chat-confirm { display: flex; gap: 6px; align-items: center; font-size: 0.82rem; font-weight: 700; }
.chat-confirm button { height: 26px; padding: 0 8px; border: 2px solid var(--ink); border-radius: 7px; cursor: pointer; background: var(--paper); font-weight: 700; }
.chat-confirm .yes { background: var(--red); color: #111; }
.chat-empty { margin: 8px 4px; font-size: 0.9rem; color: var(--muted); }
.history-note { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
.new-chat-mini { margin-left: -36px; margin-right: 2px; }
.history-scrim { display: none; }
#history-toggle[aria-expanded='true'] { background: var(--cream); border-color: var(--ink); }
:root[data-theme='glass'] .history { background: rgba(255, 255, 255, 0.03); }

/* narrower screens: the chats list slides over the window instead of taking a column */
@media (max-width: 1280px) {
  .panes.with-history { grid-template-columns: 92px minmax(0, 1fr) minmax(310px, 360px); }
  .panes .history {
    display: flex !important; position: absolute; z-index: 15; top: 0; bottom: 0; left: 0; width: min(290px, 86%);
    box-shadow: var(--shadow-big); transform: translateX(-105%); transition: transform 0.25s ease; visibility: hidden;
  }
  .panes.with-history .history { transform: none; visibility: visible; }
  .panes.with-history .history-scrim { display: block; position: absolute; inset: 0; z-index: 14; background: color-mix(in srgb, var(--ink) 18%, transparent); }
  .panes { position: relative; }
}

/* ---------- agent: live steps, pictures, file previews ---------- */

.steps { margin: 0 0 6px; padding: 8px 12px; max-width: 420px; background: var(--cream); border: 2px dashed var(--ink); border-radius: 12px; font-size: 0.86rem; }
.steps.live { border-style: solid; background: var(--paper); box-shadow: var(--shadow); }
.steps-head { margin: 0; font-weight: 700; cursor: default; }
details.steps .steps-head { cursor: pointer; }
.steps ol { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.step { display: flex; gap: 8px; align-items: baseline; }
.step::before { flex: none; width: 16px; text-align: center; font-weight: 700; }
.step.run::before { content: '•'; animation: blink 0.9s infinite; }
.step.ok::before { content: '✓'; color: #2e7d32; }
.step.fail::before { content: '✕'; color: #c0392b; }
:root:not([data-theme='light']) .step.ok::before { color: #8fd694; }
:root:not([data-theme='light']) .step.fail::before { color: #ff8a80; }
@keyframes blink { 50% { opacity: 0.25; } }
.gen-image { margin: 8px 0 0; max-width: 340px; }
.gen-image img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--cream); border: var(--line) solid var(--ink); border-radius: 12px; box-shadow: var(--shadow); }
.gen-image figcaption { margin-top: 8px; font-size: 0.82rem; color: var(--muted); }
.gen-image .btn { text-decoration: none; }
.action-preview { margin: 4px 0 2px; max-height: 150px; overflow: auto; padding: 8px 10px; font-size: 0.8rem; line-height: 1.4; white-space: pre-wrap; background: var(--cream); border: 2px solid var(--ink); border-radius: 8px; }

/* ---------- account, sign in ---------- */

.account-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; cursor: pointer; font-weight: 700; font-size: 0.9rem;
  background: var(--paper); border: var(--line) solid var(--ink); border-radius: 999px; box-shadow: 2px 2px 0 var(--shade);
  max-width: 220px;
}
.account-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-btn .ico { width: 16px; height: 16px; }
.account-btn.in { background: var(--tint-soft); }
.auth-card { width: min(400px, calc(100vw - 32px)); }
.auth-form { display: grid; gap: 2px; }
.auth-form .btn { justify-self: start; margin-top: 4px; }
.auth-msg { margin: 0; min-height: 1.2em; font-size: 0.9rem; color: var(--ink-soft); }
.auth-msg.err { color: #c0392b; font-weight: 700; }
:root:not([data-theme='light']) .auth-msg.err { color: #ff8a80; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 12px 0 0; }
.link { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; color: var(--ink); }
.pop-x { position: absolute; top: 10px; right: 12px; width: 30px; height: 30px; border: 2px solid var(--ink); border-radius: 8px; background: var(--cream); cursor: pointer; font-weight: 700; line-height: 1; }

.oauth.off { display: none; }
.oauth { display: grid; gap: 8px; margin: 4px 0 6px; }
.oauth-btn { justify-content: center; gap: 10px; width: 100%; background: var(--paper); }
.oauth-btn svg { width: 20px; height: 20px; flex: none; }
.oauth-or { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; font-size: 0.82rem; color: var(--muted); }
.oauth-or::before, .oauth-or::after { content: ''; flex: 1; border-top: 2px dashed var(--rule); }
:root:not([data-theme='light']) .oauth-or::before, :root:not([data-theme='light']) .oauth-or::after { border-color: var(--beige); }

/* Agent mode while signed out */
.gate { margin: 6px 0 0 40px; padding: 14px 16px; background: var(--tint-soft); border: var(--line) solid var(--ink); border-radius: var(--wobble-sm); box-shadow: var(--shadow); max-width: 360px; }
.gate h3 { font-size: 1.05rem; margin-bottom: 4px; }
.gate p { margin: 0 0 10px; font-size: 0.92rem; }

/* ---------- documents ---------- */

.attach { cursor: pointer; flex: none; }
.attach.busy { opacity: 0.6; pointer-events: none; }
.doc-bar {
  display: flex; align-items: center; gap: 8px; margin: 0 14px; padding: 6px 8px 6px 10px; font-size: 0.88rem; font-weight: 700;
  background: var(--tint-soft); border: var(--line) solid var(--ink); border-bottom: 0; border-radius: 10px 10px 0 0;
}
.doc-bar .ico { width: 16px; height: 16px; }
.doc-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-x { width: 24px; height: 24px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); cursor: pointer; font-weight: 700; line-height: 1; }
.docs-list li { align-items: center; }
.docs-list .use { width: auto; padding: 0 8px; font-size: 0.8rem; }
.usedoc { display: inline-flex; align-items: center; gap: 6px; font-family: var(--text) !important; font-size: 0.92rem !important; font-weight: 700; white-space: nowrap; }
.usedoc input { width: 18px; height: 18px; flex: none; accent-color: var(--ink); }
.mode-setup { flex-wrap: wrap; }
.mode-setup #mode-diff { flex: 0 0 auto; width: auto; }

/* ---------- quiz card: shuffled options, checked by the site ---------- */

.quiz { margin: 8px 0 0; padding: 12px 13px; max-width: 440px; background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--wobble-sm); box-shadow: var(--shadow); }
.quiz-q { margin: 0 0 10px; font-weight: 700; line-height: 1.4; white-space: pre-wrap; }
.quiz-opts { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.quiz-opt {
  display: grid; grid-template-columns: 28px 1fr; align-items: start; gap: 8px; width: 100%; padding: 7px 10px; text-align: left; cursor: pointer;
  background: var(--cream); border: 2px solid var(--ink); border-radius: 10px; font-size: 0.93rem; line-height: 1.35;
  transition: transform 0.12s ease, background-color 0.15s ease;
}
.quiz-opt:hover:not(:disabled) { transform: translate(-1px, -1px); background: var(--tint-soft); }
.quiz-opt b { display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 50%; font-size: 0.85rem; background: var(--paper); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { background: #cdeccf; color: #102a12; }
.quiz-opt.wrong { background: #f6c9c4; color: #3a0f0b; }
.quiz-opt.right b, .quiz-opt.wrong b { background: #fff; color: #111; }
.quiz-result { margin: 10px 0 0; font-size: 0.92rem; }
.quiz-result strong { display: block; font-family: var(--display); font-size: 1rem; }
.quiz-meta { margin: 8px 0 0; font-size: 0.78rem; color: var(--muted); }

/* ---------- theme menu ---------- */

.theme-wrap { position: relative; }
.theme-menu {
  position: absolute; top: calc(100% + 8px); right: -6px; z-index: 30; min-width: 190px; padding: 6px;
  display: grid; gap: 2px; background: var(--paper); border: var(--line) solid var(--ink); border-radius: 12px; box-shadow: var(--shadow);
}
.theme-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px;
  background: none; cursor: pointer; font-weight: 700; text-align: left;
}
.theme-menu button:hover { background: var(--cream); }
.theme-menu button[aria-checked='true'] { background: var(--ink); color: var(--paper); }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; flex: none; }
.sw-light { background: #FBF6EC; } .sw-dark { background: #1A1A1D; } .sw-black { background: #000; }
.sw-glass { background: linear-gradient(135deg, #7c8cff, #c56cf0 55%, #4fd1c5); }

/* ---------- Black theme: true black, for OLED screens ---------- */

:root[data-theme='black'] {
  --desk: #000; --paper: #070707; --cream: #101010; --beige: #262626; --rule: #161616; --margin: #4a2420;
  --ink: #F5F2EC; --ink-soft: #CFCAC0; --muted: #9A948A;
  --tint-soft: color-mix(in srgb, var(--tint) 18%, var(--paper));
  --shade: #333; --shadow: 4px 4px 0 #333; --shadow-lift: 6px 6px 0 #333; --shadow-big: 9px 10px 0 #262626;
  --grain: linear-gradient(transparent, transparent);
  color-scheme: dark;
}

/* ---------- Glass theme: frosted panels over a soft colour wash ---------- */

:root[data-theme='glass'] {
  --desk: #0d1020;
  --paper: rgba(255, 255, 255, 0.07);
  --cream: rgba(255, 255, 255, 0.11);
  --beige: rgba(255, 255, 255, 0.16);
  --rule: rgba(255, 255, 255, 0.05);
  --margin: rgba(255, 255, 255, 0.10);
  --ink: #F4F6FB; --ink-soft: #D3D8E6; --muted: #A9B0C4;
  --on-tint: #10131f;
  --tint-soft: color-mix(in srgb, var(--tint) 26%, rgba(255, 255, 255, 0.06));
  --shade: transparent;
  --line: 1px; --line-bold: 1px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28); --shadow-lift: 0 12px 30px rgba(0, 0, 0, 0.34); --shadow-big: 0 24px 60px rgba(0, 0, 0, 0.45);
  --wobble: 18px; --wobble-sm: 12px;
  --hand: var(--display);
  --grain: linear-gradient(transparent, transparent);
  color-scheme: dark;
}
:root[data-theme='glass'] body {
  background:
    radial-gradient(60vmax 60vmax at 12% 8%, color-mix(in srgb, var(--tint) 45%, transparent), transparent 60%),
    radial-gradient(55vmax 55vmax at 92% 95%, rgba(110, 90, 255, 0.45), transparent 60%),
    radial-gradient(40vmax 40vmax at 70% 10%, rgba(40, 200, 200, 0.22), transparent 60%),
    linear-gradient(140deg, #0b0f1e, #161233 55%, #0c1a2a);
  background-attachment: fixed;
}
/* every hairline is a soft white edge instead of ink */
:root[data-theme='glass'] *, :root[data-theme='glass'] *::before, :root[data-theme='glass'] *::after { border-color: rgba(255, 255, 255, 0.16) !important; }
:root[data-theme='glass'] .menubar,
:root[data-theme='glass'] .window,
:root[data-theme='glass'] .nb-page,
:root[data-theme='glass'] .pop,
:root[data-theme='glass'] .theme-menu,
:root[data-theme='glass'] .auth-card {
  background: rgba(20, 24, 42, 0.45);
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%);
}
:root[data-theme='glass'] .window { border-radius: 22px; animation: none; }
:root[data-theme='glass'] .titlebar, :root[data-theme='glass'] .sidebar, :root[data-theme='glass'] .chat-head { background: rgba(255, 255, 255, 0.04); }
:root[data-theme='glass'] .stage-pane, :root[data-theme='glass'] .chat { background: transparent; }
:root[data-theme='glass'] .stage { background: radial-gradient(circle at 50% 62%, color-mix(in srgb, var(--tint) 28%, transparent), transparent 60%), rgba(255, 255, 255, 0.04); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
:root[data-theme='glass'] .doodle, :root[data-theme='glass'] .tape, :root[data-theme='glass'] .side-foot { display: none; }
:root[data-theme='glass'] .card, :root[data-theme='glass'] .sticky, :root[data-theme='glass'] .card[aria-pressed='true'] { transform: none; }
:root[data-theme='glass'] .sticky { border-radius: 14px; }
:root[data-theme='glass'] .btn, :root[data-theme='glass'] .mode, :root[data-theme='glass'] .seg, :root[data-theme='glass'] .card, :root[data-theme='glass'] .listen { box-shadow: none; }
:root[data-theme='glass'] .btn:hover, :root[data-theme='glass'] .card:hover, :root[data-theme='glass'] .mode:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }
:root[data-theme='glass'] .mode[aria-selected='true'], :root[data-theme='glass'] .seg button[aria-pressed='true'], :root[data-theme='glass'] .btn[aria-pressed='true'], :root[data-theme='glass'] .theme-menu button[aria-checked='true'] { background: rgba(255, 255, 255, 0.92); color: #111; }
:root[data-theme='glass'] .msg.bot .bubble { background: rgba(255, 255, 255, 0.08); border-radius: 6px 16px 16px 16px; box-shadow: none; }
:root[data-theme='glass'] .msg.user .bubble { border-radius: 16px 6px 16px 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
:root[data-theme='glass'] .lights span { border-color: transparent !important; }
:root[data-theme='glass'] .field input, :root[data-theme='glass'] .field textarea, :root[data-theme='glass'] .composer textarea, :root[data-theme='glass'] .mode-setup input, :root[data-theme='glass'] .mode-setup select { background: rgba(0, 0, 0, 0.25); }
:root[data-theme='glass'] select option { background: #1b1f33; color: #f4f6fb; }
:root[data-theme='glass'] .menu-item:not(:hover), :root[data-theme='glass'] .icon-btn:not(:hover) { border-color: transparent !important; }
@media (max-width: 820px) {
  .menu-right { gap: 8px; }
  .account-btn { padding: 0 9px; }
  .account-btn span { display: none; }
}
@media (max-width: 420px) { .clock { display: none; } }

@media (max-width: 820px) {
  .title-left { gap: 8px; }
  .panes .history { position: fixed; top: 58px; bottom: 12px; left: 10px; width: min(300px, calc(100vw - 40px)); border: var(--line-bold) solid var(--ink); border-radius: 14px; }
  .panes.with-history .history-scrim { position: fixed; }
}

/* big screens: use the room. The cast gets its names back next to the chats list. */
@media (min-width: 1700px) {
  .panes.with-history { grid-template-columns: clamp(240px, 14%, 300px) clamp(200px, 12%, 250px) minmax(0, 1fr) clamp(400px, 28%, 600px); }
  .panes.with-history .sidebar { padding: 16px 14px; align-items: stretch; }
  .panes.with-history .side-label, .panes.with-history .cast-group { display: block; }
  .panes.with-history .card { grid-template-columns: 52px 1fr; padding: 8px 10px; justify-items: stretch; }
  .panes.with-history .card .txt { display: block; }
}
@media (min-width: 1700px) and (min-height: 900px) {
  body { font-size: 17px; }
  .desk { padding: 26px 32px 32px; }
}
/* very large screens (1440p, 4K): scale everything up so it isn't tiny */
@media (min-width: 2200px) and (min-height: 1150px) {
  body { zoom: 1.25; height: calc(100% / 1.25); min-height: calc(100dvh / 1.25); }
}
@media (min-width: 3000px) and (min-height: 1600px) {
  body { zoom: 1.6; height: calc(100% / 1.6); min-height: calc(100dvh / 1.6); }
}
