@font-face {
    font-family: Vazir;
    src: url("../fonts/Vazir.woff2") format("woff2"), local("Vazir"), local("Vazirmatn");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --bg: #070707;
    --bg-soft: #0d0d0c;
    --surface: rgba(12, 12, 11, 0.94);
    --surface-strong: rgba(17, 16, 14, 0.98);
    --surface-soft: rgba(255, 255, 255, 0.035);
    --bg-mid: #0f0e0b;
    --brand-bg: #11100d;
    --accent-rgb: 218, 171, 64;
    --accent-soft-rgb: 245, 200, 93;
    --line: rgba(205, 170, 82, 0.26);
    --line-hot: rgba(218, 171, 64, 0.78);
    --text: #fff9eb;
    --muted: #baae90;
    --muted-2: #8f8265;
    --accent: #d9aa3f;
    --accent-deep: #8a641e;
    --accent-soft: #f4d47c;
    --gold: #f5c85d;
    --accent-text: #f7dfa4;
    --button-text: #0a0907;
    --green: #34d399;
    --danger: #f2c66a;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.56);
    --shadow-gold: 0 0 0 1px rgba(218, 171, 64, 0.2), 0 18px 48px rgba(0, 0, 0, 0.44);
    --radius: 8px;
    --radius-sm: 6px;
    --space: 18px;
    --max: 1160px;
    --font: Vazir, Vazirmatn, Tahoma, Arial, sans-serif;
}

body[data-theme="red"] {
    --bg-mid: #120708;
    --brand-bg: #140709;
    --surface: rgba(22, 8, 9, 0.96);
    --surface-strong: rgba(30, 9, 11, 0.98);
    --accent-rgb: 239, 68, 68;
    --accent-soft-rgb: 248, 113, 113;
    --line: rgba(239, 68, 68, 0.28);
    --line-hot: rgba(248, 113, 113, 0.86);
    --text: #fff1f2;
    --muted: #c7a0a3;
    --muted-2: #916b70;
    --accent: #ef4444;
    --accent-deep: #991b1b;
    --accent-soft: #f87171;
    --gold: #f87171;
    --accent-text: #fecdd3;
    --button-text: #fff7f7;
    --danger: #fb7185;
    --shadow-gold: 0 0 0 1px rgba(239, 68, 68, 0.26), 0 18px 48px rgba(0, 0, 0, 0.44);
}

body[data-theme="purple"] {
    --bg-mid: #0f0a16;
    --brand-bg: #12091c;
    --surface: rgba(18, 10, 28, 0.96);
    --surface-strong: rgba(26, 12, 42, 0.98);
    --accent-rgb: 168, 85, 247;
    --accent-soft-rgb: 192, 132, 252;
    --line: rgba(168, 85, 247, 0.3);
    --line-hot: rgba(192, 132, 252, 0.86);
    --text: #faf5ff;
    --muted: #b8a3c9;
    --muted-2: #877096;
    --accent: #a855f7;
    --accent-deep: #6b21a8;
    --accent-soft: #c084fc;
    --gold: #c084fc;
    --accent-text: #e9d5ff;
    --button-text: #fff8ff;
    --danger: #c084fc;
    --shadow-gold: 0 0 0 1px rgba(168, 85, 247, 0.26), 0 18px 48px rgba(0, 0, 0, 0.44);
}

body[data-theme="blue"] {
    --bg-mid: #06101b;
    --brand-bg: #061424;
    --surface: rgba(7, 18, 31, 0.96);
    --surface-strong: rgba(8, 25, 45, 0.98);
    --accent-rgb: 59, 130, 246;
    --accent-soft-rgb: 96, 165, 250;
    --line: rgba(59, 130, 246, 0.3);
    --line-hot: rgba(96, 165, 250, 0.86);
    --text: #eff6ff;
    --muted: #9fb4cc;
    --muted-2: #6e8095;
    --accent: #3b82f6;
    --accent-deep: #1d4ed8;
    --accent-soft: #60a5fa;
    --gold: #60a5fa;
    --accent-text: #bfdbfe;
    --button-text: #f8fbff;
    --danger: #60a5fa;
    --shadow-gold: 0 0 0 1px rgba(59, 130, 246, 0.26), 0 18px 48px rgba(0, 0, 0, 0.44);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: var(--font);
    background: var(--bg);
    overflow-x: hidden;
}

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

body::before {
    z-index: -2;
    background:
        linear-gradient(90deg, transparent 0%, rgba(var(--accent-rgb), 0.14) 50%, transparent 100%),
        linear-gradient(180deg, #070707 0%, var(--bg-mid) 48%, #080808 100%);
    background-size: 220% 100%, 100% 100%;
    animation: premium-drift 18s ease-in-out infinite alternate;
}

body::after {
    z-index: -1;
    opacity: 0.18;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.88), transparent 82%);
    animation: grid-glide 24s linear infinite;
}

body[dir="ltr"],
html[dir="ltr"] body {
    direction: ltr;
}

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

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

a {
    color: inherit;
}

.is-hidden {
    display: none !important;
}

.site-header,
.main-shell,
.donation-dock,
.announcement,
.site-copyright {
    width: min(var(--max), calc(100% - 36px));
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space);
    padding: 22px 0 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border: 1px solid var(--line-hot);
    border-radius: var(--radius);
    color: #fff;
    background: var(--brand-bg);
    box-shadow: var(--shadow-gold);
    font-size: 0.98rem;
    font-weight: 900;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    padding: 4px;
    object-fit: contain;
}

.brand strong {
    display: block;
    font-size: 1rem;
    line-height: 1.2;
}

.brand small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.74rem;
}

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

.text-action,
.lang-toggle,
.ghost-action,
.primary-action,
.toolbar button,
.icon-close {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: rgba(12, 12, 11, 0.88);
    transition:
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease,
        transform 180ms ease;
}

.text-action,
.lang-toggle,
.ghost-action {
    padding: 0 15px;
}

.lang-toggle {
    border-color: var(--line-hot);
    background: var(--accent-deep);
}

.lang-toggle:hover {
    border-color: rgba(var(--accent-soft-rgb), 0.84);
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

.text-action:hover,
.lang-toggle:hover,
.ghost-action:hover,
.toolbar button:hover,
.icon-close:hover {
    border-color: var(--line-hot);
    background: rgba(20, 18, 13, 0.96);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.08);
    transform: translateY(-1px);
}

.primary-action {
    width: 100%;
    padding: 0 18px;
    border: 1px solid rgba(var(--accent-rgb), 0.82);
    color: var(--button-text);
    background: var(--accent);
    box-shadow: var(--shadow-gold);
    font-size: 0.9rem;
    font-weight: 850;
}

.primary-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.11), 0 18px 42px rgba(0, 0, 0, 0.44);
}

.isax {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: currentColor;
}

.isax svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.announcement {
    position: relative;
    display: grid;
    gap: 8px;
    margin-top: 2px;
    margin-bottom: 18px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 0.88rem;
    font-weight: 750;
}

.announcement span {
    display: block;
    padding: 13px 16px;
    border: 1px solid var(--line-hot);
    border-radius: var(--radius);
    color: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.main-shell {
    padding-bottom: 12px;
}

.composer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 352px;
    gap: var(--space);
    align-items: stretch;
}

.ad-banner-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space);
    margin-top: var(--space);
}

.ad-banner-slot {
    position: relative;
    display: block;
    min-height: 92px;
    aspect-ratio: 16 / 5;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(12, 12, 11, 0.74);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.ad-banner-slot::before {
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(var(--accent-rgb), 0.08);
    border-radius: 5px;
    content: "";
    pointer-events: none;
}

.ad-banner-slot.is-empty {
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), transparent 38%),
        rgba(12, 12, 11, 0.74);
}

.ad-banner-slot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-banner-slot a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.composer {
    display: grid;
    gap: var(--space);
}

.content-box,
.side-panel,
.result-box,
.viewer-status,
.admin-login,
.stat-grid article,
.field-panel {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.content-box::before,
.side-panel::before,
.result-box::before,
.viewer-status::before,
.admin-login::before,
.stat-grid article::before,
.field-panel::before {
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(var(--accent-rgb), 0.08);
    border-radius: 5px;
    content: "";
    pointer-events: none;
}

.content-box {
    padding: 16px;
}

.box-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--accent-text);
    font-size: 0.82rem;
    font-weight: 850;
}

input,
textarea,
select,
.editor {
    width: 100%;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: rgba(5, 5, 5, 0.7);
    outline: none;
    transition: border-color 170ms ease, box-shadow 170ms ease, background 170ms ease;
}

input,
select {
    min-height: 42px;
    padding: 0 12px;
    font-size: 0.88rem;
}

textarea {
    padding: 13px;
    resize: vertical;
    line-height: 1.7;
}

select {
    appearance: none;
    padding-inline-end: 42px;
    color: var(--text);
    background-image:
        url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10L12 15L17 10' stroke='%23f4d47c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
        linear-gradient(180deg, transparent, transparent);
    background-repeat: no-repeat, no-repeat;
    background-position: right 13px center, center;
}

html[dir="rtl"] select,
body[dir="rtl"] select {
    padding-inline-start: 42px;
    padding-inline-end: 13px;
    background-position: left 13px center, center;
}

input:focus,
textarea:focus,
select:focus,
.editor:focus {
    border-color: rgba(var(--accent-soft-rgb), 0.72);
    background-color: rgba(13, 9, 12, 0.76);
    box-shadow: 0 0 0 3px rgba(var(--accent-soft-rgb), 0.1);
}

.editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.editor-head .box-label {
    margin-bottom: 0;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: flex-end;
}

.toolbar button {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    font-size: 0.86rem;
    font-weight: 850;
}

.toolbar button .isax {
    width: 17px;
    height: 17px;
}

.editor {
    min-height: 306px;
    max-height: 54vh;
    padding: 15px;
    overflow: auto;
    font-size: 0.92rem;
    line-height: 1.9;
}

.editor:empty::before {
    color: rgba(255, 255, 255, 0.42);
    content: attr(data-placeholder);
    pointer-events: none;
}

.editor blockquote,
.rendered-message blockquote {
    margin: 12px 0;
    padding: 11px 14px;
    border-inline-start: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent-text);
    background: rgba(var(--accent-rgb), 0.1);
}

.editor code,
.rendered-message code {
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 5px;
    padding: 1px 6px;
    direction: ltr;
    background: rgba(255, 255, 255, 0.095);
    font-family: Consolas, Monaco, monospace;
}

.editor pre,
.rendered-message pre {
    margin: 12px 0;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: var(--radius-sm);
    direction: ltr;
    overflow: auto;
    background: rgba(7, 5, 7, 0.78);
}

.editor pre code,
.rendered-message pre code {
    border: 0;
    padding: 0;
    background: transparent;
}

.side-panel {
    display: flex;
    flex-direction: column;
    padding: 15px;
}

.option-group {
    display: grid;
    gap: 13px;
    margin-bottom: 16px;
}

.side-panel .option-group {
    flex: 1 1 auto;
    align-content: start;
}

.option-group h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 2px;
    font-size: 0.95rem;
}

.field-line,
.password-field {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.86rem;
}

.field-caption {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.switch-line {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 50px;
    padding: 9px 10px;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    border-radius: var(--radius);
    color: var(--muted);
    background: rgba(5, 5, 5, 0.56);
}

.switch-line input[type="checkbox"] {
    position: relative;
    width: 42px;
    height: 24px;
    min-height: 24px;
    padding: 0;
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    border-radius: 999px;
    appearance: none;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.35);
}

.switch-line input[type="checkbox"]::before {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    content: "";
    transition: transform 180ms ease, background 180ms ease;
}

html[dir="ltr"] .switch-line input[type="checkbox"]::before,
body[dir="ltr"] .switch-line input[type="checkbox"]::before {
    right: auto;
    left: 3px;
}

.switch-line input[type="checkbox"]:checked {
    border-color: rgba(var(--accent-rgb), 0.82);
    background: var(--accent);
}

.switch-line input[type="checkbox"]:checked::before {
    transform: translateX(-18px);
    background: #fff8e6;
}

html[dir="ltr"] .switch-line input[type="checkbox"]:checked::before,
body[dir="ltr"] .switch-line input[type="checkbox"]:checked::before {
    transform: translateX(18px);
}

input[type="color"] {
    min-height: 42px;
    padding: 5px;
}

output {
    display: block;
    min-height: 24px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.84rem;
}

output[data-tone="good"] {
    color: var(--green);
}

output[data-tone="bad"] {
    color: var(--danger);
}

.result-box {
    margin-top: 16px;
    padding: 15px;
}

.result-box label {
    display: block;
    margin-bottom: 9px;
    color: var(--accent-text);
    font-size: 0.84rem;
    font-weight: 850;
}

.result-box .result-code-label {
    margin-top: 13px;
}

.access-code-output,
#codeInput {
    text-align: center;
    font-weight: 900;
}

.copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.copy-row .primary-action,
.copy-row .ghost-action {
    width: auto;
    min-width: 100px;
}

.result-box p {
    margin: 11px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.7;
}

.viewer-layout {
    display: grid;
    max-width: 880px;
    gap: var(--space);
    margin: 26px auto 0;
}

.viewer-status {
    padding: 16px;
    color: var(--muted);
    line-height: 1.8;
    font-size: 0.88rem;
}

#viewSubject {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.28;
    overflow-wrap: anywhere;
}

.rendered-message {
    color: #fff9eb;
    font-size: 0.92rem;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.rendered-message a {
    color: #f3cf76;
}

.donation-dock {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin-top: var(--space);
    margin-bottom: 12px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(8, 8, 8, 0.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.site-copyright {
    margin-top: 0;
    margin-bottom: 22px;
    color: var(--muted-2);
    font-size: 0.78rem;
    text-align: center;
}

.donate-link {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-hot);
    color: #0a0907;
    background: var(--accent);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 850;
}

.donate-link .isax {
    color: #b91c1c;
}

.donor-ticker {
    overflow: hidden;
    white-space: nowrap;
}

.donor-track {
    display: inline-flex;
    min-width: 100%;
    gap: 28px;
    color: var(--muted);
    animation: ticker var(--ticker-duration, 120s) linear infinite;
}

.donor-ticker:hover .donor-track {
    animation-play-state: paused;
}

.donor-track span {
    display: inline-flex;
    gap: 6px;
}

.donor-track strong {
    color: #fff;
}

.info-modal {
    width: min(720px, calc(100% - 28px));
    max-height: min(760px, calc(100vh - 48px));
    border: 1px solid var(--line-hot);
    border-radius: var(--radius);
    color: var(--text);
    background: #0d0d0c;
    box-shadow: var(--shadow);
}

.info-modal::backdrop {
    background: rgba(0, 0, 0, 0.66);
    backdrop-filter: blur(6px);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.modal-head h2 {
    margin: 0;
    font-size: 1rem;
}

.icon-close {
    width: 38px;
    min-height: 38px;
    padding: 0;
    font-size: 1.15rem;
}

.modal-body {
    padding: 10px 16px 18px;
}

.code-modal {
    width: min(620px, calc(100% - 28px));
}

.code-entry {
    display: grid;
    gap: 12px;
    padding-top: 8px;
}

.code-modal .content-box {
    margin-top: 14px;
}

#codeSubject {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.modal-body ol {
    display: grid;
    gap: 10px;
    padding-inline-start: 22px;
}

.modal-body li,
.modal-body p {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.8;
}

.modal-body h3 {
    margin: 18px 0 8px;
}

.rules-list {
    display: grid;
    gap: 10px;
    padding-inline-start: 22px;
}

.rules-list li {
    padding: 11px 12px;
    border: 1px solid rgba(var(--accent-rgb), 0.16);
    border-radius: var(--radius-sm);
    color: var(--muted);
    background: rgba(5, 5, 5, 0.36);
    line-height: 1.8;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 0;
    list-style: none;
}

.spec-grid li {
    padding: 10px 11px;
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: var(--radius-sm);
    background: rgba(5, 5, 5, 0.48);
}

.admin-shell {
    width: min(1120px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 64px;
}

.admin-login {
    width: min(430px, 100%);
    margin: 8vh auto 0;
    padding: 20px;
}

.admin-login h1,
.admin-dashboard h1 {
    margin: 13px 0 8px;
}

.admin-login h1 {
    font-size: 1.18rem;
}

.admin-login p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.8;
}

.admin-login form,
.admin-form {
    display: grid;
    gap: var(--space);
}

.admin-login label,
.admin-form label {
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space);
    margin-bottom: var(--space);
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.admin-topbar h1 {
    margin: 4px 0 0;
    font-size: 1.65rem;
    line-height: 1.2;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: var(--space);
    margin-bottom: var(--space);
}

.stat-grid article {
    padding: 15px;
}

.stat-grid span {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.stat-grid strong {
    display: block;
    margin-top: 10px;
    font-size: 1.55rem;
}

.admin-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: dense;
}

.field-panel {
    padding: 15px;
}

.field-panel h2 {
    margin: 0 0 14px;
    font-size: 0.94rem;
}

.media-panel {
    grid-column: 1 / -1;
}

.upload-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: var(--space);
    align-items: start;
}

.banner-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space);
}

.upload-card {
    display: grid;
    gap: 10px;
}

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

.announcement-admin-item {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    border-radius: var(--radius);
    background: rgba(5, 5, 5, 0.45);
}

.announcement-admin-item .ghost-action {
    min-height: 36px;
}

.upload-card > span {
    color: var(--accent-text);
    font-size: 0.82rem;
    font-weight: 850;
}

.upload-hint {
    display: block;
    color: var(--muted-2);
    font-size: 0.74rem;
    line-height: 1.7;
}

.upload-preview {
    display: grid;
    place-items: center;
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: var(--radius-sm);
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), transparent 42%),
        rgba(5, 5, 5, 0.54);
    overflow: hidden;
}

.logo-preview {
    width: 92px;
    aspect-ratio: 1;
    color: #fff;
    font-weight: 900;
}

.banner-preview {
    min-height: 86px;
    aspect-ratio: 16 / 5;
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-preview img {
    padding: 8px;
    object-fit: contain;
}

.admin-form .file-picker {
    position: relative;
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: rgba(12, 12, 11, 0.88);
    font-size: 0.82rem;
    font-weight: 800;
    overflow: hidden;
}

.admin-form .file-picker input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.admin-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.admin-actions output {
    margin-top: 0;
}

@keyframes premium-drift {
    from {
        background-position: 0% 0%, 0% 0%;
    }
    to {
        background-position: 100% 0%, 0% 0%;
    }
}

@keyframes grid-glide {
    from {
        background-position: 0 0, 0 0;
    }
    to {
        background-position: 42px 42px, 42px 42px;
    }
}

@keyframes sheen {
    0%,
    42% {
        transform: translateX(-110%);
    }
    72%,
    100% {
        transform: translateX(110%);
    }
}

@keyframes ticker {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(50%);
    }
}

html[dir="ltr"] .donor-track {
    animation-name: ticker-ltr;
}

@keyframes ticker-ltr {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.maintenance-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 22px;
    background:
        radial-gradient(circle at 50% 18%, rgba(var(--accent-soft-rgb), 0.16), transparent 34%),
        rgba(5, 5, 5, 0.52);
    backdrop-filter: blur(12px) saturate(1.25);
}

body.site-is-disabled .site-header,
body.site-is-disabled .main-shell,
body.site-is-disabled .announcement,
body.site-is-disabled .donation-dock {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.maintenance-panel {
    width: min(480px, 100%);
    padding: 24px;
    border: 1px solid rgba(var(--accent-soft-rgb), 0.5);
    border-radius: var(--radius);
    color: var(--text);
    background: rgba(11, 10, 9, 0.86);
    box-shadow: var(--shadow);
    text-align: center;
}

.maintenance-pulse {
    display: inline-grid;
    width: 54px;
    height: 54px;
    margin-bottom: 12px;
    border: 1px solid rgba(var(--accent-soft-rgb), 0.65);
    border-radius: 50%;
    place-items: center;
}

.maintenance-pulse::before {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 28px rgba(var(--accent-soft-rgb), 0.8);
    content: "";
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.maintenance-panel h2 {
    margin: 0 0 8px;
    font-size: 1.45rem;
}

.maintenance-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.stats-modal {
    width: min(1040px, calc(100% - 28px));
}

.archive-modal {
    width: min(1120px, calc(100% - 28px));
}

.archive-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin: 8px 0 14px;
}

.archive-toolbar output {
    min-width: 120px;
    margin-top: 0;
    text-align: end;
}

.archive-layout {
    display: grid;
    grid-template-columns: minmax(250px, 0.9fr) minmax(0, 1.4fr);
    gap: 14px;
    min-height: 520px;
}

.archive-list,
.archive-detail {
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(5, 5, 5, 0.42);
}

.archive-list {
    display: grid;
    align-content: start;
    gap: 6px;
    max-height: 560px;
    padding: 8px;
    overflow: auto;
}

.archive-item {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(var(--accent-rgb), 0.16);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: rgba(12, 12, 11, 0.72);
    text-align: start;
    overflow: hidden;
}

.archive-item:hover,
.archive-item.is-selected {
    border-color: var(--line-hot);
    background: rgba(var(--accent-rgb), 0.11);
}

.archive-item.is-selected {
    box-shadow: inset 3px 0 0 var(--accent);
}

html[dir="rtl"] .archive-item.is-selected,
body[dir="rtl"] .archive-item.is-selected {
    box-shadow: inset -3px 0 0 var(--accent);
}

.archive-item.is-selected {
    border-color: rgba(var(--accent-rgb), 0.42);
}

.archive-item.is-live {
    border-color: rgba(52, 211, 153, 0.34);
    background: rgba(6, 78, 59, 0.2);
}

.archive-item.is-live:hover,
.archive-item.is-live.is-selected {
    border-color: rgba(52, 211, 153, 0.7);
    background: rgba(6, 95, 70, 0.32);
}

.archive-item.is-expired {
    border-color: rgba(248, 113, 113, 0.34);
    background: rgba(127, 29, 29, 0.24);
}

.archive-item.is-expired:hover,
.archive-item.is-expired.is-selected {
    border-color: rgba(248, 113, 113, 0.72);
    background: rgba(153, 27, 27, 0.34);
}

.archive-item strong,
.archive-detail-head h3 {
    overflow-wrap: anywhere;
}

.archive-item strong {
    min-width: 0;
    flex: 1 1 auto;
    color: var(--text);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.archive-item span,
.archive-empty {
    color: var(--muted);
    font-size: 0.73rem;
    line-height: 1.4;
}

.archive-item span {
    flex: 0 0 auto;
    white-space: nowrap;
}

.archive-detail {
    max-height: 560px;
    padding: 14px;
    overflow: auto;
}

.archive-detail > p {
    color: var(--muted);
}

.archive-detail-head {
    display: grid;
    gap: 7px;
    margin-bottom: 12px;
}

.archive-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.archive-detail-tags span {
    width: max-content;
    max-width: 100%;
    padding: 4px 9px;
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    border-radius: 999px;
    color: var(--accent-text);
    background: rgba(var(--accent-rgb), 0.1);
    font-size: 0.74rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.archive-detail-head h3 {
    margin: 0;
    font-size: 1.12rem;
}

.archive-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 0 0 14px;
}

.archive-meta div {
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(var(--accent-rgb), 0.14);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.035);
}

.archive-meta dt {
    color: var(--muted-2);
    font-size: 0.74rem;
}

.archive-meta dd {
    margin: 5px 0 0;
    color: var(--text);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.archive-message {
    padding: 14px;
    border: 1px solid rgba(var(--accent-rgb), 0.16);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.28);
}

.archive-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
}

.archive-pagination span,
.stats-pagination span {
    color: var(--muted);
    font-size: 0.82rem;
}

.stats-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
}

.danger-action {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    padding: 0 14px;
    border: 1px solid rgba(248, 113, 113, 0.52);
    border-radius: var(--radius-sm);
    color: #fff1f2;
    background: rgba(127, 29, 29, 0.72);
    font-weight: 850;
}

.danger-action:hover {
    border-color: rgba(248, 113, 113, 0.84);
    background: rgba(153, 27, 27, 0.88);
}

.stats-summary {
    margin: 8px 0 12px;
    color: var(--accent-text);
    font-size: 0.88rem;
}

.stats-table-wrap {
    max-height: 520px;
    overflow: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.stats-table th,
.stats-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.16);
    color: var(--muted);
    font-size: 0.8rem;
    text-align: start;
    white-space: nowrap;
}

.stats-table th {
    color: var(--accent-text);
    background: rgba(5, 5, 5, 0.55);
    position: sticky;
    top: 0;
}

.stats-table tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.025);
}

.stats-table tbody tr:nth-child(even) {
    background: rgba(var(--accent-rgb), 0.055);
}

.stats-table tbody tr:hover {
    background: rgba(var(--accent-rgb), 0.12);
}

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

.system-check {
    padding: 12px;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    border-radius: var(--radius);
    background: rgba(5, 5, 5, 0.48);
}

.system-check strong {
    display: block;
    margin-bottom: 7px;
    color: var(--accent-text);
    font-size: 0.82rem;
}

.system-check span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.system-check.is-ok {
    border-color: rgba(52, 211, 153, 0.34);
}

.system-check.is-bad {
    border-color: rgba(248, 113, 113, 0.44);
}

.system-recommendations {
    margin-top: 14px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.8;
}

.system-recommendations h3 {
    margin: 0 0 8px;
    color: var(--accent-text);
    font-size: 0.9rem;
}

.system-recommendations ul {
    display: grid;
    gap: 7px;
    margin: 0;
    padding-inline-start: 22px;
}

@keyframes pulse-dot {
    0%,
    100% {
        transform: scale(0.85);
        opacity: 0.78;
    }
    50% {
        transform: scale(1.18);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 920px) {
    .composer-layout,
    .admin-form,
    .stat-grid,
    .ad-banner-grid,
    .upload-layout,
    .banner-upload-grid,
    .archive-toolbar,
    .archive-layout,
    .archive-meta {
        grid-template-columns: 1fr;
    }

    .side-panel {
        position: static;
    }

    .admin-topbar h1 {
        font-size: 1.35rem;
    }

    .admin-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .site-header,
    .main-shell,
    .donation-dock,
    .announcement,
    .site-copyright,
    .admin-shell {
        width: min(100% - 22px, var(--max));
    }

    .site-header,
    .editor-head,
    .admin-topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .header-actions,
    .toolbar {
        justify-content: stretch;
    }

    .text-action,
    .lang-toggle {
        flex: 1 1 auto;
    }

    #viewSubject {
        font-size: 1.25rem;
    }

    .editor {
        min-height: 260px;
    }

    .copy-row,
    .donation-dock {
        grid-template-columns: 1fr;
    }

    .spec-grid {
        grid-template-columns: 1fr;
    }

    .system-check-grid {
        grid-template-columns: 1fr;
    }
}
