/* Design 2: black and yellow, big soft shapes. A dark floating rail on a computer, a dark header and a floating dock on a phone.
   Loaded after styles.css, so these rules win. Colours that must stay dark in every theme use --ink. */
:root {
  --ink: #17171a;
  --ink-2: #26262b;
  --ink-3: #35353c;
  --ink-text: #f6f5f1;
  --ink-muted: #a3a3ab;
  --yel: #fbc700;
  --yel-2: #ffe433;
  --pill: 999px;
}

/* ============================== computer and tablet ============================== */
@media (min-width: 601px) {
  .app { --rail-w: 104px; grid-template-columns: var(--rail-w) var(--sidebar-w, 380px) minmax(0, 1fr); transition: grid-template-columns .25s ease; }
  .app[data-info='open'] { grid-template-columns: var(--rail-w) var(--sidebar-w, 380px) minmax(0, 1fr) 340px; }
  .app.rail-wide { --rail-w: 248px; }

  .app .rail {
    background: radial-gradient(130% 70% at 100% 0%, rgba(251, 199, 0, .16), transparent 55%), var(--ink);
    color: var(--ink-text); border: 0; border-radius: 30px; margin: 10px 0 10px 10px; padding: 16px 10px 12px; gap: 6px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .22); overflow: hidden;
  }
  .rail .rail-brand { position: relative; padding: 4px 0 10px; gap: 8px; }
  .rail .brand-name { color: var(--ink-text); font-size: .74rem; font-weight: 800; letter-spacing: .01em; }
  .rail .brand-logo { box-shadow: 0 6px 18px rgba(251, 199, 0, .45); transition: transform .3s cubic-bezier(.2, 1.4, .4, 1); }
  .rail .rail-brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
  .rail-toggle {
    border: 0; border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer;
    background: var(--ink-2); color: var(--ink-muted); transition: background .2s, color .2s, transform .25s;
  }
  .rail-toggle:hover { background: var(--ink-3); color: #fff; }
  .rail.wide .rail-toggle { transform: rotate(180deg); }

  .rail .rail-nav { gap: 4px; }
  .rail .rail-item {
    color: var(--ink-muted); border-radius: 18px; padding: 10px 4px; font-size: .7rem; font-weight: 600;
    transition: background .2s, color .2s, transform .15s;
  }
  .rail .rail-item:hover { background: var(--ink-2); color: #fff; }
  .rail .rail-item:active { transform: scale(.96); }
  .rail .rail-item.active, .rail .rail-item[aria-current='true'] { background: linear-gradient(135deg, var(--yel-2), var(--yel)); color: var(--ink); box-shadow: 0 6px 16px rgba(251, 199, 0, .35); }
  .rail .rail-item.active .rail-ico, .rail .rail-item.active { color: var(--ink); }
  .rail .rail-badge { background: var(--yel); color: var(--ink); border: 2px solid var(--ink); top: -8px; right: -12px; font-weight: 800; }
  .rail .rail-item.active .rail-badge { background: var(--ink); color: var(--yel); border-color: var(--yel); }
  .rail .rail-sep { background: rgba(255, 255, 255, .1); }
  .rail .rail-me { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 18px; padding: 8px; }
  .rail .rail-me:hover { background: var(--ink-2); }
  .rail .rail-me .avatar .dot { border-color: var(--ink); }
  .rail-me-text { display: none; text-align: left; min-width: 0; }
  .rail-me-text b { display: block; color: #fff; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rail-me-text small { color: var(--ink-muted); }

  /* expanded: icon and name side by side */
  .rail.wide { padding: 16px 12px 12px; }
  .rail.wide .rail-brand { display: flex; align-items: center; justify-content: flex-start; padding: 4px 6px 14px; }
  .rail.wide .rail-brand .brand-logo { width: 40px; height: 40px; }
  .rail.wide .brand-name { font-size: 1.05rem; flex: 1; text-align: left; }
  .rail.wide .rail-item { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 12px 16px; font-size: .95rem; }
  .rail.wide .rail-sep { margin: 4px 10px; }
  .rail.wide .rail-me { justify-content: flex-start; }
  .rail.wide .rail-me-text { display: block; }
  .rail.wide .rail-badge { top: -6px; right: -9px; }

  /* the chat list */
  .app .sidebar { background: var(--surface); }
  .app .side-head2 .view-title { font-size: 1.75rem; letter-spacing: -.03em; }
  .app .search { margin: 4px 16px 6px; }
  .app .search .input, .app .search input { border-radius: var(--pill); }
  .tabs { gap: 6px; padding: 6px 16px 8px; }
  .tabs .tab, .app .tab {
    border: 0; border-radius: var(--pill); padding: 8px 16px; margin: 0; background: var(--surface-2); color: var(--muted); font-weight: 600;
    transition: background .2s, color .2s, transform .15s;
  }
  .tabs .tab:hover { color: var(--text); }
  .tabs .tab[aria-selected='true'], .app .tab[aria-selected='true'] { background: var(--ink); color: var(--ink-text); background-image: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
  .tabs .tab[aria-selected='true'] * { color: var(--ink-text); }

  .app .chatlist { padding: 4px 10px 12px; }
  .app .ci { border-radius: 22px; padding: 12px 14px; margin: 2px 0; transition: background .18s, transform .15s, box-shadow .18s; }
  .app .ci:hover { background: var(--surface-2); }
  .app .ci:active { transform: scale(.992); }
  .app .ci[aria-current='true'] { background: var(--ink); color: var(--ink-text); box-shadow: 0 10px 24px rgba(0, 0, 0, .2); }
  .app .ci[aria-current='true'] .ci-title, .app .ci[aria-current='true'] .ci-last, .app .ci[aria-current='true'] .ci-time, .app .ci[aria-current='true'] time { color: var(--ink-text); }
  .app .ci[aria-current='true'] .ci-last { color: var(--ink-muted); }
  .app .ci .badge:not(.muted), .app .ci .unread { background: var(--yel); color: var(--ink); font-weight: 800; }

  /* the chat itself */
  .app .main { background: var(--surface); }
  .app .composer-wrap { border-top: 0; background: transparent; padding: 8px 14px 14px; }
  .app .composer { background: var(--surface); border-radius: 30px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .1); border: 1px solid var(--line); }
  .app .composer textarea { background: transparent; }
  .app .send-btn { background: var(--ink); color: var(--yel); }
  .app .bubble { border-radius: 22px; }
  .app .msg.out .bubble { border-bottom-right-radius: 8px; }
  .app .msg.in .bubble { border-bottom-left-radius: 8px; }
}

/* ============================== phone ============================== */
@media (max-width: 600px) {
  /* the chat: a dark rounded header, a floating composer */
  .app .chat-head {
    background: var(--ink);   /* a flat colour: the glow that was here looked like a haze on the top of the screen */
    color: var(--ink-text); border: 0; border-radius: 0 0 26px 26px; padding: calc(8px + env(safe-area-inset-top)) 10px 10px; min-height: 0; position: relative; z-index: 3;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .25);
  }
  /* a fixed dark strip under the clock: without it iOS fades the status bar into the page, which looks blurry */
  .app .chat-head::before, .app .hero::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); background: var(--ink); z-index: 60; pointer-events: none; }
  .app .chat-head .who b { color: #fff; }
  .app .chat-head .sub { color: var(--ink-muted); }
  .app .chat-head .sub.live { color: var(--yel); }
  .app .chat-head .icon-btn { color: var(--yel) !important; }
  .app .chat-head .icon-btn.back { color: #fff !important; }
  .app .composer-wrap { border-top: 0; background: transparent; padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .app .composer { background: var(--surface); border-radius: 30px; padding: 5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); border: 1px solid var(--line); }
  .app .composer textarea { background: transparent; }
  .app .send-btn { background: var(--ink); color: var(--yel); }
  .app .bubble { border-radius: 22px; }
  .app .msg.out .bubble { border-bottom-right-radius: 8px; }
  .app .msg.in .bubble { border-bottom-left-radius: 8px; }

  /* a dark header with a greeting, the search and the stories */
  .app .hero {
    background: var(--ink);   /* a flat colour, no glow */
    color: var(--ink-text); border-radius: 0 0 34px 34px; padding-bottom: 16px; position: relative; z-index: 2;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .25);
  }
  .app .hero .side-head2 { padding: calc(14px + env(safe-area-inset-top)) 10px 0 18px; min-height: 0; }
  .app .hero .brand-word { color: var(--ink-text); font-size: 1.05rem; }
  .app .hero .only-mobile { display: none; }
  .app .hero .side-head2 .icon-btn { color: var(--yel); background: var(--ink-2); border-radius: 50%; }
  .app .hero .side-head2 .compose-btn { display: grid; }
  .app .hero .greet { display: grid; padding: 12px 20px 2px; gap: 0; }
  .app .hero .greet-hi { color: var(--ink-muted); font-size: .88rem; }
  .app .hero .greet-main { font-size: 1.85rem; letter-spacing: -.03em; line-height: 1.1; color: #fff; }
  .app .hero .greet-sub { color: var(--yel); font-size: .88rem; font-weight: 600; margin-top: 2px; }
  .app[data-section='contacts'] .hero .greet, .app[data-section='archive'] .hero .greet { display: none; }
  .app .hero .search, .app .sidebar:not([data-search='open']) .hero .search {
    display: flex; margin: 14px 16px 0; background: rgba(255, 255, 255, .1); border-radius: var(--pill); color: var(--ink-muted);
    border: 1px solid rgba(255, 255, 255, .08);
  }
  .app .hero .search .input, .app .hero .search input { background: transparent; color: #fff; border: 0; }
  .app .hero .search input::placeholder { color: var(--ink-muted); }
  .app .hero .stories-bar { padding: 14px 16px 0; }
  .app .hero .story-name { color: var(--ink-muted); }
  .app .hero .stories-bar[hidden] { display: none; }

  .app .tabs { padding: 14px 14px 6px; gap: 6px; background: transparent; }
  .app .tab { border-radius: var(--pill); padding: 8px 16px; margin: 0; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
  .app .tab[aria-selected='true'] { background: var(--ink); color: var(--ink-text); border-color: var(--ink); box-shadow: 0 6px 14px rgba(0, 0, 0, .2); background-image: none; }
  .app .tab[aria-selected='true'] * { color: var(--ink-text); }

  .app .chatlist { padding: 4px 12px calc(110px + env(safe-area-inset-bottom)); }
  .app .ci { background: var(--surface); border-radius: 24px; margin: 6px 0; padding: 12px 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, .05); transition: transform .15s, box-shadow .2s; }
  .app .ci:active { transform: scale(.985); }
  .app .ci .badge:not(.muted), .app .ci .unread { background: var(--ink); color: var(--yel); font-weight: 800; }

  /* the dock: dark, floating; the open section is a yellow pill with its name */
  .app .fab { display: none; }
  .app[data-view='list'] .bottomnav {
    display: flex; align-items: center; justify-content: space-around; gap: 2px;
    left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom)); padding: 8px 10px; height: 68px;
    background: var(--ink); border: 0; border-radius: 34px; backdrop-filter: none; box-shadow: 0 16px 36px rgba(0, 0, 0, .35);
  }
  .app .bottomnav button { color: var(--ink-muted); background: none; min-height: 0; height: 50px; width: 50px; flex: 0 0 50px; border-radius: var(--pill); display: flex; align-items: center; justify-content: center; gap: 0; padding: 0; overflow: hidden; transition: flex-basis .35s cubic-bezier(.3, 1.2, .4, 1), width .35s cubic-bezier(.3, 1.2, .4, 1), background .25s, color .25s; }
  .app .bottomnav button[aria-current='true'] { flex: 0 0 auto; width: auto; padding: 0 18px 0 14px; gap: 8px; background: var(--yel); color: var(--ink); font-weight: 800; box-shadow: 0 6px 16px rgba(251, 199, 0, .4); }
  .app .bottomnav .nb-label { display: none; font-size: .86rem; }
  .app .bottomnav button[aria-current='true'] .nb-label { display: block; max-width: 110px; animation: nb-in .3s .05s both; }
  .app .bottomnav .nb-badge { top: -6px; left: auto; right: -9px; background: var(--yel); color: var(--ink); border-color: var(--ink); }
  .app .bottomnav button[aria-current='true'] .nb-badge { background: var(--ink); color: var(--yel); border-color: var(--yel); }
}
@keyframes nb-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

@media (min-width: 601px) { .greet { display: none; } .bottomnav { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .app, .rail .rail-item, .app .ci, .app .bottomnav button { transition: none; }
  .app .bottomnav button[aria-current='true'] .nb-label { animation: none; }
}

/* a low window: tighter rail so every section still fits */
@media (min-width: 601px) and (max-height: 860px) {
  .app .rail { padding-top: 10px; padding-bottom: 8px; gap: 2px; }
  .rail .rail-brand { padding-bottom: 4px; }
  .rail .brand-logo { width: 38px; height: 38px; }
  .rail .rail-item { padding: 6px 4px; gap: 1px; }
  .rail.wide .rail-item { padding: 9px 16px; }
  .rail .rail-me .avatar { width: 38px; height: 38px; }
}

/* settings: sections as rounded cards */
.sheading { padding: 20px 22px 8px; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sgroup { margin: 0 14px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 2px 10px rgba(0, 0, 0, .04); }
.sgroup + .sgroup { margin-top: 12px; }
.sgroup .srow:hover { background: var(--surface-2); }

/* a small dot: something is on in this section (a live room, focus mode) without painting the whole item as the open page */
.rail-dot { position: absolute; top: -3px; right: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--yel); border: 2px solid var(--ink); box-shadow: 0 0 0 0 rgba(251, 199, 0, .6); animation: rail-pulse 2.4s infinite; }
@keyframes rail-pulse { 70% { box-shadow: 0 0 0 7px rgba(251, 199, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(251, 199, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .rail-dot { animation: none; } }

/* the dark chat header: round buttons must not turn into light blobs (hover, focus, press) */
@media (max-width: 600px) {
  .app .chat-head .icon-btn { background: transparent; box-shadow: none; }
  .app .chat-head .icon-btn:hover, .app .chat-head .icon-btn:focus-visible, .app .chat-head .icon-btn:active { background: rgba(255, 255, 255, .14); box-shadow: none; transform: none; filter: none; }
  .app .chat-head .icon-btn:focus-visible { outline: 2px solid var(--yel); outline-offset: -2px; }
  .app .chat-head .icon-btn.back:hover, .app .chat-head .icon-btn.back:active { color: #fff !important; }
  .app .chat-head .ripple, .app .chat-head .icon-btn .ripple { background: rgba(255, 255, 255, .25); }
}

/* the phone header folds away while the list is scrolled: the greeting, the search and the stories go, the logo, search and "new chat" stay */
@media (max-width: 600px) {
  .app .hero-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .32s cubic-bezier(.3, .8, .3, 1); }
  .app .hero-inner { min-height: 0; overflow: hidden; }
  .app .hero { transition: padding-bottom .32s ease, border-radius .32s ease, box-shadow .32s ease; }
  .app .hero.compact .hero-body { grid-template-rows: 0fr; }
  .app .hero.compact .hero-inner { visibility: hidden; transition: visibility 0s .32s; }
  .app .hero.compact { padding-bottom: 8px; border-radius: 0 0 22px 22px; }
  .app .hero.compact .side-head2 { padding-bottom: 2px; }
  .app .hero.compact .side-head2 .only-mobile { display: inline-grid; }
  @media (prefers-reduced-motion: reduce) { .app .hero-body, .app .hero { transition: none; } }
}

/* folders: unread count on the tab, order buttons, rules */
.tab .tab-n { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: var(--yel, var(--brand)); color: var(--ink, #111); font-size: .72rem; font-weight: 800; line-height: 18px; text-align: center; vertical-align: 1px; }
.folder-move { display: flex; flex-direction: column; gap: 0; margin-right: 6px; }
.folder-move .icon-btn { width: 26px; height: 20px; font-size: .8rem; line-height: 1; padding: 0; }
.folder-rules { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.folder-rules b { margin-top: 6px; }
.folder-rules .rule { padding: 2px 0; }

/* search results: the words that were found */
mark { background: color-mix(in srgb, var(--yel, #f6c90e) 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.hit-voice { font-style: italic; }
.gs-results .more, .list-item + .more, [role='list'] > .more { display: block; margin: 10px auto; }
.sched-main { background: none; border: 0; text-align: left; color: inherit; padding: 0; cursor: pointer; min-width: 0; }

/* thread of replies */
.thread-chip { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 3px 10px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--brand-text, var(--text)); font-weight: 700; font-size: .85rem; cursor: pointer; }
.msg.out .bubble .thread-chip { background: rgba(255, 255, 255, .22); color: inherit; }
.modal.thread .modal-body { display: flex; flex-direction: column; gap: 8px; max-height: min(70vh, 640px); }
.thread-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 120px; padding-right: 2px; }
.thread-msg { display: flex; gap: 8px; align-items: flex-start; }
.thread-bubble { background: var(--surface-2); border-radius: 14px; padding: 8px 12px; min-width: 0; flex: 1; }
.thread-msg.mine .thread-bubble { background: color-mix(in srgb, var(--yel, var(--brand)) 28%, var(--surface-2)); }
.thread-msg.root .thread-bubble { border: 1px solid var(--line); }
.thread-head { font-size: .85rem; }
.thread-quote { color: var(--muted); font-size: .8rem; border-left: 3px solid var(--brand); padding-left: 6px; margin: 2px 0; }
.thread-text { white-space: pre-wrap; word-break: break-word; }
.thread-actions { display: flex; gap: 10px; }
.thread-actions .btn.link { padding: 2px 0; font-size: .8rem; }
.thread-sep { text-align: center; color: var(--muted); font-size: .8rem; font-weight: 700; }
.thread-target { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 8px; font-size: .85rem; }
.thread-composer { display: flex; gap: 8px; align-items: center; }
.thread-composer .input { flex: 1; }
.reactors-head { font-weight: 800; margin: 8px 0 2px; }
.reactors-emoji { font-size: 1.3rem; }

/* narrow screens: a long subtitle in the chat header is cut with "…" instead of widening the whole page */
.chat-head .who > .grow { min-width: 0; display: flex; flex-direction: column; }
.chat-head .who > .grow > b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal.mc .mc-report { white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, Consolas, monospace; background: var(--surface-2); border-radius: 10px; padding: 10px; max-height: 46vh; overflow: auto; margin: 8px 0; }

/* compact interface: small phones (320x480 points) and whoever switches it on */
@media (max-width: 600px) {
  html.compact-ui { --compact: 1; }
  html.compact-ui .app .bottomnav button { min-height: 40px; font-size: .66rem; padding: 3px 0; }
  html.compact-ui .app[data-view='list'] .chatlist { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  html.compact-ui .ci { padding-top: 6px; padding-bottom: 6px; gap: 10px; }
  html.compact-ui .ci .avatar { width: 40px; height: 40px; font-size: .9rem; }
  html.compact-ui .tabs { padding: 2px 8px 4px; gap: 4px; }
  html.compact-ui .tab { padding: 4px 10px; font-size: .82rem; }
  html.compact-ui .chat-head { min-height: 48px; padding-top: 2px; padding-bottom: 2px; }
  html.compact-ui .chat-head .avatar { width: 34px; height: 34px; }
  html.compact-ui .msg .bubble { padding: 6px 10px; font-size: .94rem; }
  html.compact-ui .msg { max-width: 94%; }
  html.compact-ui .composer { padding: 4px 6px; gap: 4px; }
  html.compact-ui .composer .icon-btn, html.compact-ui .composer .send-btn { width: 38px; height: 38px; }
  html.compact-ui .modal { max-height: 100vh; border-radius: 14px 14px 0 0; }
  html.compact-ui .modal-head { padding: 10px 14px; }
  html.compact-ui .modal-body { padding: 10px 14px; }
  html.compact-ui .sinfo { padding: 8px 12px; }
  html.compact-ui .app .bottomnav button[aria-current='true'] { font-size: .6rem; }
}
/* a small screen: the bar keeps icons only (the open section is the yellow one) */
@media (max-width: 360px), (max-height: 520px) {
  .app .bottomnav button[aria-current='true'] { width: 50px; flex: 0 0 50px; padding: 0; gap: 0; }
  .app .bottomnav button[aria-current='true'] .nb-label { display: none; }
}
html.compact-ui .app .bottomnav button[aria-current='true'] { width: 50px; flex: 0 0 50px; padding: 0; gap: 0; }
html.compact-ui .app .bottomnav button[aria-current='true'] .nb-label { display: none; }

/* ===== colour themes: the accent of the whole app, on top of light or dark (chosen in Settings → Chats) ===== */
:root[data-palette='ocean'] {
  --brand: #2f6bff; --brand-2: #2f6bff; --brand-ink: #ffffff; --brand-text: #1d4ed8; --brand-soft: #e4edff;
  --bg: #eef2f8; --surface-2: #f4f7fc; --line: #d9e2f2; --bubble-out: #dbe8ff; --g: linear-gradient(135deg, #2f6bff, #2f6bff);
  --yel: #2f6bff; --yel-2: #2f6bff;
}
:root[data-theme='dark'][data-palette='ocean'] {
  --brand: #5b8cff; --brand-2: #5b8cff; --brand-ink: #0b1220; --brand-text: #9db9ff; --brand-soft: #1b2a52;
  --bg: #0c1220; --surface-2: #19233b; --line: #25324f; --bubble-out: #b4cdff; --g: linear-gradient(135deg, #5b8cff, #5b8cff);
  --yel: #5b8cff; --yel-2: #5b8cff;
  --surface: #131b2e;
}
:root[data-palette='violet'] {
  --brand: #5b44f2; --brand-2: #5b44f2; --brand-ink: #ffffff; --brand-text: #4b35d6; --brand-soft: #ece9ff;
  --bg: #f3f1fd; --surface-2: #f7f5ff; --line: #e2ddf8; --bubble-out: #e3deff; --g: linear-gradient(135deg, #5b44f2, #5b44f2);
  --yel: #5b44f2; --yel-2: #5b44f2;
}
:root[data-theme='dark'][data-palette='violet'] {
  --brand: #8d7bff; --brand-2: #8d7bff; --brand-ink: #14102e; --brand-text: #bcb0ff; --brand-soft: #2a2352;
  --bg: #0f0d1d; --surface-2: #1e1a35; --line: #2c2748; --bubble-out: #cfc6ff; --g: linear-gradient(135deg, #8d7bff, #8d7bff);
  --yel: #8d7bff; --yel-2: #8d7bff;
  --surface: #171428;
}
:root[data-palette='forest'] {
  --brand: #1f9d55; --brand-2: #1f9d55; --brand-ink: #ffffff; --brand-text: #15803d; --brand-soft: #dcf5e6;
  --bg: #eef6f0; --surface-2: #f4faf6; --line: #d5e6da; --bubble-out: #d4f2de; --g: linear-gradient(135deg, #1f9d55, #1f9d55);
  --yel: #1f9d55; --yel-2: #1f9d55;
}
:root[data-theme='dark'][data-palette='forest'] {
  --brand: #4ade80; --brand-2: #4ade80; --brand-ink: #05210f; --brand-text: #86efac; --brand-soft: #12361f;
  --bg: #0a120d; --surface-2: #17241c; --line: #223329; --bubble-out: #a8ecc3; --g: linear-gradient(135deg, #4ade80, #4ade80);
  --yel: #4ade80; --yel-2: #4ade80;
  --surface: #111b15;
}
:root[data-palette='rose'] {
  --brand: #e11d74; --brand-2: #e11d74; --brand-ink: #ffffff; --brand-text: #be185d; --brand-soft: #fde4ef;
  --bg: #fdf1f6; --surface-2: #fff6fa; --line: #f6d5e3; --bubble-out: #fbd5e5; --g: linear-gradient(135deg, #e11d74, #e11d74);
  --yel: #e11d74; --yel-2: #e11d74;
}
:root[data-theme='dark'][data-palette='rose'] {
  --brand: #f472b6; --brand-2: #f472b6; --brand-ink: #2a0a1a; --brand-text: #f9a8d4; --brand-soft: #4a1730;
  --bg: #180b11; --surface-2: #2b1822; --line: #3d2230; --bubble-out: #f9bdd9; --g: linear-gradient(135deg, #f472b6, #f472b6);
  --yel: #f472b6; --yel-2: #f472b6;
  --surface: #22121a;
}
:root[data-palette='graphite'] {
  --brand: #3f3f46; --brand-2: #3f3f46; --brand-ink: #ffffff; --brand-text: #27272a; --brand-soft: #e8e8ec;
  --bg: #f1f1f3; --surface-2: #f6f6f8; --line: #dcdce0; --bubble-out: #e4e4e8; --g: linear-gradient(135deg, #3f3f46, #3f3f46);
  --yel: #3f3f46; --yel-2: #3f3f46;
}
:root[data-theme='dark'][data-palette='graphite'] {
  --brand: #d4d4d8; --brand-2: #d4d4d8; --brand-ink: #18181b; --brand-text: #e4e4e7; --brand-soft: #2a2a30;
  --bg: #0e0e10; --surface-2: #1e1e22; --line: #2b2b31; --bubble-out: #d4d4d8; --g: linear-gradient(135deg, #d4d4d8, #d4d4d8);
  --yel: #d4d4d8; --yel-2: #d4d4d8;
  --surface: #17171a;
}
.rail .rail-item.active, .rail .rail-item[aria-current='true'] { color: var(--brand-ink, #17171a); }
:root[data-palette] .rail .rail-item.active, :root[data-palette] .rail .rail-item[aria-current='true'] { color: var(--brand-ink); }
.pal-tiles { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 16px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pal-tile { border: 2px solid transparent; border-radius: 16px; background: none; padding: 6px 8px; font: inherit; color: var(--text); cursor: pointer; display: grid; gap: 6px; justify-items: center; min-width: 64px; }
.pal-tile .pal-dot { width: 40px; height: 40px; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55), 0 2px 8px rgba(0, 0, 0, .2); }
.pal-tile.on { border-color: var(--brand); }
.pal-tile span:last-child { font-size: .82rem; font-weight: 600; }
