/* SNAUT Marketplace — продолжение визуальной системы SNAUT Web (apps/web/styles.css): те же токены, тёмная тема
   по умолчанию; светлая — по системной настройке. Без внешних шрифтов и библиотек: первый экран рисуется из HTML+CSS. */
:root {
  color-scheme: dark;
  --bg: #0e0e10;
  --surface: #141417;
  --surface-2: #1a1a1e;
  --surface-3: #232328;
  --hover: rgba(255, 255, 255, 0.05);
  --border: #25252a;
  --border-strong: #34343b;
  --text: #ececef;
  --muted: #9b9ba4;
  --faint: #6f6f78;
  --accent: #8d9bff;
  --accent-strong: #6d7dff;
  --accent-soft: rgba(141, 155, 255, 0.14);
  --on-accent: #0b0c1a;
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  --wrap: 1180px;
  font-family: Inter, 'Segoe UI Variable Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --bg: #f6f6f8;
    --surface: #ffffff;
    --surface-2: #f2f2f5;
    --surface-3: #e8e8ed;
    --hover: rgba(0, 0, 0, 0.04);
    --border: #e3e3e8;
    --border-strong: #d0d0d8;
    --text: #17171b;
    --muted: #5d5d68;
    --faint: #85858f;
    --accent: #4b5bf0;
    --accent-strong: #3343e0;
    --accent-soft: rgba(75, 91, 240, 0.1);
    --on-accent: #ffffff;
    --success: #15803d;
    --success-soft: rgba(21, 128, 61, 0.1);
    --warning: #a16207;
    --warning-soft: rgba(161, 98, 7, 0.1);
    --danger: #b91c1c;
    --danger-soft: rgba(185, 28, 28, 0.08);
    --shadow: 0 12px 36px rgba(20, 20, 40, 0.12);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.8em; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 10; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Шапка */
.top { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: 0.04em; }
.brand:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #c084fc); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; }
.dirs { display: flex; gap: 4px; }
.dirs a { color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); font-weight: 500; }
.dirs a:hover, .dirs a[aria-current='page'] { color: var(--text); background: var(--hover); text-decoration: none; }
.search { flex: 1; max-width: 420px; margin-left: auto; }
.search input { width: 100%; }
.account { display: flex; gap: 8px; align-items: center; }
.account form { margin: 0; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] .menu-list { display: flex; }
.menu-list { display: none; position: absolute; right: 0; top: calc(100% + 6px); flex-direction: column; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
.menu-list a, .menu-list button { padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-align: left; background: none; border: 0; font: inherit; cursor: pointer; width: 100%; }
.menu-list a:hover, .menu-list button:hover { background: var(--hover); text-decoration: none; }

/* Элементы управления */
input, select, textarea { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; }
textarea { width: 100%; min-height: 110px; resize: vertical; }
input[type='checkbox'], input[type='radio'] { width: auto; accent-color: var(--accent); }
label { display: block; font-weight: 500; margin: 0 0 4px; }
.field { margin: 0 0 14px; }
.field small { display: block; margin-top: 4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > .field { flex: 1 1 180px; }
.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.small { padding: 5px 10px; font-size: 0.87rem; }
.btn.big { padding: 12px 22px; font-size: 1.05rem; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }
.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Плашки и сообщения */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ad { background: var(--warning-soft); color: var(--warning); text-transform: uppercase; letter-spacing: 0.04em; }
.notice { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; }
.notice.ok { border-color: color-mix(in srgb, var(--success) 35%, transparent); background: var(--success-soft); }
.notice.warn { border-color: color-mix(in srgb, var(--warning) 35%, transparent); background: var(--warning-soft); }
.notice.bad { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); }
.testmode { background: repeating-linear-gradient(45deg, var(--warning-soft), var(--warning-soft) 10px, transparent 10px, transparent 20px); color: var(--warning); text-align: center; font-weight: 700; padding: 6px; font-size: 0.85rem; }

/* Сетки и карточки */
.section { padding: 28px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.app-card { display: flex; gap: 14px; align-items: flex-start; color: var(--text); transition: border-color 0.15s; position: relative; }
.app-card:hover { border-color: var(--border-strong); text-decoration: none; }
.app-card .meta { min-width: 0; }
.app-card h3 { margin: 0 0 2px; font-size: 1rem; }
.app-card p { margin: 0 0 6px; color: var(--muted); font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-card .foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 0.82rem; color: var(--muted); }
.icon { width: 56px; height: 56px; border-radius: 14px; flex: none; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; color: var(--muted); font-size: 1.3rem; }
.icon.big { width: 96px; height: 96px; border-radius: 22px; font-size: 2.2rem; }
.stars { color: var(--warning); letter-spacing: 1px; white-space: nowrap; }
.price { font-weight: 600; color: var(--text); }

/* Главная: два направления */
.hero { padding: 48px 0 18px; }
.hero p.lead { color: var(--muted); font-size: 1.1rem; max-width: 760px; }
.directions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.direction { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px; display: flex; flex-direction: column; gap: 10px; }
.direction h2 { margin: 0; }
.direction ul { margin: 0 0 6px; padding-left: 18px; color: var(--muted); }
.direction .actions { margin-top: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.9rem; }
.chip:hover { border-color: var(--border-strong); text-decoration: none; }
.chip[aria-current='true'] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Каталог */
.catalog { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.filters { position: sticky; top: 76px; }
.filters fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.filters legend { font-weight: 600; margin-bottom: 6px; }
.filters select, .filters input[type='search'] { width: 100%; }
.pager { display: flex; gap: 6px; justify-content: center; margin: 22px 0; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.pager span[aria-current] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.crumbs { font-size: 0.88rem; color: var(--muted); margin: 18px 0 10px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.crumbs li + li::before { content: '›'; margin-right: 6px; color: var(--faint); }

/* Страница приложения */
.app-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: start; padding: 10px 0 22px; }
.app-hero h1 { margin-bottom: 4px; }
.app-hero .tagline { color: var(--muted); font-size: 1.08rem; margin-bottom: 8px; }
.app-hero .facts { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 0.9rem; }
.buybox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; min-width: 300px; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.buybox .btn { width: 100%; }
.buybox .note { font-size: 0.82rem; color: var(--muted); }
.shots { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.shots figure { margin: 0; flex: none; scroll-snap-align: start; }
.shots img { height: 260px; width: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
.shots figcaption { font-size: 0.82rem; color: var(--muted); margin-top: 4px; max-width: 420px; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
.prose { max-width: 760px; }
.prose ul { padding-left: 20px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.plan { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.plan.pro { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.plan .amount { font-size: 1.5rem; font-weight: 700; }
.plan ul { margin: 0; padding-left: 18px; color: var(--muted); }
.compare { width: 100%; border-collapse: collapse; }
.compare th, .compare td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.compare td.c { text-align: center; }
.dist { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; font-size: 0.85rem; }
.bar { height: 7px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--warning); }
.review { border-top: 1px solid var(--border); padding: 14px 0; }
.review .reply { margin: 10px 0 0 16px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.rate { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.rate input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rate label { font-size: 1.6rem; color: var(--surface-3); cursor: pointer; margin: 0; }
.rate input:checked ~ label, .rate label:hover, .rate label:hover ~ label { color: var(--warning); }
.rate input:focus-visible + label { outline: 2px solid var(--accent); }
.builds { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.builds th, .builds td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
details.more summary { cursor: pointer; color: var(--accent); }
.faq details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.ad-slot { border: 1px dashed color-mix(in srgb, var(--warning) 45%, var(--border)); border-radius: var(--radius); padding: 10px; }

/* Кабинеты */
.cabinet { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 24px 0; }
.side-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; align-self: start; }
.side-nav a { padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted); }
.side-nav a[aria-current='page'] { background: var(--accent-soft); color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current='page'] { color: var(--text); border-bottom-color: var(--accent); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th, table.data td { padding: 8px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th { color: var(--muted); font-weight: 500; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 1.35rem; }
.stat span { color: var(--muted); font-size: 0.85rem; }
.narrow { max-width: 440px; margin: 40px auto; }
pre, code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 0.88em; }
pre { background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; }

/* Подвал */
.foot-site { border-top: 1px solid var(--border); margin-top: 40px; padding: 26px 0; color: var(--muted); font-size: 0.88rem; }
.foot-site .wrap { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 20px; }
.foot-site a { color: var(--muted); }
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 640px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; z-index: 20; }
.consent form { display: inline; }

@media (max-width: 900px) {
  .catalog, .layout-2, .cabinet { grid-template-columns: 1fr; }
  .filters, .side-nav { position: static; }
  .side-nav { flex-direction: row; overflow-x: auto; }
  .app-hero { grid-template-columns: auto 1fr; }
  .buybox { grid-column: 1 / -1; max-width: none; min-width: 0; }
  .directions { grid-template-columns: 1fr; }
  .foot-site .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top .wrap { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; gap: 8px 12px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .dirs a { padding: 6px 8px; }
  .icon.big { width: 72px; height: 72px; font-size: 1.6rem; }
  .shots img { height: 200px; }
  .hero { padding-top: 26px; }
}
