.auth-stage {
  --stage-top: 125px;
  max-width: 600px;
  margin: clamp(28px, 10vh, var(--stage-top)) auto 0;
}
@media (min-width: 1500px) and (min-height: 850px) {
  .auth-stage { margin-top: var(--stage-top); }
}
.auth-stage--register { --stage-top: 113px; }
.auth-stage--seed, .auth-stage--challenge { --stage-top: 82px; }
.auth-stage--success { --stage-top: 228px; }
.auth-panel { padding: 32px; border-radius: 32px; background: #161616; color: #ececef; }
.auth-panel h1 { margin: 0 0 16px; font-size: 34px; line-height: 40px; font-weight: 600; }
.auth-panel header p { line-height: 24px; color: #aaaaaf; }
.auth-panel form { margin-top: 32px; }
.auth-fields { display: grid; gap: 16px; }
.auth-field { display: grid; gap: 6px; }
.auth-field label { font-size: 14px; line-height: 16px; color: #a1a1a1; }
.auth-control { display: flex; align-items: center; gap: 10px; min-height: 46px; border: 1px solid rgb(255 255 255 / 14%); border-radius: 32px; padding: 0 12px 0 14px; background: #0e0e0e; }
.auth-control:focus-within { border-color: #d4ae62; }
.auth-control--error { border-color: #d65560; }
.auth-control input { min-width: 0; width: 100%; background: none; border: 0; outline: 0; color: white; }
.auth-control input::placeholder { color: #909092; }
.auth-error, .auth-hint { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 15px; }
.auth-error { color: #ff7b86; }
.auth-hint { color: #a1a1a1; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 32px; }
.auth-stage--success .auth-actions { margin: 0; }
.auth-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border: 1px solid rgb(255 255 255 / 10%); border-radius: 10px; background: rgb(255 255 255 / 6%); color: #dedede; font-size: 14px; font-weight: 600; }
.auth-cta--primary { background: #fff; color: #14161a; border-color: transparent; }
.auth-cta:hover:not(:disabled) { filter: brightness(.86); }
.auth-cta:disabled { opacity: .38; cursor: default; }
.auth-words { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.auth-words li { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; background: rgb(0 0 0 / 40%); border: 1px solid rgb(255 255 255 / 12%); border-radius: 12px; font-size: 16px; }
.auth-words li span { color: #a5a5ab; font-size: 13px; }
.auth-seed-actions { margin-top: 32px; }
.auth-seed-actions .auth-actions { margin-top: 20px; }
.auth-confirm { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 20px; color: #d6d6d8; }
.auth-confirm input { appearance: none; flex: none; width: 20px; height: 20px; margin: 0; border: 1px solid #87878a; border-radius: 5px; }
.auth-confirm input:checked { background: #fff url('assets/flows/auth-check.svg') center no-repeat; }
.auth-demo { color: var(--muted); margin: 16px 0 0; font-size: 13px; line-height: 1.5; }
.auth-demo summary { cursor: pointer; width: fit-content; }
.auth-demo p { margin-top: 6px; }
[data-theme="light"] .auth-panel { background: #faf7f5; color: #201c1d; }
[data-theme="light"] .auth-panel header p, [data-theme="light"] .auth-field label,
[data-theme="light"] .auth-hint, [data-theme="light"] .auth-confirm, [data-theme="light"] .auth-words span { color: #5f5a5c; }
[data-theme="light"] .auth-control, [data-theme="light"] .auth-words li { background: white; border-color: #cfcac8; }
[data-theme="light"] .auth-control input, [data-theme="light"] .auth-cta:not(.auth-cta--primary) { color: #201c1d; }
[data-theme="light"] .auth-cta--primary { background: #222126; color: #fff; }
[data-theme="light"] .auth-error { color: #ad102f; }

.market-page { display: grid; gap: 16px; margin-top: 16px; }
.market-top { display: grid; grid-template-columns: minmax(0,1fr) minmax(270px,339px); align-items: stretch; gap: 20px; }
.market-bottom { display: grid; grid-template-columns: minmax(0,1fr) minmax(255px,300px); gap: 12px; }
.market-page h1, .market-page h2, .market-page h3 { margin: 0; font-weight: 600; }
.market-chat, .market-catalog { position: relative; isolation: isolate; overflow: hidden; }
.market-chat { --chat-rail: clamp(230px,17vw,278px); display: grid; grid-template-columns: minmax(0,1fr) minmax(0,var(--chat-rail)); gap: 18px; min-height: 696px; padding: 12px; background: #0d0a0d; border: 2px solid #351419; border-radius: 24px; }
.market-chat--expanded { --chat-rail: 0px; column-gap: 0; }
.market-art { position: absolute; z-index: -1; inset: 0; overflow: hidden; pointer-events: none; }
.market-art::after { content: ''; position: absolute; inset: 0; }
.market-art--chat::after { background: radial-gradient(ellipse at 90% 100%, #60091545, transparent 75%), linear-gradient(#09090dbb,#09090dd9); }
.market-art--market::after { background: radial-gradient(ellipse at 8% 70%, #121a5b99, transparent 55%), linear-gradient(#080916a3,#060b2499); }
.market-art-texture { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.market-art-edge { position: absolute; top: 0; width: 100%; height: auto; left: 0; }
.market-art-glow { position: absolute; display: grid; place-items: center; opacity: .6; filter: blur(48px); }
.market-art-glow > img { grid-area: 1 / 1; }
.market-art-glow--left { left: -17%; top: -14%; }
.market-art-glow--right { right: -4%; bottom: -18%; }
.market-art--market .market-art-glow--left { top: -65%; }
.market-art--market .market-art-glow--right { bottom: -58%; }
.chat-main { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-announcement { position: relative; display: grid; gap: 6px; padding: 11px 15px; margin-right: 16px; border-radius: 32px; background: #60202b43; }
.chat-announcement small { display: flex; gap: 7px; align-items: center; color: #ad9a9d; font-size: 12px; }
.chat-announcement p { font-weight: 600; font-size: 15px; line-height: 1.4; }
.chat-announcement .chat-show-members { position: absolute; right: 10px; top: 9px; }
.market-chat--expanded .chat-announcement { padding-right: 48px; }
.chat-log { width: 100%; display: flex; flex: 1; flex-direction: column; min-height: 0; height: 500px; max-height: 530px; overflow: auto; scrollbar-width: thin; list-style: none; margin: 12px 0 3px; padding: 0; }
.chat-message { position: relative; display: grid; flex: none; grid-template-columns: 36px minmax(0,1fr) auto; gap: 9px; align-items: start; min-height: 51px; border-left: 2px solid transparent; padding: 10px 14px; }
.chat-message:hover, .chat-message:focus-within { background: #ffffff0b; }
.chat-message--red { border-color: #fd002f; background: linear-gradient(90deg,#f200302a,transparent 46%); }
.chat-message--mint { border-color: #4ba58a; background: linear-gradient(90deg,#4ba58a23,transparent 48%); }
.chat-message--purple { border-color: #a732ff; background: linear-gradient(90deg,#a732ff22,transparent 50%); }
.chat-message--gold { border-color: #e8a86b; background: linear-gradient(90deg,#e8a86b26,transparent 50%); }
.chat-avatar { width: 36px; height: 36px; display: block; object-fit: cover; border-radius: 50%; flex: none; }
.chat-copy { min-width: 0; display: grid; gap: 3px; font-size: 14px; overflow-wrap: anywhere; }
.chat-copy strong, .chat-member strong { min-width: 0; flex-wrap: wrap; display: flex; align-items: center; gap: 4px; color: var(--chat-name, #eee3e3); font-size: 14px; }
.chat-message--red, .chat-member--red { --chat-name: #ff254d; }
.chat-message--mint, .chat-member--mint { --chat-name: #60bd9e; }
.chat-message--gold, .chat-member--gold { --chat-name: #e8ad71; }
.chat-message--purple, .chat-member--purple { --chat-name: #c76aff; }
.chat-copy p { line-height: 1.38; color: #dacbd0; }
.chat-message time { align-self: center; white-space: nowrap; color: #ab9fa5; font-size: 12px; }
.chat-actions { position: absolute; top: 4px; right: 14px; display: flex; gap: 2px; padding: 3px; border: 1px solid #ffffff11; border-radius: 11px; background: #171414; opacity: 0; }
.chat-message:hover .chat-actions, .chat-message:focus-within .chat-actions { opacity: 1; }
.chat-actions button, .chat-members-head button, .chat-show-members { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; }
.chat-actions button:hover, .chat-members-head button:hover, .chat-show-members:hover { background: #ffffff14; }
.chat-reaction { width: fit-content; padding: 3px 6px; background: #ffffff14; border-radius: 99px; font-size: 12px; }
.chat-attachment { display: flex; align-items: center; gap: 6px; color: #c7b9be; }
.chat-copy .chat-quote { border-left: 2px solid #d4ae62; padding-left: 8px; color: #b7a3a5; }
.market-composer { position: relative; display: flex; min-height: 68px; flex-direction: column; justify-content: center; padding: 9px 14px; border: 1px solid #ffffff21; border-radius: 32px; background: #000b; }
.market-composer-main { display: flex; align-items: center; gap: 8px; }
.market-composer input:not([type="file"]) { min-width: 0; flex: 1; background: none; border: 0; color: #f3eaec; padding: 0 8px; }
.market-composer input::placeholder { color: #a0999a; }
.market-composer-main > button { flex: none; width: 30px; height: 38px; display: grid; place-items: center; border-radius: 12px; }
.market-composer-main > button:hover { background: #ffffff16; }
.market-composer-main > .chat-send:disabled { opacity: .38; cursor: default; }
.market-composer-main > .chat-send { background: #f1e9ec; color: #21121b; width: 34px; height: 34px; font-weight: 700; }
.market-composer-context { display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 12px; color: #ddc4c7; }
.market-composer-context span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-side { display: grid; min-width: 0; overflow: hidden; grid-template-rows: 1fr auto; gap: 10px; }
.chat-members { min-width: 0; border: 1px solid #ffffff1c; background: #0b0a0bd1; border-radius: 16px; padding: 12px; }
.chat-members-head { display: flex; align-items: center; gap: 6px; margin: 0 0 7px; }
.chat-members-head h2 { flex: 1; font-size: 14px; }
.chat-members-head > span { color: #bca7ab; padding: 4px; border-radius: 8px; background: #ffffff0b; font-size: 13px; }
.chat-member { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; text-align: left; border-radius: 10px; }
.chat-member:hover, .chat-member.is-highlighted { background: #ffffff0f; }
.chat-member-copy { min-width: 0; overflow-wrap: anywhere; }
.chat-member small { display: block; font-size: 13px; margin-top: 2px; color: #a5959b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rfor-placement--chat { min-height: 92px; border: 1px solid #ffffff26; border-radius: 14px; gap: 9px; background: radial-gradient(ellipse at 55% -90%,#d4ae6266,transparent 67%),#21150a; color: #d4ae62; font-size: 14px; }
.rfor-placement--chat .rfor-placement-size { color: #c7a76b; }
.market-articles, .market-filters { min-width: 0; padding: 16px; border: 2px solid #ffffff12; border-radius: 24px; background: linear-gradient(130deg,#222326,#1b1b1c 62%,#202021); }
.market-articles { display: flex; flex-direction: column; gap: 12px; }
.market-articles h2 { padding: 4px; font-size: 18px; line-height: 1.3; }
.market-article { display: grid; gap: 6px; padding: 12px 16px; min-width: 0; border-radius: 16px; background: #0a0b0c6b; text-align: left; font-size: 16px; }
.market-article:hover { background: #08090b99; box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--article-tone),transparent 55%); }
.market-article--gold { --article-tone: #d4ae62; }
.market-article--red { --article-tone: #ff3152; }
.market-article--purple { --article-tone: #c963fc; }
.market-article--mint { --article-tone: #62c4ad; }
.market-article-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--article-tone); }
.market-article-top > :last-child { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.market-article strong { font-weight: 600; line-height: 1.3; }
.market-article-text { color: #aaa6a8; font-size: 14px; line-height: 16px; }
.market-tag { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 99px; background: color-mix(in srgb,var(--article-tone,#c1bdc0),transparent 88%); color: var(--article-tone,#c1bdc0); font-size: 12px; }

.market-catalog { min-height: 393px; padding: 24px; border: 1px solid #ffffff0f; border-radius: 24px 12px 12px 24px; background: #090d24; }
.market-catalog h1 { font-size: 22px; line-height: 1.3; }
.market-catalog-bar { display: flex; gap: 18px; margin: 16px 0; }
.market-search { display:flex; flex: 1; align-items:center; gap:8px; padding: 0 12px; min-width: 0; min-height: 42px; background:#06070be8; border-radius: 32px; }
.market-search input { min-width: 0; width: 100%; padding: 8px 0; border: 0; color: #eee6e9; background: none; font-size: 14px; }
.market-search input::placeholder { color: #aaa7af; }
.market-tabs { display: flex; align-items: center; border-radius: 32px; background: #060712ad; padding: 3px; overflow: auto; scrollbar-width: thin; }
.market-tabs button { padding: 8px 15px; border-radius: 32px; white-space: nowrap; color: #bbb5c1; font-size: 14px; }
.market-tabs button[aria-pressed="true"], .market-tabs button:hover { background: #29292f; color: white; }
.market-cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.market-offer { background: linear-gradient(145deg,#a3cfb533,transparent 40%),#141416; border-radius: 18px; padding: 22px; min-width: 0; min-height: 241px; display: flex; align-items: flex-start; flex-direction: column; gap: 10px; }
.market-offer--urgent { background: linear-gradient(145deg,#b855382f,transparent 40%),#141416; }
.lot-profile { display:flex; align-items:center; gap:8px; }
.lot-profile strong, .lot-profile small, .lot-description { display: flex; align-items:center; gap:6px; }
.lot-profile strong { color: #f2e9e8; font-size: 14px; }
.lot-profile small { color: #aaa7ad; font-size: 12px; }
.lot-avatar { display:grid; place-items:center; width: 34px; height: 34px; flex:none; border-radius: 8px; background:#293749; color:#d6e7fa; font-size:14px; font-weight:700; }
.lot-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.market-tag--available { --article-tone: #8bd0ae; }
.market-tag--urgent { background: linear-gradient(#9c280c,#611a08); color: #ffbdad; }
.market-offer h3 { font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.market-offer > p { font-size: 14px; color: #aaa7ad; }
.lot-description { color: #b4aeb5; margin-top: auto; text-align: left; font-size: 13px; }
.lot-description:hover { text-decoration: underline; }
.lot-cta { display:flex; justify-content:center; align-items:center; gap: 8px; width:100%; min-height: 39px; padding: 8px 12px; border-radius: 32px; background: linear-gradient(#efeded,#a6a6a7); color: #18171b; font-size: 14px; font-weight: 600; }
.lot-cta:hover { filter: brightness(1.13); }
.lot-cta--gold { background: linear-gradient(#efd28e,#aa8154); }
.market-offer .lot-cta { margin-top: auto; }
.market-empty { grid-column: 1 / -1; color: #c4c1ca; padding: 14px; }
.market-filters { min-height: 393px; display: flex; flex-direction: column; gap: 24px; justify-content: space-between; border-radius: 12px 24px 24px 12px; }
.market-filters > div { display: grid; gap: 12px; }
.market-filters header { display: flex; align-items:center; gap: 10px; justify-content:space-between; }
.market-filters header h2 { display:flex; align-items:center; gap:8px; font-size:16px; }
.market-filters header button { color:#c5bfc4; font-size:14px; }
.market-filters input[name="keywords"], .market-period select { width: 100%; min-height: 40px; padding:0 12px; border:1px solid #343237; border-radius: 32px; color:#ddd9dd; background:#08080a; font-size:14px; }
.market-filters input::placeholder { color: #b1abb2; }
.market-period { position:relative; display:block; }
.market-period > img { position:absolute; top:50%; right:12px; transform:translateY(-50%); pointer-events:none; }
.market-period select { appearance:none; padding-right:32px; }
.market-available { display:flex; align-items:center; gap:10px; color:#ccc5cb; font-size:14px; position:relative; }
.market-available input { appearance:none; width:18px; height:18px; border: 1px solid #9e9ca1; border-radius:50%; margin:0; }
.market-available input:checked { background:#f5f3f4; }
.market-available .icon { position:absolute; left:3px; visibility:hidden; pointer-events:none; }
.market-available input:checked + .icon { visibility:visible; }
.market-filters > .lot-cta { background: #f4f2f4; }
.market-deal-note { display: grid; gap: 12px; }
.market-deal-note textarea { display: block; width: 100%; min-height: 90px; resize: vertical; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.market-profile { display: flex; align-items: center; gap: 10px; }
.market-footer { display:grid; gap:18px; padding:32px 28px 20px; border:1px solid #ffffff0f; border-radius: 24px; background:#0d0d0f; color:#aaa6aa; font-size:14px; line-height:1.5; }
.market-footer-grid { display:grid; grid-template-columns:1.65fr repeat(3,minmax(0,1fr)); gap:28px; }
.market-footer-grid section { display:flex; flex-direction:column; align-items:flex-start; gap:8px; min-width:0; }
.market-footer-grid h2 { color:#eee6e9; font-size:14px; }
.market-footer button { text-align:left; }
.market-footer button:hover { color:#fff; text-decoration:underline; }
.market-brand { display:flex; align-items:center; gap:10px; letter-spacing:.22em; font-weight:700; color:white; }
.market-brand > span { width:32px; height:32px; display:grid; place-items:center; border-radius:50%; background:linear-gradient(#fd002f,#4a0410); }
.market-footer-shortcuts, .market-footer-legal > div { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.market-footer-shortcuts button { display:flex; align-items:center; gap:6px; border-radius:99px; padding:4px 8px; background:#ffffff0a; }
.market-footer-legal { display:flex; justify-content:space-between; gap:14px; padding-top:15px; border-top: 1px solid #ffffff15; }

[data-theme="light"] .market-page { color: #eae2de; color-scheme: dark; }
@media (max-width: 1500px) {
  .market-top { grid-template-columns:minmax(0,1fr) minmax(240px,280px); gap:12px; }
  .market-chat { --chat-rail: 220px; gap:10px; }
  .market-chat--expanded { --chat-rail: 0px; column-gap: 0; }
  .market-bottom { grid-template-columns:minmax(0,1fr) 245px; }
  .market-offer { padding:14px; }
  .market-catalog-bar { flex-wrap:wrap; gap:8px; }
  .market-search { flex-basis: 230px; }
}
@media (max-width: 1150px) {
  .market-top { grid-template-columns:minmax(0,1fr); }
  .market-articles { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .market-articles h2 { grid-column:1 / -1; }
  .market-cards { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .market-chat { min-height:610px; }
  .market-filters { min-height:0; }
}
@media (max-width: 760px) {
  .market-bottom { grid-template-columns:minmax(0,1fr); }
  .market-filters { grid-row: 1; border-radius: 20px; }
  .market-catalog { border-radius: 20px; padding:16px; }
  .market-chat { grid-template-columns:minmax(0,1fr); min-height:0; }
  .chat-log { flex:none; height:360px; }
  .chat-members { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .chat-members-head { grid-column:1 / -1; }
  .chat-member strong { display:block; }
  .chat-member strong .icon { display:inline-block; vertical-align:middle; margin-left:4px; }
  .chat-announcement { margin-right:0; }
  .chat-typing { margin-inline: 6px; }
  .chat-actions { opacity:1; position:static; grid-column:2; justify-self:start; padding: 0; }
  .chat-message time { align-self:start; }
  .market-footer-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 500px) {
  .auth-panel { padding:20px; border-radius:22px; }
  .auth-panel h1 { font-size:27px; line-height:34px; }
  .auth-actions { gap:8px; }
  .auth-words { gap:8px; }
  .auth-words li { font-size:14px; padding: 0 7px; gap: 5px; }
  .market-composer { padding-inline: 8px; }
  .market-composer-main { gap: 4px; }
  .market-composer-main > button { width: 26px; }
  .market-page { margin-top:12px; gap:12px; }
  .market-articles, .market-cards { grid-template-columns:minmax(0,1fr); }
  .market-offer { min-height:200px; }
  .market-chat { padding:8px; }
  .chat-message { grid-template-columns:30px minmax(0,1fr); padding:8px; }
  .chat-message time { grid-column:2; }
  .chat-message > .chat-avatar { width:30px; height:30px; }
  .chat-actions button { width:34px; height:34px; }
  .market-tabs { max-width:100%; }
  .market-tabs button { padding:8px 10px; font-size:13px; }
  .market-footer { padding:18px; }
  .market-footer-legal { flex-direction:column; }
}
.market-page .market-article:focus-visible { outline-offset: -2px; }

.chat-timeline { display: flex; flex: 1; position: relative; min-height: 0; }
.chat-typing { min-height: 20px; padding: 1px 0 4px 14px; color: #bca7ab; font-size: 12px; line-height: 15px; }
.chat-typing.is-typing::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #d4ae62; vertical-align: 1px; }
.chat-latest { position: absolute; bottom: 11px; left: 50%; translate: -50% 0; padding: 7px 12px; border: 1px solid #6d5a39; border-radius: 999px; background: #2d2118; color: #efd28e; white-space: nowrap; font-size: 13px; }
.chat-latest:hover { background: #443125; }
.chat-auto-label { color: #bca7ab; font-size: 10px; font-weight: 400; }
.chat-emojis { position: absolute; z-index: 2; bottom: calc(100% + 7px); right: 6px; display: flex; gap: 2px; padding: 5px; border: 1px solid #ffffff26; border-radius: 14px; background: #20181c; }
.chat-emojis button { width: 34px; height: 36px; border-radius: 8px; font-size: 17px; }
.chat-emojis button:hover { background: #ffffff14; }
