/* v18.1 — theme-aware Shop, readable messages and sponsor flow */

/* Message and discussion contrast must follow the active theme. */
.message-content,
.message.outgoing .message-content {
  color: var(--text);
}

.message-content {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 94%, var(--blue) 6%), var(--surface)),
    var(--surface);
  border-color: color-mix(in srgb, var(--line) 84%, var(--text) 16%);
}

.message.outgoing .message-content {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--outgoing-bg) 84%, var(--surface)), var(--outgoing-bg)),
    var(--outgoing-bg);
  border-color: color-mix(in srgb, var(--teal) 34%, var(--line));
}

.message-body,
.telegram-rich-text,
.message-rich,
.comment-post-preview span {
  color: var(--text);
}

.message-footer {
  color: color-mix(in srgb, var(--text) 68%, transparent);
}

.message-author-line,
.comment-post-preview strong {
  color: color-mix(in srgb, var(--blue) 88%, var(--text));
}

.comments-list {
  padding-left: 52px;
  padding-right: 22px;
  overflow-x: hidden;
}

.comments-list .message.with-avatar {
  margin-left: 0;
  overflow: visible;
}

.comments-list .message.with-avatar .message-avatar {
  left: -38px !important;
  bottom: 1px;
  display: grid;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: color-mix(in srgb, var(--avatar-muted-bg) 86%, var(--surface));
  color: var(--text);
  box-shadow: 0 5px 13px color-mix(in srgb, var(--text) 15%, transparent);
}

.comments-list .message-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Shop design tokens derive from the same global theme as the messenger. */
.app-shell.shop-active {
  --shop-bg: color-mix(in srgb, var(--bg) 84%, var(--surface));
  --shop-surface: color-mix(in srgb, var(--surface) 96%, transparent);
  --shop-surface-raised: color-mix(in srgb, var(--surface) 88%, var(--blue-soft));
  --shop-surface-soft: color-mix(in srgb, var(--surface-2) 88%, var(--surface));
  --shop-text: var(--text);
  --shop-muted: color-mix(in srgb, var(--muted) 86%, var(--text));
  --shop-line: color-mix(in srgb, var(--line) 78%, var(--text) 22%);
  --shop-primary: var(--blue);
  --shop-primary-strong: color-mix(in srgb, var(--blue) 76%, var(--text));
  --shop-primary-soft: color-mix(in srgb, var(--blue-soft) 86%, var(--surface));
  --shop-success: var(--teal);
  --shop-danger: var(--red);
  --shop-hero-a: color-mix(in srgb, var(--blue) 34%, #11172f);
  --shop-hero-b: color-mix(in srgb, var(--teal) 18%, #18234d);
  --shop-hero-text: #f7f9ff;
  --shop-hero-muted: #d1d8f3;
  --shop-shadow: 0 18px 48px color-mix(in srgb, var(--text) 13%, transparent);
}

body[data-theme="dark"] .app-shell.shop-active {
  --shop-bg: color-mix(in srgb, var(--bg) 92%, var(--surface));
  --shop-surface: color-mix(in srgb, var(--surface) 94%, #000 6%);
  --shop-surface-raised: color-mix(in srgb, var(--surface-2) 88%, var(--blue) 12%);
  --shop-surface-soft: color-mix(in srgb, var(--surface-2) 92%, #000 8%);
  --shop-line: color-mix(in srgb, var(--line) 70%, var(--text) 30%);
  --shop-primary-strong: color-mix(in srgb, var(--blue) 84%, #fff 16%);
  --shop-primary-soft: color-mix(in srgb, var(--blue-soft) 82%, var(--surface));
  --shop-hero-a: color-mix(in srgb, var(--blue) 22%, #090d1a);
  --shop-hero-b: color-mix(in srgb, var(--teal) 13%, #10182c);
}

.app-shell.shop-active .main-panel,
.app-shell.shop-active .content-feed {
  background:
    radial-gradient(circle at 95% 4%, color-mix(in srgb, var(--shop-primary) 10%, transparent), transparent 25rem),
    var(--shop-bg);
  color: var(--shop-text);
}

.app-shell.shop-active .main-panel {
  container-type: inline-size;
}

.shop-command {
  border-color: var(--shop-line);
  background: color-mix(in srgb, var(--shop-surface) 91%, transparent);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--shop-text) 7%, transparent);
}

.shop-wordmark,
.shop-command-actions button,
.shop-product-title,
.shop-merch-section h2,
.shop-catalog-head h1,
.shop-account-page h1,
.shop-seller-page h1,
.shop-detail-info h1,
.shop-product-card footer strong,
.shop-buy-card > strong {
  color: var(--shop-text);
}

.shop-wordmark small,
.shop-side-v18 > header small,
.shop-product-copy > p,
.shop-merch-section > header p,
.shop-catalog-head p,
.shop-account-page > header p,
.shop-seller-page > header p,
.shop-detail-lead,
.shop-card-proof,
.shop-seller-line small,
.shop-specs dt,
.shop-seller-card small,
.shop-seller-card em,
.shop-buy-card > small,
.shop-buy-card > p {
  color: var(--shop-muted);
}

.shop-search,
.shop-category-strip,
.shop-principles article,
.shop-product-card,
.shop-specs,
.shop-seller-card,
.shop-buy-card,
.shop-orders-list article,
.seller-metrics article,
.seller-listings,
.seller-checklist,
.shop-cart-overlay > aside {
  border-color: var(--shop-line);
  background: var(--shop-surface);
  color: var(--shop-text);
}

.shop-search input,
.shop-catalog-head select {
  color: var(--shop-text);
  background: transparent;
}

.shop-search input::placeholder {
  color: var(--shop-muted);
  opacity: .85;
}

.shop-search:focus-within {
  border-color: var(--shop-primary);
  background: var(--shop-surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--shop-primary) 16%, transparent);
}

.shop-search button,
.shop-product-card footer > button,
.shop-side-sell,
.shop-buy-card > button.primary,
.seller-checklist > button,
.shop-seller-page > header > button,
.shop-cart-overlay footer > button {
  border-color: var(--shop-primary);
  background: var(--shop-primary);
  color: color-mix(in srgb, #fff 94%, var(--shop-primary));
}

.shop-command-actions button {
  border-color: var(--shop-line);
  background: var(--shop-surface);
}

.shop-command-actions .shop-filter-button b {
  display: grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 99px;
  background: var(--shop-primary);
  color: #fff;
  font-size: 8px;
}

.shop-intent-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--shop-line);
  border-radius: 14px;
  background: var(--shop-surface-soft);
}

.shop-command-actions .shop-intent-switch button {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--shop-muted);
  box-shadow: none;
}

.shop-command-actions .shop-intent-switch button.active {
  background: var(--shop-primary);
  color: #fff;
  box-shadow: 0 7px 16px color-mix(in srgb, var(--shop-primary) 22%, transparent);
}

.shop-hero-v18 {
  border-color: color-mix(in srgb, var(--shop-primary) 20%, transparent);
  background:
    radial-gradient(circle at 75% 14%, color-mix(in srgb, var(--shop-primary) 28%, transparent), transparent 27%),
    linear-gradient(135deg, var(--shop-hero-a), var(--shop-hero-b));
  color: var(--shop-hero-text);
  box-shadow: var(--shop-shadow);
}

.shop-hero-v18 > div > p,
.shop-hero-v18 ul,
.shop-hero-object b,
.shop-hero-object small,
.shop-hero-float small {
  color: var(--shop-hero-muted);
}

.shop-hero-v18 h1,
.shop-hero-v18 button,
.shop-hero-object strong,
.shop-hero-object em,
.shop-hero-float strong {
  color: var(--shop-hero-text);
}

.shop-hero-v18 h1 em,
.shop-hero-label {
  color: color-mix(in srgb, var(--shop-primary) 42%, #fff);
}

.shop-hero-v18 button.primary {
  border-color: var(--shop-hero-text);
  background: var(--shop-hero-text);
  color: var(--shop-primary-strong);
}

.shop-category-strip button {
  color: var(--shop-muted);
}

.shop-category-strip button span,
.shop-card-kicker button,
.shop-gallery-thumbs button,
.seller-listings > header button,
.seller-listings article > button {
  background: var(--shop-surface-soft);
  color: var(--shop-muted);
}

.shop-category-strip button:hover,
.shop-category-strip button.active,
.shop-card-kicker > span,
.shop-detail-kicker,
.shop-merch-section > header > div > span,
.shop-catalog-head > div > span,
.shop-account-page > header > span,
.shop-seller-page > header span,
.seller-checklist > span {
  color: var(--shop-primary-strong);
}

.shop-category-strip button.active,
.shop-merch-section > header > button,
.shop-catalog-head > div > button,
.shop-detail-back {
  background: var(--shop-primary-soft);
}

.shop-category-strip button.active span,
.shop-card-kicker button.active {
  background: var(--shop-primary);
  color: #fff;
}

.shop-principles article > span,
.seller-metrics article > span,
.shop-delivery-box > span,
.shop-seller-line > span,
.shop-seller-card > span {
  background: var(--shop-primary-soft);
  color: var(--shop-primary-strong);
}

.shop-seller-line,
.shop-card-proof,
.shop-product-card footer,
.seller-listings > article,
.shop-cart-lines article {
  border-color: var(--shop-line);
}

.shop-product-card .shop-seller-line {
  width: 100%;
  border-width: 1px 0;
  border-style: solid;
  background: transparent;
  color: var(--shop-text);
  text-align: left;
  cursor: pointer;
}

.shop-product-card .shop-seller-line > svg {
  width: 14px;
  margin-left: auto;
  color: var(--shop-muted);
}

.shop-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shop-product-card footer .shop-card-actions > button {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid var(--shop-line);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.shop-product-card footer .shop-card-actions > button:hover { transform: translateY(-2px); }
.shop-product-card footer .shop-card-actions > button.cart { background: var(--shop-primary); color: #fff; }
.shop-product-card footer .shop-card-actions > button.sponsor {
  position: relative;
  background: color-mix(in srgb, var(--shop-success) 14%, var(--shop-surface));
  color: color-mix(in srgb, var(--shop-success) 74%, var(--shop-text));
  border-color: color-mix(in srgb, var(--shop-success) 45%, var(--shop-line));
}
.shop-product-card footer .shop-card-actions > button.sponsor b { font-size: 12px; }
.shop-product-card footer .shop-card-actions > button.sponsor svg { position: absolute; right: 3px; bottom: 3px; width: 10px; }
.shop-product-card footer .shop-card-actions > button.cart svg { width: 17px; }

.shop-trust-notice,
.shop-open-store-note {
  display: flex;
  gap: 11px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--shop-line);
  border-radius: 15px;
  background: var(--shop-surface);
}

.shop-trust-notice > svg,
.shop-open-store-note > i {
  width: 21px;
  flex: 0 0 auto;
}
.shop-trust-notice.verified { border-color: color-mix(in srgb, var(--shop-success) 45%, var(--shop-line)); background: color-mix(in srgb, var(--shop-success) 10%, var(--shop-surface)); }
.shop-trust-notice.verified > svg { color: var(--shop-success); }
.shop-trust-notice.independent { border-color: color-mix(in srgb, var(--amber) 52%, var(--shop-line)); background: color-mix(in srgb, var(--amber) 10%, var(--shop-surface)); }
.shop-trust-notice.independent > svg { color: var(--amber); }
.shop-trust-notice div { display: grid; gap: 4px; }
.shop-trust-notice strong { font-size: 10px; }
.shop-trust-notice p { margin: 0; color: var(--shop-muted); font-size: 8px; line-height: 1.5; }

/* Store directory and storefront */
.shop-store-directory,
.shop-store-page {
  width: min(1460px, calc(100% - clamp(32px, 7vw, 104px)));
  margin: 0 auto;
  padding: 38px 0 72px;
  color: var(--shop-text);
}
.shop-store-directory > header { max-width: 760px; margin-bottom: 28px; }
.shop-store-directory > header > span,
.shop-store-identity small { color: var(--shop-primary-strong); font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.shop-store-directory h1,
.shop-store-identity h1 { margin: 6px 0 9px; font-size: clamp(34px, 4vw, 54px); line-height: 1.04; letter-spacing: -.045em; }
.shop-store-directory > header p,
.shop-store-identity p,
.shop-store-about p { margin: 0; color: var(--shop-muted); font-size: 11px; line-height: 1.6; }
.shop-store-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.shop-store-card { overflow: hidden; padding: 0; border: 1px solid var(--shop-line); border-radius: 20px; background: var(--shop-surface); color: var(--shop-text); text-align: left; cursor: pointer; box-shadow: 0 10px 28px color-mix(in srgb, var(--shop-text) 6%, transparent); transition: transform 170ms ease, box-shadow 170ms ease; }
.shop-store-card:hover { transform: translateY(-3px); box-shadow: var(--shop-shadow); }
.shop-store-cover { display: flex; align-items: flex-end; justify-content: space-between; min-height: 132px; padding: 18px; background: linear-gradient(135deg, var(--shop-primary-soft), color-mix(in srgb, var(--shop-success) 17%, var(--shop-surface))); }
.shop-store-cover > span { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 18px; background: var(--shop-primary); color: #fff; font-size: 15px; font-weight: 850; box-shadow: 0 13px 25px color-mix(in srgb, var(--shop-primary) 25%, transparent); }
.shop-store-cover em { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; border-radius: 99px; background: var(--shop-surface); color: var(--shop-text); font-size: 8px; font-style: normal; font-weight: 760; }
.shop-store-cover em svg { width: 11px; color: var(--shop-primary); }
.shop-store-card > div:last-child { padding: 17px; }
.shop-store-card > div:last-child > span { color: var(--shop-primary-strong); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.shop-store-card h2 { margin: 7px 0 5px; font-size: 18px; }
.shop-store-card p { min-height: 38px; margin: 0; color: var(--shop-muted); font-size: 9px; line-height: 1.5; }
.shop-store-card footer { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--shop-line); }
.shop-store-card footer small { color: var(--shop-muted); font-size: 8px; }
.shop-store-card footer b { display: flex; align-items: center; gap: 4px; font-size: 9px; }
.shop-store-card footer svg { width: 11px; fill: var(--amber); color: var(--amber); }
.shop-store-page > header { display: flex; align-items: center; justify-content: space-between; gap: 30px; margin: 20px 0 18px; padding: 26px; border: 1px solid var(--shop-line); border-radius: 22px; background: var(--shop-surface); }
.shop-store-identity { display: flex; align-items: center; gap: 17px; }
.shop-store-identity > span { display: grid; width: 76px; height: 76px; flex: 0 0 auto; place-items: center; border-radius: 22px; background: var(--shop-primary); color: #fff; font-size: 19px; font-weight: 850; }
.shop-store-identity h1 { font-size: clamp(30px, 3vw, 44px); }
.shop-store-stats { display: flex; gap: 9px; }
.shop-store-stats > span { display: grid; min-width: 78px; gap: 3px; padding: 13px; border-radius: 13px; background: var(--shop-surface-soft); text-align: center; }
.shop-store-stats b { font-size: 16px; }
.shop-store-stats small { color: var(--shop-muted); font-size: 8px; }
.shop-store-about { display: grid; grid-template-columns: minmax(0,1fr) minmax(300px,.7fr); gap: 14px; }
.shop-store-about > div,
.shop-store-about > aside { padding: 18px; border: 1px solid var(--shop-line); border-radius: 17px; background: var(--shop-surface); }
.shop-store-about h2 { margin: 0 0 6px; font-size: 15px; }
.shop-store-about > aside { display: flex; gap: 10px; }
.shop-store-about > aside > svg { width: 21px; flex: 0 0 auto; }
.shop-store-about aside.verified { border-color: color-mix(in srgb, var(--shop-success) 42%, var(--shop-line)); }
.shop-store-about aside.verified > svg { color: var(--shop-success); }
.shop-store-about aside.independent { border-color: color-mix(in srgb, var(--amber) 50%, var(--shop-line)); }
.shop-store-about aside.independent > svg { color: var(--amber); }
.shop-store-about aside div { display: grid; gap: 4px; }
.shop-store-about aside strong { font-size: 10px; }
.shop-store-about aside small { color: var(--shop-muted); font-size: 8px; line-height: 1.5; }
.shop-store-page > .shop-category-strip { margin-top: 18px; }
.shop-open-store-note { align-items: center; margin: -14px 0 18px; border-color: color-mix(in srgb, var(--shop-primary) 38%, var(--shop-line)); background: var(--shop-primary-soft); }
.shop-open-store-note > i { color: var(--shop-primary); }
.shop-open-store-note > div { display: grid; gap: 3px; }
.shop-open-store-note strong { font-size: 11px; }
.shop-open-store-note p { margin: 0; color: var(--shop-muted); font-size: 8px; line-height: 1.5; }
.shop-open-store-note button { margin-left: auto; padding: 10px 13px; border: 0; border-radius: 10px; background: var(--shop-primary); color: #fff; font-size: 9px; font-weight: 760; white-space: nowrap; cursor: pointer; }

/* Marketplace filter */
.shop-filter-overlay { position: fixed; z-index: 1002; inset: 0; background: color-mix(in srgb, var(--text) 48%, transparent); backdrop-filter: blur(6px); }
.shop-filter-overlay[hidden] { display: none; }
.shop-filter-overlay > aside { position: absolute; top: 0; right: 0; display: grid; grid-template-rows: auto minmax(0,1fr); width: min(430px, 100%); height: 100%; background: var(--surface); color: var(--text); box-shadow: -24px 0 70px color-mix(in srgb, var(--text) 22%, transparent); }
.shop-filter-overlay > aside > header { display: flex; align-items: flex-start; justify-content: space-between; padding: 23px; border-bottom: 1px solid var(--line); }
.shop-filter-overlay header span { color: var(--blue); font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.shop-filter-overlay header h2 { margin: 5px 0 0; font-size: 24px; }
.shop-filter-overlay header button { display: grid; width: 37px; height: 37px; place-items: center; border: 0; border-radius: 11px; background: var(--surface-2); color: var(--text); cursor: pointer; }
.shop-filter-overlay header svg { width: 17px; }
.shop-filter-overlay form { display: grid; align-content: start; gap: 14px; padding: 23px; overflow-y: auto; }
.shop-filter-overlay label { display: grid; gap: 7px; }
.shop-filter-overlay label > span { color: var(--muted); font-size: 9px; font-weight: 760; }
.shop-filter-overlay select { width: 100%; min-height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--text); }
.shop-filter-overlay form > section { display: flex; gap: 10px; padding: 13px; border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line)); border-radius: 13px; background: color-mix(in srgb, var(--amber) 9%, var(--surface)); }
.shop-filter-overlay form > section svg { width: 19px; flex: 0 0 auto; color: var(--amber); }
.shop-filter-overlay form > section p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.55; }
.shop-filter-overlay form > section strong { display: block; margin-bottom: 3px; color: var(--text); font-size: 9px; }
.shop-filter-overlay form > footer { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-top: 6px; }
.shop-filter-overlay form > footer button { min-height: 43px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--text); font-weight: 760; cursor: pointer; }
.shop-filter-overlay form > footer button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }

@media (max-width: 1100px) {
  .shop-store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-store-page > header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 720px) {
  .shop-store-directory,
  .shop-store-page { width: calc(100% - 26px); padding-top: 18px; }
  .shop-store-grid { grid-template-columns: 1fr; }
  .shop-store-about { grid-template-columns: 1fr; }
  .shop-store-stats { width: 100%; overflow-x: auto; }
  .shop-store-identity { align-items: flex-start; }
  .shop-store-identity > span { width: 58px; height: 58px; border-radius: 17px; }
  .shop-open-store-note { align-items: flex-start; flex-wrap: wrap; }
  .shop-open-store-note button { width: 100%; margin-left: 0; }
}

.shop-specs dl > div,
.shop-delivery-box,
.seller-checklist li {
  background: var(--shop-surface-soft);
  color: var(--shop-text);
}

.shop-buy-card > button {
  border-color: var(--shop-line);
  background: var(--shop-surface-soft);
  color: var(--shop-text);
}

.shop-buy-card > button.sponsor {
  border-color: color-mix(in srgb, var(--shop-success) 54%, var(--shop-line));
  background: color-mix(in srgb, var(--shop-success) 16%, var(--shop-surface));
  color: color-mix(in srgb, var(--shop-success) 72%, var(--shop-text));
}

.shop-cart-overlay {
  background: color-mix(in srgb, var(--shop-text) 48%, transparent);
}

.shop-cart-overlay > aside > header,
.shop-cart-overlay > aside > footer {
  border-color: var(--shop-line);
}

.shop-cart-lines article small svg {
  width: 12px;
  color: var(--shop-success);
  vertical-align: -2px;
}

/* Sponsorship request browser. */
.shop-sponsor-open { overflow: hidden; }
.shop-sponsor-overlay {
  position: fixed;
  z-index: 1001;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--text) 52%, transparent);
  backdrop-filter: blur(7px);
}

.shop-sponsor-overlay[hidden] { display: none; }

.shop-sponsor-overlay > section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(880px, 100%);
  max-height: min(780px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 90px color-mix(in srgb, var(--text) 24%, transparent);
}

.shop-sponsor-overlay > section > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 24px 27px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, var(--blue-soft));
}

.shop-sponsor-overlay header span {
  color: var(--blue);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .13em;
}

.shop-sponsor-overlay header h2 {
  margin: 5px 0 6px;
  font-size: clamp(24px, 3vw, 35px);
  letter-spacing: -.035em;
}

.shop-sponsor-overlay header p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.shop-sponsor-overlay header button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.shop-sponsor-overlay header button svg { width: 18px; }
.shop-sponsor-body { min-height: 0; padding: 20px 27px 27px; overflow-y: auto; }
.shop-sponsor-product,
.shop-sponsor-intro {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 15px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-2) 88%, var(--surface));
}
.shop-sponsor-product > span,
.shop-sponsor-intro > i {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  color: #fff;
}
.shop-sponsor-intro > i { padding: 14px; background: var(--teal); }
.shop-sponsor-product > span svg { width: 25px; }
.shop-sponsor-product > div,
.shop-sponsor-intro > div { display: grid; gap: 3px; }
.shop-sponsor-product small { color: var(--blue); font-size: 8px; font-weight: 820; }
.shop-sponsor-product strong,
.shop-sponsor-intro strong { font-size: 12px; }
.shop-sponsor-product em { color: var(--muted); font-size: 10px; font-style: normal; }
.shop-sponsor-intro small { color: var(--muted); font-size: 9px; }
.shop-sponsor-list { display: grid; gap: 11px; }
.shop-sponsor-list > article { padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.shop-sponsor-owner { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.shop-sponsor-owner > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 850; }
.shop-sponsor-owner > div { display: grid; min-width: 0; gap: 2px; }
.shop-sponsor-owner strong { font-size: 12px; }
.shop-sponsor-owner strong svg { width: 13px; margin-left: 4px; color: var(--blue); vertical-align: -2px; }
.shop-sponsor-owner small,
.shop-sponsor-owner > em { color: var(--muted); font-size: 8px; font-style: normal; }
.shop-sponsor-list article > p { margin: 12px 0; color: color-mix(in srgb, var(--text) 82%, var(--muted)); font-size: 10px; line-height: 1.55; }
.shop-sponsor-needs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.shop-sponsor-needs > span { color: var(--muted); font-size: 8px; }
.shop-sponsor-needs button { padding: 6px 8px; border: 0; border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 8px; cursor: pointer; }
.shop-sponsor-needs button b { color: var(--blue); }
.shop-sponsor-progress { display: flex; align-items: center; gap: 10px; margin-top: 13px; }
.shop-sponsor-progress > span { display: block; width: min(230px, 44%); height: 6px; overflow: hidden; border-radius: 99px; background: color-mix(in srgb, var(--line) 72%, transparent); }
.shop-sponsor-progress > span i { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.shop-sponsor-progress small { color: var(--muted); font-size: 8px; }
.shop-sponsor-select,
.shop-sponsor-view { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; margin-top: 13px; padding: 0 13px; border: 0; border-radius: 11px; background: var(--teal); color: #fff; font-size: 9px; font-weight: 780; cursor: pointer; }
.shop-sponsor-select svg,
.shop-sponsor-view svg { width: 15px; }

@media (max-width: 980px) {
  .shop-command-actions > [data-shop-location] { display: none; }
  .shop-command { grid-template-columns: minmax(220px, 1fr) auto; }
  .shop-wordmark { display: none; }
}

@container (max-width: 1040px) {
  .shop-command {
    grid-template-columns: minmax(150px, 190px) minmax(160px, 1fr) auto;
    gap: 12px;
    padding-inline: 22px;
  }
  .shop-command-actions > [data-shop-location] { display: none; }
}

@container (max-width: 760px) {
  .shop-command { grid-template-columns: minmax(180px, 1fr) auto; }
  .shop-wordmark { display: none; }
}

@media (max-width: 720px) {
  .comments-list { padding-left: 48px; padding-right: 12px; }
  .shop-intent-switch span { display: none; }
  .shop-command-actions .shop-intent-switch button { width: 35px; padding: 0; justify-content: center; }
  .shop-sponsor-overlay { padding: 0; }
  .shop-sponsor-overlay > section { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
  .shop-sponsor-overlay > section > header,
  .shop-sponsor-body { padding: 18px; }
  .shop-sponsor-owner { grid-template-columns: 38px minmax(0, 1fr); }
  .shop-sponsor-owner > em { grid-column: 2; }
}

/* v18.3 — compact glass shell, readable commerce controls and product discussion. */
.app-shell {
  grid-template-rows: 1fr;
  background:
    radial-gradient(circle at 12% 10%, color-mix(in srgb, var(--blue) 18%, transparent), transparent 34rem),
    radial-gradient(circle at 88% 84%, color-mix(in srgb, var(--teal) 13%, transparent), transparent 38rem),
    linear-gradient(145deg, color-mix(in srgb, var(--bg) 88%, var(--surface)), var(--bg));
}
.topbar { position: fixed; z-index: 120; inset: 0 auto auto 0; display: block; width: 0; height: 0; padding: 0; overflow: visible; border: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.topbar > :not(#mainMenuButton) { display: none !important; }
#mainMenuButton { position: fixed; top: 13px; left: 14px; display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid color-mix(in srgb, var(--line) 72%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--surface) 72%, transparent); color: var(--text); box-shadow: 0 10px 28px color-mix(in srgb, var(--text) 10%, transparent); backdrop-filter: blur(20px) saturate(1.25); }
.workspace { height: 100vh; height: 100dvh; }
.rail { padding-top: 70px; background: var(--glass-bg) !important; backdrop-filter: blur(var(--glass-blur)) saturate(1.2); }
.space-list,
.tools-panel { background: var(--glass-bg) !important; backdrop-filter: blur(var(--glass-blur)) saturate(1.18); }
.conversation-header,
.composer,
.shop-command,
.shop-filter-overlay > aside,
.shop-sponsor-overlay > section { background: var(--glass-bg-strong) !important; backdrop-filter: blur(var(--glass-blur)) saturate(1.16); }
.app-shell.shop-active .main-panel,
.app-shell.shop-active .content-feed { background: radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--shop-primary) 12%, transparent), transparent 28rem), radial-gradient(circle at 8% 92%, color-mix(in srgb, var(--shop-success) 8%, transparent), transparent 30rem), color-mix(in srgb, var(--shop-bg) 76%, transparent); }

/* Native select menus must remain readable in every theme. */
.shop-catalog-head select,
.shop-filter-overlay select { border-color: var(--shop-line) !important; background: var(--shop-surface-soft) !important; color: var(--shop-text) !important; }
.shop-catalog-head select option,
.shop-filter-overlay select option { background: var(--surface); color: var(--text); }
body[data-theme="dark"] .shop-catalog-head select,
body[data-theme="dark"] .shop-filter-overlay select,
body[data-theme="qorgon"] .shop-catalog-head select,
body[data-theme="qorgon"] .shop-filter-overlay select { color-scheme: dark; }
body[data-theme="light"] .shop-catalog-head select,
body[data-theme="light"] .shop-filter-overlay select { color-scheme: light; }

/* Compact catalog heading: remove the oversized empty band. */
.shop-catalog-page { padding-top: 18px; }
.shop-catalog-head { align-items: end; gap: 16px; padding: 0; }
.shop-catalog-head > div { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: start; gap: 5px 9px; }
.shop-catalog-head > div > button { margin: 0; padding: 7px 10px; }
.shop-catalog-head > div > span { font-size: 9px; }
.shop-catalog-head h1 { grid-column: 1 / -1; margin: 6px 0 1px; font-size: clamp(27px, 3vw, 38px) !important; }
.shop-catalog-head p { grid-column: 1 / -1; font-size: 10px; }
.shop-catalog-head > label { gap: 4px; }
.shop-catalog-head select { height: 38px; }
.shop-catalog-page > .shop-product-grid { margin-top: 16px; }

/* Product cards: image-led, shorter copy and a compact store link. */
.shop-product-visual { height: 238px; }
.shop-product-icon svg { width: 78px; height: 78px; }
.shop-product-copy { padding: 12px 13px 13px; }
.shop-product-title { margin-top: 6px; font-size: 13px; }
.shop-product-copy > p { min-height: 29px; margin-bottom: 8px; font-size: 9px; }
.shop-product-card .shop-seller-line { display: inline-grid; grid-template-columns: 25px minmax(0, auto) 13px; width: auto; max-width: 100%; gap: 6px; padding: 6px 7px; border: 1px solid var(--shop-line); border-radius: 10px; background: var(--shop-surface-soft); }
.shop-product-card .shop-seller-line > span { width: 25px; height: 25px; }
.shop-product-card .shop-seller-line strong { font-size: 8px; }
.shop-product-card .shop-seller-line small { font-size: 7px; }
.shop-card-proof { min-height: 31px; }
.shop-product-card footer { padding-top: 8px; }

/* Storefront identity is a compact strip, not a hero card. */
.shop-store-page { padding-top: 20px; }
.shop-store-page > header { gap: 18px; margin: 10px 0; padding: 13px 15px; border-radius: 16px; background: color-mix(in srgb, var(--shop-surface) 80%, transparent); backdrop-filter: blur(18px); }
.shop-store-identity { gap: 11px; }
.shop-store-identity > span { width: 50px; height: 50px; border-radius: 14px; font-size: 13px; }
.shop-store-identity h1 { margin: 3px 0 4px; font-size: clamp(22px, 2.5vw, 30px); }
.shop-store-identity p { font-size: 8px; }
.shop-store-stats > span { min-width: 62px; padding: 9px; }
.shop-store-stats b { font-size: 12px; }
.shop-store-about { grid-template-columns: minmax(0, 1fr) minmax(260px, .72fr); gap: 9px; }
.shop-store-about > div,
.shop-store-about > aside { padding: 12px 14px; border-radius: 13px; }
.shop-store-about h2 { font-size: 12px; }
.shop-store-page > .shop-category-strip { margin-top: 10px; }
.shop-store-page .shop-merch-section > header { margin-bottom: 13px; }

/* Cart contrast: no white-on-white quantity controls or dark-on-dark totals. */
.shop-cart-overlay { background: color-mix(in srgb, #080c18 62%, transparent); }
.shop-cart-overlay > aside { background: color-mix(in srgb, var(--surface) 96%, transparent) !important; color: var(--text) !important; backdrop-filter: blur(24px) saturate(1.12); }
.shop-cart-overlay header h2,
.shop-cart-lines article strong,
.shop-cart-lines article b,
.shop-cart-overlay footer > div:first-child strong { color: var(--text); }
.shop-cart-overlay header button,
.shop-qty button { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.shop-cart-lines article small,
.shop-cart-overlay footer > div,
.shop-cart-overlay footer > p { color: var(--muted); }
.shop-cart-lines article { border-color: var(--line); }
.shop-cart-lines article > span { position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 14px; color: #fff; }
.shop-cart-lines article > span svg { position: relative; z-index: 1; width: 22px; }
.shop-cart-lines button.remove { background: color-mix(in srgb, var(--red) 14%, var(--surface)); color: var(--red); }
.shop-cart-overlay footer b { color: var(--teal); }
.shop-cart-overlay footer > button { color: #fff; }

/* Product information and comments. */
.shop-seller-card { grid-template-columns: 32px minmax(0, 1fr) auto; width: min(100%, 340px); margin-top: 12px; padding: 8px 10px; border-radius: 11px; }
.shop-seller-card > span { width: 32px; height: 32px; }
.shop-seller-card strong { font-size: 9px; }
.shop-product-insights { margin: 30px 0 48px; overflow: hidden; border: 1px solid var(--shop-line); border-radius: 20px; background: color-mix(in srgb, var(--shop-surface) 86%, transparent); color: var(--shop-text); backdrop-filter: blur(20px); }
.shop-product-insights > nav { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--shop-line); background: var(--shop-surface-soft); }
.shop-product-insights > nav button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 13px; border-radius: 10px; background: transparent; color: var(--shop-muted); font-size: 9px; font-weight: 780; }
.shop-product-insights > nav button.active { background: var(--shop-surface); color: var(--shop-primary-strong); box-shadow: 0 5px 14px color-mix(in srgb, var(--shop-text) 7%, transparent); }
.shop-product-insights > nav b { display: grid; min-width: 19px; height: 19px; place-items: center; border-radius: 99px; background: var(--shop-primary-soft); font-size: 7px; }
.shop-product-insights > div { padding: 20px; }
.shop-insight-copy { max-width: 800px; }
.shop-insight-copy h2,
.shop-review-panel h2 { margin: 0; font-size: 18px; }
.shop-insight-copy > p { color: var(--shop-muted); font-size: 11px; line-height: 1.75; }
.shop-insight-copy > div { display: flex; gap: 9px; padding: 11px; border-radius: 12px; background: var(--shop-primary-soft); }
.shop-insight-copy > div svg { width: 18px; color: var(--shop-primary); }
.shop-insight-copy > div span { display: grid; gap: 3px; }
.shop-insight-copy > div strong { font-size: 9px; }
.shop-insight-copy > div small { color: var(--shop-muted); font-size: 8px; }
.shop-insight-specs { max-width: 820px; padding: 0; border: 0; background: transparent; }
.shop-review-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.shop-review-panel > header p { margin: 4px 0 0; color: var(--shop-muted); font-size: 9px; }
.shop-review-panel > header > strong { display: grid; min-width: 70px; font-size: 22px; text-align: right; }
.shop-review-panel > header > strong small { color: var(--shop-muted); font-size: 7px; }
.shop-review-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .65fr); gap: 18px; }
.shop-review-list { display: grid; align-content: start; gap: 8px; }
.shop-review-list > article { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 9px; padding: 11px; border: 1px solid var(--shop-line); border-radius: 12px; background: var(--shop-surface-soft); }
.shop-review-list > article > span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: var(--shop-primary-soft); color: var(--shop-primary-strong); font-size: 8px; font-weight: 850; }
.shop-review-list article header { display: flex; justify-content: space-between; gap: 10px; }
.shop-review-list article header strong { font-size: 9px; }
.shop-review-list article header small { color: var(--shop-muted); font-size: 7px; }
.shop-review-list article p { margin: 5px 0 0; color: var(--shop-muted); font-size: 9px; line-height: 1.55; }
.shop-review-empty { display: grid; place-items: center; padding: 26px; border: 1px dashed var(--shop-line); border-radius: 13px; text-align: center; }
.shop-review-empty svg { width: 24px; color: var(--shop-primary); }
.shop-review-empty strong { margin-top: 8px; font-size: 10px; }
.shop-review-empty small { margin-top: 3px; color: var(--shop-muted); font-size: 8px; }
.shop-review-layout form { display: grid; align-content: start; gap: 7px; padding: 13px; border: 1px solid var(--shop-line); border-radius: 13px; background: var(--shop-surface-soft); }
.shop-review-layout form label { color: var(--shop-text); font-size: 9px; font-weight: 780; }
.shop-review-layout textarea { min-height: 104px; resize: vertical; padding: 10px; border: 1px solid var(--shop-line); border-radius: 10px; outline: 0; background: var(--shop-surface); color: var(--shop-text); font: inherit; font-size: 9px; line-height: 1.5; }
.shop-review-layout textarea:focus { border-color: var(--shop-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--shop-primary) 15%, transparent); }
.shop-review-layout form footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shop-review-layout form footer small { color: var(--shop-muted); font-size: 7px; }
.shop-review-layout form button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 11px; border-radius: 9px; background: var(--shop-primary); color: #fff; font-size: 8px; font-weight: 780; }
.shop-review-layout form button svg { width: 13px; }

@media (max-width: 760px) {
  #mainMenuButton { top: 8px; left: 7px; width: 42px; height: 42px; }
  .rail { padding-top: 57px; }
  .shop-catalog-head { align-items: stretch; flex-direction: column; }
  .shop-product-visual { height: 250px; }
  .shop-store-about,
  .shop-review-layout { grid-template-columns: 1fr; }
  .shop-store-page > header { align-items: stretch; }
  .shop-product-insights > div { padding: 14px; }
}

@container (max-width: 1120px) {
  .shop-detail-grid { grid-template-columns: minmax(280px, .9fr) minmax(280px, 1fr); gap: 20px; }
  .shop-buy-card { position: static; grid-column: 2; }
}

@container (max-width: 760px) {
  .shop-detail-grid { grid-template-columns: 1fr; }
  .shop-buy-card { grid-column: 1; }
  .shop-gallery-main { min-height: 390px; }
}

/* v18.4 — backdrop scenes and genuinely translucent glass. */
body[data-backdrop="aurora"] {
  --scene-background:
    radial-gradient(circle at 12% 16%, color-mix(in srgb, var(--blue) 48%, transparent), transparent 34%),
    radial-gradient(circle at 88% 22%, color-mix(in srgb, var(--teal) 36%, transparent), transparent 32%),
    radial-gradient(circle at 52% 110%, color-mix(in srgb, var(--blue-soft) 62%, transparent), transparent 44%),
    linear-gradient(135deg, color-mix(in srgb, var(--bg) 78%, var(--blue)), var(--bg));
}
body[data-backdrop="ocean"] {
  --scene-background:
    radial-gradient(circle at 80% 10%, color-mix(in srgb, #4ce4dd 38%, transparent), transparent 32%),
    radial-gradient(circle at 14% 86%, color-mix(in srgb, #2388df 44%, transparent), transparent 38%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg) 74%, #0d5688), color-mix(in srgb, var(--bg) 82%, #0a344f));
}
body[data-backdrop="sunset"] {
  --scene-background:
    radial-gradient(circle at 16% 18%, color-mix(in srgb, #ffb76a 50%, transparent), transparent 34%),
    radial-gradient(circle at 84% 84%, color-mix(in srgb, #b45cff 36%, transparent), transparent 38%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg) 80%, #7d315c), color-mix(in srgb, var(--bg) 82%, #273b7d));
}
body[data-backdrop="graphite"] {
  --scene-background:
    radial-gradient(circle at 22% 12%, color-mix(in srgb, var(--blue) 24%, transparent), transparent 31%),
    radial-gradient(circle at 78% 88%, color-mix(in srgb, var(--teal) 18%, transparent), transparent 36%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg) 90%, #28313b), color-mix(in srgb, var(--bg) 94%, #101820));
}
body { background: var(--scene-background) !important; }
.app-shell { background: transparent; }

body[data-glass="crystal"] {
  --ambient-1: color-mix(in srgb, var(--blue) 54%, transparent);
  --ambient-2: color-mix(in srgb, var(--teal) 44%, transparent);
  --ambient-3: color-mix(in srgb, var(--blue-soft) 68%, transparent);
  --glass-bg: color-mix(in srgb, var(--surface) 20%, transparent);
  --glass-bg-strong: color-mix(in srgb, var(--surface) 30%, transparent);
  --glass-border: color-mix(in srgb, #fff 68%, var(--line));
  --glass-highlight: rgba(255, 255, 255, .72);
  --glass-sheen: rgba(255, 255, 255, .34);
  --glass-blur: 38px;
  --noise-opacity: .16;
}
body[data-glass="crystal"] .rail,
body[data-glass="crystal"] .space-list,
body[data-glass="crystal"] .tools-panel,
body[data-glass="crystal"] .conversation-header,
body[data-glass="crystal"] .composer,
body[data-glass="crystal"] .shop-command,
body[data-glass="crystal"] .settings-dialog,
body[data-glass="crystal"] .account-drawer {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
}
body[data-glass="crystal"] .main-panel,
body[data-glass="crystal"] .content-feed {
  background: color-mix(in srgb, var(--bg) 16%, transparent) !important;
}
body[data-glass="crystal"] .app-shell.shop-active {
  --shop-bg: transparent;
  --shop-surface: color-mix(in srgb, var(--surface) 48%, transparent);
  --shop-surface-raised: color-mix(in srgb, var(--surface) 52%, transparent);
  --shop-surface-soft: color-mix(in srgb, var(--surface-2) 44%, transparent);
  --shop-line: color-mix(in srgb, var(--line) 58%, #fff 42%);
}

.shop-cart-overlay {
  background: color-mix(in srgb, #080c18 26%, transparent) !important;
  backdrop-filter: blur(3px) saturate(1.08);
}
.shop-cart-overlay > aside {
  border-left: 1px solid var(--glass-border);
  background:
    linear-gradient(135deg, color-mix(in srgb, #fff 10%, transparent), transparent 34%),
    var(--glass-bg-strong) !important;
  box-shadow: -28px 0 76px color-mix(in srgb, #050914 32%, transparent), inset 1px 0 0 var(--glass-highlight);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.32);
}
body[data-glass="crystal"] .shop-cart-overlay > aside { background: var(--glass-bg) !important; }

/* v18.5 — moving ambient color and theme-safe translucent workshop surfaces. */
body[data-glass="normal"] {
  --glass-bg: color-mix(in srgb, var(--surface) 42%, transparent);
  --glass-bg-strong: color-mix(in srgb, var(--surface) 54%, transparent);
}

body[data-backdrop="aurora"] {
  --scene-lights:
    radial-gradient(ellipse 32% 18% at 12% 18%, color-mix(in srgb, var(--blue) 72%, transparent), transparent 72%),
    radial-gradient(ellipse 30% 20% at 88% 24%, color-mix(in srgb, var(--teal) 62%, transparent), transparent 72%),
    radial-gradient(ellipse 34% 20% at 52% 88%, color-mix(in srgb, #8d5bff 48%, transparent), transparent 74%);
}
body[data-backdrop="ocean"] {
  --scene-lights:
    radial-gradient(ellipse 34% 20% at 80% 12%, rgba(76, 228, 221, .64), transparent 72%),
    radial-gradient(ellipse 38% 22% at 14% 86%, rgba(35, 136, 223, .72), transparent 74%),
    radial-gradient(ellipse 30% 18% at 48% 48%, rgba(83, 96, 255, .42), transparent 74%);
}
body[data-backdrop="sunset"] {
  --scene-lights:
    radial-gradient(ellipse 34% 20% at 16% 18%, rgba(255, 160, 84, .72), transparent 72%),
    radial-gradient(ellipse 36% 22% at 84% 82%, rgba(180, 92, 255, .64), transparent 74%),
    radial-gradient(ellipse 30% 18% at 52% 38%, rgba(255, 76, 130, .42), transparent 74%);
}
body[data-backdrop="graphite"] {
  --scene-lights:
    radial-gradient(ellipse 32% 18% at 20% 16%, color-mix(in srgb, var(--blue) 54%, transparent), transparent 72%),
    radial-gradient(ellipse 34% 20% at 80% 84%, color-mix(in srgb, var(--teal) 42%, transparent), transparent 74%),
    radial-gradient(ellipse 28% 18% at 52% 46%, rgba(142, 108, 255, .3), transparent 74%);
}

body:not([data-glass="off"])::before {
  inset: -18%;
  background: var(--scene-lights);
  filter: blur(34px) saturate(1.26);
  opacity: .94;
  will-change: transform;
  animation: qorgonAmbientDrift 24s ease-in-out infinite alternate;
}

@keyframes qorgonAmbientDrift {
  0% { transform: translate3d(-2.5%, -1.5%, 0) rotate(-2deg) scale(1.04); }
  48% { transform: translate3d(3.5%, 2%, 0) rotate(1.5deg) scale(1.1); }
  100% { transform: translate3d(-1%, 4%, 0) rotate(-.5deg) scale(1.07); }
}

/* Older workshop cards now inherit the active theme instead of falling back to grey/white. */
.workshop-dashboard.v16 {
  background: transparent !important;
}

.home-path-v17 > button:first-child,
.home-tools-v17,
.paths-note-v17,
.path-row-v17,
.path-hero-v17,
.path-stages-v17,
.home-resume-v16,
.home-challenges-v16,
.home-competition-v16 {
  border-color: var(--glass-border) !important;
  background: var(--glass-bg-strong) !important;
  color: var(--text) !important;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--glass-highlight) 72%, transparent), var(--glass-shadow-soft);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.22);
}
.home-path-v17 > button:first-child small,
.home-path-v17 > button:first-child em,
.paths-note-v17 span,
.path-copy-v17 small,
.path-copy-v17 em,
.path-progress-v17 small { color: var(--muted) !important; }
.home-path-v17 > button:first-child > span:not(.path-icon-v17),
.path-progress-v17 > i,
.path-hero-v17 > div > div > span { background: color-mix(in srgb, var(--text) 16%, transparent); }

body[data-glass="crystal"] .home-path-v17 > button:first-child,
body[data-glass="crystal"] .home-tools-v17,
body[data-glass="crystal"] .paths-note-v17,
body[data-glass="crystal"] .path-row-v17,
body[data-glass="crystal"] .path-hero-v17,
body[data-glass="crystal"] .path-stages-v17,
body[data-glass="crystal"] .home-resume-v16,
body[data-glass="crystal"] .home-challenges-v16,
body[data-glass="crystal"] .home-competition-v16 {
  background: color-mix(in srgb, var(--surface) 24%, transparent) !important;
}

@media (prefers-reduced-motion: reduce) {
  body:not([data-glass="off"])::before { animation: none; }
}

body[data-animations="off"]::before {
  animation: none !important;
}

/* v18.6 — one scene across every portal, theme-safe search and personal backdrops. */
body[data-backdrop="custom"] {
  --scene-background:
    linear-gradient(125deg, color-mix(in srgb, var(--bg) 24%, transparent), color-mix(in srgb, var(--bg) 8%, transparent)),
    var(--user-backdrop-image),
    var(--bg);
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
}
body[data-backdrop="custom"]::before { opacity: .42; }

/* Search controls no longer keep legacy grey/white surfaces. */
.space-search,
.media-searchbar,
.conversation-search-bar,
.forward-search,
.shop-search {
  border: 1px solid var(--glass-border) !important;
  background: var(--glass-bg-strong) !important;
  color: var(--text) !important;
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--glass-shadow-soft) !important;
  backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
}
.space-search input,
.media-searchbar input,
.conversation-search-bar input,
.forward-search input,
.shop-search input,
input[type="search"] {
  border-color: transparent !important;
  background: transparent !important;
  color: var(--text) !important;
  caret-color: var(--blue) !important;
  box-shadow: none !important;
}
.space-search input::placeholder,
.media-searchbar input::placeholder,
.conversation-search-bar input::placeholder,
.forward-search input::placeholder,
.shop-search input::placeholder,
input[type="search"]::placeholder {
  color: var(--muted) !important;
  opacity: .88;
}
.space-search > svg,
.media-searchbar > svg,
.conversation-search-bar > svg,
.forward-search > svg,
.shop-search > svg { color: var(--muted) !important; }

/* Messenger, Workshop, Media and Shop all reveal the same body scene. */
body .app-shell .main-panel,
body .app-shell .content-feed,
body .app-shell.shop-active .main-panel,
body .app-shell.shop-active .content-feed {
  background: color-mix(in srgb, var(--bg) 14%, transparent) !important;
}
.app-shell.shop-active {
  --shop-bg: transparent;
  --shop-surface: var(--glass-bg-strong);
  --shop-surface-raised: color-mix(in srgb, var(--surface) 48%, transparent);
  --shop-surface-soft: color-mix(in srgb, var(--surface-2) 38%, transparent);
  --shop-line: var(--glass-border);
}
body[data-glass="off"] .app-shell .main-panel,
body[data-glass="off"] .app-shell .content-feed {
  background: var(--bg) !important;
}

.settings-backdrop-upload {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: var(--glass-bg);
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: blur(var(--glass-blur));
}
.settings-backdrop-upload > span { color: var(--muted); font-size: 11px; font-weight: 720; }
.settings-backdrop-upload > div { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-backdrop-upload button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--glass-border);
  border-radius: 11px;
  background: var(--glass-bg-strong);
  color: var(--text);
  font-weight: 740;
}
.settings-backdrop-upload button:first-child { color: var(--blue); }
.settings-backdrop-upload button:last-child { color: var(--red); }
.settings-backdrop-upload button svg { width: 15px; }
.settings-backdrop-upload small { color: var(--muted); font-size: 10px; line-height: 1.45; }

/* Every product exposes its own review thread. */
.shop-product-card footer .shop-card-actions > button.review {
  position: relative;
  background: color-mix(in srgb, var(--shop-primary) 12%, var(--shop-surface));
  color: var(--shop-primary-strong);
}
.shop-product-card footer .shop-card-actions > button.review svg { width: 16px; }
.shop-product-card footer .shop-card-actions > button.review b {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  place-items: center;
  border-radius: 99px;
  background: var(--shop-primary);
  color: #fff;
  font-size: 7px;
}
.shop-review-shell {
  display: grid;
  grid-template-columns: minmax(220px, .42fr) minmax(0, 1fr);
  gap: 16px;
}
.shop-review-product-facts {
  align-self: start;
  padding: 15px;
  border: 1px solid var(--shop-line);
  border-radius: 15px;
  background: var(--shop-surface-soft);
}
.shop-review-product-facts > span { color: var(--shop-primary-strong); font-size: 8px; font-weight: 850; letter-spacing: .09em; }
.shop-review-product-facts h2 { margin: 7px 0; font-size: 14px; }
.shop-review-product-facts > p { margin: 0 0 12px; color: var(--shop-muted); font-size: 9px; line-height: 1.55; }
.shop-review-product-facts dl { display: grid; gap: 0; margin: 0; }
.shop-review-product-facts dl > div { display: grid; grid-template-columns: minmax(80px, .7fr) minmax(0, 1fr); gap: 9px; padding: 8px 0; border-top: 1px solid var(--shop-line); }
.shop-review-product-facts dt { color: var(--shop-muted); font-size: 8px; }
.shop-review-product-facts dd { margin: 0; color: var(--shop-text); font-size: 8px; font-weight: 760; text-align: right; }
.shop-review-product-facts > small { display: flex; gap: 7px; margin-top: 12px; color: var(--shop-muted); font-size: 8px; line-height: 1.5; }
.shop-review-product-facts > small svg { width: 14px; flex: 0 0 auto; color: var(--shop-primary); }
.shop-review-thread { min-width: 0; }
.shop-review-thread > header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.shop-review-thread > header p { margin: 4px 0 0; color: var(--shop-muted); font-size: 9px; }
.shop-review-thread > header > strong { display: grid; min-width: 70px; color: var(--shop-text); font-size: 22px; text-align: right; }
.shop-review-thread > header > strong small { color: var(--shop-muted); font-size: 7px; }
.shop-review-thread .shop-review-layout { grid-template-columns: minmax(0, 1fr) minmax(240px, .62fr); }

@media (max-width: 820px) {
  .shop-review-shell { grid-template-columns: 1fr; }
  .shop-review-product-facts { position: static; }
  .shop-review-thread .shop-review-layout { grid-template-columns: 1fr; }
}

/* v18.7: product reviews reuse the Telegram-style discussion workspace. */
.shop-product-card .shop-product-copy {
  display: flex;
  min-height: 0;
  flex-direction: column;
}
.shop-product-grid { align-items: start; }
.shop-product-card .shop-seller-line {
  display: inline-grid;
  grid-template-columns: 24px minmax(0, auto);
  align-self: flex-start;
  width: auto;
  max-width: 100%;
  margin-top: 7px;
  padding: 3px 5px 3px 3px;
  border: 0;
  border-radius: 99px;
  background: color-mix(in srgb, var(--shop-primary) 8%, transparent);
}
.shop-product-card .shop-seller-line > span { width: 24px; height: 24px; }
.shop-product-card .shop-seller-line strong {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--shop-text);
  font-size: 8px;
}
.shop-product-card .shop-seller-line strong svg { width: 10px; color: var(--shop-primary); }
.shop-product-card .shop-seller-line small { color: var(--shop-muted); font-size: 7px; }
.shop-product-card .shop-product-title { margin-top: 10px; }
.shop-product-card .shop-product-copy > p { min-height: 0; margin-bottom: 8px; }
.shop-product-card .shop-card-proof { min-height: 27px; margin-top: auto; }
.shop-product-card footer { padding-top: 8px; }
.shop-product-card footer > div:first-child { min-width: 0; }
.shop-product-card footer .shop-card-actions { display: flex; flex: 0 0 auto; flex-wrap: nowrap; gap: 5px; }
.shop-product-card footer .shop-card-actions > button { width: 34px; height: 34px; border-radius: 10px; }
.shop-product-card footer .shop-card-actions > button.review b { display: none; }

/* v18.8.5: creator identity starts media and shop cards, like a message author line. */
.media-continue-card > .media-card-author,
.media-recommend-card > .media-card-author {
  display: flex;
  min-height: 34px;
  align-items: center;
  padding: 8px 11px 7px;
  border-bottom: 1px solid color-mix(in srgb, var(--teal) 18%, var(--line));
  background: color-mix(in srgb, var(--surface-2) 86%, transparent);
}

.media-card-author > span {
  min-width: 0;
  overflow: hidden;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-product-card > .shop-seller-line {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  width: 100%;
  max-width: none;
  min-height: 44px;
  margin: 0;
  padding: 8px 11px;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--shop-primary) 18%, var(--shop-line));
  border-radius: 0;
  background: color-mix(in srgb, var(--shop-surface) 92%, var(--shop-primary) 8%);
  text-align: left;
}

.shop-product-card > .shop-seller-line > span {
  width: 27px;
  height: 27px;
}

.shop-product-card > .shop-seller-line strong {
  color: var(--shop-primary-strong);
  font-size: 9px;
}

.shop-product-card > .shop-seller-line small {
  font-size: 7px;
}

.shop-product-card > .shop-product-visual {
  border-top: 0;
}

/* v18.8.6: compact identity line and navigable media creator profile. */
.shop-product-card > .shop-seller-line > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.shop-product-card > .shop-seller-line strong,
.shop-product-card > .shop-seller-line small {
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-continue-card > button.media-card-author,
.media-recommend-card > button.media-card-author {
  width: 100%;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.media-card-author:hover > span,
.media-card-author:focus-visible > span {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.media-card-author:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--teal) 72%, transparent);
  outline-offset: -2px;
}

.media-creator-profile {
  display: grid;
  gap: 14px;
}

.media-creator-profile > header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--teal) 24%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
}

.media-creator-profile > header > span {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--teal) 20%, var(--surface-2));
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
}

.media-creator-profile > header > div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
}

.media-creator-profile > header strong { color: var(--text); }
.media-creator-profile > header small { color: var(--teal); }
.media-creator-profile > p { margin: 0; color: var(--muted); line-height: 1.5; }

.media-creator-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.media-creator-stats > span {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  text-align: center;
}

.media-creator-stats b { color: var(--text); }
.media-creator-stats small { color: var(--muted); }

.media-creator-library {
  display: grid;
  gap: 6px;
}

.media-creator-library article {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.media-creator-library svg { width: 17px; color: var(--teal); }
.media-creator-library div { display: grid; min-width: 0; gap: 2px; }
.media-creator-library strong { overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.media-creator-library small { color: var(--muted); }

.app-shell.portal-active.shop-active.shop-discussion-active:not(.media-active) .workspace {
  grid-template-columns: 74px minmax(220px, 300px) 5px minmax(420px, 1fr) minmax(285px, 340px) !important;
}
.app-shell.shop-active.shop-discussion-active .tools-panel {
  display: grid;
  border-left: 1px solid var(--glass-border);
}
.app-shell.shop-discussion-active .tools-tab[data-tools-mode="versions"],
.app-shell.shop-discussion-active .tools-tab[data-tools-mode="tasks"],
.app-shell.shop-discussion-active .tools-tab[data-tools-mode="create"] { display: none; }
.app-shell.shop-discussion-active .tools-tabs { overflow-x: auto; }
.discussion-overlay.shop-product-discussion { background: transparent; }
.shop-product-discussion .comments-dialog { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(24px) saturate(1.2); }
.shop-product-discussion .comments-dialog .forward-head { background: color-mix(in srgb, var(--surface) 74%, transparent); }
.shop-product-discussion .comments-list { background: linear-gradient(145deg, color-mix(in srgb, var(--blue) 5%, transparent), transparent 42%), color-mix(in srgb, var(--surface) 70%, transparent); }
.shop-product-discussion .comment-post-preview {
  width: min(680px, calc(100% - 32px));
  padding: 0;
  overflow: hidden;
  border-left-width: 1px;
  background: var(--glass-bg-strong);
}
.shop-product-discussion .comment-post-preview > button {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.shop-product-discussion .comment-post-preview > button > span { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 9px; color: #fff; }
.shop-product-discussion .comment-post-preview > button > span svg { width: 24px; }
.shop-product-discussion .comment-post-preview > button > div { display: grid; min-width: 0; gap: 2px; }
.shop-product-discussion .comment-post-preview small { color: var(--blue); font-size: 8px; font-weight: 850; letter-spacing: .08em; }
.shop-product-discussion .comment-post-preview strong { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.shop-product-discussion .comment-post-preview em { color: var(--muted); font-size: 9px; font-style: normal; }
.shop-product-discussion .comment-post-preview > button > svg { width: 16px; color: var(--muted); }
.shop-discussion-message { display: flex; align-items: end; gap: 7px; width: fit-content; max-width: min(76%, 590px); }
.shop-discussion-message.outgoing { align-self: flex-end; }
.shop-discussion-avatar { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--blue); color: #fff; font-size: 8px; font-weight: 850; }
.shop-discussion-message > div { min-width: 92px; padding: 7px 9px 5px; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; background: var(--surface-2); box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 7%, transparent); }
.shop-discussion-message.outgoing > div { border-radius: 12px 12px 4px 12px; background: var(--outgoing-bg); }
.shop-discussion-message strong { color: var(--blue); font-size: 10px; }
.shop-discussion-message p { margin: 2px 0 3px; color: var(--text); font-size: 13px; line-height: 1.4; white-space: pre-wrap; }
.shop-discussion-message small { display: flex; align-items: center; justify-content: flex-end; gap: 4px; color: var(--muted); font-size: 8px; }
.shop-discussion-message .source-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--shop-success); }

.shop-discussion-product-tools { display: grid; align-content: start; gap: 12px; min-height: 0; color: var(--text); }
.shop-discussion-product-visual { position: relative; display: grid; min-height: 150px; place-items: center; overflow: hidden; border-radius: 17px; color: #fff; }
.shop-discussion-product-visual > svg { width: 52px; height: 52px; }
.shop-discussion-product-visual small { position: absolute; right: 9px; bottom: 9px; padding: 4px 7px; border-radius: 99px; background: rgba(10,18,32,.55); color: #fff; font-size: 8px; }
.shop-discussion-product-tools > header { display: grid; gap: 4px; }
.shop-discussion-product-tools > header span { color: var(--blue); font-size: 8px; font-weight: 850; letter-spacing: .08em; }
.shop-discussion-product-tools > header h3 { margin: 0; font-size: 16px; line-height: 1.3; }
.shop-discussion-product-tools > header strong { font-size: 15px; }
.shop-discussion-product-tools > button { display: grid; grid-template-columns: 30px minmax(0,1fr) 15px; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--glass-bg); color: var(--text); text-align: left; }
.shop-discussion-product-tools > button > span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 8px; font-weight: 850; }
.shop-discussion-product-tools > button > div { display: grid; gap: 1px; }
.shop-discussion-product-tools > button strong { font-size: 10px; }
.shop-discussion-product-tools > button small { color: var(--muted); font-size: 8px; }
.shop-discussion-product-tools > button svg { width: 14px; color: var(--muted); }
.shop-discussion-product-tools > p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.shop-discussion-product-tools dl { max-height: 230px; margin: 0; overflow-y: auto; border-top: 1px solid var(--line); }
.shop-discussion-product-tools dl > div { display: grid; grid-template-columns: minmax(80px,.8fr) minmax(0,1fr); gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.shop-discussion-product-tools dt { color: var(--muted); font-size: 9px; }
.shop-discussion-product-tools dd { margin: 0; color: var(--text); font-size: 9px; font-weight: 750; text-align: right; }
.shop-discussion-product-tools > footer { display: grid; gap: 7px; }
.shop-discussion-product-tools > footer span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
.shop-discussion-product-tools > footer svg { width: 14px; color: var(--shop-success); }

@media (max-width: 1080px) {
  .app-shell.portal-active.shop-active.shop-discussion-active:not(.media-active) .workspace { grid-template-columns: 64px minmax(0, 1fr) minmax(260px, 310px) !important; }
  .app-shell.shop-active.shop-discussion-active .space-list,
  .app-shell.shop-active.shop-discussion-active .space-list-resizer { display: none; }
}
@media (max-width: 760px) {
  .app-shell.portal-active.shop-active.shop-discussion-active:not(.media-active) .workspace { grid-template-columns: 56px minmax(0, 1fr) !important; }
  .app-shell.shop-active.shop-discussion-active .tools-panel { position: absolute; z-index: 48; inset: 56px 0 0 56px; display: none; }
  .shop-discussion-message { max-width: 90%; }
}

/* v18.8 — CSS-only Telegram visual consistency across every workspace. */
body {
  --telegram-accent: #2dd4bf;
  --telegram-accent-soft: color-mix(in srgb, var(--telegram-accent) 13%, transparent);
  --telegram-control-bg: color-mix(in srgb, var(--surface-2) 88%, var(--text) 5%);
  --telegram-control-border: color-mix(in srgb, var(--line) 72%, transparent);
  --telegram-rail-bg: color-mix(in srgb, var(--surface) 74%, #121820);
  --telegram-rail-active: color-mix(in srgb, var(--surface-2) 70%, #27313a);
  --telegram-rail-muted: #9aa6b3;
}

body[data-theme="light"] {
  --telegram-control-bg: color-mix(in srgb, var(--surface-2) 94%, #dfe5ea);
  --telegram-rail-bg: color-mix(in srgb, var(--surface) 94%, #e7ecef);
  --telegram-rail-active: color-mix(in srgb, var(--telegram-accent) 10%, var(--surface-2));
  --telegram-rail-muted: #70808e;
}

/* The same compact navigation identity is used by Chat, Media, Workshop and Shop. */
.rail,
.app-shell.media-active .rail,
.app-shell.portal-active .rail,
.app-shell.shop-active .rail {
  grid-auto-rows: 66px;
  align-content: start;
  padding-top: 68px;
  border-right-color: color-mix(in srgb, var(--telegram-rail-muted) 18%, transparent);
  background: var(--telegram-rail-bg) !important;
  box-shadow: none;
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

#mainMenuButton {
  top: 11px;
  left: 15px;
  width: 43px;
  height: 43px;
  border-color: transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--telegram-rail-muted);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#mainMenuButton:hover {
  background: var(--telegram-rail-active);
  color: var(--telegram-accent);
}

.rail-item,
body[data-theme="qorgon"] .rail-item,
.app-shell.media-active .rail-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 4px 6px;
  overflow: hidden;
  border: 0;
  border-bottom: 0;
  border-radius: 0;
  background: transparent;
  color: var(--telegram-rail-muted);
  box-shadow: none;
}

.rail-item:hover,
.rail-item.active,
body[data-theme="qorgon"] .rail-item.active,
body[data-theme="qorgon"] .app-shell.media-active .rail-item.active,
.app-shell.media-active .rail-item.active {
  border: 0;
  border-radius: 0;
  background: var(--telegram-rail-active);
  color: var(--telegram-accent);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.rail-item::before,
.rail-item::after,
body[data-theme="qorgon"] .rail-item.active::before,
body[data-theme="qorgon"] .rail-item.active::after,
body[data-theme="qorgon"] .app-shell.media-active .rail-item.active::before,
body[data-theme="qorgon"] .app-shell.media-active .rail-item.active::after {
  display: none;
}

.rail-item svg,
body[data-theme="qorgon"] .rail-item.active svg,
body[data-theme="qorgon"] .app-shell.media-active .rail-item.active svg {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  color: currentColor;
  filter: none;
  stroke-width: 1.8;
}

.rail-label {
  display: -webkit-box;
  width: 100%;
  max-height: 19px;
  overflow: hidden;
  color: currentColor;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* One Telegram-like search field for sidebars, dialogs, portals and tools. */
.space-search,
.media-searchbar,
.conversation-search-bar,
.forward-search,
.shop-search,
.tool-search {
  min-height: 42px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--telegram-control-border) !important;
  border-radius: 999px !important;
  background: var(--telegram-control-bg) !important;
  color: var(--telegram-rail-muted) !important;
  box-shadow: none !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.space-search:focus-within,
.media-searchbar:focus-within,
.conversation-search-bar:focus-within,
.forward-search:focus-within,
.shop-search:focus-within,
.tool-search:focus-within {
  border-color: color-mix(in srgb, var(--telegram-accent) 68%, var(--telegram-control-border)) !important;
  box-shadow: 0 0 0 2px var(--telegram-accent-soft) !important;
}

.space-search > svg,
.media-searchbar > svg,
.conversation-search-bar > svg,
.forward-search > svg,
.shop-search > svg,
.tool-search > svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  color: var(--telegram-rail-muted) !important;
  stroke-width: 1.8;
}

.space-search input,
.media-searchbar input,
.conversation-search-bar input,
.forward-search input,
.shop-search input,
.tool-search input,
input[type="search"] {
  min-height: 38px;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

.space-search input::placeholder,
.media-searchbar input::placeholder,
.conversation-search-bar input::placeholder,
.forward-search input::placeholder,
.shop-search input::placeholder,
.tool-search input::placeholder,
input[type="search"]::placeholder {
  color: var(--telegram-rail-muted) !important;
  opacity: .92;
}

.space-search .mini-button,
.media-searchbar button,
.conversation-search-bar button {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.space-search .space-search-add {
  border: 1px solid color-mix(in srgb, var(--telegram-rail-muted) 36%, transparent);
  color: var(--telegram-rail-muted);
}

.space-search .space-search-add:hover {
  border-color: var(--telegram-accent);
  background: var(--telegram-accent-soft);
  color: var(--telegram-accent);
}

/* Compact tools controls scale with the application shell. */
.tools-panel {
  min-width: 0;
  gap: .625rem;
  padding: .375rem .625rem .625rem;
}

.tools-head {
  display: grid;
  gap: 8px;
}

.tools-head h2 {
  display: none;
}

.tools-tabs {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  gap: .1875rem;
  padding: 0 0 .375rem;
  overflow-x: visible;
  border: 0;
  border-bottom: 1px solid var(--ui-stroke, var(--line));
  border-radius: 0;
  background: transparent;
}

.tools-panel .tools-tab {
  flex: 1 1 auto;
  min-height: 1.75rem;
  padding: .125rem .3125rem;
  border: 1px solid transparent;
  border-radius: .375rem;
  background: transparent !important;
  color: var(--muted);
  box-shadow: none !important;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.tools-tabs[hidden],
.tools-tab[hidden],
.tools-panel .tools-tab::before {
  display: none;
}

.tools-panel .tools-tab:hover {
  transform: none;
  background: var(--ui-control-hover, var(--surface-2)) !important;
  color: var(--text);
}

.tools-panel .tools-tab.active {
  border-color: var(--ui-stroke, var(--line));
  background: var(--telegram-accent-soft, var(--blue-soft)) !important;
  color: var(--blue);
}

.tools-panel .tools-tab:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.tools-empty {
  gap: 10px;
}

.emoji-grid,
.sticker-grid,
.gif-grid {
  gap: 6px;
}

.emoji-grid button,
.sticker-grid button,
.gif-grid button {
  border-color: transparent;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.emoji-grid button:hover,
.sticker-grid button:hover,
.gif-grid button:hover {
  transform: none;
  border-color: transparent;
  background: var(--telegram-accent-soft);
  box-shadow: none;
}

@media (max-width: 760px) {
  .rail,
  .app-shell.media-active .rail,
  .app-shell.portal-active .rail,
  .app-shell.shop-active .rail { padding-top: 56px; }

  #mainMenuButton {
    top: 7px;
    left: 7px;
    width: 42px;
    height: 42px;
  }

  .rail-label { font-size: 8px; }
}

/* v18.8.1 — match the supplied Telegram component geometry and details. */
#mainMenuButton::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 7px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--telegram-rail-bg);
  border-radius: 50%;
  background: var(--telegram-accent);
}

.rail-icon-wrap {
  position: relative;
  display: grid;
  width: 31px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
}

.rail-icon-wrap > svg {
  width: 27px;
  height: 27px;
}

.rail-badge {
  position: absolute;
  top: -5px;
  left: 20px;
  z-index: 2;
  display: grid;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  place-items: center;
  border: 2px solid var(--telegram-rail-bg);
  border-radius: 999px;
  background: var(--telegram-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}

.rail-item.active .rail-badge {
  border-color: var(--telegram-rail-active);
}

.space-search {
  margin: 10px 13px;
}

.space-search-peers {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  padding-left: 4px;
}

.space-search-peers > span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--telegram-control-bg);
  border-radius: 50%;
  background: #263746;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  box-shadow: 0 0 0 1px var(--telegram-accent);
}

.space-search-peers > span + span { margin-left: -7px; }
.space-search-peers svg { width: 12px; height: 12px; }
.space-search-peers .telegram-peer-mark { background: #229ed9; }

.space-search {
  grid-template-columns: 19px minmax(0, 1fr) auto auto auto !important;
}

.space-search:has(.sidebar-search-mode-close[hidden]) {
  grid-template-columns: 19px minmax(0, 1fr) auto auto !important;
}

.tools-panel .tool-search {
  grid-template-columns: .875rem minmax(0, 1fr) auto;
  gap: .3125rem;
  min-height: 2rem;
  padding: 0 .375rem 0 .5rem;
}

.tools-panel .tool-search > svg {
  width: .875rem;
  height: .875rem;
}

.tools-panel .tool-search input {
  min-height: 1.75rem;
  font-size: .8125rem;
}

.tool-search-actions {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
}

.tool-search-actions button {
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--telegram-rail-muted);
}

.tool-search-actions button:hover {
  background: var(--telegram-accent-soft);
  color: var(--telegram-accent);
}

.tool-search-actions svg {
  width: .8125rem;
  height: .8125rem;
  stroke-width: 1.6;
}

.tools-panel :is(.sticker-grid, .gif-grid) {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 4.25rem), 1fr));
  gap: .3125rem;
}

.tools-panel :is(.sticker-grid, .gif-grid) button {
  min-width: 0;
  min-height: 1.75rem;
  padding: .1875rem .3125rem;
  aspect-ratio: auto;
  border-color: var(--ui-stroke, var(--line));
  border-radius: .375rem;
  background: var(--ui-control, var(--surface-2));
  color: var(--text);
  font-size: .75rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.tools-panel :is(.sticker-grid, .gif-grid) button:hover {
  background: var(--ui-control-hover, var(--surface-2));
}

@media (max-width: 1180px) {
  .tool-search-actions button:nth-child(4) { display: none; }
}

@media (max-width: 1000px) {
  .space-search-peers { display: none; }
}

/* v18.8.2 — sender attribution is the first readable message layer. */
.main-panel .content-feed .message-content {
  gap: 4px;
}

.main-panel .content-feed .message:not(.has-telegram-media) .message-content,
.comments-list .message:not(.has-telegram-media) .message-content {
  padding: 9px 12px 7px !important;
}

.main-panel .content-feed .message-author-line,
.comments-list .message-author-line,
.shop-discussion-message.incoming > div > strong {
  display: block;
  max-width: 100%;
  min-height: 16px;
  margin: 0 0 3px !important;
  padding: 0 2px !important;
  overflow: hidden;
  color: var(--telegram-accent) !important;
  font-size: calc(13px * var(--message-scale)) !important;
  font-style: normal;
  font-weight: 820;
  line-height: 1.15 !important;
  letter-spacing: .005em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-panel .content-feed .message-author-line + .telegram-forward-origin,
.main-panel .content-feed .message-author-line + .reference-card,
.main-panel .content-feed .message-author-line + .message-body,
.main-panel .content-feed .message-author-line + .telegram-rich-text {
  margin-top: 0;
}

.main-panel .content-feed .message.outgoing .message-author-line {
  display: none;
}

/* v19.2.3 — sender names keep the same Telegram-safe inset in every group,
   channel and discussion bubble. Media bubbles intentionally have no content
   padding, so their attribution needs its own inset. */
.main-panel.group-like .content-feed .message.has-telegram-media .message-author-line,
.main-panel.channel-space .content-feed .message.has-telegram-media .message-author-line,
.comments-list .message.has-telegram-media .message-author-line {
  margin: 9px 12px 4px !important;
  padding: 0 !important;
}

.main-panel.group-like .content-feed .message:not(.has-telegram-media) .message-author-line,
.main-panel.channel-space .content-feed .message:not(.has-telegram-media) .message-author-line,
.comments-list .message:not(.has-telegram-media) .message-author-line {
  padding-inline: 2px !important;
}

.shop-discussion-message.outgoing > div > strong {
  display: none;
}

/* v18.8.7 — in-app notifications inherit the active app theme. */
body[data-theme="light"] {
  --notification-surface: color-mix(in srgb, var(--surface) 92%, var(--blue) 8%);
  --notification-text: var(--text);
}

body[data-theme="dark"] {
  --notification-surface: color-mix(in srgb, var(--surface) 86%, var(--blue) 14%);
  --notification-text: var(--text);
}

body[data-theme="qorgon"] {
  --notification-surface: linear-gradient(135deg, rgba(34, 31, 67, .94), rgba(25, 48, 66, .94));
  --notification-text: #f3f7fb;
}

.toast-region .toast {
  --toast-accent: var(--blue);
  border: 1px solid color-mix(in srgb, var(--line) 86%, var(--toast-accent) 14%);
  border-inline-start: 3px solid var(--toast-accent);
  background: var(--notification-surface, var(--surface)) !important;
  color: var(--notification-text, var(--text)) !important;
  box-shadow: var(--glass-shadow-soft);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.15);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.15);
}

.toast-region .toast-info { --toast-accent: var(--blue); }
.toast-region .toast-success { --toast-accent: var(--teal); }
.toast-region .toast-error { --toast-accent: var(--red); }
.toast-region .toast svg { color: var(--toast-accent); }

/* v18.9 — one accessibility scale controls the complete application shell. */
.app-shell {
  width: var(--ui-scale-width, 100%);
  height: var(--ui-scale-height, 100vh);
  min-height: var(--ui-scale-height, 100vh);
  overflow: clip;
  transform: scale(var(--ui-scale, 1));
  transform-origin: 0 0;
}

.app-shell > .workspace {
  height: 100% !important;
  min-height: 0;
  padding-block-start: max(.625rem, env(safe-area-inset-top));
}

/* At large UI scales, drawers scroll inside themselves instead of moving the app shell. */
.drawer-overlay {
  min-height: 0;
}

.account-drawer {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ui-scale-setting {
  border-color: color-mix(in srgb, var(--blue) 34%, var(--line)) !important;
  background: color-mix(in srgb, var(--blue) 8%, var(--surface-2)) !important;
}

.ui-scale-setting > small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.settings-advanced-appearance {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.settings-advanced-appearance > summary {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  cursor: pointer;
}

.settings-advanced-appearance[open] > summary {
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.settings-advanced-appearance > div {
  display: grid;
  gap: 10px;
  padding: 11px;
}
