:root {
    --bg: #0a0b0f;
    --bg-elevated: #101218;
    --panel: rgba(15, 18, 24, 0.96);
    --panel-soft: rgba(18, 22, 30, 0.92);
    --card: rgba(255, 255, 255, 0.03);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 92, 92, 0.28);
    --text: #f5f7fb;
    --muted: #98a0ad;
    --muted-strong: #b5bcc8;
    --accent: #ff4655;
    --accent-strong: #ff6b5f;
    --accent-soft: rgba(255, 70, 85, 0.12);
    --accent-soft-strong: rgba(255, 70, 85, 0.2);
    --success: #32d583;
    --danger: #ff7d7d;
    --shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
    --font-body: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: "Trebuchet MS", "Arial Narrow", "Segoe UI", sans-serif;
    --font-mono: Consolas, "Courier New", monospace;
}

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

body {
    margin: 0;
    color: var(--text);
    font-family: var(--font-body);
    background:
        radial-gradient(circle at top right, rgba(255, 70, 85, 0.12), transparent 22%),
        radial-gradient(circle at bottom left, rgba(255, 70, 85, 0.06), transparent 24%),
        linear-gradient(180deg, #090b0f 0%, #0d1016 45%, #0a0c10 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.028) 0, rgba(255, 255, 255, 0.028) 1px, transparent 1px, transparent 4px);
    opacity: 0.1;
}

body::after {
    background: radial-gradient(circle at center, transparent 45%, rgba(0, 0, 0, 0.28) 100%);
}

.page-grid,
.page-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.page-grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.95), transparent 88%);
    opacity: 0.18;
}

.page-noise {
    background:
        radial-gradient(circle at 18% 14%, rgba(255, 70, 85, 0.08), transparent 20%),
        radial-gradient(circle at 82% 78%, rgba(255, 255, 255, 0.03), transparent 16%);
    opacity: 0.85;
}

.shell {
    position: relative;
    z-index: 1;
    max-width: 1460px;
}

.auth-layout > *,
.workspace-grid > * {
    min-width: 0;
}

.surface-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(20, 24, 31, 0.96), rgba(11, 14, 20, 0.98)),
        linear-gradient(135deg, rgba(255, 70, 85, 0.05), transparent 38%);
    box-shadow: var(--shadow);
}

.surface-panel::before,
.surface-panel::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.surface-panel::before {
    inset: 0;
    background:
        linear-gradient(135deg, rgba(255, 70, 85, 0.08), transparent 34%),
        radial-gradient(circle at 100% 0%, rgba(255, 70, 85, 0.08), transparent 24%);
}

.surface-panel::after {
    inset: 0;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.025);
}

.panel-shell {
    padding: 24px;
}

.panel-tall {
    min-height: 100%;
}

.surface-panel,
.workspace-grid > *,
.main-panels > *,
.hero-metrics > *,
.ops-grid > *,
.quick-stats > * {
    min-width: 0;
}

.panel-tag,
.metric-label,
.stat-label,
.identity-label,
.preview-link-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ff8a8a;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero-topline,
.section-head,
.section-actions,
.identity-line,
.generator-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hero-topline,
.section-head,
.section-actions,
.generator-footer {
    flex-wrap: wrap;
}

.hero-line {
    width: min(180px, 42%);
    height: 2px;
    margin: 16px 0 20px;
    background: linear-gradient(90deg, var(--accent), transparent);
    box-shadow: 0 0 18px rgba(255, 70, 85, 0.26);
}

.mini-kicker {
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero-title,
.section-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 0.98;
}

.hero-title {
    font-size: clamp(2.3rem, 4vw, 4rem);
}

.section-title {
    font-size: clamp(1.4rem, 1.8vw, 2rem);
}

.hero-copy,
.section-copy,
.status-line,
.ops-card p,
.stack-item,
.preview-empty span,
.library-card p,
.form-text,
.text-body-secondary {
    color: var(--muted) !important;
}

.hero-copy,
.section-copy {
    line-height: 1.7;
    max-width: 62ch;
}

.brand-mark,
.workspace-brand {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin: 8px 0 2px;
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 4.8vw, 4.6rem);
    font-weight: 900;
    line-height: 0.94;
    letter-spacing: -0.07em;
    color: var(--text);
    text-transform: lowercase;
}

.brand-mark::before,
.brand-mark::after,
.workspace-brand::before,
.workspace-brand::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.brand-mark::before,
.workspace-brand::before {
    color: rgba(255, 70, 85, 0.72);
    transform: translate(1px, 0);
    clip-path: polygon(0 0, 100% 0, 100% 44%, 0 44%);
    animation: glitchSlice 6s infinite linear;
}

.brand-mark::after,
.workspace-brand::after {
    color: rgba(255, 255, 255, 0.18);
    transform: translate(-1px, 0);
    clip-path: polygon(0 62%, 100% 62%, 100% 100%, 0 100%);
    animation: glitchSlice 7.2s infinite linear reverse;
}

.hero-glitch-wrap {
    display: inline-block;
}

.hero-metrics,
.ops-grid,
.quick-stats,
.unlock-layout,
.main-panels {
    display: grid;
    gap: 16px;
}

.hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 24px;
}

.metrics-grid {
    align-items: stretch;
}

.metric-card,
.ops-card,
.stat-card,
.library-card,
.stack-item,
.status-chip,
.preview-link,
.identity-block,
.check-block,
.result-panel {
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--card);
}

.metric-card,
.ops-card,
.stack-item,
.stat-card,
.preview-link,
.identity-block,
.result-panel {
    border-radius: 16px;
}

.metric-card,
.ops-card,
.stat-card,
.library-card {
    position: relative;
}

.metric-card {
    padding: 16px;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    color: var(--text) !important;
    font-weight: 700;
}

.ops-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 22px;
}

.ops-layout {
    align-items: stretch;
}

.ops-card {
    padding: 18px;
}

.ops-index {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: #ffb0b0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
}

.ops-card h3 {
    margin: 0 0 8px;
    font-size: 1.02rem;
    line-height: 1.35;
}

.auth-panel,
.generator-panel,
.preview-panel,
.intel-panel,
.library-panel {
    height: 100%;
}

.generator-panel,
.preview-panel,
.library-panel,
.command-panel,
.intel-panel,
.auth-panel,
.auth-hero {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auth-hero .hero-copy,
.command-panel .hero-copy {
    max-width: 34rem;
    font-size: 0.98rem;
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.auth-tabs .nav-item {
    min-width: 0;
}

.auth-tabs .nav-link,
.btn-mode,
.btn,
.form-control,
.form-select,
.form-check-input,
.status-chip {
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.auth-tabs .nav-link {
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid transparent;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
    text-align: center;
}

.auth-panel .section-head {
    margin-bottom: 6px;
}

.auth-panel .section-title {
    max-width: 11ch;
    font-size: clamp(1.7rem, 2.2vw, 2.45rem);
    line-height: 1.02;
}

.auth-tabs .nav-link.active,
.auth-tabs .nav-link:hover {
    color: var(--text);
    border-color: rgba(255, 70, 85, 0.24);
    background: linear-gradient(180deg, rgba(255, 70, 85, 0.18), rgba(255, 70, 85, 0.08));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.form-stack {
    display: grid;
    gap: 16px;
}

.form-grid {
    margin-top: 0;
}

.form-label {
    margin-bottom: 8px;
    color: var(--muted-strong);
    font-size: 0.95rem;
    font-weight: 600;
}

.form-control,
.form-select {
    border-radius: 14px;
    padding: 0.92rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
}

.form-control::placeholder,
.form-select {
    color: #7d8592;
}

.form-control:focus,
.form-select:focus {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 70, 85, 0.32);
    box-shadow: 0 0 0 0.22rem rgba(255, 70, 85, 0.12);
}

textarea.form-control {
    resize: vertical;
    min-height: 132px;
}

.check-block {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    padding-left: 16px;
}

.form-check {
    margin: 0;
}

.check-block.form-check {
    padding-left: 16px;
}

.form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.18);
}

.check-block .form-check-input {
    margin-left: 0;
    flex: 0 0 auto;
}

.check-block .form-check-label {
    line-height: 1.2;
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.btn {
    border-radius: 14px;
    font-weight: 700;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-1px);
}

.btn-accent {
    color: #fff;
    background: linear-gradient(180deg, var(--accent-strong), var(--accent));
    border: 1px solid transparent;
    box-shadow: 0 14px 30px rgba(255, 70, 85, 0.18);
}

.btn-accent:hover,
.btn-accent:focus-visible {
    color: #fff;
    background: linear-gradient(180deg, #ff7667, #ff5260);
}

.btn-ghost,
.btn-outline-light {
    color: var(--text);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover,
.btn-ghost:focus-visible,
.btn-outline-light:hover,
.btn-outline-light:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.btn:disabled {
    opacity: 0.48;
    transform: none;
    cursor: not-allowed;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 324px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.workspace-rail {
    display: grid;
    gap: 18px;
}

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

.workspace-brand {
    font-size: clamp(1.95rem, 3.6vw, 3.2rem);
}

.command-panel .workspace-brand {
    max-width: 260px;
}

.identity-block {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    margin-top: 18px;
}

.identity-line {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 6px;
}

.identity-line strong,
.identity-value {
    color: var(--text) !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-align: left;
    line-height: 1.45;
}

.quick-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.stat-card {
    padding: 16px 12px;
    text-align: center;
    min-height: 106px;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    color: var(--text);
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    line-height: 1;
}

.stack-list {
    display: grid;
    gap: 12px;
}

.stack-item {
    display: flex;
    align-items: start;
    gap: 12px;
    padding: 14px 16px;
    line-height: 1.65;
}

.stack-dot,
.banner-led {
    width: 9px;
    height: 9px;
    margin-top: 0.45rem;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(255, 70, 85, 0.45);
}

.main-panels {
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
    align-items: start;
}

.generator-panel .section-head,
.preview-panel .section-head,
.library-panel .section-head {
    align-items: start;
}

.generator-panel form,
.preview-panel > *,
.library-panel > * {
    min-width: 0;
}

.generator-panel .section-head > div:first-child,
.preview-panel .section-head > div:first-child,
.library-panel .section-head > div:first-child {
    max-width: 40rem;
    min-width: 0;
}

.generator-panel .section-actions {
    flex: 0 0 auto;
    align-self: start;
}

.mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-mode {
    min-width: 76px;
    border-radius: 999px;
    padding: 0.5rem 0.95rem;
    color: var(--muted-strong);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.88rem;
}

.btn-mode:hover,
.btn-mode.active,
.btn-mode:focus-visible {
    color: #fff;
    border-color: rgba(255, 70, 85, 0.28);
    background: linear-gradient(180deg, rgba(255, 70, 85, 0.2), rgba(255, 70, 85, 0.1));
    box-shadow: 0 0 0 1px rgba(255, 70, 85, 0.08);
}

.btn-mode-critical:hover,
.btn-mode-critical.active,
.btn-mode-critical:focus-visible {
    border-color: rgba(255, 70, 85, 0.36);
}

.secure-banner {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 70, 85, 0.22);
    background: rgba(255, 70, 85, 0.08);
}

.secure-banner strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
}

.status-chip {
    padding: 8px 12px;
    border-radius: 999px;
    color: #ffd6d6;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
}

.muted-chip {
    color: var(--muted);
}

.generator-footer {
    align-items: end;
    flex-wrap: wrap;
    padding-top: 4px;
}

.button-stack {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    min-width: min(100%, 420px);
    justify-content: flex-end;
}

.button-stack .btn {
    flex: 1 1 180px;
}

.preview-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 430px;
    padding: 24px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01)),
        radial-gradient(circle at 50% 0%, rgba(255, 70, 85, 0.08), transparent 34%);
}

.preview-stage::before {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    pointer-events: none;
}

.preview-empty {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
    justify-items: center;
    text-align: center;
}

.empty-mark {
    display: grid;
    place-items: center;
    width: 86px;
    height: 86px;
    border-radius: 18px;
    border: 1px solid rgba(255, 70, 85, 0.2);
    background: rgba(255, 70, 85, 0.08);
    color: #ffd3d3;
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

#qrcode canvas,
#qrcode img {
    width: min(100%, 352px) !important;
    height: auto !important;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.32);
}

.preview-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    flex-wrap: wrap;
}

.preview-link code {
    flex: 1 1 auto;
    min-width: 0;
    color: #ffe0e0;
    font-family: var(--font-mono);
    word-break: break-all;
}

.action-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.action-row .btn {
    min-width: 0;
}

.library-card {
    height: 100%;
    padding: 18px;
    border-radius: 16px;
}

.library-card h4 {
    margin: 0 0 6px;
    font-size: 1.06rem;
}

.library-meta {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.library-card .badge {
    border-radius: 999px;
}

.result-panel {
    padding: 18px;
    color: var(--muted-strong) !important;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.alert {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.alert-danger {
    color: #ffe8e8;
    background: rgba(255, 125, 125, 0.13);
    border-color: rgba(255, 125, 125, 0.2);
}

.alert-success {
    color: #fff1f1;
    background: rgba(50, 213, 131, 0.12);
    border-color: rgba(50, 213, 131, 0.2);
}

.unlock-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

@keyframes glitchSlice {
    0%,
    93%,
    100% {
        transform: translate(0);
    }

    94% {
        transform: translate(2px, -1px);
    }

    96% {
        transform: translate(-2px, 1px);
    }
}

@media (max-width: 1399px) {
    .workspace-grid {
        grid-template-columns: 296px minmax(0, 1fr);
    }

    .main-panels {
        grid-template-columns: minmax(0, 1fr) minmax(330px, 0.92fr);
    }
}

@media (min-width: 1280px) {
    .workspace-rail {
        position: sticky;
        top: 16px;
    }
}

@media (max-width: 1279px) {
    .main-panels {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        order: 2;
    }
}

@media (max-width: 1199px) {
    .workspace-grid,
    .unlock-layout,
    .hero-metrics {
        grid-template-columns: 1fr;
    }

    .ops-grid,
    .quick-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .generator-panel .section-head,
    .preview-panel .section-head,
    .library-panel .section-head {
        flex-direction: column;
    }

    .generator-panel .section-actions {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 991px) {
    .panel-shell {
        padding: 22px;
    }

    .section-head,
    .section-actions,
    .hero-topline,
    .generator-footer,
    .identity-line {
        flex-direction: column;
        align-items: start;
    }

    .button-stack,
    .action-row {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .button-stack .btn {
        width: 100%;
        flex-basis: auto;
    }

    .preview-stage {
        min-height: 360px;
    }
}

@media (max-width: 767px) {
    .shell {
        padding-inline: 10px;
    }

    .surface-panel,
    .surface-panel::after {
        border-radius: 18px;
    }

    .ops-grid,
    .quick-stats {
        grid-template-columns: 1fr;
    }

    .brand-mark,
    .workspace-brand {
        font-size: clamp(2.2rem, 14vw, 3.3rem);
    }

    .preview-link {
        flex-direction: column;
        align-items: start;
    }

    .button-stack {
        min-width: 100%;
    }
}
