/* YukiSocial classic blue and white design tokens. */
:root {
  color-scheme: light;
  --yuki-black: #F5F8FC;
  --yuki-dark-blue: #FFFFFF;
  --yuki-white: #172B45;
  --yuki-page-bg: #F5F8FC;
  --yuki-card-bg: #FFFFFF;
  --yuki-text: #172B45;
  --yuki-border: #DCE5F0;
  --ys-page: #F5F8FC;
  --ys-panel: #FFFFFF;
  --ys-panel-soft: #EDF3FA;
  --ys-panel-raised: #FFFFFF;
  --ys-ink: #172B45;
  --ys-muted: #64748B;
  --ys-line: #DCE5F0;
  --ys-input: #FFFFFF;
  --ys-accent: #3478C9;
  --ys-accent-strong: #2867B0;
  --ys-button: #2867B0;
  --ys-accent-soft: #E8F0FA;
  --ys-danger: #A7474D;
  --ys-danger-surface: #F8ECEC;
  --ys-success: #397454;
  --ys-success-surface: #EAF3EE;
  --ys-warning: #8A6427;
  --ys-warning-surface: #F5F0E5;
  --ys-shadow: 0 4px 14px rgba(23, 43, 69, .08);
  --ys-overlay: rgba(23, 43, 69, .48);
  --yuki-primary: #3478C9;
  --yuki-primary-dark: #2867B0;
  --yuki-ink: #172B45;
  --yuki-muted: #64748B;
  --yuki-line: #DCE5F0;
  --yuki-panel: #FFFFFF;
  --yuki-soft: #F5F8FC;
  --yuki-radius: 10px;
  --yuki-shadow: 0 4px 14px rgba(23, 43, 69, .08);
  --home-feed-surface: #FFFFFF;
  --home-feed-soft: #EDF3FA;
  --home-feed-ink: #172B45;
  --home-feed-muted: #64748B;
  --home-feed-line: #DCE5F0;
  --ms-primary: #3478C9;
  --ms-primary-dark: #2867B0;
  --ms-bg: #F5F8FC;
  --ms-border: #DCE5F0;
  --ms-muted: #64748B;
  --ms-text: #172B45;
  --ms-card: #FFFFFF;
  --bg: #F5F8FC;
  --card: #FFFFFF;
  --ink: #172B45;
  --muted: #64748B;
  --line: #DCE5F0;
  --brand: #3478C9;
}

html[data-yuki-theme="light"] {
  color-scheme: light;
  --yuki-black: #F5F8FC;
  --yuki-dark-blue: #FFFFFF;
  --yuki-white: #172B45;
  --yuki-page-bg: #F5F8FC;
  --yuki-card-bg: #FFFFFF;
  --yuki-text: #172B45;
  --yuki-border: #DCE5F0;
  --ys-page: #F5F8FC;
  --ys-panel: #FFFFFF;
  --ys-panel-soft: #EDF3FA;
  --ys-panel-raised: #FFFFFF;
  --ys-ink: #172B45;
  --ys-muted: #64748B;
  --ys-line: #DCE5F0;
  --ys-input: #FFFFFF;
  --ys-accent: #3478C9;
  --ys-accent-strong: #2867B0;
  --ys-button: #2867B0;
  --ys-accent-soft: #E8F0FA;
  --ys-danger: #A7474D;
  --ys-danger-surface: #F8ECEC;
  --ys-success: #397454;
  --ys-success-surface: #EAF3EE;
  --ys-warning: #8A6427;
  --ys-warning-surface: #F5F0E5;
  --ys-shadow: 0 4px 14px rgba(23, 43, 69, .08);
  --ys-overlay: rgba(23, 43, 69, .48);
  --yuki-primary: #3478C9;
  --yuki-primary-dark: #2867B0;
  --yuki-ink: #172B45;
  --yuki-muted: #64748B;
  --yuki-line: #DCE5F0;
  --yuki-panel: #FFFFFF;
  --yuki-soft: #F5F8FC;
  --yuki-shadow: 0 4px 14px rgba(23, 43, 69, .08);
  --home-feed-surface: #FFFFFF;
  --home-feed-soft: #EDF3FA;
  --home-feed-ink: #172B45;
  --home-feed-muted: #64748B;
  --home-feed-line: #DCE5F0;
  --ms-primary: #3478C9;
  --ms-primary-dark: #2867B0;
  --ms-bg: #F5F8FC;
  --ms-border: #DCE5F0;
  --ms-muted: #64748B;
  --ms-text: #172B45;
  --ms-card: #FFFFFF;
  --bg: #F5F8FC;
  --card: #FFFFFF;
  --ink: #172B45;
  --muted: #64748B;
  --line: #DCE5F0;
  --brand: #3478C9;
}

html[data-yuki-theme="dark"] {
  color-scheme: dark;
  accent-color: #4388D6;
  --yuki-black: #101B2D;
  --yuki-dark-blue: #172943;
  --yuki-white: #F1F5FA;
  --yuki-page-bg: #101B2D;
  --yuki-card-bg: #1D3452;
  --yuki-text: #F1F5FA;
  --yuki-border: #2B405D;
  --ys-page: #101B2D;
  --ys-panel: #172943;
  --ys-panel-soft: #1D3452;
  --ys-panel-raised: #223B5B;
  --ys-ink: #F1F5FA;
  --ys-muted: #B8C2D0;
  --ys-line: #2B405D;
  --ys-input: #172943;
  --ys-accent: #4388D6;
  --ys-accent-strong: #5797DF;
  --ys-button: #2F6FAE;
  --ys-accent-soft: #203A59;
  --ys-danger: #E0B2B2;
  --ys-danger-surface: #3A2C38;
  --ys-success: #B7D4C4;
  --ys-success-surface: #243B3B;
  --ys-warning: #E0CCA2;
  --ys-warning-surface: #3C382C;
  --ys-shadow: 0 6px 18px rgba(5, 12, 22, .22);
  --ys-overlay: rgba(7, 15, 27, .72);
  --yuki-primary: #4388D6;
  --yuki-primary-dark: #5797DF;
  --yuki-ink: #F1F5FA;
  --yuki-muted: #B8C2D0;
  --yuki-line: #2B405D;
  --yuki-panel: #172943;
  --yuki-soft: #101B2D;
  --yuki-radius: 10px;
  --yuki-shadow: 0 6px 18px rgba(5, 12, 22, .22);
  --home-feed-surface: #1D3452;
  --home-feed-soft: #172943;
  --home-feed-ink: #F1F5FA;
  --home-feed-muted: #B8C2D0;
  --home-feed-line: #2B405D;
  --ms-primary: #4388D6;
  --ms-primary-dark: #5797DF;
  --ms-bg: #101B2D;
  --ms-border: #2B405D;
  --ms-muted: #B8C2D0;
  --ms-text: #F1F5FA;
  --ms-card: #1D3452;
  --bg: #101B2D;
  --card: #1D3452;
  --ink: #F1F5FA;
  --muted: #B8C2D0;
  --line: #2B405D;
  --brand: #4388D6;
}

.theme-toggle {
  position: fixed; right: 16px; bottom: 18px; z-index: 7900;
  min-width: 44px; min-height: 44px; padding: 9px 12px;
  border: 1px solid var(--ys-line); border-radius: 8px;
  background: var(--ys-panel); color: var(--ys-ink);
  box-shadow: var(--ys-shadow); font: 700 14px/1.2 system-ui,sans-serif;
  cursor: pointer;
}
@media (max-width: 700px) {
  .theme-toggle { right: 12px; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); min-width: 46px; min-height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle { transition: none !important; scroll-behavior: auto !important; }
}

/* Ordinary application text is upright. The Yuki script wordmark keeps its brand styling. */
html[data-yuki-theme] body *:not(.yuki-script-logo):not(#yuki-type-reset-exception) {
  font-style: normal !important;
}
html[data-yuki-theme] body input,
html[data-yuki-theme] body textarea,
html[data-yuki-theme] body select,
html[data-yuki-theme] body [contenteditable="true"],
html[data-yuki-theme] body input::placeholder,
html[data-yuki-theme] body textarea::placeholder {
  font-style: normal !important;
}

/* Shared classic surface, contrast, and control rules for every themed page. */
html[data-yuki-theme] body {
  background-color: var(--ys-page) !important;
  color: var(--ys-ink) !important;
}
html[data-yuki-theme] body *:not(#yuki-theme-global-exception) {
  border-color: var(--ys-line) !important;
  outline-color: var(--ys-line) !important;
  box-shadow: none !important;
  text-shadow: none !important;
}
html[data-yuki-theme] body *:not(img):not(video):not(canvas):not(iframe):not(object):not(embed):not([class*="avatar"]):not([class*="photo"]):not([class*="cover"]):not([class*="image"]):not([class*="media"]):not([class*="logo"]):not(#yuki-theme-image-exception) {
  background-image: none !important;
}
html[data-yuki-theme] body :is(
  .top, .topbar, .header, .navbar, .nav, .yuki-mobile-nav,
  .card, .post, .post-card, .composer, .side, .panel, .box,
  .settings-card, .setting-card, .profile-card, .owner-card, .auth-card,
  .form-card, .chat-panel, .chat-container, .chat-sidebar, .chat-main,
  .creator, .modalbox, .comment-box, .profile-comment-box,
  .notification-panel, .notification-head, .notification-list,
  .notification-item, .home-notify-panel, .home-notify-item,
  .mention-suggestions, .reaction-viewer-box, .post-create-dialog,
  .post-create-head, .post-create-body, .post-create-footer,
  .post-create-caption-panel, .story-create-box, .story-viewers-panel,
  .result, .request, .search-result, .search-results, .incoming-card,
  .settings-profile-link, .dropdown-menu, .context-menu, .menu, .tooltip,
  .reaction-panel, .reaction-viewer, .table-wrap, .sidebar, .chat,
  .chat-header, .messages, .input-area, .message-search-bar,
  .voice-composer, .group-call-window, .group-call-tile,
  [class*="card"], [class*="panel"], [class*="modal"], [class*="sidebar"],
  [class*="dropdown"], [class*="menu"], [class*="composer"],
  [class*="notification"], [class*="request"], [class*="result"],
  [class*="group-call"]
):not(#yuki-theme-surface-exception) {
  background-color: var(--ys-panel) !important;
  border-color: var(--ys-line) !important;
}
html[data-yuki-theme] body :is(
  input, textarea, select, [contenteditable="true"],
  .search, .message-input, .message-search-bar input
):not(#yuki-theme-input-exception) {
  background-color: var(--ys-input) !important;
  color: var(--ys-ink) !important;
  border-color: var(--ys-line) !important;
  caret-color: var(--ys-ink) !important;
  border-radius: 8px !important;
}
html[data-yuki-theme] body :is(button, [role="button"], .btn, .action-btn, .call-btn):not(#yuki-theme-button-exception) {
  background-color: var(--ys-panel-soft) !important;
  background-image: none !important;
  color: var(--ys-ink) !important;
  border-color: var(--ys-line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  transition-duration: .16s !important;
}
html[data-yuki-theme] body :is(.primary, .btn-primary, .submit-btn, .button-primary, .primary-button, .post-submit, .send-button, .call-action):not(#yuki-theme-primary-exception) {
  background-color: var(--ys-button) !important;
  background-image: none !important;
  color: #F1F5FA !important;
  border-color: var(--ys-accent-strong) !important;
}
html[data-yuki-theme] body :is(.secondary, .btn-secondary):not(#yuki-theme-secondary-exception) {
  background-color: var(--ys-panel-soft) !important;
  color: var(--ys-ink) !important;
  border-color: var(--ys-line) !important;
}
html[data-yuki-theme] body :is(a, .link):not(#yuki-theme-link-exception),
html[data-yuki-theme] body :is(a, .link) *:not(#yuki-theme-link-text-exception) {
  color: var(--ys-accent-strong) !important;
}
html[data-yuki-theme] body :is(.muted, .subtle, .secondary-text, .helper-text, .timestamp, .post-time, .profile-username, .empty, .status):not(#yuki-theme-muted-exception) {
  color: var(--ys-muted) !important;
}
html[data-yuki-theme] body :is(.active, .selected, .is-current, [aria-current="page"], :focus-visible):not(#yuki-theme-active-exception) {
  background-color: var(--ys-accent-soft) !important;
  background-image: none !important;
  color: var(--ys-accent-strong) !important;
  border-color: var(--ys-line) !important;
}
html[data-yuki-theme] body :is(.error, .danger, .danger-zone):not(#yuki-theme-danger-exception) {
  color: var(--ys-danger) !important;
  background-color: var(--ys-danger-surface) !important;
}
html[data-yuki-theme] body :is(.success, .good):not(#yuki-theme-success-exception) {
  color: var(--ys-success) !important;
  background-color: var(--ys-success-surface) !important;
}
html[data-yuki-theme] body :is(.warn, .warning, .pending):not(#yuki-theme-warning-exception) {
  color: var(--ys-warning) !important;
  background-color: var(--ys-warning-surface) !important;
}
html[data-yuki-theme] body :is(input, textarea)::placeholder {
  color: var(--ys-muted) !important;
  opacity: 1;
}
html[data-yuki-theme] body option {
  background-color: var(--ys-panel) !important;
  color: var(--ys-ink) !important;
}
html[data-yuki-theme] body svg [fill]:not([fill="none"]):not(#yuki-theme-svg-fill-exception),
html[data-yuki-theme] body svg [style*="fill"]:not(#yuki-theme-svg-style-exception) {
  fill: currentColor !important;
}
html[data-yuki-theme] body svg [stroke]:not([stroke="none"]):not(#yuki-theme-svg-stroke-exception),
html[data-yuki-theme] body svg [style*="stroke"]:not(#yuki-theme-svg-stroke-style-exception) {
  stroke: currentColor !important;
}
html[data-yuki-theme] body :is(.card, [class*="card"], .post, .post-card, .panel, [class*="panel"], .modalbox, [class*="modal"], .dropdown-menu, [class*="dropdown"]):not(#yuki-theme-radius-exception) {
  border-radius: 10px !important;
}
html[data-yuki-theme] body :is(.modalbox, .comment-box, [class*="dialog"], [class*="modal"]):not(#yuki-theme-modal-radius-exception) {
  border-radius: 12px !important;
}
html[data-yuki-theme] body :is(.message.other .bubble, .message.me .bubble) {
  background-color: var(--ys-panel-soft) !important;
  color: var(--ys-ink) !important;
  border-color: var(--ys-line) !important;
}
html[data-yuki-theme="dark"] .message.other .bubble {
  background-color: #1D3452 !important;
  color: #F1F5FA !important;
}
html[data-yuki-theme="dark"] .message.me .bubble {
  background-color: #203A59 !important;
}
html[data-yuki-theme] body ::selection {
  background-color: var(--ys-accent-soft) !important;
  color: var(--ys-ink) !important;
}
html[data-yuki-theme] body,
html[data-yuki-theme] body * {
  scrollbar-color: var(--ys-muted) var(--ys-panel-soft);
}
html[data-yuki-theme] .theme-toggle {
  background-color: var(--ys-panel) !important;
  color: var(--ys-ink) !important;
  border-color: var(--ys-line) !important;
  box-shadow: var(--ys-shadow) !important;
}
@media (prefers-reduced-motion: reduce) {
  html[data-yuki-theme] body * { scroll-behavior: auto !important; }
}


/* Dark Mode text hierarchy: keep body content primary and supporting copy muted. */
html[data-yuki-theme="dark"] body :is(
  h1, h2, h3, h4, h5, h6, label, button, [role="button"],
  .posttext, .post-text, .comment-text, .comment-author,
  .message, .message .bubble, .message-content, .message-text,
  .user-name, .username, .display-name, .profile-name,
  .author, .author-name, .settings-value, .setting-value,
  .notification-item, .notification-content, .important-notification,
  .chat-title, .conversation-name, .group-name, .member-name,
  .creator-name, .creator-info, .yedio-creator, .video-caption,
  .nav-label, .navigation-label, .friend-name, .contact-name,
  .person-name, .result-name, .search-result-name, .user-result-name,
  .participant-name, .sender-name, .incoming-username, .profile-preview-name,
  .profile-popup-name, .notification-user, .notification-actor,
  [class*="user-name"], [class*="username"], [class*="display-name"],
  [class*="contact-name"], [class*="friend-name"], [class*="member-name"],
  [class*="participant-name"], [class*="sender-name"], [class*="author-name"],
  [class*="profile-name"], [class*="creator-name"], [class*="result-name"],
  [class*="person-name"], [id*="userName"], [id*="displayName"],
  [id*="chatTitle"], [id*="currentChat"]
):not(#yuki-dark-primary-text-exception) {
  color: #F1F5FA !important;
}
html[data-yuki-theme="dark"] body :is(
  .muted, .subtle, .secondary-text, .helper-text, .form-hint,
  .hint, .instructions, .instruction, .timestamp, .post-time,
  .time, .date, .last-message, .notification-empty, .comment-empty,
  .empty, .empty-state, .nav-description, .muted-description,
  .disabled-label, .comment-meta, .notification-meta, .notification-time,
  .user-row-meta, .message-time, .chat-empty, .search-hint,
  .user-presence, .presence-label, .online-status, .offline-status,
  [class*="presence"], [class*="online-status"], [class*="offline-status"],
  [class*="muted"], [class*="subtle"], [class*="helper"],
  [class*="hint"], [class*="timestamp"], [class*="empty"],
  [class*="description"], [class*="secondary"],
  [disabled], [aria-disabled="true"]
):not(#yuki-dark-secondary-text-exception) {
  color: #B8C2D0 !important;
}
html[data-yuki-theme="dark"] body input::placeholder,
html[data-yuki-theme="dark"] body textarea::placeholder,
html[data-yuki-theme="dark"] body [contenteditable="true"][data-placeholder]::before {
  color: #B8C2D0 !important;
}
html[data-yuki-theme="dark"] body :is(.yuki-mobile-nav a, .nav a, .sidebar a, .desktop-nav a):not(.active):not(.selected):not([aria-current="page"]):not(#yuki-dark-nav-label-exception) {
  color: #F1F5FA !important;
}
html[data-yuki-theme="dark"] body :is(.active, .selected, [aria-current="page"]):not(#yuki-dark-active-text-exception) {
  color: #79A8DC !important;
}


/* Mobile dark user-name cascade fix: overrides chat's responsive dark-text rules only on narrow screens. */
@media (max-width: 760px) {
  html[data-yuki-theme="dark"] body :is(
    .user-name, .username, .display-name, .chat-name, .chat-title,
    .request-name, .search-result-name, .user-result-name,
    .friend-name, .contact-name, .member-name, .group-member-name,
    .participant-name, .sender-name, .profile-name, .profile-preview-name,
    .profile-popup-name, .creator-name, .incoming-username,
    [class*="user-name"], [class*="username"], [class*="display-name"],
    [class*="contact-name"], [class*="friend-name"], [class*="member-name"],
    [class*="participant-name"], [class*="sender-name"], [class*="result-name"],
    [class*="profile-name"], [class*="creator-name"], [id*="chatTitle"],
    [id*="currentChat"], [id*="displayName"]
  ):not(#yuki-mobile-dark-primary-name-exception) {
    color: #F1F5FA !important;
  }
  html[data-yuki-theme="dark"] body :is(
    .last-message, .user-row-meta, .user-presence, .presence-label,
    .online-status, .offline-status, .timestamp, .post-time, .message-time,
    .notification-time, .comment-meta, .helper-text, .form-hint, .empty,
    .empty-state, .disabled-label, [disabled], [aria-disabled="true"]
  ):not(#yuki-mobile-dark-secondary-text-exception),
  html[data-yuki-theme="dark"] body input::placeholder,
  html[data-yuki-theme="dark"] body textarea::placeholder {
    color: #B8C2D0 !important;
  }
}

/* Dark comments use a navy bubble so light author and message text always has contrast. */
html[data-yuki-theme="dark"] body :is(
  .comment-item, .comment-bubble, .profile-comment, .profile-comment-bubble,
  .yedio-comment, .yedio-comment-body, .yedio-comment-bubble,
  [class*="comment-bubble"], [class*="comment-item"]
):not(#yuki-dark-comment-surface-exception) {
  background-color: var(--ys-panel-soft) !important;
  border-color: var(--ys-line) !important;
}
html[data-yuki-theme="dark"] body :is(
  .comment-bubble, .profile-comment-bubble, .yedio-comment-bubble,
  [class*="comment-bubble"]
):not(#yuki-dark-comment-text-exception),
html[data-yuki-theme="dark"] body :is(
  .comment-text, .comment-author, .profile-comment-bubble strong,
  .yedio-comment-bubble p, .yedio-comment-bubble a,
  [class*="comment-text"], [class*="comment-author"]
):not(#yuki-dark-comment-text-exception) {
  color: #F1F5FA !important;
}
html[data-yuki-theme="dark"] body :is(
  .comment-meta, .profile-comment-tools, .yedio-comment-bubble small,
  .yedio-comment-actions, [class*="comment-meta"]
):not(#yuki-dark-comment-meta-exception) {
  color: #B8C2D0 !important;
}
