:root {
    --bg: #080b14;
    --bg-soft: #101624;
    --surface: rgba(16, 23, 40, 0.86);
    --surface-solid: #0f1729;
    --text: #e5edff;
    --text-muted: #95a3c5;
    --primary: #4f8cff;
    --primary-strong: #3c79ff;
    --brand-logo-bg: linear-gradient(135deg, #3d8bfd 0%, #2cd2ff 100%);
    --brand-logo-fill: #f5f9ff;
    --success-bg: rgba(29, 201, 129, 0.16);
    --success-border: rgba(34, 197, 94, 0.45);
    --error-bg: rgba(249, 78, 106, 0.14);
    --error-border: rgba(244, 63, 94, 0.45);
    --line: rgba(132, 150, 201, 0.2);
    --shadow: 0 18px 44px rgba(2, 8, 20, 0.55);
}

html[data-theme="light"] {
    --bg: #f3f6ff;
    --bg-soft: #eef3ff;
    --surface: rgba(255, 255, 255, 0.8);
    --surface-solid: #ffffff;
    --text: #0f1731;
    --text-muted: #536183;
    --primary: #3b52ff;
    --primary-strong: #243cff;
    --brand-logo-bg: linear-gradient(135deg, #2f49ff 0%, #5a7dff 100%);
    --brand-logo-fill: #ffffff;
    --success-bg: rgba(16, 185, 129, 0.12);
    --success-border: rgba(5, 150, 105, 0.35);
    --error-bg: rgba(244, 63, 94, 0.11);
    --error-border: rgba(225, 29, 72, 0.32);
    --line: rgba(90, 112, 167, 0.14);
    --shadow: 0 15px 40px rgba(53, 78, 140, 0.14);
}

@font-face {
    font-family: "Vazirmatn";
    src: url("/assets/fonts/vazirmatn/Vazirmatn-VariableFont_wght.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition:
        background-color 0.35s ease,
        color 0.35s ease,
        border-color 0.35s ease,
        box-shadow 0.35s ease,
        fill 0.35s ease,
        stroke 0.35s ease;
}

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

body {
    background:
        radial-gradient(circle at 20% 8%, rgba(89, 116, 255, 0.17) 0, transparent 30%),
        radial-gradient(circle at 85% 18%, rgba(0, 196, 255, 0.12) 0, transparent 28%),
        radial-gradient(circle at 24% 82%, rgba(78, 120, 228, 0.16) 0, transparent 26%),
        var(--bg);
    background-size: 165% 165%, 180% 180%, 170% 170%, 100% 100%;
    background-position: 20% 8%, 85% 18%, 24% 82%, 0 0;
    color: var(--text);
    font-family: "Vazirmatn", Tahoma, sans-serif;
    line-height: 1.7;
    animation: ambient-gradient 8s ease-in-out infinite alternate, ambient-tone 6s ease-in-out infinite;
}

html.theme-transition body,
html.theme-transition .bg-grid,
html.theme-transition .bg-effect-a,
html.theme-transition .bg-effect-b {
    transition: background 0.4s ease, background-image 0.4s ease, opacity 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
    html.theme-transition *,
    html.theme-transition *::before,
    html.theme-transition *::after,
    html.theme-transition body,
    html.theme-transition .bg-grid,
    html.theme-transition .bg-effect-a,
    html.theme-transition .bg-effect-b {
        transition: none !important;
    }
}

button,
input,
select,
textarea {
    font-family: "Vazirmatn", Tahoma, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.bg-effect {
    position: fixed;
    pointer-events: none;
    z-index: -1;
    border-radius: 999px;
    filter: blur(60px);
    opacity: 0.34;
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(118, 138, 191, 0.07) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(118, 138, 191, 0.07) 1px, transparent 1px);
    background-size: 24px 24px;
    animation: grid-drift 10s linear infinite;
}

.bg-effect-a {
    width: 320px;
    height: 320px;
    top: -110px;
    right: -70px;
    background: #5969ff;
    animation: float-a 5.5s ease-in-out infinite;
}

.bg-effect-b {
    width: 280px;
    height: 280px;
    left: -80px;
    bottom: 40px;
    background: #14b8ff;
    animation: float-b 6.5s ease-in-out infinite;
}

.site-shell {
    width: min(1100px, 94vw);
    margin: 22px auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

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

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-logo-bg);
    color: var(--brand-logo-fill);
    box-shadow: 0 8px 20px rgba(83, 102, 255, 0.42);
}

.brand-logo svg {
    width: 24px;
    height: 24px;
    display: block;
    fill: currentColor;
}

.brand-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.brand-subtitle {
    margin: 1px 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.ghost-btn {
    border: 1px solid var(--line);
    background: rgba(127, 144, 197, 0.1);
    color: var(--text);
    border-radius: 10px;
    padding: 9px 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: "Vazirmatn", Tahoma, sans-serif;
}

.ghost-btn:hover {
    transform: translateY(-1px);
    background: rgba(127, 144, 197, 0.2);
}

.switch-wrapper {
    direction: ltr;
    display: inline-flex;
    align-items: center;
}

.switch-wrapper input[type="checkbox"] {
    visibility: hidden;
    display: none;
}

.switch-wrapper *,
.switch-wrapper ::after,
.switch-wrapper ::before {
    box-sizing: border-box;
}

.switch-wrapper .switch {
    --width-of-switch: 3.5em;
    --height-of-switch: 2em;
    --size-of-icon: 1.4em;
    --slider-offset: 0.3em;
    position: relative;
    width: var(--width-of-switch);
    height: var(--height-of-switch);
    display: inline-block;
}

.switch-wrapper .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d7deeb;
    border: 1px solid #c2cbdb40;
    transition: 0.4s;
    border-radius: 30px;
}

.switch-wrapper .slider:before {
    position: absolute;
    content: "";
    height: var(--size-of-icon, 1.4em);
    width: var(--size-of-icon, 1.4em);
    border-radius: 20px;
    left: var(--slider-offset, 0.3em);
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(40deg, #ffba61, #ffd094 70%);
    background-color: #abacb2;
    transition: 0.4s;
}

.switch-wrapper input:checked+.slider {
    background-color: #303136;
}

.switch-wrapper input:checked+.slider:before {
    left: calc(100% - (var(--size-of-icon, 1.4em) + var(--slider-offset, 0.3em)));
    background: #303136;
    box-shadow: inset -3px -2px 5px -2px #474bff, inset -10px -4px 0 0 #7a7dff;
}

.icon-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.plus-btn {
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
}

.copy-btn {
    position: relative;
}

.copy-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.copy-btn.is-copied .icon-copy {
    transform: scale(0.9);
    opacity: 0.7;
}

.content-wrap {
    margin-top: 16px;
}

.site-footer {
    margin-top: 26px;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    color: var(--text-muted);
}

.site-footer-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0.35rem 0.85rem;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.65;
}

.site-footer-item {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.3rem;
    column-gap: 0.35rem;
    row-gap: 0.12rem;
    max-width: 100%;
    text-align: center;
}

.site-footer-item a:not(.footer-donate) {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer-item a:not(.footer-donate):hover {
    color: var(--primary-strong);
}

.site-footer-sep span {
    display: inline-block;
    opacity: 0.5;
    user-select: none;
    transform: translateY(-0.05em);
}

.site-footer-stat {
    max-width: min(40rem, 100%);
}

.site-footer-stat-label {
    font-weight: 600;
}

.footer-paste-count {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--primary);
}

.site-footer-stat-tail {
    color: var(--text-muted);
}

.footer-donate {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.footer-donate:hover {
    color: var(--primary-strong);
    opacity: 0.95;
}

.footer-donate-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

.section-head h1 {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2.35rem);
    line-height: 1.35;
}

.section-head p {
    margin: 9px 0 0;
    color: var(--text-muted);
}

.page-wrap {
    width: min(960px, 100%);
    margin: 0 auto;
}

.page-wrap-wide {
    width: min(1020px, 100%);
    display: grid;
    gap: 14px;
}

.page-wrap-narrow {
    width: min(640px, 100%);
}

.panel {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.panel-body {
    padding: clamp(14px, 2.8vw, 24px);
}

.panel-editor {
    overflow: hidden;
}

.alert-box {
    margin: 14px 0;
    border: 1px solid;
    border-radius: 16px;
    padding: 14px;
}

.alert-success {
    border-color: var(--success-border);
    background: var(--success-bg);
}

.alert-error {
    border-color: var(--error-border);
    background: var(--error-bg);
}

.stack {
    display: grid;
    gap: 14px;
}

fieldset {
    border: none;
}

.field {
    display: grid;
    gap: 7px;
}

.field-row {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field label {
    font-size: 0.92rem;
    font-weight: 700;
}

.hint {
    color: var(--text-muted);
    font-size: 0.79rem;
}

input[type="text"],
input[type="password"],
select,
textarea,
input[type="file"] {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-solid);
    color: var(--text);
    outline: none;
    font: inherit;
    padding: 11px 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    min-height: 320px;
    resize: vertical;
    line-height: 1.7;
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus,
input[type="file"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(118, 140, 255, 0.25);
}

.btn-primary,
.btn-secondary {
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-primary {
    width: 100%;
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    padding: 12px 16px;
    box-shadow: 0 10px 24px rgba(64, 86, 255, 0.35);
}

.btn-secondary {
    color: var(--text);
    border: 1px solid var(--line);
    background: rgba(122, 143, 193, 0.12);
    padding: 11px 14px;
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-1px);
}

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

.paste-qr--inline {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.paste-qr-caption {
    margin: 0 0 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

.paste-qr-img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    margin-inline: auto;
}

.paste-qr--inline .paste-qr-img {
    max-width: 200px;
}

.paste-qr--compact .paste-qr-img {
    border-radius: 10px;
    width: 120px;
    height: 120px;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.code-box {
    background: linear-gradient(180deg, rgba(108, 130, 184, 0.15), rgba(108, 130, 184, 0.06));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
}

.text-left {
    direction: ltr;
    text-align: left;
}

.paste-content {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #0b1322;
    padding: 0;
    box-shadow: var(--shadow);
}

.paste-content-editor pre {
    margin: 0;
    padding: 18px;
}

.paste-content pre {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    line-height: 1.8;
    font-size: 0.92rem;
    color: #d8e5ff;
}

.view-title {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.2px;
}

.view-meta {
    margin: 4px 0 0;
}

.burn-option {
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 12px;
    background: rgba(122, 143, 193, 0.06);
}

.burn-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.burn-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.burn-badge {
    margin: 8px 0 0;
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid rgba(244, 63, 94, 0.35);
    background: rgba(244, 63, 94, 0.12);
    color: #ffb4c2;
}

.attachments-title {
    margin: 0 0 12px;
    font-size: 0.98rem;
}

.attachment-list {
    display: grid;
    gap: 10px;
}

.attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(127, 144, 197, 0.06);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.attachment-item:hover {
    transform: translateY(-1px);
    border-color: rgba(124, 140, 255, 0.35);
}

.error-card {
    width: min(620px, 100%);
    margin: 22px auto 0;
    text-align: center;
}

.unlock-title {
    margin: 0;
    font-size: 1.28rem;
}

.unlock-meta {
    margin-top: 6px;
}

.unlock-form {
    margin-top: 14px;
}

.error-code {
    margin: 0;
    font-size: clamp(2.5rem, 9vw, 4.4rem);
    font-weight: 900;
    letter-spacing: 1px;
}

.error-title {
    margin: 6px 0 0;
    font-size: 1.2rem;
}

.error-desc {
    margin: 10px auto 0;
    color: var(--text-muted);
    max-width: 40ch;
}

@keyframes ambient-gradient {
    0% {
        background-position: 20% 8%, 85% 18%, 24% 82%, 0 0;
    }

    50% {
        background-position: 34% 20%, 68% 35%, 40% 62%, 0 0;
    }

    100% {
        background-position: 12% 28%, 92% 8%, 14% 90%, 0 0;
    }
}

@keyframes float-a {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(-46px, 28px, 0) scale(1.15);
    }

    100% {
        transform: translate3d(22px, -32px, 0) scale(0.92);
    }
}

@keyframes float-b {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(34px, -36px, 0) scale(1.13);
    }

    100% {
        transform: translate3d(-30px, 26px, 0) scale(0.9);
    }
}

@keyframes ambient-tone {
    0% {
        filter: hue-rotate(0deg) saturate(100%) brightness(100%);
    }

    50% {
        filter: hue-rotate(8deg) saturate(122%) brightness(108%);
    }

    100% {
        filter: hue-rotate(-8deg) saturate(114%) brightness(103%);
    }
}

@keyframes grid-drift {
    0% {
        background-position: 0 0, 0 0;
    }

    100% {
        background-position: 24px 24px, 24px 24px;
    }
}

@media (max-width: 768px) {
    .field-row {
        grid-template-columns: 1fr;
    }

    .inline-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .paste-qr--compact {
        align-self: center;
    }

    .paste-qr--compact .paste-qr-img {
        margin-inline: auto;
    }
}