/* =========================================================
   Kitobdosh — o'quvchilar uchun kitob almashinuv platformasi
   Dizayn: daftar qog'ozi, siyoh va marker (highlighter) ranglari
   ========================================================= */

:root {
  --paper: #F3F4F9;
  --surface: #FFFFFF;
  --surface-2: #EBEDF5;
  --surface-3: #E0E3EF;
  --ink: #1A1E3A;
  --ink-2: #4A5072;
  --ink-3: #82879F;
  --line: #E0E3EE;
  --line-2: #CBD0E2;

  --marker: #FFE04A;
  --marker-soft: #FFF4B8;
  --on-marker: #1A1E3A;
  --sale: #FFB25E;
  --sale-soft: #FFEAD3;
  --rent: #7DD3FF;
  --rent-soft: #DCF3FF;
  --swap: #FF9CCF;
  --swap-soft: #FFE3F1;
  --gift: #8EEDB0;
  --gift-soft: #DBF9E6;
  --stamp: #5B45C8;

  --danger: #D23F5A;
  --danger-soft: #FCE5EA;
  --ok: #128555;
  --ok-soft: #DCF4E9;
  --warn: #A86A12;
  --info: #2563A8;

  --btn: #1A1E3A;
  --on-btn: #FFFFFF;
  --plank: #1A1E3A;

  --shadow-float: 0 14px 34px -14px rgba(26, 30, 58, .38), 0 2px 6px rgba(26, 30, 58, .06);
  --book-shadow: 0 1px 1px rgba(26, 30, 58, .1), 0 12px 20px -12px rgba(26, 30, 58, .6);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;

  --font: 'Onest', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Literata', 'Lora', Georgia, 'Times New Roman', serif;

  --tabbar-h: 64px;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #111329;
  --surface: #1A1D38;
  --surface-2: #242848;
  --surface-3: #2E3356;
  --ink: #ECEEFA;
  --ink-2: #B4B8D4;
  --ink-3: #7F84A6;
  --line: #2A2F54;
  --line-2: #3A4070;
  --marker-soft: rgba(255, 224, 74, .16);
  --sale-soft: rgba(255, 178, 94, .16);
  --rent-soft: rgba(125, 211, 255, .14);
  --swap-soft: rgba(255, 156, 207, .14);
  --gift-soft: rgba(142, 237, 176, .14);
  --stamp: #A99BFF;
  --danger: #FF7A90;
  --danger-soft: rgba(255, 122, 144, .14);
  --ok: #5FD69E;
  --ok-soft: rgba(95, 214, 158, .14);
  --warn: #F0BE5A;
  --info: #86BBF5;
  --btn: #ECEEFA;
  --on-btn: #111329;
  --plank: #3D4375;
  --shadow-float: 0 14px 34px -12px rgba(0, 0, 0, .6);
  --book-shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 12px 22px -12px rgba(0, 0, 0, .85);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ic { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em; }
.ic.fill { fill: currentColor; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-3); }
.serif { font-family: var(--serif); }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- layout ---------- */
.view { max-width: 1120px; margin: 0 auto; padding: 0 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); }
body.no-tabs .view { padding-bottom: calc(var(--safe-b) + 28px); }
.page { animation: pageIn .18s ease-out; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

/* desktop top bar */
.topbar { display: none; }
@media (min-width: 960px) {
  .view { padding: 24px 32px 72px; }
  body.no-tabs .view { padding-bottom: 72px; }
  .topbar { display: block; position: sticky; top: 0; z-index: 40; background: var(--paper); border-bottom: 1px solid var(--line); }
  .topbar-in { max-width: 1120px; margin: 0 auto; height: 68px; padding: 0 32px; display: flex; align-items: center; gap: 28px; }
  .topnav { display: flex; gap: 4px; }
  .topnav a { padding: 8px 14px; border-radius: 10px; font-weight: 600; color: var(--ink-2); }
  .topnav a:hover { background: var(--surface-2); color: var(--ink); }
  .topnav a.on { color: var(--ink); background: var(--marker-soft); }
  .tb-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
  .tb-right .btn { margin-right: 8px; }
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.brand svg { width: 34px; height: 34px; flex: none; }

/* mobile tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar-in { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar-h); max-width: 560px; margin: 0 auto; }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.tab-ic { display: grid; place-items: center; width: 46px; height: 30px; border-radius: 15px; transition: background .2s, color .2s; }
.tab .ic { width: 22px; height: 22px; }
.tab.on { color: var(--ink); font-weight: 650; }
.tab.on .tab-ic { background: var(--marker); color: var(--on-marker); }
.tab-add .tab-ic { width: 52px; height: 52px; border-radius: 50%; background: var(--btn); color: var(--on-btn); margin-top: -20px; box-shadow: var(--shadow-float); }
.tab-add .ic { width: 26px; height: 26px; }
.tab-add.on .tab-ic { background: var(--btn); color: var(--on-btn); }
.tab .badge { position: absolute; top: 5px; left: calc(50% + 7px); }
body.no-tabs .tabbar { display: none; }
@media (min-width: 960px) { .tabbar { display: none; } .view { padding-bottom: 72px; } }

/* ---------- small parts ---------- */
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.dot { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--paper); }
.spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.avatar { --s: 40px; position: relative; width: var(--s); height: var(--s); flex: none; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; background: var(--av, var(--surface-2)); color: var(--on-marker); font-weight: 700; font-size: calc(var(--s) * .38); line-height: 1; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.stars { display: inline-flex; gap: 1px; color: #F2A31B; vertical-align: -2px; }
.stars .ic { width: 15px; height: 15px; stroke-width: 1.4; }
.stars .off { color: var(--line-2); }
.verified { color: var(--ok); display: inline-flex; }
.verified .ic { width: 17px; height: 17px; }

/* highlighter labels */
.hl { display: inline-block; padding: 1px 7px 2px; border-radius: 3px 10px 4px 9px / 9px 4px 10px 3px; background: var(--hlc, var(--marker)); color: var(--on-marker); font-size: 12.5px; font-weight: 650; line-height: 1.35; white-space: nowrap; }
.hl-sale { --hlc: var(--sale); }
.hl-rent { --hlc: var(--rent); }
.hl-swap { --hlc: var(--swap); }
.hl-gift { --hlc: var(--gift); }
.hl-lg { font-size: 15px; padding: 2px 10px 3px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: var(--r); background: var(--surface-2); color: var(--ink); font-size: 15px; font-weight: 650; white-space: nowrap; transition: transform .1s, background .15s, opacity .15s; user-select: none; }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--btn); color: var(--on-btn); }
.btn-marker { background: var(--marker); color: var(--on-marker); }
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; gap: 6px; }
.btn-block { width: 100%; }
.btn-icon { position: relative; width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; color: var(--ink); flex: none; }
.btn-icon:hover { background: var(--surface-2); }
.btn-icon .badge { position: absolute; top: 2px; right: 0; }
.link { font-weight: 650; color: var(--ink-2); }
.link:hover { color: var(--ink); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.label { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.label small { font-weight: 500; color: var(--ink-3); }
.input, .select, .textarea { width: 100%; height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 100px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 4px var(--marker-soft); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2382879F' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; }
.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.err { font-size: 13px; color: var(--danger); font-weight: 600; }
.affix { position: relative; }
.affix .input { padding-right: 64px; }
.affix-r { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 14px; pointer-events: none; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.select { min-width: 0; text-overflow: ellipsis; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; cursor: pointer; }
.switch-text b { display: block; font-size: 15px; font-weight: 600; }
.switch-text span { font-size: 13px; color: var(--ink-3); }
.switch input { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 48px; height: 28px; border-radius: 14px; background: var(--line-2); cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked { background: var(--btn); }
.switch input:checked::after { transform: translateX(20px); background: var(--on-btn); }

/* chips & tabs */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar, .hscroll::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 15px; border-radius: 19px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink-2); font-size: 14px; font-weight: 550; white-space: nowrap; transition: background .15s, color .15s; }
.chip.on { background: var(--btn); color: var(--on-btn); box-shadow: none; }
.chip .n { font-size: 12px; opacity: .6; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cc, var(--marker)); }
.chip.on .chip-dot { box-shadow: 0 0 0 2px var(--on-btn); }
.tabs { display: flex; gap: 4px; padding: 4px; margin: 8px 0 16px; border-radius: 14px; background: var(--surface-2); }
.tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; border-radius: 10px; color: var(--ink-2); font-size: 14px; font-weight: 650; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(26, 30, 58, .12); }
.tabs .badge { background: var(--ink-3); }
.tabs button.on .badge { background: var(--danger); }

/* ---------- headers ---------- */
.phead { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 6px; min-height: 58px; margin: 0 -16px; padding: 6px 12px 6px 8px; background: var(--paper); }
.phead.no-back { padding-left: 16px; }
.phead h1 { flex: 1; min-width: 0; font-size: 19px; font-weight: 750; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 960px) {
  .phead { position: static; margin: 0 0 12px; padding: 0; min-height: 0; }
  .phead h1 { font-size: 28px; }
}

.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 14px; }
.hh-hello { font-size: 21px; font-weight: 750; letter-spacing: -0.015em; }
.hh-sub { font-size: 13.5px; color: var(--ink-3); }
.hh-right { display: flex; align-items: center; gap: 4px; }
@media (min-width: 960px) { .hh-right { display: none; } .home-head { padding-top: 4px; } .hh-hello { font-size: 30px; } }

.section { margin-top: 30px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { font-size: 19px; font-weight: 750; letter-spacing: -0.01em; }
.sec-head a { font-size: 14px; font-weight: 650; color: var(--ink-2); white-space: nowrap; }

/* ---------- search ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-radius: 15px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink-3); transition: box-shadow .15s; }
.search { min-width: 0; }
.search input { flex: 1; min-width: 0; width: 100%; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search:focus-within { box-shadow: inset 0 0 0 1.5px var(--ink), 0 0 0 4px var(--marker-soft); }
.search-row { display: flex; gap: 10px; align-items: center; }
.search-row .search { flex: 1; }
.filter-btn { width: 52px; height: 52px; border-radius: 15px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); }
.filter-btn .badge { top: -4px; right: -4px; background: var(--btn); color: var(--on-btn); }

/* ---------- home ---------- */
.guest-hero { margin-top: 4px; padding: 22px 20px; border-radius: 22px; background: var(--surface); }
.guest-hero h1 { font-family: var(--serif); font-size: 25px; line-height: 1.22; font-weight: 700; letter-spacing: -0.01em; max-width: 520px; }
.guest-hero p { margin-top: 10px; color: var(--ink-2); max-width: 520px; }
.guest-hero .btn { margin-top: 16px; }
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.mode { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 12px; border-radius: var(--r-lg); background: var(--surface); font-size: 12.5px; font-weight: 650; line-height: 1.2; text-align: center; transition: transform .12s; }
.mode:active { transform: scale(.97); }
.mode-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 52% 48% 55% 45% / 47% 55% 45% 53%; background: var(--mc); color: var(--on-marker); }
.mode-ic .ic { width: 22px; height: 22px; }
.mode-sale { --mc: var(--sale); } .mode-rent { --mc: var(--rent); } .mode-swap { --mc: var(--swap); } .mode-free, .mode-gift { --mc: var(--gift); }
@media (min-width: 960px) {
  .modes { gap: 14px; }
  .mode { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 16px; font-size: 15.5px; text-align: left; }
}
.cats-row { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.cats-row::-webkit-scrollbar { display: none; }
.cat { flex: none; display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 9px; border-radius: 15px; background: var(--surface); }
.cat-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); font-size: 20px; line-height: 1; }
.cat-name { display: block; font-size: 14px; font-weight: 650; white-space: nowrap; line-height: 1.2; }
.cat-n { display: block; font-size: 12px; color: var(--ink-3); }
@media (min-width: 960px) { .cats-row { flex-wrap: wrap; margin: 0; padding: 0; } }
.home-foot { margin-top: 36px; padding: 18px 0 0; border-top: 1px dashed var(--line-2); color: var(--ink-3); font-size: 13.5px; }

/* shelf: featured books standing on a plank */
.shelf { margin: 0 -16px; }
.shelf-row { display: flex; align-items: flex-end; gap: 14px; overflow-x: auto; padding: 14px 24px 0; scrollbar-width: none; }
.shelf-row::-webkit-scrollbar { display: none; }
.shelf-book { flex: none; width: calc(var(--h) * .72); height: var(--h); transition: transform .18s; }
.shelf-book:hover { transform: translateY(-4px); }
.shelf-book .book { height: 100%; aspect-ratio: auto; }
.shelf::after { content: ''; display: block; height: 11px; margin: 0 10px; border-radius: 3px; background: var(--plank); box-shadow: 0 12px 20px -10px rgba(26, 30, 58, .5); }
@media (min-width: 960px) { .shelf { margin: 0; } .shelf-row { padding: 14px 20px 0; } .shelf::after { margin: 0; } }

/* ---------- books ---------- */
.book { position: relative; aspect-ratio: 3 / 4; border-radius: 3px 8px 8px 3px; overflow: hidden; background: var(--surface-3); box-shadow: var(--book-shadow); isolation: isolate; container-type: inline-size; }
.book img { width: 100%; height: 100%; object-fit: cover; }
.book::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(90deg, rgba(0, 0, 0, .26) 0, rgba(255, 255, 255, .16) 3%, rgba(0, 0, 0, .06) 6%, transparent 11%); }
.book.gen { background: var(--cbg); color: var(--cfg); }
.gen-inner { position: absolute; inset: 8% 9% 8% 15%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6%; padding: 10% 8%; border: 1px solid currentColor; text-align: center; }
.gen-inner::before, .gen-inner::after { content: ''; position: absolute; left: 50%; width: 7%; aspect-ratio: 1; background: currentColor; transform: translateX(-50%) rotate(45deg); }
.gen-inner::before { top: 7%; }
.gen-inner::after { bottom: 7%; }
.gen-title { font-family: var(--serif); font-weight: 700; font-size: 14px; font-size: 11.5cqi; line-height: 1.12; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.gen-author { font-size: 10px; font-size: 6.4cqi; opacity: .85; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.grid-books { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
@media (min-width: 540px) { .grid-books { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .grid-books { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 24px; } }
@media (min-width: 1100px) { .grid-books { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.bk { display: flex; flex-direction: column; min-width: 0; }
.bk-cover { position: relative; margin-bottom: 11px; transition: transform .18s; }
.bk:hover .bk-cover { transform: translateY(-3px); }
.bk-title { font-family: var(--serif); font-size: 15px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bk-author { margin-top: 2px; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.bk-meta { margin-top: 6px; font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.bk-meta .ic { width: 14px; height: 14px; }
.bk-ribbon { position: absolute; top: 0; right: 10px; z-index: 3; width: 16px; height: 26px; background: var(--marker); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%); }
.bk-state { position: absolute; left: 8px; bottom: 8px; z-index: 3; padding: 2px 8px; border-radius: 6px; background: rgba(17, 19, 41, .82); color: #fff; font-size: 11.5px; font-weight: 650; }
.hrow { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 14px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.hrow::-webkit-scrollbar { display: none; }
@media (min-width: 540px) { .hrow { grid-auto-columns: 28%; } }
@media (min-width: 960px) { .hrow { grid-auto-columns: calc(20% - 19px); gap: 24px; margin: 0; padding: 0 0 4px; } }

/* ---------- skeleton & empty ---------- */
.sk { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; }
@keyframes sk { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
.sk-book { aspect-ratio: 3 / 4; border-radius: 3px 8px 8px 3px; }
.sk-line { height: 12px; margin-top: 10px; }
.sk-line.w60 { width: 60%; } .sk-line.w40 { width: 40%; }
.sk-block { height: 72px; border-radius: var(--r-lg); margin-top: 12px; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 44px 20px; text-align: center; }
.empty svg { width: 132px; height: auto; margin-bottom: 6px; }
.empty h3 { font-size: 17px; font-weight: 700; }
.empty p { max-width: 340px; color: var(--ink-3); font-size: 14.5px; }
.empty .btn { margin-top: 8px; }

/* ---------- explore ---------- */
.ex-head { position: sticky; top: 0; z-index: 30; margin: 0 -16px; padding: 12px 16px 10px; background: var(--paper); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 960px) { .ex-head { top: 69px; margin: 0; padding: 0 0 12px; } }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 16px; font-size: 14px; color: var(--ink-3); }
.result-bar select { border: 0; background: transparent; font-weight: 650; color: var(--ink); font-size: 14px; padding: 6px 0; outline: none; cursor: pointer; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.af { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 6px 0 11px; border-radius: 15px; background: var(--marker-soft); font-size: 13px; font-weight: 600; }
.af .ic { width: 16px; height: 16px; }
.load-more { display: flex; justify-content: center; margin-top: 28px; }

/* ---------- sheets & toasts ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(17, 19, 41, .48); opacity: 0; transition: opacity .2s; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; padding: 6px 20px calc(20px + var(--safe-b)); border-radius: 22px 22px 0 0; background: var(--surface); transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.sheet-root.open .sheet-backdrop { opacity: 1; }
.sheet-root.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 4px; margin: 4px auto 12px; border-radius: 2px; background: var(--line-2); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head h3 { font-size: 18px; font-weight: 750; }
.sheet-head .btn-icon { margin-right: -8px; }
.sheet .field:last-child { margin-bottom: 0; }
@media (min-width: 640px) {
  .sheet-root { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; padding-bottom: 22px; opacity: 0; transform: translateY(20px); transition: transform .2s, opacity .2s; }
  .sheet-root.open .sheet { opacity: 1; transform: none; }
  .sheet-grip { display: none; }
  .sheet-head { margin-top: 10px; }
}
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }

#toasts { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); left: 0; right: 0; z-index: 300; display: grid; justify-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast { max-width: 460px; padding: 12px 16px; border-radius: 14px; background: var(--btn); color: var(--on-btn); font-size: 14.5px; font-weight: 550; box-shadow: var(--shadow-float); opacity: 0; transform: translateY(-10px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--marker); color: var(--on-marker); }

/* ---------- lists ---------- */
.list-item { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.li-cover { width: 54px; flex: none; }
.li-cover .book { box-shadow: 0 8px 14px -10px rgba(26, 30, 58, .7); }
.li-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.li-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.li-title { font-family: var(--serif); font-size: 15.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-time { flex: none; font-size: 12px; color: var(--ink-3); }
.li-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13.5px; color: var(--ink-2); }
.li-end { align-self: center; }
.list-item .badge { position: absolute; right: 0; bottom: 16px; }

.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.st::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st-pending { color: var(--warn); }
.st-accepted, .st-active { color: var(--info); }
.st-completed { color: var(--ok); }
.st-declined, .st-cancelled, .st-expired { color: var(--ink-3); }
.st-overdue { color: var(--danger); }

.menu { margin-top: 16px; border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.menu > a, .menu > button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 16px; font-size: 15px; font-weight: 550; text-align: left; }
.menu > * + * { border-top: 1px solid var(--line); }
.menu .ic { color: var(--ink-2); }
.menu .chev { margin-left: auto; color: var(--ink-3); }
.menu .badge { margin-left: auto; }
.menu .badge + .chev { margin-left: 6px; }
.menu .danger, .menu .danger .ic { color: var(--danger); }

.card { padding: 16px; border-radius: var(--r-lg); background: var(--surface); }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--marker-soft); font-size: 13.5px; line-height: 1.45; }
.note > .ic { flex: none; margin-top: 1px; color: var(--warn); }
.note.info { background: var(--rent-soft); }
.note.info > .ic { color: var(--info); }
.note.danger { background: var(--danger-soft); }
.note.danger > .ic { color: var(--danger); }
.note.ok { background: var(--ok-soft); }
.note.ok > .ic { color: var(--ok); }
.note b { font-weight: 700; }

/* ---------- book page ---------- */
.bp { display: grid; gap: 22px; }
@media (min-width: 960px) {
  .bp { grid-template-columns: minmax(0, 430px) minmax(0, 1fr); gap: 52px; align-items: start; }
  .bp-gallery { position: sticky; top: 92px; }
}
.gal-wrap { position: relative; margin: 0 -16px; background: var(--surface-2); }
@media (min-width: 960px) { .gal-wrap { margin: 0; border-radius: 22px; overflow: hidden; } }
.gal { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 1 / 1.08; }
.gal::-webkit-scrollbar { display: none; }
.gal img { flex: none; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; cursor: zoom-in; }
.gal-dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.gal-dots i { width: 7px; height: 7px; border-radius: 4px; background: rgba(17, 19, 41, .25); transition: width .2s, background .2s; }
.gal-dots i.on { width: 20px; background: var(--ink); }
.gal-gen { display: grid; place-items: center; padding: 30px 0 34px; }
.gal-gen .book { width: 50%; max-width: 230px; }
.gal-actions { position: absolute; top: 12px; right: 12px; z-index: 5; display: flex; gap: 8px; }
.gal-actions button { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .94); color: #1A1E3A; box-shadow: 0 2px 10px rgba(17, 19, 41, .14); }
.gal-actions button.on { color: var(--danger); }
.bp-cat { font-size: 13.5px; color: var(--ink-3); font-weight: 550; }
.bp-title { margin: 6px 0 4px; font-family: var(--serif); font-size: 27px; font-weight: 700; line-height: 1.18; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.bp-author { font-size: 16px; color: var(--ink-2); }
@media (min-width: 960px) { .bp-title { font-size: 36px; } }
.offers { display: grid; gap: 10px; margin: 20px 0; }
.offer { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 20px; border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.offer::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--oc); }
.offer-sale { --oc: var(--sale); } .offer-rent { --oc: var(--rent); } .offer-swap { --oc: var(--swap); } .offer-gift { --oc: var(--gift); }
.offer-body { flex: 1; min-width: 0; }
.offer-label { font-size: 13px; font-weight: 550; color: var(--ink-3); }
.offer-main { font-size: 18px; font-weight: 750; line-height: 1.3; }
.offer-note { margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; font-size: 14.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 550; }
.desc { font-size: 15.5px; line-height: 1.62; white-space: pre-wrap; overflow-wrap: anywhere; }
.owner-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); }
.owner-card .oc-name { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.owner-card .oc-meta { font-size: 13px; color: var(--ink-3); }
.owner-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.owner-tools .btn { padding: 0 8px; }
.bp-stats { display: flex; gap: 16px; font-size: 13.5px; color: var(--ink-3); margin-top: 12px; }
.bp-stats span { display: inline-flex; align-items: center; gap: 5px; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 10px 16px calc(10px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); }
.action-bar-in { display: flex; gap: 10px; max-width: 760px; margin: 0 auto; }
.action-bar .btn { flex: 1; }
.action-bar .btn.sq { flex: none; width: 50px; padding: 0; }
.action-bar .btn.sq.on { color: var(--danger); }
.page-book { padding-bottom: 76px; }
@media (min-width: 960px) {
  .action-bar { position: static; padding: 0; margin-top: 20px; background: none; border: 0; }
  .action-bar-in { margin: 0; max-width: 460px; }
  .page-book { padding-bottom: 0; }
}

/* image viewer */
.viewer { position: fixed; inset: 0; z-index: 400; background: #0B0C18; display: flex; flex-direction: column; }
.viewer-strip { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer-strip img { flex: none; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; }
.viewer-x { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; }

/* request sheet */
.req-book { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.req-book .book { width: 44px; }
.req-book b { display: block; font-family: var(--serif); font-size: 15.5px; line-height: 1.3; }
.req-book span { font-size: 13px; color: var(--ink-3); }
.calc { display: grid; gap: 6px; margin: 14px 0; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); }
.calc div { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; }
.calc span { color: var(--ink-2); }
.calc .total { font-size: 17px; font-weight: 750; }
.stepper { display: flex; align-items: center; gap: 0; height: 50px; border-radius: var(--r); background: var(--surface-2); width: max-content; }
.stepper button { width: 50px; height: 50px; display: grid; place-items: center; font-size: 22px; font-weight: 500; }
.stepper input { width: 64px; height: 50px; border: 0; background: transparent; text-align: center; font-size: 18px; font-weight: 750; outline: none; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.pick-list { display: grid; gap: 8px; max-height: 300px; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer; }
.pick.on { box-shadow: inset 0 0 0 2px var(--ink); background: var(--marker-soft); }
.pick .book { width: 38px; }
.pick b { display: block; font-size: 14.5px; font-weight: 650; line-height: 1.3; }
.pick span { font-size: 12.5px; color: var(--ink-3); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- deal ---------- */
.deal-book { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface); }
.deal-book .book { width: 50px; flex: none; }
.deal-book b { display: block; font-family: var(--serif); font-size: 16px; line-height: 1.3; }
.deal-book span { font-size: 13px; color: var(--ink-3); }
.steps { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 22px 0 18px; padding: 0; list-style: none; counter-reset: st; }
.steps li { position: relative; padding-top: 32px; text-align: center; font-size: 12px; line-height: 1.3; color: var(--ink-3); }
.steps li::before { counter-increment: st; content: counter(st); position: absolute; top: 0; left: 50%; z-index: 1; width: 26px; height: 26px; margin-left: -13px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink-3); font-size: 12px; font-weight: 750; }
.steps li::after { content: ''; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: var(--line-2); }
.steps li:first-child::after { display: none; }
.steps li.done { color: var(--ink-2); }
.steps li.done::before { content: '✓'; background: var(--btn); color: var(--on-btn); }
.steps li.done::after, .steps li.cur::after { background: var(--btn); }
.steps li.cur { color: var(--ink); font-weight: 700; }
.steps li.cur::before { background: var(--marker); color: var(--on-marker); box-shadow: 0 0 0 5px var(--marker-soft); }
.closed-banner { margin: 18px 0; }
.formular { position: relative; padding: 4px 18px; border-radius: var(--r-lg); background: var(--surface); }
.fr { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--line-2); font-size: 14.5px; }
.fr:last-child { border-bottom: 0; }
.fr dt { color: var(--ink-3); }
.fr dd { margin: 0; font-weight: 650; text-align: right; }
.fr dd small { display: block; font-weight: 550; font-size: 12.5px; }
.fr .late { color: var(--danger); }
.stamp { position: absolute; top: -10px; right: 12px; z-index: 2; padding: 5px 12px; border: 2.5px solid currentColor; border-radius: 8px; color: var(--stamp); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--surface); transform: rotate(-8deg); opacity: .9; animation: stamp .42s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes stamp { from { transform: rotate(-8deg) scale(1.9); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: .9; } }
.contact { display: grid; gap: 10px; margin-top: 14px; }
.contact-row { display: flex; flex-wrap: wrap; gap: 10px; }
.contact-row .btn { flex: 1 1 140px; min-width: 0; }
.deal-actions { display: grid; gap: 10px; margin-top: 16px; }
.deal-actions .row .btn { flex: 1; }
.review-box { margin-top: 16px; }
.star-pick { display: flex; gap: 6px; margin: 6px 0 12px; }
.star-pick button { color: var(--line-2); }
.star-pick button .ic { width: 36px; height: 36px; stroke-width: 1.3; }
.star-pick button.on { color: #F2A31B; }

.chat { margin-top: 26px; }
.chat h2 { font-size: 16px; font-weight: 750; margin-bottom: 6px; }
.chat-list { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 12px; }
.msg { position: relative; max-width: 82%; padding: 9px 13px 7px; border-radius: 17px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { display: block; margin-top: 2px; font-size: 11px; opacity: .55; text-align: right; }
.msg.them { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 6px; }
.msg.mine { align-self: flex-end; background: var(--btn); color: var(--on-btn); border-bottom-right-radius: 6px; }
.msg-sys { align-self: center; max-width: 92%; padding: 6px 12px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; text-align: center; }
.chat-day { align-self: center; margin: 10px 0 4px; font-size: 12px; font-weight: 650; color: var(--ink-3); }
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 8px 12px calc(8px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); }
.composer-in { display: flex; align-items: flex-end; gap: 8px; max-width: 760px; margin: 0 auto; }
.composer textarea { flex: 1; min-height: 46px; max-height: 130px; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 23px; background: var(--paper); font-size: 16px; line-height: 1.3; resize: none; outline: none; }
.composer textarea:focus { border-color: var(--ink); }
.composer .send { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--marker); color: var(--on-marker); }
.composer .send[disabled] { opacity: .5; }
.page-deal { padding-bottom: 84px; }

/* ---------- profile ---------- */
.prof-head { display: flex; align-items: center; gap: 16px; padding: 10px 0 18px; }
.prof-name { display: flex; align-items: center; gap: 6px; font-size: 23px; font-weight: 750; letter-spacing: -0.015em; line-height: 1.2; }
.prof-meta { margin-top: 3px; font-size: 13.5px; color: var(--ink-3); }
.level { padding: 16px; border-radius: var(--r-lg); background: var(--surface); }
.level-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.level-name { font-size: 16px; font-weight: 750; }
.level-pts { font-size: 13.5px; color: var(--ink-3); }
.level-bar { height: 12px; margin-top: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.level-bar i { display: block; height: 100%; width: calc(var(--p) * 100%); min-width: 12px; border-radius: 6px; background: var(--marker); }
.level-next { margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.pstats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; border-radius: var(--r-lg); background: var(--surface); }
.pstat { padding: 14px 8px; text-align: center; }
.pstat + .pstat { box-shadow: inset 1px 0 0 var(--line); }
.pstat b { display: block; font-size: 19px; font-weight: 750; }
.pstat span { font-size: 12.5px; color: var(--ink-3); }
.mybook-state { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 650; white-space: nowrap; }
.pill.warn { background: var(--marker-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.good { background: var(--ok-soft); color: var(--ok); }
.review { padding: 14px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
.review-top { display: flex; align-items: center; gap: 10px; }
.review p { margin-top: 8px; font-size: 14.5px; }

/* ---------- leaders / notifications / wanted ---------- */
.leader { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.leader .rank { width: 30px; text-align: center; font-weight: 750; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.leader.top .rank { display: grid; place-items: center; height: 30px; border-radius: 52% 48% 55% 45% / 47% 55% 45% 53%; background: var(--marker); color: var(--on-marker); }
.leader .pts { margin-left: auto; font-weight: 750; white-space: nowrap; }
.leader .lv { font-size: 12.5px; color: var(--ink-3); }
.me-rank { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--marker-soft); margin-bottom: 8px; }

.notif { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.n-ic { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 13px; background: var(--surface); color: var(--ink-2); }
.notif.unread .n-ic { background: var(--marker); color: var(--on-marker); }
.notif b { display: block; font-size: 14.5px; font-weight: 650; line-height: 1.35; }
.notif p { margin-top: 2px; font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.notif time { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-3); }

.want { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.want:last-child { border-bottom: 0; }
.want-ic { display: grid; place-items: center; width: 42px; height: 52px; flex: none; border-radius: 3px 7px 7px 3px; background: var(--surface); box-shadow: inset 4px 0 0 var(--line-2); color: var(--ink-3); font-family: var(--serif); font-size: 22px; font-weight: 700; }
.want-title { font-family: var(--serif); font-size: 16px; font-weight: 650; line-height: 1.3; }
.want-meta { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.want-note { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.want-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- edit form ---------- */
.form { max-width: 680px; }
.form-sec { margin-top: 26px; }
.form-sec > h2 { font-size: 16.5px; font-weight: 750; margin-bottom: 4px; }
.form-sec > p.hint { margin-bottom: 12px; }
.photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
@media (min-width: 540px) { .photos { grid-template-columns: repeat(5, 1fr); } }
.ph { position: relative; aspect-ratio: 3 / 4; border-radius: 4px 9px 9px 4px; overflow: hidden; background: var(--surface-2); }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph .rm { position: absolute; top: 5px; right: 5px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(17, 19, 41, .72); color: #fff; }
.ph .rm .ic { width: 15px; height: 15px; }
.ph .first { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 0; background: var(--marker); color: var(--on-marker); font-size: 11px; font-weight: 750; text-align: center; }
.ph .mk { position: absolute; left: 5px; bottom: 5px; padding: 2px 7px; border-radius: 6px; background: rgba(17, 19, 41, .72); color: #fff; font-size: 11px; font-weight: 650; }
.ph-add { display: grid; place-items: center; align-content: center; gap: 4px; border: 2px dashed var(--line-2); background: transparent; color: var(--ink-3); font-size: 12px; font-weight: 650; cursor: pointer; }
.ph-add .ic { width: 26px; height: 26px; }
.toggles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
@media (max-width: 360px) { .tg { padding: 10px; gap: 8px; font-size: 13.5px; } .tg-ic { width: 32px; height: 32px; } .modes { gap: 6px; } .mode { font-size: 11.5px; } }
.tg { position: relative; display: flex; align-items: center; gap: 10px; padding: 13px; border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 650; font-size: 14.5px; cursor: pointer; line-height: 1.25; transition: box-shadow .15s, background .15s; }
.tg input { position: absolute; opacity: 0; pointer-events: none; }
.tg-ic { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--mcs); }
.tg.on { background: var(--mcs); box-shadow: inset 0 0 0 2px var(--ink); }
.tg.on .tg-ic { background: var(--mc); color: var(--on-marker); }
.tg-sale { --mc: var(--sale); --mcs: var(--sale-soft); }
.tg-rent { --mc: var(--rent); --mcs: var(--rent-soft); }
.tg-swap { --mc: var(--swap); --mcs: var(--swap-soft); }
.tg-gift { --mc: var(--gift); --mcs: var(--gift-soft); }
.mode-fields { margin-top: 10px; padding: 16px 16px 2px; border-radius: var(--r-lg); background: var(--surface); border-left: 6px solid var(--mc); }
.conds { display: grid; gap: 8px; }
.cond { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer; }
.cond input { position: absolute; opacity: 0; pointer-events: none; }
.cond.on { box-shadow: inset 0 0 0 2px var(--ink); }
.cond .radio { width: 20px; height: 20px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line-2); }
.cond.on .radio { box-shadow: inset 0 0 0 6px var(--btn); }
.cond b { display: block; font-size: 14.5px; font-weight: 650; }
.cond span { font-size: 12.5px; color: var(--ink-3); }
.form-foot { position: sticky; bottom: 0; z-index: 20; margin: 26px -16px 0; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(to bottom, transparent, var(--paper) 22%); }
@media (min-width: 960px) { .form-foot { margin: 26px 0 0; padding: 12px 0; } .form-foot .btn { width: auto; min-width: 240px; } }

/* ---------- login / onboarding ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; max-width: 440px; margin: 0 auto; padding: 18px 0 32px; }
.login-shelf { margin: 0 -16px; }
.login-shelf .shelf-row { justify-content: center; overflow: hidden; }
.login h1 { font-family: var(--serif); font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.login p { color: var(--ink-2); }
.login-steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: ls; }
.login-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; }
.login-steps li::before { counter-increment: ls; content: counter(ls); flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); font-weight: 750; font-size: 13px; }
.waiting { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--marker-soft); font-weight: 600; }
.ob-head { padding: 18px 0 8px; }
.ob-head h1 { font-family: var(--serif); font-size: 26px; line-height: 1.2; font-weight: 700; }
.ob-head p { margin-top: 6px; color: var(--ink-2); }

.rules { white-space: pre-wrap; font-size: 15.5px; line-height: 1.7; }
.blocked { max-width: 420px; margin: 18vh auto 0; text-align: center; display: grid; gap: 12px; padding: 0 16px; }

/* ---------- majburiy obuna (required channels & groups) ---------- */
html.gated, html.gated body { overflow: hidden; }
.subgate { position: fixed; inset: 0; z-index: 200; overflow-y: auto; overscroll-behavior: contain; display: grid; justify-items: center; align-content: start; padding: max(40px, 9vh) 16px calc(32px + var(--safe-b)); background: var(--paper); animation: sg-in .22s ease-out; transition: opacity .18s; }
.subgate.out { opacity: 0; }
@keyframes sg-in { from { opacity: 0; } }
.sg-card { width: 100%; max-width: 420px; display: grid; gap: 12px; text-align: center; }
.sg-card > svg { width: 120px; height: auto; justify-self: center; }
.sg-card h2 { font-family: var(--serif); font-size: 24px; line-height: 1.25; font-weight: 700; }
.sg-card .btn-block { margin-top: 6px; }
.sg-card:focus { outline: none; }
.sg-out { justify-self: center; padding: 8px 12px; font-size: 14px; }
.sg-list { display: grid; gap: 8px; margin: 6px 0 0; padding: 0; list-style: none; text-align: left; }
.sg-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 10px 10px 12px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.sg-ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--rent-soft); color: var(--info); }
.sg-ic.group { background: var(--gift-soft); color: var(--ok); }
.sg-name { flex: 1; min-width: 0; display: grid; gap: 1px; }
.sg-name b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-weight: 650; line-height: 1.3; }
.sg-name small { font-size: 12.5px; color: var(--ink-3); }
.sg-row .btn { flex: none; }
.sg-row.joined { background: transparent; }
.sg-row.joined .sg-name small { color: var(--ok); font-weight: 600; }
.sg-ok { flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin-right: 2px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.sg-inline { display: grid; gap: 4px; padding: 14px; border-radius: var(--r); background: var(--marker-soft); }
.sg-inline p { font-size: 14px; color: var(--ink); }
.sg-inline .sg-row { min-height: 58px; }
@media (max-width: 360px) {
  .sg-row { flex-wrap: wrap; }
  .sg-row .btn { flex: 1 0 100%; }
}

/* desktop two-column helpers */
@media (min-width: 960px) {
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
  .cols > aside { position: sticky; top: 92px; }
}

/* ---------- additions ---------- */
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; color: var(--ink-3); }
.hl-more { --hlc: var(--surface-2); color: var(--ink-2); }
.result-bar select { appearance: none; -webkit-appearance: none; padding-right: 22px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2382879F' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right center / 16px; }
.pick, .cond { position: relative; }
.prof-meta .ic { width: 15px; height: 15px; }
.owner-card > .ic, .deal-book > .ic { color: var(--ink-3); }
.hint .ic { width: 15px; height: 15px; }

.sheet .offer { box-shadow: inset 0 0 0 1.5px var(--line); }
.page-hint { margin: 0 0 14px; }
.calc .total span { color: var(--ink); }
