:root {
    --bg: #0e1116;
    --bg-card: #151b26;
    --border: rgba(255, 255, 255, 0.08);
    --text: #e7eaf0;
    --muted: #98a2b3;
    --accent: #4f8cff;
    --accent-2: #22d3ee;
    --radius: 16px;
    --bg-header: rgba(14, 17, 22, 0.88);
    --bg-input: #0f141d;
    --bg-toast: #1c2534;
    --media-bg: #10151f;
    --ph-a: #161c29;
    --ph-b: #1d2534;
    --tint-weak: rgba(255, 255, 255, 0.03);
    --tint: rgba(255, 255, 255, 0.05);
    --tint-strong: rgba(255, 255, 255, 0.08);
    --scroll: #2a3342;
}

html[data-theme="light"] {
    --bg: #f2f5f9;
    --bg-card: #ffffff;
    --border: rgba(15, 23, 42, 0.14);
    --text: #1c2430;
    --muted: #5b6675;
    --accent: #2f6fe4;
    --accent-2: #0891b2;
    --bg-header: rgba(242, 245, 249, 0.9);
    --bg-input: #ffffff;
    --bg-toast: #ffffff;
    --media-bg: #e8ecf3;
    --ph-a: #e8ecf3;
    --ph-b: #dbe2ec;
    --tint-weak: rgba(15, 23, 42, 0.04);
    --tint: rgba(15, 23, 42, 0.06);
    --tint-strong: rgba(15, 23, 42, 0.1);
    --scroll: #c3ccd9;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html {
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
}

main { flex: 1 0 auto; }

.site-footer { flex-shrink: 0; }

::selection { background: rgba(79, 140, 255, 0.35); }

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

.cat-3d { --cat: #a78bfa; }
.cat-devops { --cat: #34d399; }
.cat-dev { --cat: #fbbf24; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.dev-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 4px 12px;
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: repeating-linear-gradient(45deg, #ffd23e 0 14px, #141414 14px 28px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.6);
    cursor: help;
    white-space: nowrap;
    overflow: hidden;
    user-select: none;
}

.dev-badge span {
    background: #141414;
    color: #ffd23e;
    padding: 3px 14px;
    border-radius: 6px;
}

.header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "logo actions"
        "nav nav";
    align-items: center;
    gap: 4px 14px;
    min-height: 64px;
    padding-top: 8px;
    padding-bottom: 10px;
}

.logo {
    grid-area: logo;
    justify-self: start;
    font-weight: 700;
    font-size: 1.15em;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.logo span { color: var(--accent); }

.main-nav {
    grid-area: nav;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 15px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--tint-weak);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85em;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.nav-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cat, var(--accent));
}

.nav-pill:hover {
    color: var(--text);
    border-color: var(--cat, var(--accent));
    background: var(--tint-strong);
}

.header-actions {
    grid-area: actions;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 8px;
}

.lang-switch {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.lang-btn {
    padding: 6px 13px;
    font-size: 0.78em;
    background: transparent;
    color: var(--muted);
    border: none;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.06em;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.lang-btn:hover { color: var(--text); }

.lang-btn.active {
    background: rgba(79, 140, 255, 0.22);
    color: var(--accent);
    font-weight: 700;
}

.btn-chat {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #fff;
    text-decoration: none;
    font-size: 0.88em;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(79, 140, 255, 0.25);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-chat:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 140, 255, 0.35);
}

.hero {
    padding: 96px 20px 56px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(1.8em, 4.5vw, 2.9em);
    margin: 0 0 0.5em;
    line-height: 1.2;
}

.grad {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-sub {
    color: var(--muted);
    max-width: 680px;
    margin: 0 auto 26px;
    font-size: 1.05em;
}

.hero-sub.sub2 {
    margin: -14px auto 26px;
    font-size: 0.92em;
}

.category {
    padding: 58px 0;
    scroll-margin-top: 84px;
}

.category + .category {
    border-top: 1px solid var(--border);
}

.section-head {
    margin-bottom: 30px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.section-titles {
    max-width: 720px;
}

.scroll-btns {
    display: flex;
    gap: 8px;
    flex: none;
}

.scroll-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--tint);
    color: var(--muted);
    font-size: 1em;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.scroll-btn:hover {
    color: var(--text);
    border-color: var(--cat, var(--accent));
    background: var(--tint-strong);
}

.section-head h2 {
    font-size: 1.45em;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-head h2::before {
    content: "";
    width: 6px;
    height: 28px;
    border-radius: 3px;
    background: var(--cat, var(--accent));
    flex: none;
}

.section-desc {
    color: var(--muted);
    margin: 0;
}

.grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 48px) / 3);
    gap: 24px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    padding-bottom: 14px;
    scrollbar-width: thin;
    scrollbar-color: #2a3342 transparent;
}

.grid .card { scroll-snap-align: start; }

.grid::-webkit-scrollbar { height: 8px; }

.grid::-webkit-scrollbar-track { background: transparent; }

.grid::-webkit-scrollbar-thumb {
    background: var(--scroll);
    border-radius: 999px;
}

.card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--cat, var(--accent));
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

.card-empty {
    border-style: dashed;
    background: var(--tint-weak);
}

.card-empty .media-placeholder { opacity: 0.55; }

.media {
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #10151f;
}

.media img,
.media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-placeholder {
    height: 100%;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    font-size: 0.85em;
    color: var(--cat, #6b7688);
    background: linear-gradient(135deg, var(--ph-a), var(--ph-b));
}

.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.card-title {
    margin: 0;
    font-size: 1.05em;
    font-weight: 600;
}

.card-desc {
    margin: 0;
    color: var(--muted);
    font-size: 0.92em;
}

.card-foot {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    font-size: 0.74em;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--tint);
    color: var(--muted);
    white-space: nowrap;
}

.chip.accent {
    background: var(--tint);
    color: var(--cat, var(--accent));
}

.more {
    color: var(--cat, var(--accent));
    font-weight: 600;
    font-size: 0.9em;
}

.more .arrow {
    display: inline-block;
    transition: transform 0.2s ease;
}

.card:hover .more .arrow {
    transform: translateX(4px);
}

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 56px;
    padding: 34px 20px 26px;
    text-align: center;
    color: var(--muted);
    font-size: 0.88em;
}

.footer-cols {
    display: flex;
    gap: 56px;
    justify-content: center;
    flex-wrap: wrap;
    text-align: left;
    margin-bottom: 24px;
}

.footer-col { min-width: 210px; }

.footer-col h4 {
    margin: 0 0 10px;
    font-size: 0.85em;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
}

.footer-col a {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95em;
    padding: 3px 0;
    transition: color 0.2s ease;
}

.footer-col a:hover { color: var(--text); }

.footer-col svg {
    width: 15px;
    height: 15px;
    flex: none;
}

.copyright {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin: 0;
    font-size: 0.92em;
}

.page {
    padding: 48px 20px 64px;
}

.back {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.92em;
    margin-bottom: 26px;
    transition: color 0.2s ease;
}

.back:hover { color: var(--text); }

.detail {
    max-width: 860px;
    margin: 0 auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cat, var(--accent));
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 14px;
    background: var(--tint-weak);
}

.badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cat, var(--accent));
}

.detail h1 {
    font-size: clamp(1.5em, 3.5vw, 2.2em);
    margin: 16px 0 22px;
}

.detail-media {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--media-bg);
}

.detail-desc {
    color: var(--muted);
    font-size: 1.02em;
    max-width: 720px;
}

.detail .chips {
    margin: 18px 0 24px;
}

.btn-open {
    display: inline-block;
    padding: 11px 24px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(90deg, var(--cat, var(--accent)), var(--accent-2));
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease;
}

.btn-open:hover { transform: translateY(-1px); }

.link-btn { margin-top: 26px; }

.btn-secondary {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--tint);
    color: var(--text);
    font-size: 0.95em;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--cat, var(--accent));
    background: var(--tint-strong);
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.toast {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%) translateY(-14px);
    background: var(--bg-toast);
    border: 1px solid rgba(79, 140, 255, 0.5);
    color: var(--text);
    padding: 15px 28px;
    border-radius: 12px;
    font-size: 1em;
    max-width: min(90vw, 520px);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
    z-index: 100;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 12, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 90;
}

.modal-backdrop.open { display: flex; }

.modal {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    position: relative;
}

.modal-wide { max-width: min(640px, 92vw); }

.modal h3 {
    margin: 0 0 6px;
    font-size: 1.15em;
}

.modal-notice { padding: 14px 0 4px; color: var(--muted); font-size: 0.95em; }
.modal-notice .actions { margin-top: 16px; justify-content: flex-start; }

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-note {
    color: var(--muted);
    font-size: 0.85em;
    margin: 0 0 16px;
}

.stars {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.star {
    font-size: 1.35em;
    background: none;
    border: none;
    color: #3a4658;
    cursor: pointer;
    line-height: 1;
    padding: 2px;
    transition: color 0.15s ease;
}

.star.on { color: #fbbf24; }

.review-textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 12px;
    font-family: inherit;
    font-size: 0.95em;
}

.form-card {
    max-width: 760px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
}

.form-title {
    margin: 0 0 4px;
    font-size: 1.5em;
}

.form-sub {
    color: var(--muted);
    margin: 0 0 26px;
    font-size: 0.92em;
}

.field { margin-bottom: 20px; }

.label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 8px;
}

.opt-tag {
    font-size: 0.72em;
    font-weight: 500;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 9px;
}

.input,
.textarea,
.select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 11px 13px;
    font-family: inherit;
    font-size: 0.95em;
}

.textarea {
    min-height: 110px;
    resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
    outline: none;
    border-color: var(--accent);
}

.hint {
    color: var(--muted);
    font-size: 0.82em;
    margin-top: 6px;
}

.lang-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.lang-tab {
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 0.82em;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.06em;
}

.lang-tab.active {
    background: rgba(79, 140, 255, 0.18);
    color: var(--accent);
    font-weight: 700;
    border-color: transparent;
}

.cat-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cat-pill {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 0.88em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.cat-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cat);
}

.cat-pill.active {
    border-color: var(--cat);
    color: var(--text);
    background: var(--tint);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.hero-variant { margin-bottom: 24px; }

.variant-tag {
    display: block;
    width: fit-content;
    margin: 0 auto 10px;
    font-size: 0.72em;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 999px;
    padding: 3px 12px;
}

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 40px;
}

.search-input {
    flex: 1;
    min-width: 220px;
}

.f-select {
    width: auto;
    min-width: 160px;
}

.no-res {
    text-align: center;
    color: var(--muted);
    padding: 48px 0;
    font-size: 1.02em;
}

.api-error {
    text-align: center;
    padding: 48px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.api-error p {
    color: var(--muted);
    font-size: 1.02em;
}

.w-3d { color: #a78bfa; }
.w-devops { color: #34d399; }
.w-dev { color: #fbbf24; }
.dotsep { color: var(--muted); }

.grad-c {
    background: linear-gradient(90deg, #a78bfa, #fbbf24, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.btn-auth {
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--tint);
    color: var(--text);
    font-size: 0.85em;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.btn-auth:hover {
    border-color: var(--accent);
    background: var(--tint-strong);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    font-size: 0.7em;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    white-space: nowrap;
}

.footer-contacts a,
.footer-links a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-contacts a:hover,
.footer-links a:hover {
    color: var(--text);
}

.footer-links {
    font-size: 0.82em;
}

.btn-report {
    margin-left: auto;
}

.legal-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    max-width: 960px;
    margin: 0 auto;
}

.legal {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 760px;
}

.legal h1 {
    font-size: clamp(1.5em, 3.5vw, 2em);
    margin: 0 0 26px;
}

.legal section {
    padding: 22px 0;
    border-top: 1px solid var(--border);
    scroll-margin-top: 84px;
}

.legal h2 {
    font-size: 1.15em;
    margin: 0 0 8px;
}

.legal p {
    color: var(--muted);
    margin: 0;
}

.legal-toc {
    flex: 0 0 220px;
    position: sticky;
    top: 96px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 0;
    background: var(--tint-soft);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.legal-toc h2 {
    margin: 0 0 10px;
    font-size: 1.05em;
}

.legal-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.legal-toc a {
    color: var(--accent, #4f8cff);
    text-decoration: none;
}

.legal-toc a:hover {
    text-decoration: underline;
}

@media (max-width: 860px) {
    .legal-layout {
        flex-direction: column;
        gap: 18px;
    }

    .legal-toc {
        position: static;
        flex: none;
        width: 100%;
        max-height: none;
        overflow-y: visible;
    }
}

.btn-theme {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.btn-theme:hover {
    color: var(--text);
    border-color: var(--accent);
}

.btn-theme .ic {
    width: 16px;
    height: 16px;
    display: none;
}

html[data-mode="system"] .ic-system { display: block; }
html[data-mode="light"] .ic-light { display: block; }
html[data-mode="dark"] .ic-dark { display: block; }

.variant-switch {
    display: flex;
    gap: 9px;
    justify-content: center;
    margin-bottom: 20px;
}

.v-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    padding: 0;
    border: 1px solid var(--muted);
    background: transparent;
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.v-dot:hover { opacity: 0.85; }

.v-dot.active {
    opacity: 1;
    background: var(--accent);
    border-color: var(--accent);
}

.btn-open:hover { transform: translateY(-1px); }

.notfound {
    text-align: center;
    padding: 60px 0 30px;
    max-width: 560px;
    margin: 0 auto;
}

.notfound .code {
    font-size: clamp(4em, 12vw, 7em);
    font-weight: 800;
    line-height: 1;
}

.notfound h1 {
    margin: 14px 0 10px;
    font-size: 1.4em;
}

.notfound p {
    color: var(--muted);
    margin: 0 0 28px;
}

@media (max-width: 1020px) {
    .grid {
        grid-auto-columns: calc((100% - 24px) / 2);
    }
}

@media (max-width: 760px) {
    .header-inner { justify-content: center; }
    .main-nav { justify-content: center; padding-bottom: 2px; }
    .hero { padding-top: 64px; }
    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .grid {
        grid-auto-columns: 86%;
    }
}

/* --- Авторизация: кнопка в шапке и модалка входа --- */
.btn-auth {
    border: 1px solid var(--line, rgba(128,128,128,.4));
    background: transparent;
    color: var(--text);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}
.btn-auth:hover { color: var(--accent, #4cc2ff); border-color: var(--accent, #4cc2ff); }

.auth-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1000;
}
.auth-card {
    position: fixed; z-index: 1001;
    top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: min(20rem, calc(100vw - 2rem));
    display: flex; flex-direction: column; gap: 12px;
    background: var(--bg-card, #14181f);
    color: var(--text);
    border: 1px solid var(--line, rgba(128,128,128,.35));
    border-radius: 16px;
    padding: 22px;
}
.auth-card h3 { margin: 0 0 4px; font-size: 18px; }
.auth-card input {
    font: inherit; font-size: 14px;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--line, rgba(128,128,128,.35));
    background: transparent; color: inherit;
}
.auth-row { display: flex; gap: 10px; }
.auth-submit, .auth-cancel {
    flex: 1; font: inherit; font-size: 14px;
    padding: 9px 0; border-radius: 10px; cursor: pointer;
    border: 1px solid transparent;
}
.auth-submit { background: var(--accent, #4cc2ff); color: #08131a; font-weight: 600; }
.auth-cancel { background: transparent; color: var(--text); border-color: var(--line, rgba(128,128,128,.35)); }
.auth-error { color: #ff7a7a; font-size: 13px; }
.auth-agree { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: var(--text); }
.auth-agree input[type="checkbox"] { width: auto; height: auto; padding: 0; border: none; accent-color: var(--accent, #4cc2ff); }
.auth-agree a { color: var(--accent, #4cc2ff); text-decoration: underline; }
.auth-switch { align-self: flex-start; padding: 0; border: none; background: none; font: inherit; font-size: 13px; color: var(--accent, #4cc2ff); text-decoration: underline; cursor: pointer; }

/* Галерея проекта: карусель и лайтбокс */
.detail-gallery { margin-top: 18px; }
.gal-track { position: relative; min-height: 220px; }
.gal-slide { display: none; }
.gal-slide.active { display: block; }
.gal-slide img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 10px; cursor: zoom-in; background: rgba(128,128,128,.08); }
.gal-slide video { width: 100%; max-height: 420px; border-radius: 10px; background: #000; }
.gal-nav { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 10px; }
.gal-nav button { background: transparent; border: 1px solid var(--line, rgba(128,128,128,.35)); color: var(--text); border-radius: 8px; padding: 4px 12px; cursor: pointer; }
.gal-dot { width: 10px; height: 10px; padding: 0 !important; border-radius: 50% !important; opacity: .45; }
.gal-dot.active { opacity: 1; background: var(--accent, #4cc2ff); border-color: var(--accent, #4cc2ff) !important; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 60; cursor: zoom-out; }
.lightbox img:not([hidden]) { max-width: 92vw; max-height: 92vh; border-radius: 8px; }

/* Менеджер галереи в форме */
.gallery-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.gal-item { position: relative; }
.gal-thumb { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line, rgba(128,128,128,.35)); display: flex; align-items: center; justify-content: center; font-size: 22px; background: rgba(128,128,128,.08); }
span.gal-thumb { text-align: center; line-height: 62px; }
.gal-del { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: #ff5a5a; color: #fff; cursor: pointer; font-size: 11px; line-height: 1; }
.input-file { padding: 8px; }

/* Глобальный приоритет hidden (перебивает display:flex у оверлеев) */
[hidden] { display: none !important; }

/* Адаптив и мелкие исправления ревизии */
@media (max-width:520px) {
    .form-row { grid-template-columns: 1fr; }
}
.header-actions { flex-wrap: wrap; }
.card .media { background: var(--media-bg, #10151f); }
.auth-error { color: #e05252; }
.mini-btn.danger { color: #e05252; border-color: rgba(224,82,82,.5); }
@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
