/* Social identity: cream, rose, people. Guest entry retains its saved theme.
   Existing semantic tokens remain the contract for all vanilla UI modules. */
html:root body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) {
  --concept-cream: #fff9f5;
  --concept-pink: #d92b68;
  --concept-pink-strong: #b62557;
  --concept-pink-soft: #fff0f4;
  --concept-purple: #786096;
  --concept-purple-soft: #f4effa;
  --concept-lilac: var(--concept-purple-soft);
  --concept-text-secondary: #756d73;
  --concept-text-muted: #81777c;
  --concept-border: #e6d8dd;
  --concept-radius-card: 24px;
  --concept-radius-panel: 22px;
  --concept-radius-control: 14px;
  --concept-radius-chip: 8px;
  --concept-action-size: 68px;
  --concept-space-1: 4px;
  --concept-space-2: 8px;
  --concept-space-3: 12px;
  --concept-space-4: 16px;
  --concept-space-5: 24px;
  --concept-space-6: 32px;
  --concept-space-7: 40px;
  --concept-space-8: 48px;
  --concept-type-brand: 18px;
  --concept-type-title: 26px;
  --concept-type-section: 18px;
  --concept-type-name: 28px;
  --concept-type-body: 14px;
  --concept-type-caption: 12px;
  --concept-type-button: 14px;
  --concept-shadow: 0 8px 28px #6337420d;
  --bg: var(--concept-cream);
  --surface: #fff;
  --ink: #29262b;
  --muted: var(--concept-text-secondary);
  --line: #eee4e5;
  --control-line: #a28491;
  --soft: var(--concept-pink-soft);
  --accent: var(--concept-pink);
  --on-accent: #fff;
  --green: var(--concept-pink-strong);
  --bright: #ffe1eb;
  --danger: #b63248;
  --focus: var(--concept-pink-strong);
  --shadow: var(--concept-shadow);
  --toast-action: var(--concept-pink-strong);
  color-scheme: light;
  background: var(--bg);
  color: var(--ink);
}
body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .topbar {
  height: 64px;
  background: var(--bg);
  border-bottom: 0;
  padding-inline: 32px;
}
body[data-authenticated="true"] #main { padding: 24px 32px 64px; }
body[data-authenticated="true"] .navigation { padding: 32px 18px 24px; border-color: var(--line); background: var(--surface); }
body[data-authenticated="true"] .brand { margin: 0 10px 40px; }
body[data-authenticated="true"] .brand > span { font-size: var(--concept-type-brand); letter-spacing: -.04em; }
body[data-authenticated="true"] .brand small { font-size: 12px; font-weight: 450; color: var(--muted); margin-top: 6px; }
.app-brand { display: inline-flex; align-items: center; gap: 8px; }
body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .app-brand { font-size: var(--concept-type-brand); letter-spacing: -.04em; }
.app-brand > svg { width: 24px; height: 24px; color: #d92b68; }
body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .brand-tools { display: flex; align-items: center; gap: 24px; }
body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .feedback-trigger { min-height: 44px; font-size: 11px; }
body[data-authenticated="true"] .top-actions { gap: 8px; }
body[data-authenticated="true"] .logout-button { color: var(--muted); font-size: 12px; }
body[data-authenticated="true"] .nav-link { color: var(--muted); font-weight: 550; border-radius: var(--concept-radius-control); }
body[data-authenticated="true"] .nav-link.active { background: var(--soft); color: var(--concept-pink-strong); }
body[data-authenticated="true"] .nav-link.active svg { stroke-width: 2.2; }
body[data-authenticated="true"] .nav-count { background: var(--accent); color: var(--on-accent); }
body[data-authenticated="true"] .page-heading h1 { font-size: var(--concept-type-title); letter-spacing: -.04em; }
body[data-authenticated="true"] .page-heading p { max-width: 560px; line-height: 1.75; }
body[data-authenticated="true"] .primary { background: var(--accent); color: var(--on-accent); border-radius: var(--concept-radius-control); }
body[data-authenticated="true"] :is(.secondary, .danger, input, select, textarea) { border-radius: var(--concept-radius-control); }
body[data-authenticated="true"] .secondary { border-color: var(--control-line); }
body[data-authenticated="true"] :is(.primary, .secondary, .danger) { font-size: var(--concept-type-button); }
body[data-authenticated="true"] input[type="checkbox"] { accent-color: var(--accent); }
body[data-authenticated="true"] .chip.selected { background: var(--soft); border-color: var(--accent); color: var(--concept-pink-strong); }
body[data-authenticated="true"] :is(.badge, .active-filter) { border-radius: var(--concept-radius-chip); }
body[data-authenticated="true"] .link-button { color: var(--muted); text-decoration: none; }
body[data-authenticated="true"] .link-button:hover { color: var(--concept-pink-strong); text-decoration: underline; }
body[data-authenticated="true"] dialog:not(.lightbox) { background: var(--surface); color: var(--ink); border-radius: var(--concept-radius-panel); box-shadow: 0 16px 64px #63374224; }
body[data-authenticated="true"] dialog::backdrop { background: #43343e66; }
body[data-authenticated="true"] .lightbox { background: var(--bg); }
body[data-authenticated="true"] .lightbox > .icon-button { color: var(--ink); background: var(--surface); }
body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .empty-state { background: var(--surface); border: 0; border-radius: var(--concept-radius-panel); padding-block: 56px; box-shadow: var(--concept-shadow); }
body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .empty-state > svg { width: 48px; height: 48px; padding: 10px; color: var(--accent); background: var(--soft); border-radius: 50%; }
body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .empty-state h2 { font-size: 21px; }
body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .toast { background: var(--surface); color: var(--ink); box-shadow: 0 5px 28px #63374224; border: 1px solid var(--line); border-radius: var(--concept-radius-control); }
body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .toast button { color: var(--concept-pink-strong); }
body[data-authenticated="true"] .chat-layout { border-radius: var(--concept-radius-panel); border-color: var(--line); box-shadow: var(--concept-shadow); }
body[data-authenticated="true"] .chat-list button { border-radius: var(--concept-radius-control); }
body[data-authenticated="true"] .messages { background: var(--bg); }
body[data-authenticated="true"] .message p { border-radius: 16px 16px 16px 4px; background: var(--surface); border: 1px solid var(--line); }
body[data-authenticated="true"] .message.mine p { background: var(--soft); border-color: transparent; color: var(--ink); border-radius: 16px 16px 4px 16px; }
body[data-authenticated="true"] .composer button { background: var(--accent); color: var(--on-accent); border-radius: var(--concept-radius-control); }
body[data-authenticated="true"] .interest-item > img { border-radius: var(--concept-radius-control); }
body[data-authenticated="true"] :is(.tutorial-mark, .completion-mark, .notification-icon) { background: var(--soft); color: var(--concept-pink-strong); }
body[data-loading="true"] .loading-shell { padding-top: 0; }
body[data-loading="true"] :is(.loading-portrait, .loading-toolbar span, .loading-lines span, .loading-chat-list span, .loading-thread span, .loading-thread > div, .loading-rooms span) { background: #f1e8e7; }
body[data-loading="true"] .loading-portrait { border-radius: var(--concept-radius-card); }

/* The portrait and a small set of decisions form one composition. */
body[data-authenticated="true"][data-route="browse"] .browse-heading { max-width: 940px; margin-bottom: 20px; }
body[data-authenticated="true"][data-route="browse"] .browse-heading h1 { font-size: 22px; letter-spacing: -.04em; }
body[data-authenticated="true"] .browse-layout { grid-template-columns: 160px minmax(280px, 400px) minmax(160px, 190px); gap: 32px; }
body[data-authenticated="true"] .browse-tools { padding-top: 4px; }
body[data-authenticated="true"] .browse-tools .toolbar { gap: 8px; }
body[data-authenticated="true"] .browse-tools .scope-select { background: var(--surface); border: 1px solid var(--line); border-radius: var(--concept-radius-control); padding: 8px 24px 8px 12px; }
body[data-authenticated="true"] .browse-tools .today-overview { border-color: var(--line); }
body[data-authenticated="true"] .right-rail .rail-heading h2 { font-size: 13px; }
body[data-authenticated="true"] .discovery-card { max-width: 400px; }
body[data-authenticated="true"] .photo-frame { border-radius: var(--concept-radius-card); }
body[data-authenticated="true"] .discovery-photo .photo-frame { box-shadow: 0 8px 24px #70424c24; }
body[data-authenticated="true"] .has-next .discovery-photo::before { inset: 8px -5px -9px 10px; border: 4px solid var(--surface); border-radius: var(--concept-radius-card); background: #f1e1e7; box-shadow: 0 5px 15px #70424c14; }
.portrait-summary { position: absolute; inset: auto 0 0; padding: 64px 22px 22px; color: #fff; background: linear-gradient(transparent, #271d21bd); pointer-events: none; }
.portrait-summary .discovery-identity { gap: 4px 10px; }
body[data-authenticated="true"] .portrait-summary h2 { font-size: var(--concept-type-name); font-weight: 750; line-height: 1.25; letter-spacing: -.03em; overflow-wrap: anywhere; }
body[data-authenticated="true"] .portrait-summary .birth-line { font-size: 12px; margin: 0; color: #fff; }
body[data-authenticated="true"] .portrait-summary .profile-facts { display: flex; flex-wrap: wrap; gap: 0 10px; margin-top: 6px; font-size: 12px; color: #fff; }
body[data-authenticated="true"] .portrait-summary .profile-facts > span { overflow-wrap: anywhere; }
body[data-authenticated="true"] .portrait-summary .text-tags { display: flex; gap: 5px; margin-top: 10px; font-size: 11px; color: #fff; }
.portrait-summary .text-tags > span { padding: 3px 8px; background: #fffffff0; color: #4e4149; border-radius: var(--concept-radius-chip); }
.portrait-summary .text-tags > .profile-mbti { color: #624b7b; background: #f4effaf5; }
body[data-authenticated="true"] .photo-position { top: 14px; bottom: auto; left: 14px; transform: none; background: #35262e66; font-weight: 500; border-radius: 20px; padding: 3px 9px; }
body[data-authenticated="true"] .gallery-controls { bottom: auto; top: 44%; left: 6px; right: 6px; }
body[data-authenticated="true"] .gallery-controls button { background: #35262e33; }
body[data-authenticated="true"] .save-photo { background: #fffffff0; color: #4e4149; box-shadow: none; }
body[data-authenticated="true"] .save-photo.saved { background: var(--soft); color: var(--concept-pink-strong); }
body[data-authenticated="true"] .discovery-copy { padding-top: 16px; gap: 4px; }
body[data-authenticated="true"] .discovery-copy .connection { justify-content: center; text-align: center; }
body[data-authenticated="true"] .discovery-detail { min-height: 36px; justify-content: center; }
body[data-authenticated="true"] .discovery-actions { grid-template-columns: repeat(2, var(--concept-action-size)); gap: 32px 48px; margin-top: 0; padding-top: 12px; }
body[data-authenticated="true"] .discovery-actions > button:not(.deck-next) { position: relative; width: var(--concept-action-size); height: var(--concept-action-size); min-height: var(--concept-action-size); border: 0; padding: 0; gap: 0; box-shadow: 0 4px 14px #70424c0d; }
body[data-authenticated="true"] .discovery-actions > .secondary:not(.deck-next) { color: #77737d; background: var(--surface); }
body[data-authenticated="true"] .discovery-actions > button:not(.deck-next) svg { width: 29px; height: 29px; stroke-width: 2.2; }
body[data-authenticated="true"] .discovery-actions > .primary svg[data-lucide="heart"] { fill: currentColor; }
body[data-authenticated="true"] .discovery-actions .action-label { position: absolute; top: calc(var(--concept-action-size) + 7px); left: 50%; transform: translateX(-50%); color: var(--ink); width: 116px; font-size: 11px; font-weight: 500; line-height: 1.5; text-align: center; }
body[data-authenticated="true"] .discovery-actions .deck-next { background: transparent; border: 0; border-radius: var(--concept-radius-control); min-height: 44px; padding: 8px; font-size: 12px; }
body[data-authenticated="true"] .discovery-status { justify-content: center; font-size: 12px; }
body[data-authenticated="true"] .discovery-copy :is(.incoming-hint, .discovery-unavailable) { text-align: center; }

@media (min-width: 768px) and (max-width: 1199px) {
  body[data-authenticated="true"] .app-shell { grid-template-columns: 164px minmax(0, 1fr); }
  body[data-authenticated="true"] .navigation { padding-inline: 12px; }
  body[data-authenticated="true"] .brand { margin-inline: 0; }
  body[data-authenticated="true"] .brand > span { font-size: 16px; }
  body[data-authenticated="true"] .browse-layout { grid-template-columns: 140px minmax(0, 380px); gap: 24px; }
  body[data-authenticated="true"] .right-rail { display: none; }
  body[data-authenticated="true"] #main { padding-inline: 24px; }
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .brand-tools { gap: 12px; }
}
@media (max-width: 767px) {
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .topbar { height: 56px; padding-inline: 18px; gap: 8px; }
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .brand-tools { display: flex; gap: 4px; min-width: 0; }
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .app-brand { font-size: 16px; gap: 5px; }
  .app-brand > svg { width: 21px; height: 21px; }
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .feedback-trigger { width: 36px; min-height: 44px; justify-content: center; }
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .feedback-trigger span { display: none; }
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .feedback-trigger svg { width: 17px; height: 17px; }
  body[data-authenticated="true"] .top-actions { gap: 3px; }
  body[data-authenticated="true"] .top-actions > .icon-button { width: 36px; height: 44px; }
  body[data-authenticated="true"] .avatar-button { min-width: 36px; min-height: 44px; display: grid; place-items: center; }
  body[data-authenticated="true"] .logout-button { width: 36px; height: 44px; padding: 0; }
  body[data-authenticated="true"] .logout-button span { display: none; }
  body[data-authenticated="true"] .navigation { height: calc(68px + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px #63374204; }
  body[data-authenticated="true"] .navigation nav { height: 68px; }
  body[data-authenticated="true"] .nav-link { gap: 4px; font-size: 10px; border-radius: 0; }
  body[data-authenticated="true"] .nav-link.active { color: var(--concept-pink-strong); }
  body[data-authenticated="true"] .nav-link.active::before { content: ''; width: 38px; height: 3px; border-radius: 3px; background: var(--accent); position: absolute; top: 0; }
  body[data-authenticated="true"] #main { padding: 18px 20px 104px; }
  body[data-authenticated="true"] .page-heading { margin-bottom: 24px; }
  body[data-authenticated="true"] .page-heading h1 { font-size: 24px; }
  body[data-authenticated="true"][data-route="browse"] #main { padding: 2px 24px calc(228px + env(safe-area-inset-bottom)); }
  body[data-authenticated="true"][data-route="browse"] .browse-heading { margin-bottom: 1px; }
  body[data-authenticated="true"][data-route="browse"] .browse-heading h1 { font-size: 17px; }
  body[data-authenticated="true"] .browse-layout { display: flex; gap: 0; }
  body[data-authenticated="true"] .browse-tools { display: contents; }
  body[data-authenticated="true"] .browse-tools .toolbar { gap: 4px; margin-bottom: 9px; }
  body[data-authenticated="true"] .browse-tools .scope-select { border: 0; padding: 6px 18px 6px 0; background: transparent; font-size: 11px; max-width: none; min-width: 0; }
  body[data-authenticated="true"] .browse-tools .toolbar-actions { gap: 0; }
  body[data-authenticated="true"] .browse-tools .toolbar-actions .icon-button { width: 40px; }
  body[data-authenticated="true"] .browse-tools .filter-button { padding-inline: 4px; font-size: 11px; }
  body[data-authenticated="true"] .discovery-photo .photo-frame > button:first-child { height: clamp(230px, calc(100dvh - 390px), 510px); }
  body[data-authenticated="true"] .portrait-summary { padding: 60px 18px 20px; }
  body[data-authenticated="true"] .portrait-summary h2 { font-size: 26px; }
  body[data-authenticated="true"] .portrait-summary .profile-facts { gap: 0 8px; font-size: 11px; }
  body[data-authenticated="true"] .discovery-copy { padding-top: 18px; }
  body[data-authenticated="true"] .discovery-actions { position: fixed; bottom: calc(68px + env(safe-area-inset-bottom)); left: 0; right: 0; margin: 0; padding: 12px 24px 2px; grid-template-columns: repeat(2, var(--concept-action-size)); gap: 29px 48px; border: 0; background: var(--bg); }
  body[data-authenticated="true"] .discovery-actions .deck-next { min-height: 44px; padding: 6px; }
  body[data-authenticated="true"] .discovery-copy .discovery-detail { min-height: 44px; }
  body[data-authenticated="true"] .discovery-story { margin-top: 6px; }
  body[data-authenticated="true"] .right-rail { display: none; }
  body[data-authenticated="true"] dialog:not(.lightbox) { border-radius: var(--concept-radius-panel); }
  body[data-authenticated="true"] .chat-layout { border-radius: 18px; }
  body[data-authenticated="true"] .chat-header { background: var(--surface); }
  body[data-loading="true"] .loading-portrait { height: clamp(230px, calc(100dvh - 390px), 510px); }
}
@media (max-width: 359px) {
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .topbar { padding-inline: 12px; }
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .app-brand { font-size: 14px; gap: 4px; }
  body:is([data-authenticated="true"], [data-loading="true"], [data-recovering="true"]) .feedback-trigger { width: 28px; }
  body[data-authenticated="true"] .top-actions { gap: 0; }
  body[data-authenticated="true"] .top-actions > .icon-button, body[data-authenticated="true"] .logout-button { width: 32px; }
  body[data-authenticated="true"][data-route="browse"] #main { padding-inline: 18px; }
  body[data-authenticated="true"] .portrait-summary { padding-inline: 15px; }
  body[data-authenticated="true"] .portrait-summary .text-tags { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-authenticated="true"] * { scroll-behavior: auto; }
}
