:root {
    --bg: #060911;
    --bg-soft: #0a0f1a;
    --surface: rgba(17, 23, 35, 0.72);
    --surface-solid: #111723;
    --surface-2: rgba(255, 255, 255, 0.045);
    --border: rgba(255, 255, 255, 0.075);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #e9eff8;
    --muted: #8a98ad;
    --accent: #4f9cf9;
    --accent-2: #8b7bff;
    --mint: #4be3b0;
    --danger: #ff6b81;
    --radius: 14px;
    --ease: cubic-bezier(0.2, 0.8, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

@supports not selector(::-webkit-scrollbar) {
    * {
        scrollbar-width: thin;
        scrollbar-color: rgba(126, 168, 255, 0.45) transparent;
    }
}

*::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(126, 168, 255, 0.5), rgba(150, 130, 255, 0.5));
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    border-width: 2px;
    background: linear-gradient(180deg, rgba(126, 168, 255, 0.85), rgba(150, 130, 255, 0.85));
    background-clip: padding-box;
}

::selection {
    background: rgba(79, 156, 249, 0.35);
    color: #fff;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

a {
    color: var(--accent);
}

/* ================= живой фон ================= */

.aurora {
    position: fixed;
    inset: -10%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    transform: translate3d(var(--px, 0px), var(--py, 0px), 0);
}

.blob {
    position: absolute;
    display: block;
    border-radius: 50%;
    filter: blur(72px);
    opacity: 0.55;
    will-change: transform;
}

.blob.one {
    width: 46vw;
    height: 46vw;
    left: -6vw;
    top: -10vw;
    background: radial-gradient(circle at 35% 35%, #2b7bff, #123a8a 65%, transparent 72%);
    animation: driftOne 24s ease-in-out infinite alternate;
}

.blob.two {
    width: 40vw;
    height: 40vw;
    right: -8vw;
    top: 2vw;
    background: radial-gradient(circle at 60% 40%, #8b7bff, #4b2c95 65%, transparent 72%);
    animation: driftTwo 29s ease-in-out infinite alternate;
}

.blob.three {
    width: 38vw;
    height: 38vw;
    left: 18vw;
    bottom: -14vw;
    background: radial-gradient(circle at 50% 50%, #21d4c0, #0d6b62 62%, transparent 72%);
    opacity: 0.42;
    animation: driftThree 33s ease-in-out infinite alternate;
}

.blob.four {
    width: 26vw;
    height: 26vw;
    right: 12vw;
    bottom: -8vw;
    background: radial-gradient(circle at 50% 50%, #b14dff, #5d1f96 62%, transparent 72%);
    opacity: 0.36;
    animation: driftFour 21s ease-in-out infinite alternate;
}

.veil {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(1200px 700px at 50% 0%, rgba(6, 9, 17, 0) 0%, rgba(6, 9, 17, 0.55) 60%, rgba(6, 9, 17, 0.9) 100%),
        linear-gradient(180deg, rgba(6, 9, 17, 0.35), rgba(6, 9, 17, 0.75));
}

@keyframes driftOne {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(7vw, 5vh, 0) scale(1.12); }
}

@keyframes driftTwo {
    from { transform: translate3d(0, 0, 0) scale(1.05); }
    to { transform: translate3d(-6vw, 7vh, 0) scale(0.95); }
}

@keyframes driftThree {
    from { transform: translate3d(0, 0, 0) scale(0.96); }
    to { transform: translate3d(9vw, -6vh, 0) scale(1.1); }
}

@keyframes driftFour {
    from { transform: translate3d(0, 0, 0) scale(1.1); }
    to { transform: translate3d(-8vw, -5vh, 0) scale(0.92); }
}

.bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.cursor-glow {
    position: fixed;
    left: 0;
    top: 0;
    width: 520px;
    height: 520px;
    margin: -260px 0 0 -260px;
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle, rgba(79, 156, 249, 0.12), rgba(79, 156, 249, 0) 68%);
    transition: opacity 0.4s var(--ease);
}

.wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ================= шапка ================= */

.top {
    position: relative;
    z-index: 2;
    background: linear-gradient(180deg, rgba(15, 21, 33, 0.82), rgba(10, 15, 24, 0.88));
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}

.top-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    padding-bottom: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    font-size: 15px;
    text-decoration: none;
}

.mark {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 24px rgba(79, 156, 249, 0.45);
    color: #050b16;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 23px;
    line-height: 1;
    animation: logoFloat 6s ease-in-out infinite;
}

.mark::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 18px;
    border: 1px solid rgba(79, 156, 249, 0.5);
    animation: haloPulse 3s ease-out infinite;
    pointer-events: none;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes haloPulse {
    0% { opacity: 0.7; transform: scale(0.9); }
    70% { opacity: 0; transform: scale(1.35); }
    100% { opacity: 0; transform: scale(1.35); }
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    font-size: 14.5px;
}

.top-nav a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

.top-nav a:hover {
    color: var(--text);
}

.top-nav .nav-enter {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.top-nav .nav-enter:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-strong);
}

.who {
    color: var(--muted);
    font-size: 13.5px;
}

.logout-form {
    display: inline;
}

.link-btn {
    padding: 0;
    border: none;
    background: none;
    color: var(--danger);
    font-size: 13.5px;
    transition: color 0.2s var(--ease);
}

.link-btn:hover {
    color: #ff8f9f;
    text-decoration: underline;
}

/* ================= контент ================= */

main {
    flex: 1 0 auto;
    padding-top: 46px;
    padding-bottom: 60px;
}

.hero {
    max-width: 640px;
    margin-bottom: 34px;
    animation: fadeUp 0.5s var(--ease) both;
}

h1 {
    margin-bottom: 12px;
    font-size: 40px;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #ffffff, #b9cdff 60%, #cfc4ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lead {
    max-width: 580px;
    color: var(--muted);
    font-size: 17px;
}

.crumbs {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 14px;
}

.crumbs a {
    color: var(--muted);
    text-decoration: none;
}

.crumbs a:hover {
    color: var(--accent);
}

.page-head {
    margin-bottom: 26px;
    animation: fadeUp 0.45s var(--ease) both;
}

.head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
}

/* Карточки проектов */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(22, 29, 44, 0.86), rgba(13, 18, 29, 0.92));
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
    animation: cardIn 0.55s var(--ease) both;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(400px 160px at 20% 0%, rgba(79, 156, 249, 0.16), transparent 70%);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
    pointer-events: none;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(79, 156, 249, 0.12);
}

.card:hover::before {
    opacity: 1;
}

.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.card-title {
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.card-text {
    color: var(--muted);
    font-size: 14.5px;
}

.card-link {
    margin-top: 10px;
    color: #b9cdff;
    font-size: 14px;
    font-weight: 600;
}

.card-link::after {
    content: " →";
    display: inline-block;
    transition: transform 0.3s var(--ease);
}

.card:hover .card-link::after {
    transform: translateX(5px);
}

/* Разделы и темы */

.section-list,
.thread-list {
    display: grid;
    gap: 12px;
}

.section-row,
.thread-row {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
    color: inherit;
    text-decoration: none;
    transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
    animation: fadeUp 0.45s var(--ease) both;
}

.section-row:nth-child(2),
.thread-row:nth-child(2) { animation-delay: 0.05s; }
.section-row:nth-child(3),
.thread-row:nth-child(3) { animation-delay: 0.1s; }

.section-row:hover,
.thread-row:hover {
    transform: translateY(-2px);
    border-color: rgba(79, 156, 249, 0.45);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4), 0 0 30px rgba(79, 156, 249, 0.12);
}

.section-main,
.thread-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.section-title,
.thread-title {
    font-size: 18px;
    font-weight: 620;
    overflow-wrap: anywhere;
}

.section-about,
.thread-sub,
.muted {
    color: var(--muted);
    font-size: 13.5px;
}

.section-meta,
.thread-meta {
    color: var(--muted);
    font-size: 13.5px;
    text-align: right;
    white-space: nowrap;
}

.empty {
    padding: 20px 0;
    color: var(--muted);
}

/* Сообщения */

.thread {
    display: grid;
    gap: 14px;
    margin-bottom: 28px;
}

.post {
    position: relative;
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
    animation: fadeUp 0.45s var(--ease) both;
}

.post-first {
    border-color: rgba(79, 156, 249, 0.35);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35), 0 0 30px rgba(79, 156, 249, 0.1);
}

.post-head {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-items: baseline;
    margin-bottom: 8px;
}

.post-author {
    font-weight: 650;
    color: #cfe0ff;
}

.post-date {
    color: var(--muted);
    font-size: 13px;
}

.post-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.post-del {
    margin-top: 10px;
}

/* Формы */

.stack-form,
.reply {
    display: grid;
    gap: 8px;
    max-width: 660px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(22, 29, 44, 0.86), rgba(13, 18, 29, 0.92));
    backdrop-filter: blur(18px);
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.38), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
    animation: fadeUp 0.45s var(--ease) both;
}

.reply {
    padding: 20px 22px;
}

.stack-form label,
.reply label {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    font-size: 14.5px;
    outline: none;
    transition: border-color 0.2s var(--ease), box-shadow 0.25s var(--ease), background 0.2s var(--ease);
}

input[type="text"]:hover,
input[type="password"]:hover,
textarea:hover {
    background: rgba(255, 255, 255, 0.05);
}

input:focus,
textarea:focus {
    border-color: rgba(79, 156, 249, 0.75);
    background: rgba(79, 156, 249, 0.06);
    box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.16), 0 0 22px rgba(79, 156, 249, 0.18);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 11px 18px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: transparent;
    color: var(--text);
    font-size: 14.5px;
    text-decoration: none;
    overflow: hidden;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease),
                transform 0.12s var(--ease), box-shadow 0.25s var(--ease);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-strong);
}

.btn.primary {
    margin-top: 8px;
    justify-self: start;
    border: 0;
    padding: 12px 20px;
    background: linear-gradient(135deg, #5aa6ff, var(--accent) 45%, var(--accent-2));
    color: #050b16;
    font-weight: 650;
    box-shadow: 0 10px 26px rgba(79, 156, 249, 0.25);
}

.btn.primary::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: skewX(-18deg);
    transition: left 0.55s var(--ease);
}

.btn.primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 14px 34px rgba(79, 156, 249, 0.34);
}

.btn.primary:hover::after {
    left: 130%;
}

.btn.primary:active {
    transform: translateY(1px) scale(0.995);
}

.error {
    padding: 10px 14px;
    border-left: 3px solid var(--danger);
    border-radius: 10px;
    background: rgba(255, 107, 129, 0.1);
    color: #ffb3bf;
    font-size: 13.5px;
}

.hint {
    color: var(--muted);
    font-size: 12.5px;
}

.trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.login-note {
    color: var(--muted);
}

.narrow {
    max-width: 440px;
    margin: 30px auto 0;
    animation: cardIn 0.6s var(--ease) both;
}

.narrow h1 {
    font-size: 30px;
}

.switch {
    margin-top: 16px;
    color: var(--muted);
    font-size: 13.5px;
}

.switch a {
    color: #b9cdff;
}

/* Подвал */

.foot {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    justify-content: space-between;
    padding-top: 22px;
    padding-bottom: 28px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13.5px;
}

.foot a {
    color: #b9cdff;
    text-decoration: none;
}

.foot a:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .wrap { padding: 0 16px; }

    main {
        padding-top: 30px;
        padding-bottom: 40px;
    }

    h1 { font-size: 29px; }

    .lead { font-size: 15.5px; }

    .card { padding: 20px; }

    .post { padding: 16px; }

    .stack-form,
    .reply { padding: 16px; }

    .section-meta,
    .thread-meta {
        text-align: left;
        white-space: normal;
    }

    .btn.primary {
        justify-self: stretch;
    }

    .cursor-glow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.001ms !important;
    }

    .aurora,
    .bg-canvas,
    .cursor-glow {
        display: none;
    }
}

/* --------------------------- прозрачность --------------------------- */

/* Шапка, карточки и формы пропускают фон, оставаясь читаемыми. */
.top {
    background: linear-gradient(180deg, rgba(13, 18, 29, 0.55), rgba(8, 12, 20, 0.62)) !important;
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.card {
    background: linear-gradient(180deg, rgba(22, 29, 44, 0.52), rgba(13, 18, 29, 0.62)) !important;
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
}

.section-row,
.thread-row {
    background: rgba(17, 23, 35, 0.42) !important;
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.post {
    background: rgba(17, 23, 35, 0.42) !important;
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.stack-form,
.reply {
    background: linear-gradient(180deg, rgba(22, 29, 44, 0.5), rgba(13, 18, 29, 0.6)) !important;
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.narrow .stack-form input,
.stack-form input,
.stack-form textarea,
.reply textarea {
    background: rgba(255, 255, 255, 0.06);
}
/* Убираем светлый уголок изменения размера: на телефоне он выглядит как белый квадрат */
textarea::-webkit-resizer {
  background: transparent;
  border: 0;
  box-shadow: none;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

@media (max-width: 860px) {
  textarea {
    resize: none;
  }
}
/* ---------------------- строка AI-кабинета в списке разделов ---------------------- */

.section-row-ai {
  border-color: rgba(79, 156, 249, 0.45);
  background:
    linear-gradient(135deg, rgba(79, 156, 249, 0.16), rgba(139, 123, 255, 0.12)),
    var(--surface);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28), 0 0 26px rgba(79, 156, 249, 0.12);
}

.section-row-ai .section-title::after {
  content: "AI";
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.08em;
  vertical-align: 2px;
  color: #cddfff;
  background: rgba(79, 156, 249, 0.28);
  border: 1px solid rgba(79, 156, 249, 0.45);
}

.section-row-ai:hover {
  border-color: rgba(139, 123, 255, 0.65);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42), 0 0 34px rgba(139, 123, 255, 0.18);
}
