:root {
    --bg-a: #0e1f2b;
    --bg-b: #162d3f;
    --text: #e8f2f7;
    --muted: #b4c6d2;
    --line: rgba(255, 255, 255, 0.18);
    --glass: rgba(16, 34, 49, 0.58);
    --glass-soft: rgba(20, 45, 65, 0.38);
    --primary: #26c6da;
    --primary-strong: #11acc0;
    --danger: #ff6b6b;
    --shadow: 0 18px 60px rgba(5, 17, 29, 0.35);
    --radius: 14px;
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(144, 206, 236, 0.55) rgba(9, 24, 36, 0.35);
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

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

*::-webkit-scrollbar-track {
    background: rgba(8, 23, 35, 0.4);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(132, 209, 241, 0.72), rgba(86, 167, 210, 0.72));
    border-radius: 999px;
    border: 2px solid rgba(8, 23, 35, 0.45);
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(160, 224, 250, 0.88), rgba(114, 188, 228, 0.88));
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font: 16px/1.65 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: radial-gradient(circle at 8% -8%, #2f6f91 0%, transparent 38%),
                radial-gradient(circle at 88% 0%, #2b4f72 0%, transparent 34%),
                linear-gradient(145deg, var(--bg-a), var(--bg-b));
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: var(--random-bg);
    background-size: cover;
    background-position: center;
    filter: blur(22px) saturate(1.08) contrast(1.03);
    opacity: 0.35;
    transform: scale(1.12);
    z-index: -2;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 19, 31, 0.26), rgba(9, 23, 37, 0.48));
    backdrop-filter: blur(2px);
    z-index: -1;
}

.toast {
    position: fixed;
    left: 50%;
    top: 18px;
    transform: translateX(-50%) translateY(-10px);
    opacity: 0;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(7, 17, 28, 0.7);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    color: #e8f2f7;
    z-index: 999;
    transition: all 0.2s ease;
}

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

.toast-success {
    border-color: rgba(72, 215, 170, 0.8);
}

.toast-error {
    border-color: rgba(255, 126, 126, 0.9);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(8, 21, 34, 0.45);
    backdrop-filter: blur(16px);
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 14px 0;
}

.brand {
    text-decoration: none;
    color: #f3fdff;
    font-weight: 800;
    letter-spacing: 0.03em;
    font-size: 18px;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.topnav a {
    text-decoration: none;
    color: #dff6ff;
}

main.container {
    padding-top: 24px;
    padding-bottom: 50px;
}

.hero {
    margin-bottom: 18px;
    padding: 10px 2px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(24px, 3vw, 36px);
}

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

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(28, 60, 83, 0.43), rgba(13, 29, 42, 0.62));
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}

.card-head {
    margin-bottom: 12px;
}

.card-title {
    margin: 0;
    line-height: 1.25;
}

.lead, .tiny, .link-muted, .empty, .card-subtitle {
    color: var(--muted);
}

.tiny {
    font-size: 13px;
}

.section-title {
    margin: 16px 0 8px;
    font-size: 18px;
}

.grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.page-layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 16px;
    align-items: start;
}

.tutorial-layout .main-panel {
    margin: 0 auto;
    width: min(100%, 880px);
}

.tutorial-side-actions {
    margin-top: 10px;
}

.tutorial-side-actions .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
}

.tutorial-side-actions .actions .btn,
.tutorial-side-actions .actions form {
    width: 100%;
}

.tutorial-side-actions .actions form {
    display: grid;
}

.tutorial-side-actions .actions .btn {
    justify-content: center;
}

.side-panel {
    position: sticky;
    top: 76px;
    align-self: start;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(28, 60, 83, 0.36), rgba(13, 29, 42, 0.58));
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    padding: 14px;
    max-height: calc(100dvh - 100px);
    overflow: auto;
}

.main-panel {
    min-width: 0;
}

.admin-menu {
    min-height: calc(100dvh - 120px);
}

.side-title {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(232, 242, 247, 0.8);
    margin: 10px 0 8px;
}

.side-title:first-child {
    margin-top: 0;
}

.side-block {
    padding: 10px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
}

.side-list {
    display: grid;
    gap: 8px;
}

.side-item {
    display: block;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: #e8f2f7;
    text-decoration: none;
}

.side-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.side-item.active {
    background: rgba(38, 198, 218, 0.14);
    border-color: rgba(38, 198, 218, 0.65);
}

.side-item.muted {
    color: var(--muted);
    cursor: not-allowed;
}

.side-item.muted:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.14);
}

.side-item .pill {
    margin-left: 6px;
}

.side-group {
    margin-bottom: 12px;
}

.side-group-title {
    font-weight: 700;
    font-size: 14px;
    color: rgba(232, 242, 247, 0.92);
    margin-bottom: 8px;
}

.fold-panel {
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.fold-panel > summary {
    list-style: none;
    cursor: pointer;
    padding: 9px 11px;
    font-weight: 700;
    color: rgba(232, 242, 247, 0.92);
    user-select: none;
}

.fold-panel > summary::-webkit-details-marker {
    display: none;
}

.fold-panel[open] > summary {
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.fold-list {
    padding: 10px;
}

.fold-logout {
    padding: 0 10px 10px;
}

.step-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.step-nav-item {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 8px;
    align-items: center;
    padding: 6px 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
}

.step-nav-item.active {
    background: rgba(38, 198, 218, 0.14);
    border-color: rgba(38, 198, 218, 0.65);
}

.step-nav-item.dragging {
    opacity: 0.7;
}

.drag-handle {
    user-select: none;
    color: rgba(232, 242, 247, 0.72);
    cursor: grab;
    text-align: center;
    font-weight: 800;
}

.step-link {
    display: flex;
    gap: 6px;
    align-items: baseline;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.step-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    background: linear-gradient(160deg, rgba(34, 74, 101, 0.42), rgba(18, 39, 56, 0.45));
    backdrop-filter: blur(8px);
}

.tile-title {
    font-weight: 700;
}

.tile-desc {
    margin-top: 5px;
    color: var(--muted);
    font-size: 14px;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #eef9ff;
    text-decoration: none;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.16);
}

.btn-primary {
    border-color: transparent;
    background: linear-gradient(145deg, var(--primary), #3ad7ea);
    color: #093340;
    font-weight: 700;
}

.btn-primary:hover {
    background: linear-gradient(145deg, var(--primary-strong), #1bc2d6);
    color: #e8ffff;
}

.btn-danger {
    border-color: rgba(255, 107, 107, 0.8);
    color: #ffdede;
    background: rgba(106, 20, 20, 0.35);
}

.btn-disabled,
.btn:disabled {
    pointer-events: none;
    opacity: 0.6;
}

.inline {
    display: inline;
}

.link-btn {
    border: none;
    background: none;
    color: #c7ebff;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

.row-actions {
    white-space: nowrap;
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.form {
    display: grid;
    gap: 12px;
}

.form label {
    display: grid;
    gap: 6px;
}

.publish-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    padding: 8px 0;
    cursor: pointer;
    position: relative;
}

.publish-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.switch-ui {
    width: 54px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.15);
    position: relative;
    transition: all 0.2s ease;
}

.switch-ui::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #fff;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
}

.publish-toggle input:checked + .switch-ui {
    background: linear-gradient(145deg, var(--primary), #3ad7ea);
    border-color: transparent;
}

.publish-toggle input:checked + .switch-ui::before {
    transform: translateX(24px);
}

.switch-text {
    color: #d8ecf7;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 9px 11px;
    font: inherit;
    color: #f4fbff;
    background: rgba(12, 31, 46, 0.46);
    backdrop-filter: blur(6px);
}

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

input::placeholder,
textarea::placeholder {
    color: #9bb5c6;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox input {
    width: auto;
}

.flash {
    border: 1px solid;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 14px;
    backdrop-filter: blur(8px);
}

.flash-success {
    border-color: rgba(72, 215, 170, 0.9);
    background: rgba(22, 87, 73, 0.45);
}

.flash-error {
    border-color: rgba(255, 126, 126, 0.95);
    background: rgba(102, 27, 27, 0.45);
}

.pill {
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    color: #def5ff;
    background: rgba(255, 255, 255, 0.08);
}

.pill-success {
    border-color: rgba(72, 215, 170, 0.8);
    background: rgba(22, 87, 73, 0.45);
    color: #d9fff2;
}

.pill-muted {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(232, 242, 247, 0.86);
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.article-content {
    line-height: 1.9;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(170deg, rgba(13, 30, 45, 0.55), rgba(9, 23, 36, 0.7));
    padding: 16px;
    margin: 12px 0;
    overflow-x: auto;
}

.article-content h2,
.article-content h3 {
    margin: 0.8em 0 0.45em;
}

.article-content p {
    margin: 0.65em 0;
}

.article-content ul,
.article-content ol {
    margin: 0.65em 0;
    padding-left: 22px;
}

.article-content a {
    color: #8ee9ff;
}

.article-content pre,
.article-content code {
    font-family: Consolas, "Courier New", monospace;
}

.article-content pre {
    background: rgba(0, 0, 0, 0.28);
    padding: 10px;
    border-radius: 8px;
}

.article-content img,
.article-content video,
.article-media {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: block;
    margin: 12px auto;
    background: rgba(4, 14, 22, 0.56);
}

.jump-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 999px;
    padding: 8px 14px;
    border: 1px solid rgba(94, 236, 252, 0.75);
    background: rgba(31, 150, 167, 0.3);
    color: #d9faff;
}

.step-list {
    margin: 6px 0 0;
    padding-left: 20px;
}

.breadcrumbs {
    color: var(--muted);
    margin-bottom: 10px;
}

.breadcrumbs a {
    color: #bce9ff;
}

.gate {
    border: 1px dashed rgba(255, 208, 113, 0.85);
    background: rgba(112, 86, 37, 0.28);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.gate-done {
    border-color: rgba(72, 215, 170, 0.85);
    background: rgba(18, 93, 70, 0.3);
}

.editor-tools {
    border: 1px dashed rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    padding: 10px;
    background: rgba(12, 29, 44, 0.35);
}

.editor-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 14px;
}

.editor-split.preview-open {
    grid-template-columns: minmax(0, 1fr) 380px;
}

.editor-main {
    min-width: 0;
}

.editor-preview {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(8, 25, 39, 0.55);
    padding: 12px;
    min-height: 220px;
    position: sticky;
    top: 86px;
}

.preview-box {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 10px;
}

.preview-box h3 {
    margin: 0;
    font-size: 18px;
}

.lock-box {
    border: 1px dashed rgba(255, 255, 255, 0.28);
    border-radius: 12px;
    background: rgba(10, 29, 44, 0.45);
    padding: 14px;
    margin: 12px 0;
}

.footer {
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(7, 17, 28, 0.38);
    backdrop-filter: blur(8px);
}

.footer-inner {
    padding: 15px 0;
}

.auth-card {
    max-width: 480px;
    margin: 26px auto;
}

@media (max-width: 760px) {
    .row-between,
    .step-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .table th:nth-child(1),
    .table td:nth-child(1) {
        display: none;
    }
    .container {
        padding: 0 14px;
    }

    .page-layout {
        grid-template-columns: 1fr;
    }

    .side-panel {
        position: relative;
        top: auto;
        max-height: none;
    }

    .tutorial-layout .main-panel {
        width: min(100%, 760px);
        margin: 0 auto;
    }

    .tutorial-layout > .side-panel {
        display: none;
    }

    .tutorial-side-actions {
        margin-top: 8px;
    }

    .tutorial-side-actions > summary {
        text-align: center;
    }

    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    .editor-split.preview-open {
        grid-template-columns: 1fr;
    }

    .editor-preview {
        position: relative;
        top: auto;
    }
}
