/* Moderator mask prototype - standalone. Tokens follow the ChatMate brand: warm neutrals, orange accent,
   Outfit for text, Sofia Sans for names and numbers. Light/dark via color-scheme + light-dark(). */

@font-face {
  font-family: "Outfit"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/outfit-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Outfit"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/outfit-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Sofia Sans"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/sofia-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;

  --accent: #f37338;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-text: light-dark(color-mix(in srgb, var(--accent) 66%, #000), color-mix(in srgb, var(--accent) 72%, #fff));
  --on-accent: #24130a;

  --page:    light-dark(#faf8f5, #12110f);
  --surface: light-dark(#ffffff, #1b1a17);
  --sunken:  light-dark(#f4f2ee, #24221f);
  --ink:     light-dark(#141413, #f2efe9);
  --ink2:    light-dark(#52525b, #b6b1a8);
  --ink3:    light-dark(#6b6b74, #949087);
  --line:    light-dark(#e7e3dc, #2e2b27);
  --line2:   light-dark(#d9d4cb, #3d3934);

  --ok:        light-dark(#12633f, #4ec98a);
  --ok-soft:   light-dark(rgba(22, 122, 78, .1), rgba(78, 201, 138, .14));
  --warn:      light-dark(#7d5304, #e0a93c);
  --warn-soft: light-dark(rgba(196, 132, 12, .13), rgba(224, 169, 60, .15));
  --bad:       light-dark(#b03a2e, #ff8878);
  --bad-soft:  light-dark(rgba(176, 58, 46, .07), rgba(240, 112, 95, .1));
  --bad-line:  light-dark(rgba(176, 58, 46, .26), rgba(255, 136, 120, .3));
  --heart:      light-dark(#a61f50, #ff8fb6);
  --heart-soft: light-dark(rgba(194, 37, 92, .09), rgba(255, 143, 182, .12));

  --us:     light-dark(#141413, #663f22);
  --us-ink: light-dark(#f5f5f4, #f5f1ea);
  --them:   light-dark(#f1eee8, #26241f);

  --shadow-c: light-dark(rgba(20, 18, 15, .06), rgba(0, 0, 0, .4));
  --shadow:   0 1px 2px var(--shadow-c), 0 10px 30px var(--shadow-c);
  --pop-c:    light-dark(rgba(20, 18, 15, .18), rgba(0, 0, 0, .55));
  --pop:      0 18px 50px var(--pop-c);
  --scrim:    light-dark(rgba(20, 18, 15, .38), rgba(0, 0, 0, .6));
  --toast:    light-dark(#141413, #34312c);

  --font:   "Outfit", system-ui, sans-serif;
  --font-d: "Sofia Sans", "Outfit", system-ui, sans-serif;
  --ease:   cubic-bezier(.22, .61, .36, 1);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* "Kiki" (chatmate.vip/kikitheme, 2026-10-15): the portal in a pleasant rose pink - frame and top bar clearly pink but
   soft (the hot pink #F062A8 was "zu grell"), everything people read and type in stays calm: very light pink panels,
   dark text, own bubbles and buttons a muted deep pink with white text (contrast >= 4.5). --page stays light because
   input fields use it; the pink frame is only the body. Light and dark follow the usual switch. */
:root[data-look="kiki"] {
  --kiki-frame:   light-dark(#f3a6c8, #4a1e36);
  --kiki-bar:     light-dark(#f3a6c8, #582842);
  --kiki-bar-ink: light-dark(#3d0a24, #ffe8f3);
  --accent: light-dark(#c93f80, #f28bbd);
  --on-accent: light-dark(#ffffff, #2a0715);
  --accent-text: light-dark(#a8296a, #f7a8cd);
  --page:    light-dark(#fff3f8, #26101b);
  --surface: light-dark(#fffafc, #2e1322);
  --sunken:  light-dark(#ffe4f0, #3a1a2c);
  --ink:     light-dark(#2a0e1b, #fff0f7);
  --ink2:    light-dark(#6b2e4c, #f0bcd6);
  --ink3:    light-dark(#8a4a6a, #d395b5);
  --line:    light-dark(#f8c9de, #4f2238);
  --line2:   light-dark(#f2a9ca, #67294a);
  --us:      light-dark(#bf3a78, #8e3261);
  --us-ink:  #ffffff;
  --them:    light-dark(#ffe7f2, #3a1629);
  --toast:   light-dark(#5c0a33, #6e1a45);
  --shadow-c: light-dark(rgba(140, 10, 70, .10), rgba(0, 0, 0, .45));
  --pop-c:    light-dark(rgba(140, 10, 70, .22), rgba(0, 0, 0, .6));
}
/* the frame: full pink around the mask's panels; on pages with text right on the background a lighter pink */
:root[data-look="kiki"] body { background: light-dark(#fbd9e8, #2c1420); }
:root[data-look="kiki"] body:has(#comp) { background: var(--kiki-frame); }
/* the top bar in the strong pink; its texts and chips read in the bar's own ink */
:root[data-look="kiki"] .bar { background: var(--kiki-bar); border-bottom-color: transparent; --ink: var(--kiki-bar-ink); --ink2: var(--kiki-bar-ink); --ink3: var(--kiki-bar-ink); }
:root[data-look="kiki"] .bar .nav a:hover, :root[data-look="kiki"] .bar .nav a[aria-current="page"] { background: light-dark(rgba(255, 255, 255, .42), rgba(255, 255, 255, .12)); }
/* taboos and the note about profile deviations in the look's pink, not as warning/danger colours */
:root[data-look="kiki"] .taboo { border-color: var(--line2); background: var(--sunken); }
:root[data-look="kiki"] .taboo > .ic, :root[data-look="kiki"] .taboo h3 { color: var(--accent-text); }
:root[data-look="kiki"] .taboo li { border-color: var(--line2); }
:root[data-look="kiki"] .diff-note { background: var(--sunken); color: var(--accent-text); }
/* our own kitten (assets/p/brand/kiki-cat.svg): next to the logo, and hopping instead of the spinner while a chat opens */
.kiki-cat { display: none; }
:root[data-look="kiki"] .brand .kiki-cat { display: block; flex: none; width: 30px; height: 27px; margin-left: 6px; }
:root[data-look="kiki"] .card.load .spin { display: none; }
:root[data-look="kiki"] .card.load .kiki-cat { display: block; flex: none; width: 46px; height: 42px; animation: kiki-hop .9s var(--ease) infinite; }
@keyframes kiki-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px); } 62% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { :root[data-look="kiki"] .card.load .kiki-cat { animation: none; } }
/* falling hearts, sparkles and glitter (js/kiki-fall.js): behind the page - the body becomes its own stacking context, so
   the layer lies above the pink background and below every card, bar and text (never over the chat box or writing) */
:root[data-look="kiki"] body { isolation: isolate; }
.kiki-fall { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
:root[data-look="kiki"] .cm-logo-chat { background-image: linear-gradient(135deg, light-dark(#b02a68, #ffc2dc), light-dark(#cf4b8a, #f28bbd)); }
:root[data-look="kiki"] .cm-logo-mate { background-image: linear-gradient(135deg, light-dark(#5a0b30, #fff0f6), light-dark(#8a1a4f, #ffc8de)); }

[hidden] { display: none !important; }
/* Everything scrolls, nothing shows a scrollbar */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- App shell ---------- */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.bar {
  flex: none; min-height: 56px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px;
  padding: 8px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
/* ChatMate wordmark, as in the portal's top bar */
.brand { display: inline-flex; align-items: center; margin-right: 6px; border-radius: 8px; text-decoration: none; }
.cm-logo {
  display: inline-flex; font-family: var(--font); font-size: 20px; font-weight: 900; letter-spacing: -.8px; line-height: 1;
  white-space: nowrap; filter: drop-shadow(0 4px 8px rgba(234, 88, 12, .25));
}
.cm-logo-chat, .cm-logo-mate { -webkit-background-clip: text; background-clip: text; color: transparent; }
.cm-logo-chat { background-image: linear-gradient(135deg, light-dark(#ea580c, #fdba74), light-dark(#9a3412, #ea580c)); }
.cm-logo-mate { background-image: linear-gradient(135deg, light-dark(#fb923c, #fff1e2), light-dark(#ea580c, #fb923c)); }
.nav { display: flex; gap: 2px; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px;
  color: var(--ink2); font-weight: 500; text-decoration: none;
}
.nav a:hover { color: var(--ink); background: var(--sunken); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--sunken); }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600;
}
.bar-r { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.queue {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--ink2); font-size: 13px;
}
.queue b { color: var(--ink); font-family: var(--font-d); font-size: 15px; font-weight: 700; }
.queue i { width: 1px; height: 14px; margin: 0 4px; background: var(--line2); }
.clock { color: var(--ink2); font-size: 13px; font-variant-numeric: tabular-nums; }
.theme-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
  background: none; color: var(--ink2); cursor: pointer; transition: background-color .15s, color .15s;
}
.theme-btn:hover { background: var(--sunken); color: var(--ink); }
.theme-btn .ic { width: 18px; height: 18px; }
.theme-btn .i-sun, .theme-btn[aria-pressed="true"] .i-moon { display: none; }
.theme-btn[aria-pressed="true"] .i-sun { display: block; }
.me { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; }
.me-av { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--sunken); font-size: 12px; font-weight: 600; }

/* ---------- Work area: fan | conversation | model ---------- */
.work {
  flex: 1; min-height: 0; display: grid; gap: 16px; padding: 16px;
  grid-template-columns: minmax(264px, 300px) minmax(0, 1fr) minmax(284px, 320px);
}
.panel {
  min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
}
.scroll { flex: 1; min-height: 0; overflow: auto; padding: 20px; scrollbar-width: none; }

/* Person head */
.who { display: flex; align-items: center; gap: 14px; }
.av {
  display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 50%;
  color: #fff; font-family: var(--font-d); font-size: 19px; font-weight: 700;
}
.av-fan { background: #4a6378; }
.av-model { background: #8a4a62; }
.who-t { min-width: 0; }
.who h2 {
  margin: 0; display: flex; align-items: center; gap: 6px;
  font-family: var(--font-d); font-size: 20px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2;
}
.who .age { color: var(--ink3); font-weight: 600; }
.who h2 .ic { color: var(--ink3); }
.status { margin: 4px 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; color: var(--ink2); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.off { background: var(--line2); box-shadow: none; }
/* Real pictures fill their frame (avatar, tiles, chat images, picker, attachment) */
.av { overflow: hidden; }
.av img, .tile img, .img img, .pick img, .thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.tile, .pick, .img, .thumb { overflow: hidden; background-color: var(--sunken); }
.pf-icon { height: 1.35em; width: auto; vertical-align: -.32em; }
.as { margin: 14px 0 0; color: var(--ink2); font-size: 13px; }
/* Numbers and small labels */
.stats { margin: 18px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; }
.stats div { padding: 9px 12px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats dt { color: var(--ink3); font-size: 12px; }
.stats dd { margin: 1px 0 0; font-family: var(--font-d); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vip { margin: 10px 0 0; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 13px; }
.vip .ic { color: var(--accent-text); }
.vip b { font-weight: 600; }
.vip span { margin-left: auto; color: var(--ink2); font-variant-numeric: tabular-nums; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px;
  background: var(--sunken); color: var(--ink2); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.heart { background: var(--heart-soft); color: var(--heart); }

/* Sections in the side columns */
.sec { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.sec-h { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.sec-h h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.sec-h .hint { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; color: var(--ink3); font-size: 12px; }
.sec-h .hint .ic { width: 14px; height: 14px; }
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tile {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 0; border-radius: 10px;
  color: rgba(255, 255, 255, .9); cursor: zoom-in; transition: transform .15s var(--ease);
}
.tile:hover { transform: scale(1.04); }
.tile.more { background: var(--sunken); color: var(--ink2); font-size: 13px; font-weight: 600; cursor: pointer; }
/* placeholder colours of the fictional example: doubled class so they win over the tiles' own background */
.ph1.ph1 { background-color: #c9a68a; } .ph2.ph2 { background-color: #8fa3b5; } .ph3.ph3 { background-color: #b98c9a; }
.ph4.ph4 { background-color: #9cae93; } .ph5.ph5 { background-color: #a99bc2; } .ph6.ph6 { background-color: #c7b07a; }
/* Facts: label above value, two columns; lists as chips and long texts across the full width */
.fgrid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.fgrid + .fgrid { margin-top: 12px; }
.fgrid > div { min-width: 0; }
.fgrid > .wide { grid-column: 1 / -1; }
.fgrid dt { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; color: var(--ink3); font-size: 12px; line-height: 16px; }
.fgrid dd { margin: 0; font-size: 13.5px; font-weight: 500; line-height: 20px; overflow-wrap: anywhere; }
.fgrid .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fgrid dd > span:not(.chips) { font-weight: 400; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips > span {
  display: inline-flex; align-items: center; min-height: 24px; padding: 2px 9px; border-radius: 999px;
  background: var(--sunken); color: var(--ink); font-size: 12.5px; font-weight: 500; line-height: 1.35;
}
.chip-more, .more-link {
  padding: 0 4px; border: 0; background: none; color: var(--accent-text); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.more-link { display: block; margin-top: 2px; padding: 0; }
.chip-more:hover, .more-link:hover { text-decoration: underline; }
.diff { display: inline-flex; color: var(--warn); cursor: help; }
.diff .ic { width: 13px; height: 13px; }
.diff-note { margin: 0 0 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; }
.diff-note summary { display: flex; gap: 8px; padding: 9px 12px; list-style: none; cursor: pointer; }
.diff-note summary::-webkit-details-marker { display: none; }
.diff-note summary .ic { flex: none; margin-top: 1px; width: 15px; height: 15px; }
.diff-note b { font-weight: 600; }
.diff-note ul { margin: 0; padding: 0 12px 10px 35px; display: grid; gap: 3px; color: var(--ink); }
.diff-note li span { color: var(--ink3); }
/* One line under the fan's name */
.summary { margin: 10px 0 0; color: var(--ink2); font-size: 13px; line-height: 1.45; }

/* "Merken": one field, choose where it goes, Enter saves and returns to the reply */
.quick { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border: 1px solid var(--line2); border-radius: 12px; background: var(--page); transition: border-color .15s, box-shadow .15s; }
.quick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.quick input { flex: 1; min-width: 0; height: 32px; padding: 0; border: 0; outline: 0; background: none; font-size: 13.5px; }
.quick input::placeholder { color: var(--ink3); }
.quick-go { display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 9px; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.quick-go .ic { stroke-width: 2.2; }
.quick-to { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 8px; }

.quick-l { margin-right: 2px; color: var(--ink3); font-size: 12px; }
.qopt {
  height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink2); font-size: 12.5px; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s;
}
.qopt:hover { border-color: var(--line2); color: var(--ink); }
.qopt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.qopt.more { border-style: dashed; color: var(--ink3); }
.nlist { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.nlist li { position: relative; padding: 8px 34px 8px 12px; border-radius: 10px; background: var(--sunken); }
.nlist p { margin: 0; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
/* a note is changed in place: click the text, Enter saves (like the Steckbrief values) */
.nval {
  display: block; width: 100%; margin: 0; padding: 0; border: 0; background: none; color: var(--ink);
  font-size: 13.5px; line-height: 1.45; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text;
}
.nlist li:has(.nval:hover) { box-shadow: inset 0 0 0 1px var(--line2); }
.nlist li.editing { padding-right: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.note-in {
  display: block; width: 100%; min-height: 1.45em; margin: 0; padding: 0; border: 0; outline: 0; background: none;
  color: var(--ink); font-size: 13.5px; line-height: 1.45; resize: none; field-sizing: content;
}
.nmeta { display: block; margin-top: 2px; color: var(--ink3); font-size: 11.5px; }
.ndel { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; opacity: 0; transition: opacity .15s; }
.nlist li:hover .ndel, .ndel:focus-visible { opacity: 1; }
.fgrid > div.flash { animation: flash 1.6s var(--ease); border-radius: 8px; }
@keyframes flash { 0%, 35% { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }

.quick-tip { margin: 6px 0 0 2px; color: var(--ink3); font-size: 12px; }
/* the model's own fields for this chat, below her notes */
#mfacts { margin-top: 18px; }

/* Right-click menu of the mask (a popover, so it also sits above the image picker) */
.ctx {
  position: fixed; inset: auto; margin: 0; min-width: 220px; max-width: min(300px, calc(100vw - 16px)); padding: 6px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--pop);
  font-family: var(--font); font-size: 13.5px; animation: pop-in .12s var(--ease);
}
.ctx-t { margin: 2px 6px 6px; overflow: hidden; color: var(--ink2); font-size: 12.5px; font-style: italic; white-space: nowrap; text-overflow: ellipsis; }
.ctx-h { margin: 6px 8px 2px; color: var(--ink3); font-size: 11.5px; font-weight: 600; }
.ctx-sep { margin: 6px 4px; border: 0; border-top: 1px solid var(--line); }
.ctx button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 9px;
  background: none; color: var(--ink); font-size: 13.5px; text-align: left; cursor: pointer;
}
.ctx button .ic { color: var(--ink3); }
.ctx button:hover, .ctx button:focus-visible { background: var(--sunken); outline: none; }
.ctx button:hover .ic, .ctx button:focus-visible .ic { color: var(--accent-text); }
.ctx button:disabled { color: var(--ink3); cursor: default; background: none; }

/* The fan's Steckbrief: topic groups; only the exception (own or profile value) carries a small mark */
.src .ic { width: 14px; height: 14px; }
.src { display: inline-flex; margin-left: 2px; color: var(--ink3); opacity: .8; }
.fgroup + .fgroup { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.fgroup h4 { margin: 0 0 10px; color: var(--ink2); font-size: 12.5px; font-weight: 600; }
.val.long, .ro.long { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-weight: 400; }
.val.long:focus-visible, .val.long:hover, .ro.long:hover { -webkit-line-clamp: unset; }
/* values from his profile: plain text, nothing suggests they can be changed */
.ro { display: block; font-size: 13.5px; font-weight: 500; line-height: 20px; cursor: default; }
.taboo-none { margin: 16px 0 0; display: flex; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line2); border-radius: 12px; color: var(--ink2); font-size: 12.5px; }
.taboo-none .ic { margin-top: 1px; color: var(--ink3); }
.taboo-none b { color: var(--ink); font-weight: 600; }
/* Editable fan facts */
.val {
  display: block; width: calc(100% + 12px); margin: -3px -6px; padding: 3px 6px; border: 0; border-radius: 7px; background: none;
  font-size: 13.5px; font-weight: 500; line-height: 20px; text-align: left; cursor: text; transition: background-color .15s;
}
.val:hover { background: var(--sunken); }
/* a field nobody filled yet: a quiet dash, a click fills it in */
.val.unset { color: var(--ink3); font-weight: 400; }
.val.unset:hover { color: var(--ink2); }
.val.list:hover .chips > span { background: var(--surface); }
/* the field being edited takes exactly the place of its value (same box as .val) - nothing below moves */
.val-in {
  display: block; width: calc(100% + 12px); height: 26px; margin: -3px -6px; padding: 0 6px; border: 1px solid var(--accent);
  border-radius: 7px; background: var(--surface); font-size: 13.5px; line-height: 20px; outline: 0; box-shadow: 0 0 0 3px var(--accent-soft);
}
.add-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.add-f {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border: 1px dashed var(--line2);
  border-radius: 999px; background: none; color: var(--ink2); font-size: 12.5px; cursor: pointer;
}
.add-f .ic { width: 13px; height: 13px; }
.add-f:hover { color: var(--ink); border-color: var(--ink3); border-style: solid; }
.more-btn {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
  border: 0; border-radius: 9px; background: none; color: var(--accent-text); font-size: 13px; font-weight: 600; cursor: pointer;
}
.more-btn .ic { width: 14px; height: 14px; }
.more-btn:hover { background: var(--accent-soft); }

/* Model pictures: FSK on each, the ones this fan already got are marked */
.mgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.mtile {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 0; border-radius: 10px;
  overflow: hidden; background-color: var(--sunken); color: rgba(255, 255, 255, .9); cursor: zoom-in;
}
.mtile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s var(--ease); }
.mtile:hover img { transform: scale(1.05); }
.mtile .fsk {
  position: absolute; left: 5px; bottom: 5px; min-width: 22px; height: 18px; padding: 0 5px; border-radius: 5px;
  background: rgba(20, 18, 15, .72); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.mtile .fsk.f16 { background: rgba(125, 83, 4, .9); }
.mtile .fsk.f18 { background: rgba(176, 58, 46, .92); }
.mtile.sent img { opacity: .45; }
.mtile .was {
  position: absolute; top: 5px; right: 5px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--ok); color: #fff;
}
.mtile .was .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.mtile.more { flex-direction: column; background: var(--sunken); color: var(--ink); font-size: 16px; font-weight: 700; cursor: pointer; }
.mtile.more small { color: var(--ink3); font-size: 11.5px; font-weight: 500; }
button.av { padding: 0; border: 0; cursor: zoom-in; }
.notes { display: block; margin-top: 16px; }
.notes span { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.notes textarea {
  display: block; width: 100%; min-height: 88px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--page); font-size: 13.5px; line-height: 1.5; resize: vertical;
}
.notes textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Taboos: always visible at the top of the model column */
.taboo { margin: 16px 0 0; display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--bad-line); border-radius: 12px; background: var(--bad-soft); }
.taboo > .ic { margin-top: 2px; width: 18px; height: 18px; color: var(--bad); }
.taboo h3 { margin: 0 0 7px; color: var(--bad); font-size: 13.5px; font-weight: 700; }
.taboo ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.taboo li { padding: 2px 8px; border: 1px solid var(--bad-line); border-radius: 6px; background: var(--surface); font-size: 12.5px; font-weight: 500; }
.ptext + .ptext { border-top: 1px solid var(--line); }
.ptext summary {
  display: flex; align-items: center; justify-content: space-between; padding: 9px 0;
  list-style: none; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.ptext summary::-webkit-details-marker { display: none; }
.ptext summary .ic { color: var(--ink3); transition: transform .2s var(--ease); }
.ptext[open] summary .ic { transform: rotate(180deg); }
.ptext p { margin: 0 0 12px; color: var(--ink2); font-size: 13.5px; line-height: 1.6; }

/* ---------- Conversation ---------- */
.chat { position: relative; box-shadow: var(--shadow); }
.chat-h { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.plat { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 8px; background: var(--sunken); font-size: 12.5px; font-weight: 600; }
.chat-h h1 { margin: 0; font-family: var(--font-d); font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.state { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.state .ic { width: 14px; height: 14px; }
.state.wait { background: var(--accent-soft); color: var(--accent-text); }
.state.calm { background: var(--sunken); color: var(--ink2); }
.state.ok { background: var(--ok-soft); color: var(--ok); }
.state.lock { background: var(--bad-soft); color: var(--bad); }
.note { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--sunken); color: var(--ink2); font-size: 13px; line-height: 1.5; }
.chat .note { flex: none; margin: 12px 16px 0; }
.note > .ic { margin-top: 2px; }
.note b { color: var(--ink); font-weight: 600; }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.bad b { color: inherit; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.warn b, .note.ok b { color: inherit; }
.log {
  flex: 1; min-height: 0; display: flex; flex-direction: column-reverse; overflow: auto; scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent 0, #000 14px);
}
.strip-empty { margin: 0; color: var(--ink3); font-size: 13px; }
.log-in { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 10px; }
.day { align-self: center; margin: 6px 0 0; padding: 3px 10px; border-radius: 999px; background: var(--sunken); color: var(--ink3); font-size: 12px; font-weight: 600; }
.empty { align-self: center; max-width: 380px; margin: 48px auto; color: var(--ink2); text-align: center; }
.empty .ic { width: 28px; height: 28px; color: var(--ink3); }
.empty b { display: block; margin: 10px 0 4px; color: var(--ink); font-size: 15px; }
.empty p { margin: 0; }

/* Messages */
.row { display: flex; flex-direction: column; align-items: flex-start; max-width: min(76%, 600px); }
.row.us { align-self: flex-end; align-items: flex-end; }
.row.new { animation: msg-in .3s var(--ease); }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.bub { padding: 10px 14px; border-radius: 18px; background: var(--them); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.bub p { margin: 0; }
/* A bubble with an image stays photo-sized; the caption wraps below it */
.bub:has(> .img) { width: 280px; max-width: 100%; padding: 6px 6px 10px; }
.bub:has(> .img) p { padding: 0 8px; }
.bub:has(> .img:last-child) { padding-bottom: 6px; }
.row.fan .bub { border-bottom-left-radius: 6px; }
.row.us .bub { background: var(--us); color: var(--us-ink); border-bottom-right-radius: 6px; }
.row.ext .bub { background: transparent; color: var(--ink); border: 1.5px dashed var(--line2); }
.row.failed .bub { box-shadow: 0 0 0 1.5px var(--bad); }
.img {
  display: grid; place-items: center; align-content: center; gap: 6px; width: 100%; aspect-ratio: 4 / 3;
  margin: 0 0 8px; padding: 0; border: 0; border-radius: 12px; color: rgba(255, 255, 255, .95);
  font-size: 12px; font-weight: 600; text-align: center;
}
button.img { position: relative; cursor: zoom-in; }
.img-tag {
  position: absolute; left: 8px; bottom: 8px; height: 22px; padding: 0 8px; border-radius: 6px;
  background: rgba(20, 18, 15, .72); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 22px;
}
.img.missing { aspect-ratio: auto; height: 96px; border: 1.5px dashed currentColor; background: transparent; color: inherit; opacity: .6; font-weight: 500; }
.img.missing .ic { width: 20px; height: 20px; }
.img:last-child { margin-bottom: 0; }
.img .ic { width: 24px; height: 24px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; padding: 0 4px; color: var(--ink3); font-size: 12px; }
.row.us .meta { justify-content: flex-end; }
/* the platform's automatic welcome in a first contact's history: her side, quieter than a real message */
.row.us.auto .bub { background: var(--sunken); color: var(--ink2); border: 1px dashed var(--line2); }
.auto-note { align-self: center; margin: 6px 0 0; color: var(--ink3); font-size: 12.5px; text-align: center; }
.meta time, .pay { font-variant-numeric: tabular-nums; }
.tick.read { color: var(--ok); }
.err { margin: 4px 0 0; padding: 0 4px; color: var(--bad); font-size: 12px; }
.react, .flag {
  display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink3); cursor: pointer;
  transition: color .15s, background-color .15s, border-color .15s, opacity .15s;
}
.react .ic, .flag .ic { width: 14px; height: 14px; }
.react:hover, .flag:hover { color: var(--ink); border-color: var(--line2); }
.react[aria-pressed="true"] { color: var(--heart); border-color: color-mix(in srgb, var(--heart) 40%, transparent); background: var(--heart-soft); }
.react[aria-pressed="true"] .ic { fill: currentColor; }
.react.pending { opacity: .6; cursor: progress; }
.react.failed { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft); }
/* reporting is rare: the flag only shows on the message under the pointer (and in the right-click menu) */
.flag { opacity: 0; }
.row:hover .flag, .row:focus-within .flag, .flag:focus-visible { opacity: 1; }

/* Report dialog: the message, then one click on a reason */
dialog.report { width: min(500px, calc(100vw - 32px)); }
.rp-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 18px 6px 22px; }
.rp-head h3 { margin: 0 0 2px; font-family: var(--font-d); font-size: 19px; font-weight: 700; }
.rp-head p { margin: 0; color: var(--ink2); font-size: 13px; }
.rp-msg { margin: 12px 22px 0; padding: 10px 14px; border-radius: 12px; background: var(--sunken); }
.rp-msg blockquote { margin: 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rp-msg figcaption { margin-top: 4px; color: var(--ink3); font-size: 12px; }
.rp-reasons { margin: 16px 22px 0; padding: 0; border: 0; display: grid; gap: 6px; }
.rp-reasons legend { margin-bottom: 8px; padding: 0; font-size: 13.5px; font-weight: 600; }
.rp-only { margin: 0 0 4px; display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--sunken); color: var(--ink2); font-size: 12.5px; line-height: 1.45; }
.rp-only .ic { flex: none; margin-top: 1px; color: var(--ink3); }
.rp-only b { color: var(--ink); font-weight: 600; }
.rp-opt {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer; transition: border-color .15s, background-color .15s;
}
.rp-opt:hover { border-color: var(--line2); background: var(--page); }
.rp-opt input {
  appearance: none; flex: none; width: 18px; height: 18px; margin: 1px 0 0; border: 1.5px solid var(--line2); border-radius: 50%;
  background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.rp-opt input:checked { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 9px var(--accent); }
.rp-opt input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rp-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.rp-opt b { display: block; font-size: 13.5px; font-weight: 600; }
.rp-opt small { display: block; margin-top: 1px; color: var(--ink3); font-size: 12px; }
.rp-note { padding: 12px 22px 0; }
.rp-note textarea { min-height: 64px; }
.typing { flex: none; display: flex; align-items: center; gap: 8px; padding: 2px 22px 6px; color: var(--ink3); font-size: 12.5px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---------- Composer ---------- */
.comp {
  flex: none; position: relative; margin: 6px 16px 16px; border: 1px solid var(--line2); border-radius: 16px;
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.comp:focus-within, .comp.focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.comp.off { background: var(--sunken); }
.comp.off .count, .comp.off .kbd { display: none; }
/* room for the prototype's "Ansicht" button at the bottom left */
@media (min-width: 701px) { body[data-page="maske"] #fan .scroll { padding-bottom: 64px; } }
.quote { display: flex; align-items: flex-start; gap: 10px; margin: 10px 10px 0; padding: 8px 12px; border-radius: 10px; background: var(--sunken); font-size: 13px; }
.quote > .ic { margin-top: 2px; color: var(--accent-text); }
.quote div { min-width: 0; }
.quote b { display: block; color: var(--ink2); font-size: 12px; font-weight: 600; }
.quote span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.att { display: inline-flex; align-items: center; gap: 10px; margin: 10px 10px 0; padding: 6px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; }
.thumb { flex: none; width: 40px; height: 40px; border-radius: 8px; }
.att b { display: block; font-weight: 600; }
.att small { display: block; color: var(--ink3); font-size: 12px; }
.ib { display: grid; place-items: center; flex: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink3); cursor: pointer; }
.ib:hover { background: var(--sunken); color: var(--ink); }
.comp textarea {
  display: block; width: 100%; min-height: 80px; padding: 12px 16px 4px; border: 0; outline: 0;
  background: transparent; font-size: 15px; line-height: 1.5; resize: none;
}
.comp textarea::placeholder { color: var(--ink3); }
.tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 10px 10px; }
.tool {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.tool:hover { background: var(--sunken); }
.tool[aria-expanded="true"] { background: var(--sunken); border-color: var(--line2); }
.tool:disabled { opacity: .5; cursor: not-allowed; }
.spacer { flex: 1; }
.count { color: var(--ink3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.count.near { color: var(--warn); font-weight: 600; }
.count.max { color: var(--bad); font-weight: 600; }
.kbd { display: inline-flex; align-items: center; gap: 4px; }
.kbd kbd { padding: 1px 6px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--ink2); font: inherit; font-size: 11.5px; }
.send {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--on-accent); font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: filter .15s, transform .1s;
}
.send:hover { filter: brightness(1.06); }
.send:active { transform: scale(.98); }
.send:disabled { background: var(--sunken); color: var(--ink3); cursor: not-allowed; filter: none; transform: none; }
/* Emojis: the most used ones always in a row under the reply (a click, no popup); "Emoji" opens the full picker above */
.emo-row { display: flex; gap: 2px; padding: 2px 10px 0; overflow-x: auto; scrollbar-width: none; }
.emo-row::-webkit-scrollbar { display: none; }
.emo {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px;
  background: none; font-size: 19px; line-height: 1; cursor: pointer; transition: background-color .15s, transform .1s;
}
.emo:hover { background: var(--sunken); }
.emo:active { transform: scale(.92); }
.emo:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.emo:disabled { opacity: .35; cursor: default; background: none; transform: none; }
.emoji {
  position: absolute; left: 10px; bottom: 92px; z-index: 5; width: min(392px, calc(100% - 20px)); overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--pop); animation: pop-in .16s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(4px) scale(.98); } }
emoji-picker {
  display: block; width: 100%; height: 380px; font-family: var(--font);
  /* the picker sets color-scheme: light on itself - our light-dark() colours would stay light in the dark theme */
  color-scheme: inherit;
  --background: var(--surface); --border-color: var(--line); --border-size: 1px; --border-radius: 0;
  --button-active-background: var(--sunken); --button-hover-background: var(--sunken);
  --indicator-color: var(--accent); --indicator-height: 2px; --outline-color: var(--accent); --outline-size: 2px;
  --input-border-color: var(--line2); --input-border-radius: 10px; --input-font-color: var(--ink); --input-font-size: 14px;
  --input-placeholder-color: var(--ink3); --input-padding: .45rem .75rem; --input-line-height: 1.4;
  --category-font-color: var(--ink2); --category-font-size: 12.5px;
  --num-columns: 9; --emoji-size: 1.4rem; --emoji-padding: .38rem; --skintone-border-radius: 10px;
}

/* Overlay while the account's browser opens the chat */
.opening {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(3px);
}
.card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.load { display: flex; align-items: center; gap: 16px; max-width: 460px; padding: 20px 22px; box-shadow: var(--pop); }
.spin { flex: none; width: 28px; height: 28px; border: 3px solid var(--sunken); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.load b { display: block; font-size: 15px; font-weight: 600; }
.load span { color: var(--ink2); font-size: 13px; }

/* Empty queue */
.work.is-empty { display: grid; place-items: center; grid-template-columns: minmax(0, 1fr); }
.emptyc { display: flex; flex-direction: column; align-items: center; max-width: 440px; padding: 36px 28px; text-align: center; }
.emptyc > .ic { width: 32px; height: 32px; color: var(--ink3); }
.emptyc b { margin: 12px 0 4px; font-size: 16px; font-weight: 600; }
.emptyc p { max-width: 40ch; margin: 0; color: var(--ink2); }
/* not unlocked yet: the two steps before the first chat */
.gatec { max-width: 460px; }
.gate-list { align-self: stretch; margin: 20px 0 22px; padding: 0; list-style: none; display: grid; gap: 8px; text-align: left; }
.gate-list li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--sunken); }
.gate-list li > div { flex: 1; min-width: 0; }
.gate-list b { display: block; margin: 0; font-size: 14px; }
.gate-list span:not(.gate-ic):not(.gate-bar) { display: block; color: var(--ink2); font-size: 13px; }
.gate-ic { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); color: var(--ink3); }
.gate-ic .ic { width: 15px; height: 15px; }
.gate-list li.ok .gate-ic { background: var(--ok); color: #fff; }
.gate-list li.ok .gate-ic .ic { stroke-width: 2.6; }
.gate-bar { display: block; height: 6px; margin-top: 8px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.gate-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.gatec .btn { text-decoration: none; }

/* ---------- Dialogs (native <dialog>) ---------- */
dialog.dlg {
  width: min(780px, calc(100vw - 32px)); max-height: min(720px, calc(100dvh - 32px)); padding: 0; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--ink); box-shadow: var(--pop); overflow: hidden;
  opacity: 0; transform: translateY(10px) scale(.98);
  transition: opacity .2s var(--ease), transform .2s var(--ease), overlay .2s allow-discrete, display .2s allow-discrete;
}
dialog.dlg[open] { display: flex; flex-direction: column; opacity: 1; transform: none; }
@starting-style { dialog.dlg[open] { opacity: 0; transform: translateY(10px) scale(.98); } }
dialog.dlg::backdrop { background: var(--scrim); opacity: 0; transition: opacity .2s, overlay .2s allow-discrete, display .2s allow-discrete; }
dialog.dlg[open]::backdrop { opacity: 1; }
@starting-style { dialog.dlg[open]::backdrop { opacity: 0; } }
dialog.dlg.sm { width: min(480px, calc(100vw - 32px)); }
dialog.dlg form { display: contents; }
.dlg-h { flex: none; display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px 22px; border-bottom: 1px solid var(--line); }
.dlg-h h2 { margin: 0; font-family: var(--font-d); font-size: 20px; font-weight: 700; }
.dlg-h p { margin: 2px 0 0; color: var(--ink3); font-size: 13px; }
.x {
  margin-left: auto; display: grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink2); cursor: pointer;
}
.x:hover { background: var(--sunken); color: var(--ink); }
.dlg-scroll { overflow: auto; padding: 4px 22px 22px; }
.dlg-card { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--pop); overflow: hidden; }
.dlg-b { display: flex; gap: 14px; padding: 22px 22px 4px; }
.dlg-ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; }
.dlg-ic .ic { width: 20px; height: 20px; }
.dlg-ic.bad { background: var(--bad-soft); color: var(--bad); }
.dlg-ic.warn { background: var(--warn-soft); color: var(--warn); }
.dlg-b h3 { margin: 0 0 4px; font-family: var(--font-d); font-size: 19px; font-weight: 700; }
.dlg-b p { margin: 0; color: var(--ink2); }
.dlg-q { margin: 12px 0 0 !important; padding: 8px 12px; border-radius: 10px; background: var(--sunken); color: var(--ink) !important; font-size: 13.5px; overflow-wrap: anywhere; }
.dlg-q mark { padding: 0 2px; border-radius: 3px; background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.dlg-f { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 18px 22px 20px; }
.btn, .btn2 {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 12px; font-size: 14px; cursor: pointer; transition: filter .15s, background-color .15s;
}
.btn { border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn:hover { filter: brightness(1.06); }
.btn2 { border: 1px solid var(--line2); background: var(--surface); color: var(--ink); font-weight: 500; }
.btn2:hover { background: var(--sunken); }
.field { display: block; padding: 14px 22px 0; }
.field span { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.field textarea { display: block; width: 100%; min-height: 84px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--page); font-size: 14px; resize: vertical; }
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Image picker: filters on top, grid left, the chosen picture large on the right */
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 700; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
dialog.picker { width: min(1040px, calc(100vw - 32px)); height: min(720px, calc(100dvh - 32px)); max-height: none; }
.pk-head { flex: none; display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 14px 24px; }
.pk-head h2 { margin: 0; font-family: var(--font-d); font-size: 20px; font-weight: 700; }
.pk-head p { margin: 2px 0 0; color: var(--ink3); font-size: 13px; }
.pk-bar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 0 24px 14px; border-bottom: 1px solid var(--line); }
.pk-filter { display: flex; gap: 2px; max-width: 100%; padding: 3px; overflow-x: auto; border-radius: 12px; background: var(--sunken); }
.pk-f {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 30px; padding: 0 12px; border: 0; border-radius: 9px;
  background: none; color: var(--ink2); font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .15s, color .15s, box-shadow .15s;
}
.pk-f span { color: var(--ink3); font-size: 12px; font-variant-numeric: tabular-nums; }
.pk-f:hover { color: var(--ink); }
.pk-f[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--shadow-c), 0 0 0 1px var(--line); }
.pk-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--ink2); font-size: 13px; cursor: pointer; }
.pk-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.pk-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.pk-grid {
  min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px;
  align-content: start; padding: 16px 16px 24px 24px;
}
/* the tile keeps its 3:4 size in the grid; the picture is clipped by an inner layer (overflow on the tile would let rows collapse) */
.pk-tile {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; padding: 0; border: 0; border-radius: 12px;
  background-color: var(--sunken); color: rgba(255, 255, 255, .9); cursor: pointer;
}
.pk-img { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; overflow: hidden; }
.pk-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s var(--ease), opacity .15s; }
.pk-tile:hover .pk-img img { transform: scale(1.04); }
.pk-tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 0 var(--accent); transition: box-shadow .15s; pointer-events: none; }
.pk-tile[aria-selected="true"]::after { box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 5px var(--surface); }
.pk-tile:focus-visible { outline: none; }
.pk-tile:focus-visible::after { box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 5px var(--surface); }
.pk-tile.sent .pk-img img { opacity: .38; }
.pk-fsk {
  position: absolute; left: 6px; top: 6px; min-width: 22px; height: 18px; padding: 0 5px; border-radius: 5px;
  background: rgba(20, 18, 15, .72); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.pk-fsk.f16 { background: rgba(125, 83, 4, .9); }
.pk-fsk.f18 { background: rgba(176, 58, 46, .92); }
.pk-price {
  position: absolute; right: 6px; bottom: 6px; height: 20px; padding: 0 7px; border-radius: 6px;
  background: rgba(20, 18, 15, .74); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 20px;
}
.pk-price.free { background: rgba(18, 99, 63, .88); }
.pk-was {
  position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px 0 5px;
  border-radius: 6px; background: var(--ok); color: #fff; font-size: 11px; font-weight: 600; line-height: 20px;
}
.pk-was .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.pk-side { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 14px; padding: 16px 24px 24px 18px; border-left: 1px solid var(--line); }
.pk-prev {
  position: relative; flex: none; display: grid; place-items: center; aspect-ratio: 3 / 4; max-height: 330px; border-radius: 14px; overflow: hidden;
  background: #0c0b0a; color: rgba(255, 255, 255, .85);
}
.pk-prev img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pk-prev .ic { width: 36px; height: 36px; }
.pk-zoom {
  position: absolute; right: 8px; top: 8px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0;
  border-radius: 9px; background: rgba(20, 18, 15, .6); color: #fff; cursor: zoom-in;
}
.pk-zoom .ic { width: 16px; height: 16px; }
.pk-info b { font-size: 15px; font-weight: 600; }
.pk-tags { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.pk-cost { font-family: var(--font-d); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pk-cost.free { color: var(--ok); }
.pk-info p { margin: 0 0 6px; color: var(--ink2); font-size: 13px; line-height: 1.5; }
.pk-info .pk-note { color: var(--ink3); }
.pk-info .pk-status { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--ok); font-weight: 600; }
.pk-go { width: 100%; margin-top: auto; flex: none; }
.pk-go kbd { margin-left: 4px; padding: 0 5px; border: 1px solid currentColor; border-radius: 5px; font: inherit; font-size: 11px; font-weight: 600; opacity: .55; }
.pk-go:disabled { background: var(--sunken); color: var(--ink3); cursor: default; filter: none; }
.pk-empty { grid-column: 1 / -1; margin: 48px auto; color: var(--ink3); font-size: 13px; text-align: center; }

/* Image viewer */
dialog.viewer {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0;
  background: transparent; color: #f5f5f4; opacity: 0;
  transition: opacity .2s var(--ease), overlay .2s allow-discrete, display .2s allow-discrete;
}
dialog.viewer[open] { display: flex; flex-direction: column; opacity: 1; }
@starting-style { dialog.viewer[open] { opacity: 0; } }
/* dark glass: the mask stays faintly visible behind; a click anywhere around the picture closes */
dialog.viewer::backdrop {
  background: rgba(12, 11, 10, .74); -webkit-backdrop-filter: blur(14px) saturate(1.05); backdrop-filter: blur(14px) saturate(1.05);
  opacity: 0; transition: opacity .2s, overlay .2s allow-discrete, display .2s allow-discrete;
}
dialog.viewer[open]::backdrop { opacity: 1; }
@starting-style { dialog.viewer[open]::backdrop { opacity: 0; } }
dialog.viewer { cursor: zoom-out; }
dialog.viewer img, dialog.viewer button, dialog.viewer .vw-text { cursor: auto; }
dialog.viewer button { cursor: pointer; }
.vw-head { flex: none; display: flex; align-items: center; gap: 16px; padding: 14px 16px 14px 24px; }
.vw-count { flex: none; min-width: 52px; color: rgba(245, 245, 244, .6); font-size: 13px; font-variant-numeric: tabular-nums; }
.vw-text { min-width: 0; flex: 1; }
.vw-text b { display: block; font-size: 15px; font-weight: 600; }
.vw-text span { display: block; overflow: hidden; color: rgba(245, 245, 244, .62); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.vw-x, .vw-nav {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; transition: background-color .15s;
}
.vw-x:hover, .vw-nav:hover { background: rgba(255, 255, 255, .2); }
.vw-x .ic, .vw-nav .ic { width: 20px; height: 20px; }
.vw-nav .ic { transform: rotate(90deg); }
.vw-nav.next .ic { transform: rotate(-90deg); }
#vw-attach:disabled { background: rgba(255, 255, 255, .12); color: rgba(245, 245, 244, .7); cursor: default; filter: none; }
.vw-stage { flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 16px; padding: 0 16px; }
.vw-nav { align-self: center; }
.vw-img { position: relative; flex: 1; min-width: 0; display: grid; place-items: center; border-radius: 12px; color: rgba(255, 255, 255, .85); }
.vw-img img { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.vw-img .ic { width: 56px; height: 56px; }
.vw-img[class*=" ph"] { flex: 0 1 420px; height: auto; max-height: 100%; aspect-ratio: 4 / 5; margin: auto; }
.vw-foot { flex: none; display: flex; justify-content: center; padding: 14px 16px 0; }
.vw-foot:has(> [hidden]) { display: none; }
.vw-strip { flex: none; display: flex; gap: 6px; padding: 14px 16px 18px; overflow-x: auto; justify-content: safe center; scrollbar-width: none; }
.vw-th {
  flex: none; width: 56px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden;
  background-color: rgba(255, 255, 255, .08); opacity: .55; cursor: pointer; transition: opacity .15s, border-color .15s;
}
.vw-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vw-th:hover { opacity: .85; }
.vw-th[aria-current="true"] { border-color: var(--accent); opacity: 1; }

/* Toasts */
.toasts {
  /* top centre: never on top of the reply field */
  position: fixed; left: 50%; top: 68px; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px;
  transform: translateX(-50%); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 14px;
  background: var(--toast); color: #f5f5f4; font-size: 13.5px; box-shadow: var(--pop); animation: toast-in .25s var(--ease);
}
.toast .ic { width: 18px; height: 18px; color: #4ec98a; }
.toast-act {
  margin-left: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .12);
  color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; pointer-events: auto;
}
.toast-act:hover { background: rgba(255, 255, 255, .22); }
.toast.bad .ic { color: #ff8878; }
.toast.warn .ic { color: #e0a93c; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Sheets (Nachrichten, Hinweise) ---------- */
.sheet { max-width: 1440px; margin: 0 auto; padding: 56px 64px 96px; }
.sheet-h h1 { margin: 0; font-family: var(--font-d); font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.sheet-h p { margin: 8px 0 0; max-width: 72ch; color: var(--ink2); font-size: 15px; }
.cols4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; margin-top: 40px; }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px; margin-top: 40px; }
.col h2 { margin: 0 0 20px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; }
.spec { display: flex; flex-direction: column; margin-bottom: 28px; }
.spec-l { margin-bottom: 8px; color: var(--ink3); font-size: 12.5px; }
.sheet .row { max-width: 100%; }
.sheet .bub:has(> .img) { width: 220px; }
.sheet .err { text-align: right; }
.blk { margin-bottom: 44px; }
.blk > h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.blk > .lead { margin: 0 0 16px; color: var(--ink3); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack .spec-l { margin: 6px 0 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.sheet .comp { margin: 0; }
.sheet .typing { padding: 0 4px; }
.sheet .toast { animation: none; }

/* ---------- Smaller screens: conversation first, then fan and model ---------- */
@media (max-width: 1100px) {
  .app { height: auto; min-height: 100vh; overflow: visible; }
  .work { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat { grid-column: 1 / -1; order: -1; height: 86vh; height: 86dvh; }
  .scroll { overflow: visible; }
  .cols4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .bar { padding: 8px 12px; gap: 8px 12px; }
  /* six sections do not fit next to each other: the row scrolls, the current one is kept in view (thema.js) */
  .nav { overflow-x: auto; scrollbar-width: none; --fl: 28px; --fr: 28px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent); mask-image: linear-gradient(90deg, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent); }
  .nav.at-start { --fl: 0px; }
  .nav.at-end { --fr: 0px; }
  .nav a { flex: none; }
  .nav a { gap: 6px; padding: 0 7px; font-size: 13.5px; }
  /* logo and the right-hand controls share the first row, the sections get the second */
  .bar-r { order: 1; gap: 10px; }
  .nav { order: 2; flex: 1 0 100%; }
  .clock, .me, .kbd { display: none; }
  .work { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 10px; }
  .chat { height: 88vh; height: 88dvh; }
  .chat-h { padding: 12px 16px; }
  .chat .note { margin: 10px 12px 0; }
  .log-in { padding: 14px 12px 8px; }
  .row { max-width: 88%; }
  .comp { margin: 6px 10px 10px; }
  .tool { padding: 0 11px; }
  /* picker on a phone: grid on top, the chosen picture as a slim bar with "Anhängen" at the bottom */
  dialog.picker { height: 92dvh; }
  .pk-head { padding: 16px 12px 10px 16px; }
  .pk-bar { padding: 0 12px 10px; }
  .pk-toggle { margin-left: 0; }
  .pk-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .pk-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px; }
  .pk-side { flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .pk-prev { width: 48px; aspect-ratio: 1; border-radius: 10px; }
  .pk-zoom, .pk-info p { display: none; }
  .pk-info { flex: 1; min-width: 0; }
  .pk-tags { margin: 2px 0 0; }
  .pk-go { width: auto; margin: 0; }
  .pk-go kbd { display: none; }
  .tool .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  dialog.dlg:not(.sm):not(.lightbox) { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .sheet { padding: 32px 16px 96px; }
  .cols4 { grid-template-columns: minmax(0, 1fr); }
  .vw-head { gap: 10px; padding: 10px 10px 10px 16px; }
  .vw-count { min-width: 0; }
  .vw-stage { gap: 0; padding: 0 4px; }
  .vw-nav { width: 38px; height: 38px; background: rgba(255, 255, 255, .14); }
  .vw-foot .btn { width: 100%; }
  .vw-th { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
