:root, html[data-theme="light"] {
  --bg: #f2f3f7;
  --surface: #ffffff;
  --text: #121217;
  --muted: #6e6e7a;
  --line: rgba(18, 18, 23, 0.08);
  --accent: #0077ff;
  --accent-soft: rgba(0, 119, 255, 0.12);
  --header: rgba(255, 255, 255, 0.96);
  --shadow: 0 1px 3px rgba(0,0,0,.04);
  --radius: 16px;
  --icon-bg: #e9ecf3;
  --free: #0a7a3e;
  --free-bg: rgba(10, 122, 62, 0.1);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --danger: #d12b2b;
}

html[data-theme="dark"] {
  --bg: #0c0c10;
  --surface: #16161d;
  --text: #f3f3f6;
  --muted: #9a9aa8;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #4d9fff;
  --accent-soft: rgba(77, 159, 255, 0.16);
  --header: rgba(12, 12, 16, 0.96);
  --shadow: 0 1px 3px rgba(0,0,0,.35);
  --icon-bg: #22222c;
  --free: #3dd68c;
  --free-bg: rgba(61, 214, 140, 0.12);
  --danger: #ff6b6b;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

.container {
  width: min(1040px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  flex-wrap: nowrap;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}
.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.logo-text { font-size: 1.05rem; }

.search {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  max-width: 560px;
}
.search-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search input::placeholder { color: var(--muted); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}
.hdr-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  white-space: nowrap;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.hdr-link:hover { color: var(--text); background: var(--bg); }
.btn-reset { appearance: none; }
.inline { display: contents; }

.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.theme-btn:hover { border-color: var(--accent); }
html[data-theme="light"] .theme-moon { display: none; }
html[data-theme="dark"] .theme-sun { display: none; }

/* ——— Page ——— */
.page {
  flex: 1 0 auto;
  padding: 16px 0 40px;
}
.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  transition: background .15s, color .15s, border-color .15s;
}
.cat:hover { color: var(--text); }
.cat.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.section-head { margin-bottom: 12px; }
.section-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.section-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* App list */
.app-list { display: flex; flex-direction: column; gap: 8px; }
.app-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 20px;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.app-row:hover {
  border-color: rgba(0, 119, 255, 0.35);
  transform: translateY(-1px);
}
.app-row.static { cursor: default; }
.app-row.static:hover { transform: none; border-color: var(--line); }
.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--icon-bg);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--accent);
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-icon-lg {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  font-size: 2rem;
}
.app-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.app-dev { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }
.app-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}
.app-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 6px;
  align-items: center;
}
.rating { color: #c99200; font-weight: 700; font-size: 0.82rem; }
html[data-theme="dark"] .rating { color: #ffc233; }
.tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 6px;
}
.tag-free { color: var(--free); background: var(--free-bg); }
.app-chevron { color: var(--muted); font-size: 1.4rem; font-weight: 300; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.empty-state h2 { margin: 0 0 8px; font-size: 1.15rem; }
.empty-state p { margin: 0; color: var(--muted); }

/* Detail */
.app-page { padding-top: 8px; }
.app-hero {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 8px 0 20px;
}
.app-hero-text h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.ver-line { margin: 10px 0 0; color: var(--muted); font-size: 0.9rem; }
.app-lead { font-size: 1.05rem; color: var(--muted); margin: 0 0 20px; }
.block { margin: 0 0 24px; }
.block h2 { margin: 0 0 10px; font-size: 1.1rem; font-weight: 800; }
.prose { color: var(--text); font-size: 0.98rem; }
.prose p { margin: 0 0 0.85em; }
.hash {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
}
.ver-list { list-style: none; padding: 0; margin: 0; }
.ver-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.ver-list span { color: var(--muted); }
.pkg { color: var(--muted); font-size: 0.8rem; margin-top: 32px; }
.pkg a { color: var(--accent); font-weight: 600; }
.dl-wrap { margin: 14px 0 0; }

/* Forms */
.narrow {
  width: min(420px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}
.narrow .section-title { text-align: center; margin-bottom: 4px; }
.form-card {
  margin-top: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}
.field input,
.field select,
.field textarea,
.form-card input,
.form-card select,
.form-card textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-weight: 500;
}
.field textarea,
.form-card textarea { min-height: 100px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field em,
.form-error {
  color: var(--danger);
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 600;
}
.field input[type="file"] {
  padding: 10px;
  background: var(--surface);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { filter: brightness(0.96); }
.form-alt {
  text-align: center;
  color: var(--muted);
  margin-top: 16px;
  font-size: 0.92rem;
}
.form-alt a { color: var(--accent); font-weight: 700; }
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.review-list { list-style: none; padding: 0; margin: 16px 0 0; }
.review-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.review-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.review-form { margin-bottom: 8px; }

.shots {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.shot {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: 140px;
  height: 250px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.shot img { width: 100%; height: 100%; object-fit: cover; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  margin-top: auto;
  background: var(--surface);
  flex-shrink: 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}
.footer-brand { display: flex; flex-direction: column; gap: 2px; }
.footer-brand span { color: var(--muted); font-size: 0.85rem; }
.footer-nav {
  display: flex;
  gap: 16px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}
.footer-nav a:hover { color: var(--accent); }
.footer-copy { margin: 0; color: var(--muted); font-size: 0.82rem; }
.flash {
  list-style: none;
  padding: 10px 0 0;
  margin: 0;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .logo-text { display: none; }
  .app-desc { display: none; }
  .hdr-link { padding: 0 8px; font-size: 0.82rem; }
  .search { max-width: none; }
  .app-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .app-meta { justify-content: center; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
}
@media (min-width: 700px) {
  .shot { width: 160px; height: 284px; }
}

.footer-grid {
  display: grid;
  gap: 16px 24px;
  grid-template-columns: 1.4fr 1fr 1.2fr;
  align-items: start;
}
.footer-author {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer-label {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}
.footer-contacts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}
.footer-contacts a {
  color: var(--accent);
  font-weight: 600;
}
.footer-contacts a:hover { text-decoration: underline; }
.footer-copy {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}
.about { max-width: 640px; }
.about-lead {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 8px 0 20px;
  line-height: 1.5;
}
.about-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.about-card h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 800;
}
.about-card p { margin: 0 0 8px; color: var(--text); }
.about-card p:last-child { margin-bottom: 0; }
.contact-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
}
.contact-list span { color: var(--muted); font-size: 0.85rem; font-weight: 600; min-width: 5rem; }
.contact-list a { color: var(--accent); font-weight: 700; }
.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px !important;
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; }
}


.footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.footer-bar .footer-copy {
  margin: 0;
  border: 0;
  padding: 0;
  grid-column: auto;
}
.about-note {
  margin-top: 12px !important;
  color: var(--muted) !important;
  font-size: 0.92rem;
}
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.fav-form { margin: 12px 0 0; display: inline-block; }
