.exchange-den { color: var(--text); background: var(--bg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
#app-container.exchange-view-open { background: var(--bg); box-shadow: none; }
.exchange-view-open .app-header { display: none; }
.exchange-view-open .app-main { padding: 0 !important; }
.exchange-view-open .exchange-den { gap: 0 !important; min-height: 100dvh; }
.exchange-view-open .exchange-den::after { display: none; }
.exchange-den [hidden] { display: none !important; }
.exchange-den button, .exchange-den select, .exchange-den input { font: inherit; }
.exchange-den button, .exchange-den select { cursor: pointer; }
.exchange-den button:focus-visible, .exchange-den select:focus-visible, .exchange-den input:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; }
.exchange-den button:disabled { opacity: .5; cursor: not-allowed; }
.exchange-den ::selection { background: var(--accent-hi); color: #16130c; }
.exchange-den input { caret-color: var(--accent-hi); }
.xd-topbar { display: grid; grid-template-columns: 70px 1fr 70px; align-items: center; min-height: 48px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.xd-back { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; color: var(--accent-hi); border: 0; background: none; }
.xd-topbar-name { font: 800 15px Syne, sans-serif; color: var(--accent-hi); }
.xd-layout { max-width: 560px; margin: 0 auto; padding: 0 20px; }
.xd-tabs { display: flex; gap: 2px; padding: 3px; background: var(--bg-card); border: 0; border-radius: 11px; margin: 16px 0 22px; }
.xd-tabs button { flex: 1; position: relative; padding: 10px 3px; min-height: 40px; background: none; border: 0; border-radius: 8px; color: var(--text-sub); font-weight: 500; font-size: 13px; white-space: nowrap; }
.xd-tabs button[aria-pressed="true"] { color: var(--text); background: var(--bg-card-2); box-shadow: 0 2px 4px #00000018; }
.xd-tabs button[aria-pressed="true"]::after { display: none; }
#xd-panel-swap { max-width: 560px; margin: auto; }
.xd-converter { background: transparent; border: 0; border-radius: 0; padding: 0; }
.xd-money-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; color: var(--text-sub); font-size: 13px; min-height: 32px; }
.xd-money-head b { font-weight: 500; font-variant-numeric: tabular-nums; }
.xd-money-head button { min-height: 36px; padding: 0 0 0 8px; border: 0; background: none; color: var(--accent-hi); font-weight: 700; }
.xd-money-value { display: grid; grid-template-columns: minmax(136px, auto) minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 3px; }
.xd-currency { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none; color: var(--text); font-size: 19px !important; font-weight: 600 !important; }
.xd-currency-icon { display: grid; place-items: center; flex: 0 0 30px; height: 30px; color: var(--accent-hi); background: var(--accent-dim); border-radius: 50%; }
.xd-currency-icon[data-currency="restars"] { color: #65afff; background: #407ab51a; }
.xd-currency-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.xd-money-value input, .xd-money-value output { width: 100%; min-width: 0; padding: 8px 0; border: 0; background: none; color: var(--text); font-size: clamp(21px, 5vw, 30px); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.xd-money-value input { border-radius: 8px; }
.xd-money-value input::placeholder { color: var(--text-sub); opacity: 1; }
.xd-direction { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
.xd-direction::before, .xd-direction::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.xd-direction button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; color: var(--accent-hi); background: var(--bg-card); }
.xd-direction svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.xd-rate { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 24px; font-size: 12px; color: var(--text-sub); }
.xd-rate b { color: var(--text); font-weight: 500; }
.xd-swap-hint { min-height: 0; margin: 8px 0 18px; color: var(--text-sub); font-size: 12px; line-height: 1.4; }
.xd-swap-hint.is-error { color: var(--danger, #ff6b81); }
.xd-primary, .xd-offer-buy { min-height: 48px; width: 100%; padding: 12px 16px; color: #16130c; background: var(--accent-hi); border: 0; border-radius: 12px; font-weight: 700 !important; }
.xd-status:empty { display: none; }
.xd-status { margin-top: 12px; color: var(--text-sub); font-size: 13px; line-height: 1.5; }
.xd-history { margin-top: 28px; }
.xd-history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.xd-history h2 { margin: 0; font-size: 17px; font-weight: 600; }
.xd-history-head button { min-height: 44px; border: 0; padding: 0; color: var(--text-sub); background: none; font-size: 12px; }
.xd-history-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.xd-history-row strong, .xd-history-row time, .xd-history-row small { display: block; }
.xd-history-row strong { font-size: 13px; font-weight: 600; }
.xd-history-row time, .xd-history-row small { margin-top: 5px; font-size: 12px; color: var(--text-sub); }
.xd-history-sums { text-align: right; font-variant-numeric: tabular-nums; }
.xd-history-sums b { color: var(--accent-hi); font-size: 14px; }
.xd-empty, .xd-market-empty { padding: 22px 0; color: var(--text-sub); font-size: 14px; line-height: 1.5; }
.xd-market-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.xd-market-head h2, .xd-service-head h2 { margin: 0 0 8px; font: 600 22px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.xd-market-head p, .xd-service-note { margin: 0; color: var(--text-sub); font-size: 14px; line-height: 1.5; }
.xd-market-clock { flex-shrink: 0; text-align: right; font-size: 12px; color: var(--text-sub); }
.xd-market-clock b { display: block; margin-top: 8px; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--accent-hi); }
.xd-market-offers { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(190px, .75fr); gap: 16px; }
.xd-market-offers > :first-child { grid-row: 1 / 3; }
.xd-offer { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--bg-card); min-width: 0; }
.xd-offer-body { padding: 18px; display: flex; flex-direction: column; flex: 1; }
.xd-offer-meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; font-size: 12px; color: var(--text-sub); }
.xd-offer-meta b { color: var(--accent-hi); }
.xd-offer h3 { margin: 14px 0 8px; font-size: 20px; }
.xd-offer-subtitle, .xd-offer-description { font-size: 13px; color: var(--text-sub); line-height: 1.5; margin: 0 0 12px; }
.xd-offer-buy { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.xd-offer-media { order: -1; height: 220px; background: var(--bg-card-2); }
.xd-offer-media img, .xd-offer-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.xd-offer.is-code-offer .xd-offer-media { height: 80px; }
.xd-offer-code { height: 100%; display: grid; place-items: center; font: 800 28px Syne, sans-serif; color: var(--accent-hi); }
.xd-market-note { margin-top: 16px; color: var(--text-sub); font-size: 13px; }
.xd-offer-skeleton { height: 180px; background: var(--bg-card); border-radius: 16px; }
.xd-service-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.xd-service-head > b { color: var(--accent-hi); font-size: 24px; }
.xd-theme-tools { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0; }
.xd-theme-tools input { flex: 1; width: 100%; min-width: 140px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); border-radius: 12px; }
.xd-theme-pager { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-sub); }
.xd-theme-pager button { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); color: var(--text); }
.xd-theme-list { display: block; background: var(--bg-card); border-radius: 16px; padding: 0 12px; }
.xd-theme-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.xd-theme-media { width: 48px; height: 56px; border-radius: 8px; overflow: hidden; }
.xd-theme-media img, .xd-theme-media video { width: 100%; height: 100%; object-fit: cover; }
.xd-theme-copy { min-width: 0; overflow-wrap: anywhere; }
.xd-theme-copy strong { display: block; font-size: 15px; font-weight: 600; }
.xd-theme-copy span { display: block; margin-top: 4px; font-size: 12px; color: var(--text-sub); }
.xd-theme-sell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 70px; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 10px; color: var(--accent-hi); background: var(--bg-card-2); }
html[data-theme="light"] .xd-primary, html[data-theme="light"] .xd-offer-buy { color: #fff; }
@media (hover: hover) {
  .xd-tabs button:hover, .xd-back:hover, .xd-money-head button:hover, .xd-history-head button:hover { text-decoration: underline; text-underline-offset: 3px; }
  .xd-primary:not(:disabled):hover, .xd-offer-buy:not(:disabled):hover { background: #f9cd8a; }
  html[data-theme="light"] .xd-primary:not(:disabled):hover, html[data-theme="light"] .xd-offer-buy:not(:disabled):hover { background: #965905; }
  .xd-direction button:hover, .xd-theme-sell:not(:disabled):hover, .xd-theme-pager button:not(:disabled):hover { border-color: var(--accent-hi); }
}
@media (prefers-reduced-motion: no-preference) {
  .exchange-den button { transition: background-color 160ms ease, color 160ms ease; }
  .xd-layout > section:not([hidden]), #xd-panel-swap:not([hidden]) { animation: xd-enter 220ms cubic-bezier(.16, 1, .3, 1); }
}
@keyframes xd-enter { from { opacity: .65; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 720px) {
  .xd-layout { padding: 0 16px; }
  .xd-intro { height: 124px; }
  .xd-intro h1 { font-size: 30px; }
  .xd-intro img { width: 96px; height: 112px; }
  .xd-market-offers { grid-template-columns: minmax(0, 1fr); }
  .xd-market-offers > :first-child { grid-row: auto; }
  .xd-market-head { flex-wrap: wrap; }
  .xd-converter { padding: 0; }
}
@media (max-width: 360px) {
  .xd-layout { padding: 0 12px; }
  .xd-tabs { gap: 2px; }
  .xd-tabs button { font-size: 13px; }
  .xd-converter { padding: 0; }
  .xd-money-value { grid-template-columns: minmax(122px, auto) minmax(0, 1fr); gap: 6px; }
  .xd-currency select { font-size: 16px; }
  .xd-currency { gap: 5px; }
  .xd-currency-icon { flex-basis: 26px; height: 26px; }
  .xd-history-row { gap: 8px; grid-template-columns: 28px minmax(0, 1fr) auto; }
}

.xd-topbar h1 { margin: 0; text-align: center; font-size: 17px; font-weight: 600; }
.xd-topbar-brand { text-align: right; color: var(--text-sub); font-size: 10px; letter-spacing: .06em; }
.xd-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.xd-currency .xd-chevron { width: 13px; height: 13px; fill: none; stroke: var(--text-sub); stroke-width: 2; }
.xd-money-value input, .xd-money-value output { font-size: 30px; font-weight: 500; }
.xd-primary { margin-top: 2px; min-height: 48px; font-weight: 600 !important; }
.xd-theme-item:last-child { border-bottom: 0; }
.xd-theme-sell b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.xd-theme-sell span { font-size: 11px; }
.xd-theme-tools { flex-wrap: nowrap; gap: 8px; margin: 16px 0; }
.xd-theme-pager { gap: 6px; white-space: nowrap; }
.xd-theme-pager button { width: 36px; min-height: 44px; border: 0; background: transparent; }
html[data-theme="light"] .xd-tabs button[aria-pressed="true"] { background: #fff; }
.xd-sheet { position: fixed; inset: auto 0 0; width: 100%; max-width: 560px; max-height: 80dvh; box-sizing: border-box; margin: 0 auto; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); border: 0; border-radius: 24px 24px 0 0; background: var(--bg-card); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overflow-y: auto; }
.xd-sheet:not([open]) { display: none; }
.xd-sheet::backdrop { background: #0008; }
.xd-sheet-grip { width: 36px; height: 5px; margin: 0 auto 14px; border-radius: 4px; background: var(--text-sub); opacity: .5; }
.xd-sheet header { display: flex; align-items: center; justify-content: space-between; }
.xd-sheet h2 { margin: 0; font-size: 20px; font-weight: 600; }
.xd-sheet header button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--bg-card-2); color: var(--text-sub); font-size: 18px; }
.xd-sheet > p { color: var(--text-sub); font-size: 13px; margin: 8px 0 16px; }
.xd-currency-option { width: 100%; display: grid; grid-template-columns: 32px minmax(0,1fr) auto 20px; gap: 10px; align-items: center; min-height: 76px; padding: 12px 0; background: none; border: 0; border-bottom: 1px solid var(--border); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.xd-currency-option strong { display: block; font-size: 17px; font-weight: 600; }
.xd-currency-option small { display: block; margin-top: 5px; color: var(--text-sub); font-size: 12px; }
.xd-option-balance { font-size: 14px; font-variant-numeric: tabular-nums; }
.xd-option-check { width: 20px; height: 20px; fill: none; stroke: var(--accent-hi); stroke-width: 2; visibility: hidden; }
.xd-currency-option[aria-pressed="true"] .xd-option-check { visibility: visible; }
.xd-sheet button:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .xd-sheet[open] { animation: xd-sheet-in 240ms cubic-bezier(.16,1,.3,1); } }
@keyframes xd-sheet-in { from { transform: translateY(32px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
@media (max-width: 360px) {
  .xd-currency { font-size: 17px !important; }
  .xd-money-value input, .xd-money-value output { font-size: 25px; }
  .xd-theme-item { gap: 8px; }
  .xd-theme-sell { min-width: 62px; padding: 6px; }
  .xd-theme-copy strong { font-size: 14px; }
  .xd-sheet { padding-inline: 16px; }
}
