:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: #11141b;
  --text: #f6f7fb;
  --muted: #858d9d;
  --line: rgba(255, 255, 255, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.catalog-editor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.catalog-editor-toolbar h2 { margin: 0; font-size: 1rem; }
#catalog-draft-status { font-size: .7rem; color: var(--muted); }
#catalog-editor-rows { display: grid; gap: 8px; }
.catalog-editor-row { display: grid; grid-template-columns: 28px minmax(150px, 1fr) minmax(200px, 2fr); gap: 14px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.catalog-editor-number { color: #737d8f; font-size: .7rem; padding-top: 25px; }
.catalog-editor-row label { min-width: 0; color: var(--muted); font-size: .7rem; }
.catalog-editor-row input, .catalog-editor-row textarea { display: block; width: 100%; margin-top: 5px; padding: 9px; background: #191e28; border: 1px solid #414959; border-radius: 7px; color: #f0f2f6; font: inherit; font-size: .85rem; line-height: 1.5; }
.catalog-editor-row textarea { resize: vertical; min-height: 60px; }
.catalog-editor-row input:focus, .catalog-editor-row textarea:focus { outline: 2px solid rgb(var(--accent)); outline-offset: 1px; }
@media (max-width: 600px) { .catalog-editor-row { grid-template-columns: 22px minmax(0, 1fr); gap: 8px; } .catalog-editor-row label:last-child { grid-column: 2; } }
html { overflow-x: clip; scrollbar-gutter: stable; }
body { overflow-x: clip; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(circle at 12% -8%, rgba(94, 109, 255, 0.09), transparent 26rem), var(--bg);
  color: var(--text);
}

html[lang="ru"] body {
  font-family: "Segoe UI", Arial, sans-serif;
}

button { font: inherit; }

.shell {
  width: min(1680px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 38px;
  margin-bottom: 11px;
}

.brand { display: flex; align-items: baseline; gap: 9px; margin-right: auto; white-space: nowrap; }
.brand h1 { margin: 0; font-size: 0.95rem; font-weight: 720; letter-spacing: -0.02em; }
.brand p { margin: 0; color: var(--muted); font-size: 0.68rem; }

.filters { display: flex; flex-wrap: wrap; gap: 5px; }

.filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(19, 23, 31, 0.82);
  color: #a9b0bf;
  font-size: 0.68rem;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.filter:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.filter:focus-visible, .card:focus-visible, .modal-close:focus-visible { outline: 2px solid #91a7ff; outline-offset: 2px; }
.filter.is-active { color: white; border-color: rgba(255, 255, 255, 0.25); background: #242a36; }

.filter-dot, .card-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: rgb(var(--accent));
  box-shadow: 0 0 8px rgba(var(--accent), 0.7);
}

.green-dot { --accent: 61, 211, 141; }
.orange-dot { --accent: 255, 153, 70; }
.blue-dot { --accent: 70, 153, 255; }
.pink-dot { --accent: 255, 95, 166; }
.violet-dot { --accent: 160, 108, 255; }

.results { min-width: 52px; margin: 0; color: #6f7787; font-size: 0.65rem; text-align: right; white-space: nowrap; }

.language-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  flex: none;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(19, 23, 31, 0.82);
}

.language-option {
  min-width: 28px;
  height: 23px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #747d8d;
  font-size: 0.59rem;
  font-weight: 700;
  cursor: pointer;
}
.language-option:hover { color: #d9dce3; }
.language-option.is-active { background: #303746; color: white; }
.language-option:focus-visible { outline: 2px solid #91a7ff; outline-offset: 2px; }

.gallery {
  overflow: clip;
  overflow-clip-margin: 5px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  align-content: start;
  align-items: start;
  gap: 8px;
}
.gallery-section { grid-column: 1 / -1; margin: 0 0 24px; }
.gallery-section-title { margin: 0 0 8px; padding-left: 2px; color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .02em; }
.gallery-section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }

.card {
  --accent: 150, 160, 180;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: stretch;
  gap: 9px;
  height: 88px;
  min-width: 0;
  padding: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(17, 20, 27, 0.94);
  color: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.12);
  transition: border-color 260ms ease, background 260ms ease, box-shadow 260ms ease;
}
.gallery[data-filtering="true"] .card:hover { transform: none; }

.card:hover {
  z-index: 1;
  transform: translateY(-2px);
  border-color: rgba(var(--accent), 0.62);
  background: linear-gradient(145deg, rgba(var(--accent), 0.18), rgba(17, 20, 27, 0.97));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.26);
}

.green { --accent: 61, 211, 141; }
.orange { --accent: 255, 153, 70; }
.blue { --accent: 70, 153, 255; }
.pink { --accent: 255, 95, 166; }
.violet { --accent: 160, 108, 255; }

.art {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--gradient);
}

.art::before, .art::after { content: ""; position: absolute; border-radius: 50%; filter: blur(2px); }
.art::before {
  width: 58%;
  aspect-ratio: 1;
  top: var(--orb-y, -12%);
  left: var(--orb-x, 55%);
  background: rgba(255, 255, 255, 0.23);
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.12);
}
.art::after { width: 52%; aspect-ratio: 1; right: 58%; bottom: -28%; background: rgba(0, 0, 0, 0.17); }

.card-copy {
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  min-width: 0;
  max-height: 100%;
  padding: 1px 2px 0 0;
  overflow: hidden;
}
.card-meta { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: #687181; font-size: 0.55rem; font-weight: 400; line-height: 1.1; }
.card-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title { position: relative; display: block; margin: 3px 0; overflow: hidden; color: rgb(var(--accent)); font-size: 0.82rem; font-weight: 720; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.card .subtitle {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #7e8797;
  font-size: 0.6rem;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.detail-modal {
  width: min(550px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 18px;
  overflow: auto;
  border: 1px solid rgba(var(--accent, 150, 160, 180), 0.45);
  border-radius: 28px;
  background: #1b1d23;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72);
}
.detail-modal::backdrop { background: rgba(3, 5, 9, 0.78); backdrop-filter: blur(5px); }
.detail-modal[open] { animation: modal-in 260ms ease both; }
.modal-header { padding: 2px 4px 14px; }
.modal-header h2 { margin: 0; padding-right: 32px; font-size: 1.35rem; letter-spacing: -0.025em; }
.modal-subtitle { margin: 4px 0 0; color: #929cac; font-size: 0.76rem; }
.modal-stage { position: relative; overflow: hidden; border-radius: 19px; background: #12141a; box-shadow: 0 10px 24px rgba(0,0,0,.42); }
.modal-stage .swiper-slide { overflow: hidden; background: #12141a; }
.modal-art { width: 100%; aspect-ratio: var(--slide-ratio, 1.55 / 1); border-radius: 19px; transition: background 420ms ease; }
.modal-arrow {
  position: absolute;
  top: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  background: rgba(12,14,19,.72);
  color: #e8ebf1;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.modal-arrow::after { content: none; }
.modal-arrow, .modal-close { display: flex; align-items: center; justify-content: center; }
.modal-arrow svg, .modal-close svg { display: block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.modal-close svg { width: 18px; height: 18px; }
.modal-arrow.swiper-button-disabled { opacity: .72; pointer-events: auto; }
.modal-arrow:hover { background: rgba(36,40,50,.9); }
.modal-arrow:focus-visible, .modal-thumb:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: 2px; }
.modal-prev { left: 10px; }
.modal-next { right: 10px; }
.modal-thumbs { margin-top: 10px; padding: 2px 2px 4px; overflow-x: hidden; scrollbar-width: thin; }
.modal-thumb {
  width: 76px;
  flex: 0 0 76px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #778091;
  cursor: pointer;
  opacity: .58;
  transition: opacity 220ms ease, transform 220ms ease, color 220ms ease;
}
.modal-thumb:hover, .modal-thumb.swiper-slide-thumb-active { opacity: 1; color: #d9dee8; transform: translateY(-1px); }
.modal-thumb-art { display: block; position: relative; width: 100%; aspect-ratio: 1.25 / 1; overflow: hidden; border: 2px solid transparent; border-radius: 12px; background: var(--gradient); }
.modal-thumb.swiper-slide-thumb-active .modal-thumb-art { border-color: rgb(var(--accent)); box-shadow: 0 0 0 2px rgba(var(--accent),.18); }
.modal-thumb-label { display: block; margin-top: 4px; overflow: hidden; font-size: .56rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.modal-copy { padding: 14px 4px 2px; }
.modal-category { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; color: #9099a9; font-size: 0.61rem; text-transform: uppercase; letter-spacing: 0.1em; }
.modal-copy h3 { margin: 0; color: #edf0f5; font-size: 1.05rem; letter-spacing: -0.02em; }
.modal-detail { margin: 6px 0 0; color: #a5adbb; font-size: 0.76rem; line-height: 1.55; }
.modal-id { margin: 13px 0 0; color: #606979; font-size: 0.61rem; }
.modal-id code { color: #8992a2; }
.modal-close {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  background: rgba(7, 9, 14, 0.72);
  color: white;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.noscript { padding: 10px; border: 1px solid #733; border-radius: 10px; color: #fbb; font-size: .75rem; }

.topbar { flex-wrap: wrap; gap: 9px; }
.brand { gap: 8px; }
.card-search { width: 165px; min-height: 28px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; background: #11141b; color: var(--text); font: inherit; font-size: .68rem; }
.card-search:focus-visible { outline: 2px solid #91a7ff; }
.empty-state { color: var(--muted); font-size: .85rem; padding: 20px 0; }
.page-counter { margin: 8px 0 0; color: rgb(var(--accent)); font-size: .65rem; }
.reading-page { height: auto; border-radius: 16px; }
.reading-page .modal-art { height: 138px; aspect-ratio: auto; border-radius: 16px 16px 0 0; }
.page-copy { padding: 17px 18px 19px; }
.page-copy h3 { margin: 0 0 9px; font-size: 1.05rem; line-height: 1.3; }
.page-copy > p { margin: 0; color: #bdc4d0; font-size: .86rem; line-height: 1.65; overflow-wrap: anywhere; }
.page-preview p { margin: 0 0 10px; color: #bdc4d0; font-size: .86rem; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-line; }
.draft-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.draft-toolbar button, .edit-page { border: 1px solid #424957; border-radius: 7px; background: #242933; color: #dce0e7; padding: 5px 9px; cursor: pointer; font-size: .7rem; }
.draft-toolbar button:disabled { opacity: .4; cursor: default; }
#draft-status { font-size: .62rem; color: #929cac; }
.edit-page { margin-bottom: 12px; }
.page-editor { cursor: default; }
.page-editor label { display: block; margin-bottom: 10px; color: #a5adbb; font-size: .72rem; }
.page-editor input, .page-editor textarea { display: block; width: 100%; margin-top: 5px; padding: 9px; border: 1px solid #4a5364; border-radius: 7px; background: #191e28; color: #f0f2f6; font: inherit; font-size: .85rem; line-height: 1.55; cursor: text; }
.page-editor textarea { resize: none; min-height: 230px; }
#card-editor { margin-top: 12px; }
#card-editor textarea { min-height: 80px; }
.page-editor input:focus, .page-editor textarea:focus { outline: 2px solid rgb(var(--accent)); outline-offset: 1px; }
.edit-hint { color: #8993a3; font-size: .65rem; line-height: 1.5; }
.page-list { list-style-type: disc; margin: 10px 0 14px; padding-left: 21px; color: #bdc4d0; font-size: .86rem; line-height: 1.65; }
.page-list li { padding-left: 2px; margin: 4px 0; overflow-wrap: anywhere; }
.page-list li::marker { color: rgb(var(--accent)); }
.page-list a { color: #c9d2e2; text-decoration: underline; text-underline-offset: 3px; }
.page-list a:hover { color: rgb(var(--accent)); }
.page-list a:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: 3px; }
.list-link-kind { color: #818c9e; font-size: .68rem; }
.tool-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.tool-links a { display: inline-block; padding: 7px 10px; border: 1px solid rgba(var(--accent), .35); border-radius: 8px; background: rgba(var(--accent), .09); color: rgb(var(--accent)); text-decoration: none; font-size: .73rem; }
.tool-links a:hover { background: rgba(var(--accent), .2); }
.tool-links a:focus-visible, .modal-footer a:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: 3px; }
.page-copy .external-note { margin-top: 9px; font-size: .61rem; color: #778294; }
.modal-arrow { top: 69px; margin-top: 0; }
.modal-thumb-art { height: 45px; aspect-ratio: auto; }
.modal-thumb { width: 96px; flex-basis: 96px; }
.modal-thumb-label { white-space: normal; height: 2.5em; text-align: left; }
.modal-footer { margin: 13px 4px 0; font-size: .65rem; color: #798394; }
.modal-footer a { color: #626a77; text-decoration: none; }
.modal-footer p { margin: 6px 0 0; }
.language-switch { margin-left: auto; }
.card-meta { width: 100%; }
.card { position: relative; }
.card .subtitle { font-size: .68rem; line-height: 1.35; -webkit-line-clamp: 2; }
.topic-icon { position: absolute; z-index: 1; width: 34px; height: 34px; left: 50%; top: 50%; transform: translate(-50%, -50%); filter: invert(1); opacity: .9; }
.modal-art .topic-icon { width: 56px; height: 56px; }
.tool-links a, .modal-footer a { padding: 0; border: 0; border-radius: 0; background: none; text-decoration: underline; text-underline-offset: 3px; }
.tool-links a:hover, .modal-footer a:hover { background: none; color: #fff; }
.modal-stage, .modal-thumbs, .modal-thumb { cursor: grab; }
.modal-stage:active, .modal-thumbs:active, .modal-thumb:active { cursor: grabbing; }

@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .brand { width: 100%; }
  .filters { flex: 1; }
  .brand p { display: none; }
}
@media (max-width: 430px) {
  .shell { width: calc(100% - 14px); padding-top: 8px; }
  .gallery-section-grid { grid-template-columns: 1fr; gap: 6px; }
  .card { grid-template-columns: 72px minmax(0, 1fr); height: 82px; gap: 8px; }
  .filter { padding-inline: 7px; }
  .detail-modal { padding: 13px; border-radius: 22px; }
  .modal-header { padding-bottom: 11px; }
  .modal-art { aspect-ratio: 1.35 / 1; }
  .modal-thumb { width: 66px; flex-basis: 66px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
