:root {
  color-scheme: light;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, "Microsoft YaHei", sans-serif;
  color: #17223b;
  background: #edf0f7;
  --navy: #17223c;
  --muted: #586783;
  --line: #e5e9f3;
  --blue: #284ddc;
  --blue-hover: #1e3bb9;
  --ice: #f6f8fd;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, textarea, input { font: inherit; }
.select-wrap { display: block; position: relative; min-width: 0; }
.select-wrap select { appearance: none; width: 100%; padding-inline-end: 42px; cursor: pointer; }
.select-wrap::after { content: ''; position: absolute; inset-inline-end: 17px; top: calc(50% - 6px); width: 8px; height: 8px; color: #516488; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); pointer-events: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #6d86ff;
  outline-offset: 3px;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  max-width: 1336px;
  height: calc(100dvh - 80px);
  min-height: 400px;
  margin: 40px auto;
  width: calc(100% - 88px);
  overflow: hidden;
  isolation: isolate;
  border-radius: 24px;
  background: white;
  box-shadow: 0 22px 72px #15234b1a, 0 3px 9px #1827520a;
}

.sidebar { display: flex; flex-direction: column; padding: 29px 18px 20px; background: var(--navy); color: #fbfcff; }
.brand { display: flex; align-items: center; gap: 13px; margin: 0 9px 39px; }
.brand strong { display: block; font-size: 1.48rem; line-height: 1.08; font-weight: 750; letter-spacing: -.045em; }
.brand small { display: block; margin-top: 4px; color: #bec9e9; font-size: .81rem; letter-spacing: .045em; }
.brand-mark { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: #526fff; }
.brand-mark i { width: 23px; height: 11px; border: 2px solid white; border-top: 0; border-radius: 0 0 0 6px; transform: translateY(2px); }
.brand-mark::after { position: absolute; top: 15px; width: 21px; height: 10px; border: 2px solid white; border-bottom: 0; border-radius: 7px 7px 0 0; content: ""; }
.sidebar-label { display: block; margin: 0 10px 11px; color: #adbadc; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; }
.room-card { display: flex; align-items: center; gap: 11px; padding: 11px; border: 1px solid #6077c75e; border-radius: 13px; background: #2b3d6c; }
.room-icon { display: grid; flex: 0 0 36px; height: 36px; place-items: center; border-radius: 10px; background: #435ac4; color: white; }
.room-copy { flex: 1; }
.sidebar b { display: block; font-size: .92rem; font-weight: 650; }
.sidebar small { display: block; color: #b8c4e3; }
.room-copy small, .sidebar-bottom small { margin-top: 4px; font-size: .78rem; line-height: 1.25; }
.current-dot { width: 7px; height: 7px; border-radius: 50%; background: #a4b5ff; }
.sidebar-bottom { margin-top: auto; }
.sidebar-language, .profile { display: flex; align-items: center; gap: 11px; padding: 11px 8px; }
.sidebar-language { margin-bottom: 12px; border: 1px solid #405176; border-radius: 13px; padding: 11px; }
.sidebar-language b { font-size: .86rem; }
.language-mark { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; background: #2b3c6a; color: #cbd5ff; font-size: 1.04rem; }
.profile { border-top: 1px solid #384568; padding-top: 16px; }

.chat { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; background: white; }
.chat-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 91px; padding: 16px 30px; border-bottom: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 39px; height: 39px; flex-shrink: 0; border-radius: 13px; font-size: .76rem; font-weight: 750; line-height: 1; }
.avatar-ru { background: #e5eaff; color: #2e4ac1; }
.avatar-zh { background: #ffe8da; color: #a14124; font-size: 1.04rem; }
.participant-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.country-flag { flex-shrink: 0; object-fit: cover; border-radius: 3px; outline: 1px solid #8c9ab355; outline-offset: -1px; }
.chat-heading { display: grid; gap: 4px; min-width: 0; }
.chat-heading h1 { margin: 0; font-size: 1.25rem; font-weight: 750; letter-spacing: -.025em; }
.chat-heading p { margin: 0; color: var(--muted); font-size: .84rem; }
.chat-heading .country-pair { display: flex; align-items: baseline; gap: 5px; color: #3c5396; font-weight: 600; overflow-wrap: anywhere; }
.country-pair-side { display: flex; align-items: flex-start; min-width: 0; gap: 5px; }
.country-pair-side .country-flag { margin-top: .1em; }
.chat-heading h1, .profile b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile > div { min-width: 0; }
.header-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.header-actions .settings-button { width: 44px; padding: 0; font-size: 1.2rem; }
.order-icon { width: 17px; height: 15px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; }
.order-icon::after { content: ''; position: absolute; top: 0; left: 5px; width: 5px; height: 6px; border: 1.5px solid currentColor; border-top: 0; }
.settings-button:disabled { color: var(--muted); }
.presence { display: flex; gap: 8px; align-items: center; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #78869d; }
.presence-dot.online { background: #19845e; animation: online-pulse 2.1s ease-out infinite; }
@keyframes online-pulse {
  0% { box-shadow: 0 0 0 0 #21a87580; }
  65%, 100% { box-shadow: 0 0 0 6px #21a87500; }
}
@media (prefers-reduced-motion: reduce) { .presence-dot.online { animation: none; } }
.invite-button, .quiet-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 0 13px; border: 1px solid #dce3f5; border-radius: 10px; background: white; color: #2a47b2; font-size: .88rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.invite-button:hover, .quiet-button:hover { background: #edf2ff; }
.statusbar { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 6px 30px; background: #f1f5ff; color: #3c5396; border-bottom: 1px solid #e5ecff; font-size: .83rem; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8493b4; flex-shrink: 0; }
.status-dot.ready { background: #208262; }
.status-dot.offline { background: #ba6524; }
.statusbar #connection { min-width: 0; }
.exchange-chip { flex-shrink: 0; margin-inline-start: auto; padding: 5px 9px; max-width: min(63%, 280px); overflow-wrap: anywhere; text-align: start; border: 1px solid #d5dff9; border-radius: 8px; background: #fff; color: #2e4ba9; font: inherit; font-weight: 700; }
.exchange-chip:hover { background: #e8eefe; }

.timeline { display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain; background-color: var(--ice); scrollbar-color: #c7d0e8 transparent; }
.timeline:focus-visible { outline-offset: -3px; }
.timeline-inner { width: min(100%, 940px); margin: auto auto 0; padding: 18px 30px 24px; }
.empty, .chat-error { width: 100%; margin: auto; padding: 28px 24px; text-align: center; }
.empty h2 { margin: 15px 0 8px; font-size: clamp(1.44rem, 2.4vw, 1.8rem); font-weight: 760; letter-spacing: -.045em; }
.empty p, .chat-error p { margin: 0 auto; max-width: 365px; color: var(--muted); line-height: 1.52; }
.chat-error a { display: inline-block; margin-top: 14px; padding: 8px; color: var(--blue); }
.empty-art { position: relative; width: 163px; height: 114px; margin: 0 auto; }
.empty-tile { position: absolute; left: 36px; top: 12px; width: 91px; height: 85px; border: 1px solid #dce4fc; border-radius: 26px; transform: rotate(-10deg); background: #eaf0ff; }
.art-bubble { position: absolute; display: grid; place-items: center; width: 58px; height: 51px; border-radius: 16px; font-size: 1.58rem; font-weight: 750; box-shadow: 0 9px 18px #273a8727; }
.art-bubble::after { position: absolute; bottom: -5px; width: 13px; height: 13px; transform: rotate(45deg); border-radius: 2px; background: inherit; content: ""; }
.art-ru { left: 20px; top: 20px; transform: rotate(-12deg); background: #3154e7; color: white; }
.art-ru::after { left: 12px; }
.art-zh { right: 17px; top: 49px; transform: rotate(12deg); background: #ffdcca; color: #9c3a22; }
.art-zh::after { right: 13px; }
.spark { position: absolute; border-radius: 3px; transform: rotate(26deg); background: #8da3fc; }
.spark.one { top: 19px; right: 24px; width: 8px; height: 8px; }
.spark.two { bottom: 19px; left: 21px; width: 6px; height: 6px; background: #efaa8d; }

.message-list { display: flex; flex-direction: column; gap: 13px; }
.older { display: flex; margin: 0 auto 16px; }
.day { align-self: center; padding: 5px 12px; border: 1px solid #e3e8f5; border-radius: 20px; background: #edf1fa; color: #52627d; font-size: .79rem; }
.message { display: flex; gap: 8px; align-items: end; width: 100%; }
.message.mine { justify-content: flex-end; }
.message .avatar { width: 33px; height: 33px; border-radius: 10px; }
.message-content { max-width: min(78%, 570px); min-width: 0; padding: 9px 12px 7px; border: 1px solid #e0e6f3; border-radius: 14px 14px 14px 4px; background: white; }
.mine .message-content { border-color: #dce5ff; border-radius: 14px 14px 4px 14px; background: #e8eeff; }
.message-text { overflow-wrap: anywhere; white-space: pre-wrap; margin: 0; line-height: 1.5; }
.exchange-note { display: grid; gap: 3px; margin: 6px 0 0; padding: 5px 7px; border-left: 2px solid #90a7fc; color: #425484; font-size: .8rem; line-height: 1.35; overflow-wrap: anywhere; }
.exchange-note span { font-weight: 650; }
.product-card { display: grid; gap: 6px; min-width: min(200px, 100%); }
.product-label { color: #55698f; font-size: .74rem; font-weight: 680; }
.product-card h3, .order-title { margin: 0; color: #22355d; font-size: 1.05rem; line-height: 1.34; overflow-wrap: anywhere; }
.product-price { display: block; color: #28469e; font-weight: 740; font-size: .91rem; overflow-wrap: anywhere; }
.product-meta { color: var(--muted); font-size: .78rem; margin: 0; }
.product-card button { justify-self: start; margin-top: 3px; min-height: 40px; }
.message-photo { display: block; width: min(260px, 100%); padding: 0; margin: 2px 0 7px; overflow: hidden; border: 0; border-radius: 8px; background: #dce4f7; }
.message-photo img { display: block; width: 100%; max-height: 320px; min-height: 55px; object-fit: contain; }
.message-meta { display: flex; align-items: baseline; justify-content: end; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; color: var(--muted); font-size: .76rem; }
.message-meta button { border: 0; padding: 4px 2px; color: #2a48b8; background: transparent; font-size: .81rem; }
.message-meta button:hover { text-decoration: underline; }
.message-meta .failed { color: #9e402b; }
.chat-footer { padding: 4px 30px 13px; border-top: 1px solid var(--line); background: white; }
.peer-activity { width: min(100%, 880px); min-height: 20px; margin: 0 auto 3px; padding-inline: 4px; color: var(--muted); font-size: .84rem; line-height: 20px; }
.composer { width: min(100%, 880px); margin: 0 auto; padding: 7px; border: 1px solid #d9e0ee; border-radius: 16px; background: white; box-shadow: 0 2px 4px #1b2a5808; }
.composer:focus-within { border-color: #7d94f8; }
.compose-row { display: flex; align-items: end; gap: 8px; }
.compose-row textarea { display: block; flex: 1 1 auto; min-width: 0; resize: none; border: 0; outline: none; padding: 11px 4px 10px; min-height: 46px; max-height: 140px; background: transparent; color: #17223b; font-size: 1rem; line-height: 1.45; }
.compose-row textarea:focus { outline: none; }
.compose-row textarea::placeholder { opacity: 1; color: #63738f; }
.plain-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 10px; background: #edf2fc; color: #3b539d; }
.plain-button:not(:disabled):hover { background: #e0e8ff; }
.emoji-button { font-size: 1.34rem; background: transparent; }
.emoji-picker { position: fixed; inset: auto 20px 95px auto; margin: 0; padding: 7px; border: 1px solid #dce3f5; border-radius: 13px; color: var(--navy); background: white; box-shadow: 0 8px 30px #18275226; }
.emoji-picker:popover-open { display: grid; grid-template-columns: repeat(5, 44px); }
.emoji-picker button { background: white; font-size: 1.32rem; }
.send { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 9px; min-height: 44px; border: 0; border-radius: 10px; padding: 0 14px; background: var(--blue); color: white; font-weight: 650; font-size: .9rem; }
.send:not(:disabled):hover { background: var(--blue-hover); }
.send:disabled { background: #dfe6fb; color: #536595; }
.footer-meta { width: min(100%, 880px); margin: 9px auto 0; color: #66748b; font-size: .76rem; text-align: right; }
.footer-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 3px 10px; }
.geo-credit { color: #596b87; text-decoration: none; }
.geo-credit:hover { text-decoration: underline; }
.composer-error { width: min(100%, 880px); margin: 0 auto 8px; font-size: .87rem; color: #9e402b; }
.attachment { display: flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%; padding: 5px; margin: 0 0 6px; border-radius: 11px; background: #eef2fb; color: #405271; }
.attachment img { object-fit: cover; border-radius: 7px; }
.attachment span:not(.icon) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.attachment .plain-button { background: transparent; }

.dialog { width: min(470px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 19px; padding: 20px; color: #17223b; box-shadow: 0 20px 65px #0d1c5e38; }
dialog::backdrop { background: #111b37a8; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog h2 { margin: 0; font-size: 1.22rem; letter-spacing: -.02em; }
.dialog p { color: var(--muted); margin: 6px 0 17px; line-height: 1.45; }
.dialog .copy-status { min-height: 1.3em; margin: 8px 0 0; font-size: .84rem; }
.link-label { display: inline-block; margin-bottom: 6px; font-size: .86rem; font-weight: 650; }
.dialog input, .dialog select { width: 100%; border: 1px solid #d9e0ef; border-radius: 9px; padding: 10px; color: #334873; background: #f5f7ff; font: inherit; }
.exchange-summary { display: grid; gap: 4px; padding: 10px 12px; margin: 8px 0 13px; border: 1px solid #dce3f6; border-radius: 10px; background: #f2f5ff; overflow-wrap: anywhere; }
.exchange-summary strong { color: #28449e; }
.exchange-summary small { color: var(--muted); }
#exchange-form { display: grid; gap: 10px; }
.exchange-fields { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#exchange-form label { display: grid; gap: 5px; min-width: 0; font-size: .84rem; font-weight: 650; }
#exchange-form option { font-weight: 400; }
#exchange-form .dialog-actions { margin-top: 3px; }
.dialog .exchange-owner, .dialog .exchange-hint { font-size: .84rem; }
.commerce-dialog { width: min(510px, calc(100% - 28px)); }
.commerce-actions:has(button:not([hidden])) { display: flex; justify-content: space-between; gap: 8px; margin: 7px 0 12px; }
.commerce-form { display: grid; gap: 10px; }
.commerce-form label, .product-photo-field { display: grid; gap: 5px; min-width: 0; font-size: .87rem; font-weight: 650; }
.commerce-form .send { justify-self: flex-start; margin-top: 3px; }
.product-photo-field .quiet-button { justify-self: start; }
.product-photo-field output { color: var(--muted); overflow-wrap: anywhere; }
.orders-list { display: grid; gap: 8px; }
.orders-list button { width: 100%; padding: 10px; display: grid; gap: 4px; justify-items: start; text-align: start; border: 1px solid #dce3f6; border-radius: 10px; background: #f7f9ff; color: #22355d; }
.orders-list button:hover { background: #eef3ff; }
.orders-list button span { color: #55698f; font-size: .83rem; }
.order-status { display: inline-block; padding: 5px 9px; border-radius: 7px; background: #eef3ff; color: #2d49a1; font-size: .83rem; font-weight: 700; }
.order-lines { display: grid; gap: 6px; margin: 10px 0; }
.order-lines div { display: flex; justify-content: space-between; align-items: baseline; gap: 9px; border-bottom: 1px solid #edf0f7; padding-bottom: 5px; }
.order-lines dt { color: var(--muted); font-size: .84rem; }
.order-lines dd { font-size: .87rem; font-weight: 620; margin: 0; text-align: end; overflow-wrap: anywhere; }
.order-detail .commerce-form { margin-top: 12px; }
.order-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.order-links > * { white-space: normal; }
.order-history { margin-top: 11px; color: var(--muted); font-size: .82rem; }
.order-history summary { cursor: pointer; }
.order-history ol { padding-inline-start: 20px; }
.profile-form { margin-top: 12px; }
.nickname-row { display: flex; gap: 8px; }
.nickname-row input, .nickname-row .select-wrap { min-width: 0; flex: 1 1 auto; }
.dialog .select-wrap select { padding-inline-end: 42px; }
.language-form { margin-bottom: 7px; }
.notification-settings { border-top: 1px solid var(--line); padding-top: 12px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.notification-settings h3 { margin: 0 0 5px; font-size: .96rem; }
.setting { display: flex; align-items: center; min-height: 44px; gap: 9px; cursor: pointer; }
.setting input { width: 17px; height: 17px; accent-color: var(--blue); cursor: pointer; }
.dialog .settings-status { margin: 4px 0 7px; min-height: 1.3em; font-size: .83rem; }
.dialog-actions { display: flex; flex-wrap: wrap-reverse; gap: 8px; justify-content: flex-end; margin-top: 13px; }
.photo-dialog { max-width: 95vw; max-height: 93dvh; border: 0; padding: 9px; border-radius: 13px; background: #16203a; }
.photo-dialog img { display: block; max-width: 100%; max-height: 86dvh; margin: auto; object-fit: contain; }
.photo-dialog .close-button { position: absolute; top: 12px; right: 12px; }

.icon { position: relative; display: inline-block; width: 18px; height: 18px; flex: 0 0 auto; }
.icon-chat { width: 16px; height: 12px; border: 1.7px solid currentColor; border-radius: 5px; }
.icon-chat::after { position: absolute; left: 2px; bottom: -4px; width: 5px; height: 6px; border-left: 1.7px solid currentColor; transform: skewY(-36deg); background: #435ac4; content: ""; }
.icon-link { transform: rotate(-43deg); }
.icon-link::before, .icon-link::after { position: absolute; top: 5px; width: 11px; height: 8px; border: 1.6px solid currentColor; border-radius: 7px; content: ""; }
.icon-link::before { left: 0; border-right-color: transparent; }
.icon-link::after { right: 0; border-left-color: transparent; }
.icon-paperclip { width: 11px; height: 21px; border: 1.8px solid currentColor; border-radius: 7px 7px 7px 7px; border-top-color: transparent; transform: rotate(38deg); }
.icon-paperclip::after { position: absolute; top: 0; right: 1.25px; width: 4.5px; height: 14px; border: 1.4px solid currentColor; border-radius: 5px 5px 4px 4px; border-top-color: transparent; content: ""; }
.icon-send { background: currentColor; clip-path: polygon(1% 36%, 100% 0, 71% 98%, 43% 64%, 77% 25%, 33% 56%); }
.icon-close::before, .icon-close::after { position: absolute; left: 8px; top: 0; width: 2px; height: 18px; border-radius: 3px; background: currentColor; transform: rotate(45deg); content: ""; }
.icon-close::after { transform: rotate(-45deg); }

@media (max-width: 920px) {
  .workspace { grid-template-columns: 212px minmax(0, 1fr); width: calc(100% - 40px); height: calc(100dvh - 40px); margin: 20px auto; }
  .sidebar { padding-inline: 13px; }
  .chat-header, .statusbar, .chat-footer { padding-inline: 20px; }
}

@media (max-width: 700px), (max-height: 520px) {
  .workspace { display: block; width: 100%; height: var(--visible-height, 100dvh); min-height: 0; margin: 0; border-radius: 0; box-shadow: none; }
  .sidebar { display: none; }
  .chat { height: 100%; }
  .chat-header { min-height: 69px; padding: 10px 14px; }
  .chat-heading h1 { font-size: 1.03rem; }
  .chat-heading p { font-size: .78rem; }
  .invite-button { padding: 0 10px; gap: 5px; min-height: 44px; font-size: .81rem; }
  .statusbar { min-height: 38px; padding-inline: 15px; }
  .timeline-inner { padding: 13px 13px 16px; }
  .message-content { max-width: 85%; }
  .chat-footer { padding: 2px 10px calc(7px + env(safe-area-inset-bottom)); }
  .composer { padding: 5px; border-radius: 13px; }
  .send { min-width: 45px; }
  .compose-row > .send span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .footer-meta { margin-top: 5px; padding-inline: 4px; font-size: .69rem; text-align: left; }
  .empty p { max-width: 270px; }
}

@media (max-width: 350px) {
  .chat-header { padding-inline: 9px; }
  .chat-heading h1 { font-size: .97rem; }
  .invite-button { padding-inline: 8px; }
}

@media (max-width: 420px) {
  .invite-label, .order-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .header-actions .invite-button { width: 44px; }
  .compose-row { gap: 4px; }
}

@media (max-height: 430px) {
  .empty-art { display: none; }
  .empty h2 { margin-top: 0; }
  .empty { padding-block: 10px; }
}
