:root, [data-theme="dark"] {
  --bg: #121016;
  --bg-elev: #1a1620;
  --card: #1e1a25;
  --line: #322b3a;
  --text: #f5eef4;
  --muted: #9a8f9d;
  --accent: #ff7aaa;
  --accent-2: #c4a0ff;
  --like: #ff5b8a;
  --danger: #ff8a8a;
  --shadow: 0 8px 24px rgba(0,0,0,.28);
  --chip: #2a2432;
  --header: rgba(18,16,22,.86);
}
[data-theme="light"] {
  --bg: #f7f2f5;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --line: #eadfe6;
  --text: #1c1419;
  --muted: #6c616c;
  --accent: #d63d76;
  --accent-2: #6d3cc9;
  --like: #d63d76;
  --danger: #c03333;
  --shadow: 0 8px 24px rgba(40,20,30,.08);
  --chip: #f3e8ee;
  --header: rgba(247,242,245,.9);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Nunito, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100%;
}
img { max-width: 100%; display: block; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip {
  position: absolute; left: 1rem; top: -3.5rem; z-index: 40;
  background: var(--accent); color: #1a1014; padding: .4rem .7rem; border-radius: 8px;
}
.skip:focus { top: .6rem; }

.top {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(12px);
  background: var(--header);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  display: flex; align-items: center; gap: .85rem;
  max-width: 1180px; margin: 0 auto; padding: .7rem 1.1rem;
}
.brand {
  display: flex; align-items: center; gap: .5rem;
  color: var(--text); font-weight: 800; font-size: 1.15rem;
  letter-spacing: -.02em; text-decoration: none; flex: 0 0 auto;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand svg, .brand img { width: 28px; height: 28px; color: var(--accent); }

.search {
  flex: 1 1 auto; min-width: 0; position: relative;
}
.search input {
  width: 100%; border: 1px solid var(--line); background: var(--bg-elev);
  border-radius: 999px; padding: .5rem .95rem .5rem 2.7rem;
}
.search .ico {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.nav-links { display: flex; gap: .2rem; flex: 0 0 auto; }
.nav-links a, .icon-btn, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border-radius: 999px; border: 0; cursor: pointer; text-decoration: none;
}
.nav-links a {
  color: var(--muted); padding: .35rem .75rem; font-weight: 700; font-size: .92rem;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--chip); text-decoration: none; }
.actions { display: flex; gap: .4rem; align-items: center; margin-left: auto; }
.icon-btn {
  width: 38px; height: 38px; background: transparent; color: var(--text);
  border: 1px solid var(--line);
}
.icon-btn:hover { background: var(--chip); }
.btn {
  padding: .42rem .95rem; font-weight: 700; font-size: .92rem;
  background: var(--chip); color: var(--text); border: 1px solid var(--line);
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-primary { background: var(--accent); color: #2a1018; border-color: transparent; }
[data-theme="light"] .btn-primary { color: #fff; }
.btn-ghost { background: transparent; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.1rem 1.1rem 3rem; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: .7rem; align-items: center;
  margin: 0 0 1rem; justify-content: space-between;
}
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  border: 1px solid var(--line); background: var(--chip); color: var(--text);
  border-radius: 999px; padding: .25rem .7rem; font-size: .86rem; font-weight: 700;
  cursor: pointer;
}
.chip:hover, .chip.is-on { background: var(--accent); color: #2a1018; border-color: transparent; }
[data-theme="light"] .chip.is-on, [data-theme="light"] .chip:hover { color: #fff; }
.sort { display: flex; gap: .35rem; align-items: center; color: var(--muted); font-size: .9rem; }
.sort button { background: transparent; border: 0; color: var(--muted); font-weight: 700; cursor: pointer; padding: .2rem .5rem; border-radius: 8px; }
.sort button.is-on, .sort button:hover { color: var(--text); background: var(--chip); }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .9rem;
}
@media (max-width: 880px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .top-inner { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; color: inherit; text-decoration: none;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.card:hover { text-decoration: none; border-color: var(--accent); }
.card .cover { background: var(--bg-elev); aspect-ratio: 3/4; overflow: hidden; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: .7rem .8rem .85rem; }
.card h3 { margin: 0 0 .35rem; font-size: 1rem; font-weight: 800; color: var(--text); }
.meta { display: flex; justify-content: space-between; gap: .5rem; color: var(--muted); font-size: .85rem; font-weight: 600; }
.meta .author { color: var(--muted); }
.stat { display: inline-flex; gap: .7rem; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }

.pager { display: flex; gap: .4rem; justify-content: center; margin: 1.5rem 0 0; }
.pager a, .pager span {
  min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--line); color: var(--text); font-weight: 700;
}
.pager a:hover { background: var(--chip); text-decoration: none; }
.pager .is-on { background: var(--accent); color: #2a1018; border-color: transparent; }

.art-layout {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .9fr); gap: 1.2rem;
}
@media (max-width: 860px) { .art-layout { grid-template-columns: 1fr; } }
.art-frame {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; display: flex; justify-content: center; align-items: center;
}
.art-frame img { width: 100%; height: auto; max-height: 85vh; object-fit: contain; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.1rem 1.2rem; }
.panel h1 { margin: 0 0 .35rem; font-size: 1.35rem; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: .7rem 0; }
.tag {
  background: var(--chip); color: var(--text); border-radius: 999px; padding: .15rem .6rem;
  font-size: .82rem; font-weight: 700; text-decoration: none; border: 1px solid var(--line);
}
.tag:hover { text-decoration: none; background: var(--accent); color: #2a1018; }
.author-row { display: flex; gap: .7rem; align-items: center; margin: .8rem 0; }
.author-row img, .avatar {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line);
}
.author-row .name { font-weight: 800; color: var(--text); }
.author-row .sub { color: var(--muted); font-size: .85rem; }
.stats-row { display: flex; gap: .5rem; flex-wrap: wrap; margin: .8rem 0 0; }
.desc { color: var(--text); margin: .4rem 0 0; }
.muted { color: var(--muted); }
.comments { margin-top: 1rem; }
.comment { padding: .7rem 0; border-top: 1px solid var(--line); }
.comment .who { font-weight: 800; margin-right: .4rem; }
.comment .when { color: var(--muted); font-size: .82rem; }
.comment p { margin: .25rem 0 0; }
.form-row { display: flex; flex-direction: column; gap: .45rem; margin-top: .7rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: .55rem .7rem;
}
textarea { min-height: 90px; resize: vertical; }

/* Более специфичное правило: общее input[type=search] иначе съедает padding и иконка наезжает на подсказку */
.search input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 999px;
  padding: .5rem 1rem .5rem 2.7rem;
}
.note, .banner {
  background: var(--chip); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin: .8rem 0;
}
.banner strong { color: var(--accent); }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .7rem; }
.more-grid a { border-radius: 10px; overflow: hidden; display: block; }
.more-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.profile-head {
  display: flex; gap: 1.1rem; align-items: center; margin-bottom: 1.2rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem;
}
.profile-head img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.kpis { display: flex; gap: 1.2rem; margin-top: .4rem; color: var(--muted); font-weight: 700; }
.kpis b { color: var(--text); display: block; font-size: 1.15rem; }

.auth, .narrow { max-width: 440px; margin: 2rem auto; }
.page-title { margin: 0 0 .4rem; font-size: 1.8rem; }
.site-footer {
  border-top: 1px solid var(--line); padding: 1.1rem; color: var(--muted); font-size: .9rem;
}
.site-footer .inner { max-width: 1180px; margin: 0 auto; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.drop {
  border: 1.5px dashed var(--line); border-radius: 16px; padding: 2rem 1rem; text-align: center;
  background: var(--bg-elev); color: var(--muted);
}
.drop input { display: block; margin: .8rem auto 0; }
#up-preview { max-width: 100%; max-height: 320px; margin: .8rem auto 0; border-radius: 12px; display: none; }
.liked { color: var(--like); }
.hide { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

button:disabled, input:disabled, textarea:disabled {
  opacity: .5; cursor: not-allowed; filter: none;
}
