:root {
  color-scheme: light;
  --paper: #f8f6fb;
  --ink: #221936;
  --muted: #61576d;
  --purple: #6725ce;
  --purple-dark: #4d1aa4;
  --line: #e5ddf0;
  --white: #fff;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 Arial, sans-serif; }
h1, h2, h3, p, ul, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
input, button, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 2px solid #9b45ef; outline-offset: 3px; }
[hidden] { display: none !important; }
.wrap { width: min(1320px, calc(100% - 80px)); margin-inline: auto; }
.sr { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.skip { position: fixed; z-index: 10; background: white; padding: 8px 14px; left: 14px; top: -100px; }
.skip:focus { top: 10px; }
.market-header { background: linear-gradient(108deg, #7623cd, #5725bc 67%, #4420a4); color: white; }
.top-bar { min-height: 80px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 32px; }
.market-logo { width: fit-content; display: grid; grid-template-columns: auto auto; align-items: center; line-height: .9; gap: 6px 9px; font-size: 29px; font-weight: 900; letter-spacing: -.08em; }
.market-logo img { grid-row: span 2; width: 36px; height: auto; border-radius: 5px; }
.market-logo small { font-size: 9px; letter-spacing: .14em; font-weight: 700; }
.logo-accent { color: #f0b9ff; }
.search { display: flex; align-items: center; gap: 10px; padding: 0 15px; border-radius: 12px; background: #fff; color: var(--ink); min-width: 0; }
.search input { border: 0; width: 100%; min-height: 45px; background: none; outline-offset: -2px; font-size: 15px; }
.search svg, .cart-trigger svg { width: 21px; height: 21px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.search svg { color: var(--muted); }
.cart-trigger { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: #ffffff22; border: 1px solid #ffffff45; border-radius: 10px; color: #fff; font-size: 14px; font-weight: 700; }
.cart-trigger:hover { background: #ffffff35; }
.cart-trigger b { min-width: 21px; border-radius: 100%; background: white; color: var(--purple-dark); text-align: center; }
.market-nav { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; min-height: 39px; font-size: 13px; font-weight: 650; padding-bottom: 8px; }
.market-nav a:hover, .footer-inner a:hover { text-decoration: underline; }
.market-hero { margin: 26px 0 39px; border-radius: 20px; min-height: 312px; background: radial-gradient(ellipse at 78% 34%,#8955d5,#563398 50%,#30174f); display: grid; grid-template-columns: 1.45fr 1fr; align-items: center; overflow: hidden; color: white; }
.hero-content { padding: clamp(25px, 5vw, 64px); padding-right: 0; }
.shop-kicker, .section-kicker { color: var(--purple-dark); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.shop-kicker { color: #f0d6ff; display: flex; align-items: center; gap: 8px; }
.shop-kicker span { width: 6px; height: 6px; border-radius: 50%; background: #eecbff; }
.market-hero h1 { font-size: clamp(34px, 4.6vw, 69px); line-height: .99; letter-spacing: -.065em; margin-block: 14px; }
.market-hero h1 em { color: #f1bcff; font-style: normal; white-space: nowrap; }
.market-hero p:not(.shop-kicker) { max-width: 420px; font-size: 15px; color: #f7ebff; }
.hero-art { display: grid; place-items: center; align-self: stretch; min-width: 0; }
.hero-art img { width: min(100%, 390px); height: auto; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 14px; border: 1px solid transparent; border-radius: 9px; font-size: 14px; font-weight: 750; text-align: center; }
.primary { background: var(--purple); color: white; }
.primary:hover { background: var(--purple-dark); }
.secondary { color: var(--purple-dark); background: #f1e8fb; border-color: #e6d8f5; }
.secondary:hover { background: #e9dcf9; }
.hero-button { margin-top: 18px; color: #3c225e; background: #f6e6ff; }
.hero-button:hover { background: white; }
.catalog { scroll-margin-top: 20px; min-height: 310px; padding-bottom: 44px; }
.catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.catalog-heading h2, .cart-header h2, .admin-page h1 { font-size: clamp(31px,4vw,52px); letter-spacing: -.055em; line-height: 1.05; margin-top: 4px; }
.sort select, .admin-form :is(input,select,textarea) { background: white; border: 1px solid #dcd3e7; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.filters button { background: white; border: 1px solid var(--line); border-radius: 24px; padding: 7px 13px; font-size: 13px; font-weight: 700; }
.filters button[aria-pressed="true"] { color: white; background: var(--purple-dark); border-color: var(--purple-dark); }
.status { color: var(--muted); font-size: 13px; margin: 10px 0; }
.status:empty { display: none; }
.status.error { color: #9d203f; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(215px, 100%), 1fr)); gap: 13px; }
.card { display: flex; flex-direction: column; background: white; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; min-width: 0; }
.card-photo, .detail-photo { position: relative; display: block; background: #eee5fa; padding: 0; border: 0; width: 100%; aspect-ratio: 1; overflow: hidden; }
.card-photo img, .detail-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.card-photo img { transition: transform .2s; }
.card-photo:hover img { transform: scale(1.045); }
.art-mini { background: #e4efec; }
.art-mini img.illustration { filter: hue-rotate(75deg); }
.art-lucky { background: #fae7f0; }
.art-lucky img.illustration { filter: hue-rotate(35deg); }
.art-easy { background: #e7ebfa; }
.art-easy img.illustration { filter: hue-rotate(315deg); }
.art-stand { background: #f1e8e4; }
.art-stand img.illustration { filter: hue-rotate(155deg) saturate(.66); }
.picture-label { position: absolute; bottom: 7px; left: 8px; color: #4d405b; background: #fffcffeb; border-radius: 4px; padding: 3px 5px; font-size: 9px; }
.card-copy { flex: 1; display: flex; flex-direction: column; align-items: start; padding: 12px; }
.price { color: var(--purple-dark); font-weight: 850; font-size: 18px; }
.card-title { color: inherit; background: none; padding: 0; border: 0; text-align: left; font-weight: 750; font-size: 16px; margin: 4px 0; }
.card-title:hover { color: var(--purple); }
.card-category { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.card .button { width: 100%; margin-top: auto; min-height: 39px; }
.market-footer { background: #ede7f6; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; min-height: 75px; font-size: 14px; padding-block: 12px; }
.footer-inner strong { margin-right: auto; }
dialog { color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 16px; max-height: 90dvh; overflow: auto; padding: 0; }
dialog::backdrop { background: #251138a8; }
body:has(dialog[open]) { overflow: hidden; }
.product-dialog { width: min(720px, calc(100% - 26px)); }
#detail-body { display: grid; grid-template-columns: .9fr 1fr; }
.detail-photo { height: 100%; min-height: 290px; aspect-ratio: auto; }
.detail-photo img { height: 100%; object-fit: contain; }
.detail-copy { padding: 35px 22px 24px; }
.detail-copy h2 { font-size: 27px; line-height: 1.1; margin-block: 4px 12px; }
.detail-copy .button { margin-top: 12px; }
.detail-copy .model-credit { color: var(--muted); font-size: 12px; margin-top: 16px; }
.model-credit a { color: var(--purple-dark); text-decoration: underline; }
.detail-description { margin-block: 8px; white-space: pre-line; }
.icon-button { border: 1px solid var(--line); color: var(--ink); background: white; font-size: 23px; border-radius: 8px; width: 36px; height: 36px; line-height: 1; }
.icon-button:hover { background: #f5eff9; }
.close { position: absolute; z-index: 1; top: 8px; right: 8px; }
.cart-dialog { width: min(545px, calc(100% - 26px)); padding: 21px; }
.cart-header { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.cart-header h2 { font-size: 36px; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.cart-item p { color: var(--muted); font-size: 13px; }
.quantity { display: flex; gap: 5px; align-items: center; align-self: start; }
.quantity button { min-width: 30px; min-height: 30px; border: 1px solid var(--line); border-radius: 6px; background: white; padding: 3px; }
.quantity span { min-width: 21px; text-align: center; font-size: 13px; }
.cart-item .remove { grid-column: 1 / -1; width: fit-content; color: var(--muted); background: none; border: 0; padding: 0; font-size: 12px; text-decoration: underline; }
#cart-footer { margin-top: 15px; }
#cart-footer p:not(.cart-total) { font-size: 14px; color: var(--muted); }
.cart-total { font-weight: 800; margin-bottom: 5px; }
#order-text { width: 100%; margin-block: 9px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; resize: vertical; }
.order-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.admin-top { grid-template-columns: 1fr auto auto; }
.admin-top > a:not(.market-logo) { font-size: 14px; }
.admin-page { padding-block: 35px; }
.admin-page > p:not(.section-kicker) { margin-top: 8px; color: var(--muted); }
.admin-layout { display: grid; grid-template-columns: minmax(200px, .7fr) minmax(0, 1.3fr); gap: 16px; margin-top: 20px; align-items: start; }
.admin-panel { padding: 18px; background: white; border: 1px solid var(--line); border-radius: 13px; }
.admin-panel h2 { margin-bottom: 12px; font-size: 23px; }
.admin-list { list-style: none; padding: 0; }
.admin-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.admin-list button { padding: 3px 0; border: 0; background: white; font-weight: 750; text-align: left; }
.admin-list button:hover { color: var(--purple-dark); }
.admin-list small { color: var(--muted); display: block; }
.admin-form { display: grid; gap: 12px; }
.admin-form label { font-size: 13px; font-weight: 700; display: grid; gap: 4px; min-width: 0; }
.admin-form :is(input,select,textarea) { width: 100%; min-width: 0; font-weight: 400; }
.admin-form fieldset { border: 1px solid var(--line); border-radius: 8px; min-width: 0; display: grid; gap: 9px; }
.admin-form fieldset p { color: var(--muted); font-size: 13px; }
.admin-form legend { font-size: 13px; font-weight: 800; }
.form-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.admin-form > .button { width: fit-content; }

@media (max-width: 780px) {
  .wrap { width: calc(100% - 36px); }
  .top-bar { gap: 13px; }
  .products { grid-template-columns: repeat(auto-fill,minmax(min(150px,100%),1fr)); }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 24px); }
  .top-bar:not(.admin-top) { grid-template-columns: 1fr auto; min-height: auto; padding-top: 12px; }
  .search { grid-row: 2; grid-column: 1 / -1; }
  .market-logo { font-size: 24px; }
  .market-nav { padding-top: 6px; gap: 5px 12px; font-size: 12px; }
  .market-hero { min-height: auto; margin-block: 13px 22px; grid-template-columns: 1fr; }
  .hero-content { padding: 20px 17px 0; }
  .market-hero h1 { font-size: 34px; }
  .hero-art { justify-items: end; height: 139px; }
  .hero-art img { width: 165px; margin-top: -14px; }
  .market-hero p:not(.shop-kicker) { font-size: 14px; }
  .products { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .card-copy { padding: 8px; }
  .card-title { font-size: 14px; }
  .card-category { font-size: 11px; }
  .card .button { font-size: 13px; }
  .catalog-heading { gap: 4px; }
  .sort select { padding-inline: 4px; font-size: 12px; }
  #detail-body, .admin-layout { grid-template-columns: 1fr; }
  .detail-photo { height: 210px; min-height: 0; }
  .detail-copy { padding: 15px; }
  .admin-top { gap: 8px; }
  .admin-top > a:not(.market-logo) { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition: none !important; } }

/* Кнопка выхода владельца в шапке админки — выглядит как соседние ссылки. */
.admin-logout { display: contents; }
.admin-logout button { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-size: 14px; cursor: pointer; }
.admin-logout button:hover { text-decoration: underline; }
@media (max-width: 700px) { .admin-logout button { font-size: 12px; } }
