/* EroBlush. Tokens and components follow design/canvas/Ember.dc.html.
   The server's Content-Security-Policy forbids inline styles, so every rule lives here. */

/* Fonts: self-hosted Inter and Newsreader (SIL Open Font License, see fonts/*-OFL.txt). */
@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.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: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.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: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.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: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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: Newsreader; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/newsreader-latin-400-normal.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: Newsreader; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/newsreader-latin-500-normal.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: Newsreader; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/newsreader-latin-400-italic.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: Newsreader; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/newsreader-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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: Newsreader; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/newsreader-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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: Newsreader; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/newsreader-latin-ext-400-italic.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,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; }

/* Tokens. Light is the base; dark applies when the system asks for it, unless the switch on
   the You screen has set data-theme on <html>. The dark block is written twice for that. */
:root {
  color-scheme: light;
  --bg: #FDF6F7; --surface: #FFFFFF; --raised: #F9ECEF; --line: #EFDDE2; --text: #21161A;
  --muted: #72606A; --accent: #C2255C; --on-accent: #FFFFFF; --accent-text: #AD1F51;
  --soft: #FDE4EC; --soft-line: #F3B6C9; --bubble: #F5E8EC; --scrim: rgba(31, 23, 20, 0.45);
  --danger: #B3261E; --shadow: 0 24px 60px rgba(31, 23, 20, 0.2);
  --amber-bg: #F6DDAE; --amber-fg: #7A4A00; --blue-bg: #DCE8FB; --blue-fg: #1F4B8F;
  --teal-bg: #CFEDE6; --teal-fg: #0B5A4A; --plum-bg: #EEDCF5; --plum-fg: #6A2A80;
  --coral-bg: #FBD0DD; --coral-fg: #9C1C49; --slate-bg: #E4E6EC; --slate-fg: #3A4252;
  --serif: Newsreader, Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --mono: ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #151012; --surface: #1E171A; --raised: #1A1316; --line: #34282D; --text: #F6ECEF;
    --muted: #B5A2A9; --accent: #FF8FB0; --on-accent: #2E0A17; --accent-text: #FF9FBB;
    --soft: #2C151D; --soft-line: #5E2B3D; --bubble: #2E2428; --scrim: rgba(0, 0, 0, 0.6);
    --danger: #FF9A8F; --shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    --amber-bg: #3B2E14; --amber-fg: #F5B95F; --blue-bg: #172B45; --blue-fg: #8DB8F5;
    --teal-bg: #14332E; --teal-fg: #7FD6C2; --plum-bg: #35203A; --plum-fg: #E3A4EE;
    --coral-bg: #4A1C2B; --coral-fg: #FF9FBB; --slate-bg: #252A35; --slate-fg: #C9CDD6;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151012; --surface: #1E171A; --raised: #1A1316; --line: #34282D; --text: #F6ECEF;
  --muted: #B5A2A9; --accent: #FF8FB0; --on-accent: #2E0A17; --accent-text: #FF9FBB;
  --soft: #2C151D; --soft-line: #5E2B3D; --bubble: #2E2428; --scrim: rgba(0, 0, 0, 0.6);
  --danger: #FF9A8F; --shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  --amber-bg: #3B2E14; --amber-fg: #F5B95F; --blue-bg: #172B45; --blue-fg: #8DB8F5;
  --teal-bg: #14332E; --teal-fg: #7FD6C2; --plum-bg: #35203A; --plum-fg: #E3A4EE;
  --coral-bg: #4A1C2B; --coral-fg: #FF9FBB; --slate-bg: #252A35; --slate-fg: #C9CDD6;
}
.tint-amber { --tint-bg: var(--amber-bg); --tint-fg: var(--amber-fg); }
.tint-blue { --tint-bg: var(--blue-bg); --tint-fg: var(--blue-fg); }
.tint-teal { --tint-bg: var(--teal-bg); --tint-fg: var(--teal-fg); }
.tint-plum { --tint-bg: var(--plum-bg); --tint-fg: var(--plum-fg); }
.tint-coral { --tint-bg: var(--coral-bg); --tint-fg: var(--coral-fg); }
.tint-slate { --tint-bg: var(--slate-bg); --tint-fg: var(--slate-fg); }
.tint-plain { --tint-bg: var(--bubble); --tint-fg: var(--text); }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: flex; overflow: hidden; height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.35; -webkit-text-size-adjust: 100%; }
h1, h2, h3, p, figure { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
button:disabled { cursor: default; opacity: 0.55; }
a { color: var(--accent-text); }
svg { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; }
.gap2 { gap: 2px; } .gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap14 { gap: 14px; }
.line { display: flex; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { font-family: var(--serif); font-weight: 500; }
.brand em { font-style: italic; color: var(--accent-text); }

/* Shell: sidebar on wide screens, bottom tab bar on narrow ones. */
#side { display: none; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; outline: 0; }
#tabs { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--raised); border-top: 1px solid var(--line); }
#tabs .tab { width: 68px; height: 48px; font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); border-radius: 12px; }
#tabs .tab[aria-current="page"] { color: var(--accent-text); }
#tabs .tab-group { display: flex; flex: 1; justify-content: space-around; }
#tabs .create { width: 56px; height: 56px; flex: none; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); }
body.signed-out #tabs, body.signed-out #side, body:not(.root-screen) #tabs { display: none; }

@media (min-width: 900px) {
  #tabs { display: none; }
  #side { flex: none; width: 264px; padding: 20px 14px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; background: var(--raised); border-right: 1px solid var(--line); }
  #side .brand { padding: 0 6px; font-size: 24px; }
  #side .create { height: 44px; border-radius: 12px; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: var(--on-accent); }
  #side nav { display: flex; flex-direction: column; gap: 2px; }
  #side .nav { height: 44px; padding: 0 10px; border-radius: 12px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 12px; }
  #side .nav[aria-current="page"] { background: var(--soft); color: var(--accent-text); }
  #side .recent { flex: 1; display: flex; flex-direction: column; gap: 2px; }
  #side .recent .eyebrow { padding: 0 10px 6px; font-size: 12px; }
  #side .recent button { min-height: 48px; padding: 6px 10px; border-radius: 12px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
  #side .recent button:hover, #side .nav:hover { background: var(--bubble); }
  #side .nav[aria-current="page"]:hover { background: var(--soft); }
  #side .recent .t { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 216px; }
  #side .recent .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 216px; }
  #side .who { display: flex; align-items: center; gap: 12px; padding: 12px 8px 4px; border-top: 1px solid var(--line); }
}

/* Pages */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page { flex: 1; min-height: 0; overflow-y: auto; }
.page-inner { width: 100%; max-width: 900px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.page-inner.back { padding-top: calc(12px + env(safe-area-inset-top)); }
.page-inner.g12 { gap: 12px; } .page-inner.g14 { gap: 14px; } .page-inner.g18 { gap: 18px; }
.title { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.15; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.eyebrow.accent { color: var(--accent-text); font-size: 12px; }
h2.eyebrow { margin-top: 4px; }
.grid2 { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.empty { padding: 24px 0; text-align: center; color: var(--muted); }
.back-btn { margin-left: -8px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px; }
@media (min-width: 900px) {
  .page-inner { padding: 28px 36px 32px; }
  .page-inner.back { padding-top: 20px; }
  .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Buttons */
.icon-btn { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--text); }
.icon-btn.boxed { border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.round { border-radius: 50%; background: var(--bubble); }
.btn { height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.big { height: 50px; font-size: 15px; }
.btn.outline { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn.accent-outline { background: var(--surface); color: var(--accent-text); border: 1px solid var(--soft-line); }
.btn.danger-outline { color: var(--danger); border: 1px solid var(--line); font-size: 15px; }
.btn.danger { background: var(--danger); color: var(--bg); }
.btn.dashed { border: 1px dashed var(--soft-line); color: var(--accent-text); }
.btn.compact { height: 44px; border-radius: 12px; }
.btn.block { display: flex; width: 100%; }
.text-btn { min-height: 44px; padding: 0 10px; font-size: 13px; font-weight: 500; color: var(--muted); border-radius: 10px; }
.text-btn.accent { color: var(--accent-text); font-size: 14px; }
.text-btn.danger { color: var(--danger); font-weight: 600; }
.text-btn:hover { color: var(--text); }
.text-btn.accent:hover { color: var(--accent-text); }
.text-btn.danger:hover { color: var(--danger); }

/* Avatars: a tinted letter tile, or the character's portrait when it has one. */
.avatar { width: 52px; height: 52px; flex: none; border-radius: 16px; display: flex; align-items: center; justify-content: center; overflow: hidden; font-family: var(--serif); font-size: 26px; line-height: 1; background: var(--tint-bg, var(--bubble)); color: var(--tint-fg, var(--text)); }
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.avatar.s36 { width: 36px; height: 36px; border-radius: 50%; font-family: var(--sans); font-size: 14px; font-weight: 600; }
.avatar.s38 { width: 38px; height: 38px; border-radius: 12px; font-size: 20px; }
.avatar.s44 { width: 44px; height: 44px; border-radius: 14px; font-size: 22px; }
.avatar.s48 { width: 48px; height: 48px; border-radius: 15px; font-size: 24px; }
.avatar.s56 { width: 56px; height: 56px; border-radius: 50%; font-size: 28px; }
.avatar.s72 { width: 72px; height: 72px; border-radius: 22px; font-size: 38px; }
.avatar.s84 { width: 84px; height: 84px; border-radius: 26px; font-size: 44px; }

/* Cards, rows, chips */
.card { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
button.card:hover, button.scen:hover { border-color: var(--soft-line); }
.card .name { font-weight: 600; font-size: 16px; }
.card .sum { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { font-size: 12px; color: var(--muted); }
.search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.search:focus-within { border-color: var(--accent-text); }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; font-size: 16px; color: var(--text); }
.continue { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 20px; background: var(--soft); border: 1px solid var(--soft-line); }
.continue .quote { font-family: var(--serif); font-size: 16px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 44px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.tag { padding: 5px 11px; border-radius: 999px; font-size: 12px; background: var(--surface); border: 1px solid var(--line); }
.badge { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--soft); color: var(--accent-text); }
.pill { align-self: center; max-width: 100%; padding: 6px 12px; border-radius: 999px; font-size: 12px; text-align: center; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.pill.soft { font-weight: 500; background: var(--soft); border-color: transparent; color: var(--accent-text); }
.rowlist { display: flex; flex-direction: column; }
.rowlist .row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--line); width: 100%; }
.rowlist .row.tall { min-height: 68px; }
.rowlist .row .t { font-weight: 500; }
.rowlist .row .s { font-size: 13px; color: var(--muted); }
.rowlist .row .when { font-size: 12px; color: var(--muted); }
.rowlist .row .right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.scen { padding: 14px; border-radius: 18px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); }
.scen .n { font-weight: 600; }
.scen .b { font-size: 13px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.scen .go { font-size: 13px; font-weight: 600; color: var(--accent-text); }
.hero { display: flex; align-items: center; gap: 16px; }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.1; overflow-wrap: anywhere; }
.prose { line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Login */
.login { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.login-box { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 18px; }
.login .brand { font-size: 44px; line-height: 1; }
.login .brand small { font-size: 20px; color: var(--muted); }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login p { line-height: 1.5; color: var(--muted); }
.input.code { height: 56px; font-size: 26px; letter-spacing: 0.3em; text-align: center; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.input, .textarea, .select { width: 100%; padding: 0 14px; border-radius: 14px; outline: 0; font-size: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.input, .select { height: 48px; }
.input.tall { height: 50px; }
.textarea { resize: vertical; padding: 12px 14px; line-height: 1.45; font-size: 15px; display: block; }
.textarea.code, .input.code-id { font-family: var(--mono); font-size: 13px; }
.input.code-id { font-size: 14px; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent-text); }
.input::placeholder, .textarea::placeholder, .search input::placeholder, .composer textarea::placeholder { color: var(--muted); opacity: 0.8; }
.select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 21px) 21px, calc(100% - 15px) 21px; background-size: 6px 6px; background-repeat: no-repeat; }
.form-head { flex: none; width: 100%; max-width: 900px; margin: 0 auto; padding: calc(8px + env(safe-area-inset-top)) 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.form-head .ft { font-weight: 600; text-align: center; }
.form-head button { height: 44px; padding: 0 8px; border-radius: 10px; color: var(--muted); }
.form-head button.save { font-weight: 600; color: var(--accent-text); }
.form-body { width: 100%; max-width: 900px; margin: 0 auto; padding: 8px 20px 28px; display: flex; flex-direction: column; gap: 16px; }
.idea { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 20px; background: var(--soft); border: 1px solid var(--soft-line); }
.idea textarea { width: 100%; resize: none; border: 0; outline: 0; background: none; padding: 0; font-family: var(--serif); font-size: 18px; line-height: 1.45; color: var(--text); }
.idea .opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.idea .select { background-color: transparent; border-color: var(--soft-line); height: 44px; background-position: calc(100% - 21px) 19px, calc(100% - 15px) 19px; }
.box { padding: 12px 14px; border-radius: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); }
.box .input, .box .textarea { background: var(--bg); }
.note { font-size: 13px; line-height: 1.5; color: var(--muted); }
.vars { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; list-style: none; font-size: 13px; color: var(--muted); }
.vars li { display: flex; gap: 8px; align-items: baseline; }
code.var { flex: none; padding: 3px 8px; border-radius: 8px; font-family: var(--mono); font-size: 12px; color: var(--text); background: var(--surface); border: 1px solid var(--line); }
pre.preview { margin: 0; padding: 12px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; line-height: 1.5; background: var(--surface); border: 1px solid var(--line); }
.pair { display: flex; gap: 8px; }
.pair > * { flex: 1; min-width: 0; }
.form-error { color: var(--danger); font-size: 14px; }
@media (min-width: 900px) { .form-head { padding-top: 16px; } }

/* Chat */
.chat { flex: 1; min-height: 0; display: flex; }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head { flex: none; display: flex; align-items: center; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 12px 10px; border-bottom: 1px solid var(--line); }
.chat-head .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding-left: 6px; }
.chat-head .who .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who .t { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.chat-col { width: 100%; max-width: 720px; min-height: 100%; margin: 0 auto; padding: 16px 20px 8px; display: flex; flex-direction: column; justify-content: flex-end; gap: 18px; }
.turn { display: flex; flex-direction: column; gap: 2px; }
.turn.pending { opacity: 0.6; }
.msg-char { font-family: var(--serif); font-size: 18px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-char em, .msg-me em { color: var(--muted); }
.msg-me { align-self: flex-end; max-width: 82%; padding: 11px 15px; border-radius: 20px 20px 6px 20px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bubble); }
.turn.me .msg-actions { align-self: flex-end; margin: 0 -10px 0 0; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -10px; }
.scene { display: block; width: 320px; max-width: 100%; margin: 8px 0 4px; border-radius: 18px; border: 1px solid var(--line); overflow: hidden; }
.scene img { display: block; width: 100%; height: auto; }
.writing { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--muted); }
.chat-foot { flex: none; width: 100%; max-width: 720px; margin: 0 auto; padding: 0 12px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 4px; }
.chat-foot .picks { display: flex; flex-wrap: wrap; }
.pick { height: 44px; max-width: 100%; padding: 0 8px; font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; color: var(--muted); border-radius: 10px; }
.pick .dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--accent); }
.pick .dot.alt { background: var(--muted); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 26px; background: var(--surface); border: 1px solid var(--line); }
.composer:focus-within { border-color: var(--accent-text); }
.composer textarea { flex: 1; min-width: 0; height: 44px; max-height: 180px; padding: 11px 0; resize: none; border: 0; outline: 0; background: none; font-size: 16px; line-height: 22px; color: var(--text); }
.composer .send { width: 44px; height: 44px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); }
.chat-error { padding: 0 8px; color: var(--danger); font-size: 14px; }
.chat-side { display: none; }
@media (min-width: 900px) {
  .chat-head { padding: 12px 16px; }
  .chat-foot { padding: 0 20px 20px; }
}
@media (min-width: 1200px) {
  .chat-side { flex: none; width: 300px; padding: 24px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; border-left: 1px solid var(--line); }
  .chat-side .n { font-family: var(--serif); font-size: 26px; line-height: 1.1; overflow-wrap: anywhere; }
  .chat-side .sum { font-size: 14px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
  .chat-side .eyebrow { margin-top: 8px; font-size: 12px; }
  .chat-side .others { display: flex; flex-direction: column; gap: 2px; }
  .chat-side .others button { min-height: 48px; padding: 8px 10px; border-radius: 12px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
  .chat-side .others button[aria-current="page"] { background: var(--surface); }
  .chat-side .others .t { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
  .chat-side .others .s { font-size: 12px; color: var(--muted); }
}

/* You, models, usage */
.me-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.me-card .n { font-weight: 600; font-size: 17px; }
.segmented { display: flex; padding: 4px; border-radius: 14px; background: var(--bubble); }
.segmented button { flex: 1; height: 44px; border-radius: 10px; font-size: 14px; font-weight: 600; text-align: center; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.menu { display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.menu button { min-height: 64px; padding: 0 14px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.menu button:last-child { border-bottom: 0; }
.menu button:hover { background: var(--bg); }
.menu .l { font-weight: 500; }
.menu .s { font-size: 13px; color: var(--muted); }
.switch-row { min-height: 64px; padding: 10px 14px; display: flex; align-items: center; gap: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.switch-row label { cursor: pointer; }
.switch-row .l { font-weight: 500; }
.switch-row .s { font-size: 13px; color: var(--muted); }
.switch { flex: none; width: 52px; height: 32px; padding: 3px; border-radius: 16px; background: var(--bubble); border: 1px solid var(--line); display: flex; transition: background 0.15s; }
.switch .knob { width: 24px; height: 24px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .knob { transform: translateX(20px); background: var(--on-accent); }
@media (prefers-reduced-motion: reduce) { .switch, .switch .knob { transition: none; } }
.model { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 0; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.model .pickdef { flex: 1; min-width: 0; min-height: 56px; padding: 0 0 0 14px; display: flex; align-items: center; gap: 12px; border-radius: 14px; }
.model .radio { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--muted); }
.model.default .radio { border-color: var(--accent); background: var(--accent); }
.model .n { font-weight: 600; }
.model .badge { margin-right: 8px; }
.addbox { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; border: 1px dashed var(--soft-line); }
.addbox .h { font-weight: 600; }
.statcard { padding: 14px; border-radius: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); }
.statcard .n { font-weight: 600; }
.stats { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-family: var(--serif); font-size: 22px; }
.stat .k { font-size: 12px; color: var(--muted); }
.log { display: flex; flex-direction: column; }
.log .entry { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.log .entry .t { font-weight: 500; }
.log .entry .s { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.log .entry .right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--muted); }
.log .entry .cost { font-family: var(--serif); font-size: 17px; color: var(--text); }

/* Images */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery figure { display: flex; flex-direction: column; gap: 4px; }
.gallery .shot { display: block; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: var(--bubble); }
.gallery .shot.current { border-color: var(--accent); outline: 2px solid var(--accent); }
.gallery img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; object-position: top; }
.gallery figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; margin-left: -6px; }
.gallery figcaption .text-btn { padding: 0 6px; }
.gallery figcaption .badge { margin-left: 6px; }

/* Sheet, dialog, toast */
dialog { padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow); max-height: calc(100dvh - 24px); overflow-y: auto; }
dialog::backdrop { background: var(--scrim); }
dialog.sheet { width: 100%; max-width: none; margin: auto 0 0; padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; border-bottom: 0; }
dialog.sheet[open] { display: flex; flex-direction: column; gap: 2px; }
dialog.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 8px; }
dialog.sheet h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; }
.sheet-item { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 6px 8px; border-radius: 16px; width: 100%; }
.sheet-item:hover { background: var(--bg); }
.sheet-item.danger { color: var(--danger); }
.sheet-item .ic { width: 44px; height: 44px; flex: none; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--tint-bg); color: var(--tint-fg); }
.sheet-item .l { font-weight: 600; }
.sheet-item .s { font-size: 13px; overflow-wrap: anywhere; color: var(--muted); }
dialog.alert { width: calc(100% - 48px); max-width: 340px; padding: 22px; border-radius: 24px; }
dialog.alert[open] { display: flex; flex-direction: column; gap: 12px; }
dialog.alert h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
dialog.alert p { font-size: 14px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
dialog.alert .input { background: var(--bg); }
dialog.alert .pair { margin-top: 4px; }
dialog.alert .btn.cancel { border: 1px solid var(--line); color: var(--text); font-size: 15px; }
dialog.alert .btn { font-size: 15px; }
@media (min-width: 900px) {
  dialog.sheet { width: 460px; margin: auto; padding-bottom: 26px; border-radius: 28px; border-bottom: 1px solid var(--line); }
}
#toasts { position: fixed; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10; width: max-content; max-width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; text-align: center; background: var(--text); color: var(--bg); box-shadow: var(--shadow); }
.toast.error, .toast.notice { text-align: left; padding-right: 6px; }
.toast .x { width: 44px; height: 44px; margin: -8px 0; flex: none; display: flex; align-items: center; justify-content: center; color: inherit; border-radius: 10px; }
.toast .x:focus-visible { outline-color: var(--bg); }
@media (min-width: 900px) { #toasts { bottom: 32px; } }

@media (prefers-reduced-motion: no-preference) {
  .writing { animation: breathe 1.6s ease-in-out infinite; }
  @keyframes breathe { 50% { opacity: 0.55; } }
}
