@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-soft: #f4f8ff;
    --surface-strong: #ebf3ff;
    --ink: #143252;
    --muted: #66809d;
    --line: rgba(37, 99, 235, 0.14);
    --line-strong: rgba(37, 99, 235, 0.22);
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --accent: #60a5fa;
    --success: #16a34a;
    --danger: #dc2626;
    --shadow: 0 10px 28px rgba(37, 99, 235, 0.08);
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --container: 1180px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, #ffffff 55%, #f7fbff 100%);
}

body.modal-open {
    overflow: hidden;
}

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

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

img {
    max-width: 100%;
    display: block;
}

small {
    color: var(--muted);
}

.container {
    width: min(var(--container), calc(100% - 2rem));
    margin: 0 auto;
}

.page-content {
    padding: 1.25rem 0 2rem;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    min-height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #7dd3fc);
    color: #fff;
    box-shadow: var(--shadow);
}

.nav,
.admin-user,
.action-row,
.button-row,
.inline-meta,
.meta-list,
.footer-card,
.detail-download,
.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.nav a {
    padding: 0.56rem 0.82rem;
    border-radius: 999px;
    color: var(--muted);
    transition: 0.2s ease;
}

.nav a:hover,
.nav a.is-active {
    color: var(--primary-strong);
    background: rgba(37, 99, 235, 0.09);
}

.admin-topbar .topbar-inner {
    flex-wrap: wrap;
    row-gap: 0.55rem;
}

.admin-topbar .nav {
    order: 3;
    width: 100%;
    gap: 0.45rem;
}

.admin-topbar .nav a {
    padding: 0.5rem 0.72rem;
    font-size: 0.92rem;
}

.admin-topbar .admin-user {
    margin-left: auto;
}

.hero,
.summary-grid,
.admin-grid,
.detail-grid,
.detail-specs,
.stats-grid,
.overview-grid,
.form-grid,
.detail-stack {
    display: grid;
    gap: 1rem;
}

.hero {
    grid-template-columns: 1fr;
    margin-bottom: 1.5rem;
}

.hero-single .hero-card {
    padding: 1.4rem;
}

.summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1.5rem;
}

.overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.admin-grid,
.detail-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    align-items: start;
}

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

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

.admin-grid-single > .panel,
.detail-grid-single > .panel {
    width: min(980px, 100%);
    justify-self: center;
}

.admin-grid-full > .panel {
    width: 100%;
}

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

.detail-specs,
.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-stats {
    margin-top: 1rem;
}

.upload-shell {
    display: flex;
    justify-content: center;
}

.upload-panel {
    width: min(740px, 100%);
    text-align: center;
}

.upload-panel-tools {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.25rem;
}

.upload-panel form,
.upload-panel .field,
.upload-panel small {
    text-align: left;
}

.upload-title {
    margin-top: 0.5rem;
    font-size: 1.8rem;
    line-height: 1.12;
}

.upload-intro {
    max-width: 620px;
    margin: 0 auto 0.85rem;
    font-size: 0.96rem;
}

.upload-rule-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0.3rem 0.68rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #fb7185, #f43f5e);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    box-shadow: 0 7px 15px rgba(244, 63, 94, 0.16);
    cursor: pointer;
}

.upload-rule-trigger:hover {
    transform: translateY(-1px);
}

.hero-card,
.panel,
.login-card,
.preview-box,
.flash-modal-card,
.stat-card,
.site-modal-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.hero-card,
.panel,
.login-card {
    padding: 1.05rem;
}

.section-panel {
    padding: 1.05rem;
}

.hero-card h1,
.section-title {
    margin: 0 0 0.6rem;
    line-height: 1.06;
    letter-spacing: -0.04em;
}

.hero-card h1 {
    font-size: clamp(1.9rem, 4.3vw, 3.6rem);
}

.detail-title {
    margin-top: 0.85rem;
}

.muted,
.hero-card p,
.hint-list,
.detail-intro,
.row-summary {
    color: var(--muted);
    line-height: 1.72;
}

.detail-intro {
    margin-bottom: 0;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.7fr) auto;
    gap: 0.8rem;
    align-items: end;
    margin-bottom: 0.9rem;
}

.admin-script-filter {
    grid-template-columns: minmax(0, 1fr) auto;
}

.admin-script-filter-button {
    width: 116px;
    min-width: 116px;
}

.field {
    display: grid;
    gap: 0.38rem;
}

.field-inline-split {
    grid-template-columns: minmax(0, 1fr) auto minmax(170px, 220px);
    align-items: center;
    gap: 0.8rem;
}

.field label {
    font-weight: 700;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 0.72rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.field textarea {
    min-height: 118px;
    resize: vertical;
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 38px;
    padding: 0.64rem 0.98rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.button:hover,
button.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.14);
}

.button-secondary {
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    color: #fff;
}

.button-danger {
    background: linear-gradient(135deg, var(--danger), #ef4444);
    color: #fff;
}

.button-ghost {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary-strong);
}

.button.full {
    width: 100%;
}

.button-compact,
button.button-compact {
    min-height: 32px;
    padding: 0.46rem 0.8rem;
    font-size: 0.85rem;
}

.button-compact.button-primary,
button.button-compact.button-primary {
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: fit-content;
    padding: 0.26rem 0.56rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
}

.badge-warning {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-strong);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
}

.notice {
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-md);
    background: rgba(37, 99, 235, 0.08);
}

.compact-notice {
    margin: 0;
}

.stat-card {
    padding: 0.95rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.overview-card {
    min-height: 132px;
    border-radius: 18px;
}

.overview-value {
    display: block;
    margin: 0.28rem 0 0.42rem;
    font-size: clamp(1.8rem, 3.6vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.05em;
    color: var(--primary-strong);
}

.stat-value {
    display: block;
    margin-top: 0.28rem;
    font-size: clamp(1.6rem, 3.5vw, 2.3rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.empty-state {
    padding: 2rem 0.85rem;
    text-align: center;
    color: var(--muted);
}

.script-list {
    display: grid;
    gap: 0.85rem;
}

.home-banner-stack {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.home-banner-stack[hidden] {
    display: none;
}

.home-banner-wrap {
    margin-bottom: 0;
}

.home-banner-wrap[hidden] {
    display: none;
}

.home-banner-tools {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.45rem;
}

.home-banner-link {
    display: block;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.home-banner-link img {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    object-fit: contain;
    background: #fff;
}

.home-banner-close {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.5rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff6b6b, #ff4d4f);
    color: #fff;
    box-shadow: 0 8px 14px rgba(255, 77, 79, 0.18);
    cursor: pointer;
    font-size: 0.76rem;
    line-height: 1;
}

.home-banner-count {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-weight: 700;
    font-size: 0.74rem;
}

.home-banner-tag {
    position: absolute;
    right: 0.72rem;
    bottom: 0.72rem;
    padding: 0.22rem 0.5rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.58);
    color: #fff;
    font-size: 0.72rem;
}

.script-row {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(90px, 0.7fr) minmax(130px, 0.85fr) minmax(90px, 0.55fr) minmax(116px, 0.7fr);
    gap: 0.75rem;
    align-items: center;
    padding: 0.72rem 0.88rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.script-row-head {
    padding: 0 0.88rem 0.1rem;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    font-size: 0.84rem;
}

.script-row-head > :last-child {
    justify-self: end;
    text-align: center;
    width: 96px;
}

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

.row-title {
    display: block;
    font-size: 0.96rem;
    margin-bottom: 0.2rem;
}

.row-summary {
    margin: 0 0 0.3rem;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.row-subtitle {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.script-cell,
.script-actions {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
}

.script-actions {
    align-items: flex-end;
    justify-self: end;
    width: 96px;
}

.cell-label {
    display: none;
    font-size: 0.82rem;
    color: var(--muted);
}

.detail-shell {
    display: grid;
    gap: 0.75rem;
}

.detail-card {
    padding: 1.15rem;
}

.detail-heading {
    display: flex;
    justify-content: space-between;
    gap: 0.9rem;
    align-items: flex-start;
    margin-bottom: 0.8rem;
}

.detail-download {
    justify-content: flex-end;
}

.spec-card {
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
}

.spec-card strong {
    display: block;
    margin-top: 0.35rem;
}

.shot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.admin-shot-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.shot-card,
.shot-manage-card {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow);
}

.shot-card img,
.shot-manage-card img {
    width: 100%;
    height: 184px;
    object-fit: cover;
}

.shot-manage-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.62rem 0.75rem;
    color: var(--muted);
}

.shot-manage-card {
    cursor: pointer;
}

.hidden-frame {
    width: 0;
    height: 0;
    border: 0;
    position: absolute;
}

.site-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 0.9rem;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(6px);
}

.site-modal[hidden] {
    display: none;
}

.site-modal-card {
    position: relative;
    width: min(620px, 100%);
    padding: 1rem;
}

.download-modal-card {
    width: min(640px, calc(100% - 1rem));
    padding: 1.2rem;
    max-height: calc(100vh - 1.25rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.verify-modal-card {
    width: min(540px, calc(100% - 1rem));
    padding: 1.2rem;
    max-height: calc(100vh - 1.25rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notice-popup-card {
    width: min(560px, 100%);
}

.site-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.75rem;
}

.site-modal-body {
    display: grid;
    gap: 0.85rem;
}

.download-modal-card .site-modal-body,
.verify-modal-card .site-modal-body {
    min-height: 0;
}

.modal-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary-strong);
    font-size: 1rem;
    cursor: pointer;
}

.download-modal-card .site-modal-head {
    justify-content: center;
    margin-bottom: 0.85rem;
}

.download-modal-card .modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    font-size: 0.92rem;
}

.verify-modal-card .site-modal-head {
    justify-content: center;
    margin-bottom: 0.85rem;
}

.verify-modal-card .modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    font-size: 0.92rem;
}

.download-modal-title-wrap {
    width: 100%;
    text-align: center;
}

.download-modal-title {
    margin: 0;
    font-size: 1.32rem;
    line-height: 1.22;
}

.download-modal-content {
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: var(--surface-soft);
    text-align: center;
    line-height: 1.9;
    color: var(--ink);
    max-height: min(62vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.download-modal-actions {
    justify-content: center;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.modal-actions .button,
.modal-actions button.button,
.flash-modal-actions .button,
.flash-modal-actions button.button {
    min-height: 32px;
    padding: 0.46rem 0.8rem;
    font-size: 0.85rem;
}

.verify-file-box {
    padding: 0.78rem 0.9rem;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f6ff 100%);
    color: var(--ink);
    font-size: 0.95rem;
    line-height: 1.75;
}

.verify-captcha-box {
    display: grid;
    gap: 0.7rem;
    padding: 0.9rem 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.verify-captcha-box-clickable {
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.verify-captcha-box-clickable:hover,
.verify-captcha-box-clickable:focus-visible {
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.06);
}

.captcha-panel {
    display: grid;
    gap: 0.7rem;
    padding: 0.9rem 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    text-align: left;
}

.captcha-local-prompt {
    min-height: 44px;
    font-size: 1rem;
}

.captcha-remote-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.captcha-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.65;
}

.captcha-status.is-success {
    color: var(--success);
    font-weight: 700;
}

.captcha-status.is-error {
    color: var(--danger);
    font-weight: 700;
}

.captcha-status.is-loading {
    color: var(--primary-strong);
    font-weight: 700;
}

.button.is-loading,
button.button.is-loading {
    opacity: 0.78;
}

.verify-captcha-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink);
}

.verify-captcha-prompt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.06);
    color: var(--primary-strong);
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.verify-captcha-input {
    min-height: 44px;
    padding: 0.72rem 0.88rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 12px;
    background: #fff;
}

.verify-captcha-tip {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.verify-captcha-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 700;
}

.verify-modal-actions {
    justify-content: center;
    margin-top: 0.35rem;
}

.rules-modal-card {
    width: min(760px, calc(100% - 1rem));
    max-height: calc(100vh - 1.25rem);
}

.rules-modal-card .site-modal-head {
    justify-content: center;
    margin-bottom: 0.7rem;
}

.rules-modal-card .modal-close {
    position: absolute;
    top: 0.82rem;
    right: 0.82rem;
    width: 26px;
    height: 26px;
    font-size: 0.88rem;
}

.rules-modal-content {
    max-height: min(70vh, 560px);
    overflow-y: auto;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    text-align: left;
    line-height: 1.82;
    color: var(--ink);
    font-size: 0.88rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow-wrap: anywhere;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.85) transparent;
}

.rules-modal-content::-webkit-scrollbar {
    width: 10px;
}

.rules-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.rules-modal-content::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.82);
    background-clip: padding-box;
}

.rules-modal-actions {
    justify-content: center;
    margin-top: 0.1rem;
}

.script-preview-modal-card {
    width: min(960px, calc(100% - 1rem));
    max-height: calc(100vh - 1rem);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.script-preview-modal-body {
    display: grid;
    gap: 0.8rem;
    min-height: 0;
}

.script-preview-meta {
    margin: 0;
    text-align: center;
}

.script-preview-box {
    margin: 0;
    padding: 0.95rem;
    max-height: min(72vh, 720px);
    overflow: auto;
    white-space: pre-wrap;
    line-height: 1.62;
    border-radius: 16px;
    background: #0f172a;
    color: #dbeafe;
    font-family: "Cascadia Code", "Consolas", monospace;
}

.script-preview-actions {
    justify-content: center;
    margin-top: 0.15rem;
}

.script-content-field {
    grid-column: 1 / -1;
}

.field textarea.script-content-editor {
    min-height: min(62vh, 680px);
    resize: vertical;
    white-space: pre;
    overflow: auto;
    line-height: 1.55;
    tab-size: 4;
    font-family: "Cascadia Code", "Consolas", monospace;
}

.modal-notice {
    margin: 0;
}

.table-wrap,
.preview-box {
    overflow: auto;
}

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

th,
td {
    padding: 0.82rem 0.7rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    white-space: normal;
}

.table-actions form {
    margin: 0;
    display: inline-flex;
}

.settings-group {
    display: grid;
    gap: 0.8rem;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.ads-admin-list {
    display: grid;
    gap: 1rem;
}

.ad-admin-card {
    display: grid;
    grid-template-columns: minmax(220px, 0.82fr) minmax(0, 1.18fr);
    gap: 1rem;
    padding: 0.95rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.ad-admin-preview {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    min-height: 180px;
}

.ad-admin-preview img {
    width: 100%;
    height: 100%;
    min-height: 180px;
    object-fit: cover;
}

.ad-admin-form,
.ad-admin-delete-form {
    margin: 0;
}

.ad-admin-actions {
    justify-content: flex-start;
    margin-top: 0.2rem;
}

.settings-group .section-title {
    margin-bottom: 0;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--ink);
    font-weight: 500;
}

.check-row input {
    width: 18px;
    height: 18px;
}

.banner-preview-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}

.banner-preview-image {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
}

pre,
code {
    font-family: "Cascadia Code", "Consolas", monospace;
}

.preview-box {
    padding: 0.9rem;
    max-height: 540px;
    white-space: pre-wrap;
    line-height: 1.6;
    border-radius: var(--radius-lg);
    background: #0f172a;
    color: #dbeafe;
}

.flash-modal {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(4px);
}

.flash-modal-stack {
    display: grid;
    gap: 1rem;
    width: min(440px, 100%);
}

.flash-modal-card {
    width: 100%;
    padding: 1rem;
}

.flash-modal-card-badge-success {
    border-color: rgba(22, 163, 74, 0.18);
}

.flash-modal-card-badge-danger {
    border-color: rgba(220, 38, 38, 0.18);
}

.flash-modal-card-badge-warning {
    border-color: rgba(37, 99, 235, 0.18);
}

.flash-modal-actions {
    margin-top: 1rem;
    justify-content: flex-end;
}

.footer-card {
    justify-content: center;
    text-align: center;
    padding: 0.82rem 1rem;
    margin-top: 1rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.login-wrap {
    min-height: calc(100vh - 120px);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(520px, 100%);
    padding: 1.3rem;
}

@media (max-width: 1080px) {
    .summary-grid,
    .detail-specs,
    .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .script-row {
        grid-template-columns: minmax(0, 1.8fr) minmax(90px, 0.7fr) minmax(120px, 0.8fr) minmax(90px, 0.55fr) minmax(110px, 0.7fr);
    }

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

@media (max-width: 860px) {
    .topbar-inner {
        min-height: auto;
        padding: 0.85rem 0;
        flex-direction: column;
        align-items: stretch;
    }

    .section-head,
    .detail-heading,
    .filter-bar {
        grid-template-columns: 1fr;
        display: grid;
    }

    .detail-download,
    .section-head .action-row {
        justify-content: stretch;
    }

    .admin-script-filter-button {
        width: 100%;
        min-width: 0;
    }

    .script-row-head {
        display: none;
    }

    .script-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .cell-label {
        display: inline-block;
    }

    .script-actions {
        align-items: stretch;
        justify-self: stretch;
        width: auto;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(var(--container), calc(100% - 1rem));
    }

    .page-content {
        padding: 0.85rem 0 1.2rem;
    }

    .topbar-inner {
        gap: 0.65rem;
        padding: 0.65rem 0;
    }

    .brand {
        gap: 0.5rem;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
        border-radius: 9px;
        font-size: 0.85rem;
    }

    .brand-text {
        font-size: 1rem;
    }

    .nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .admin-topbar .nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hero-card,
    .panel,
    .section-panel,
    .login-card,
    .site-modal-card {
        padding: 0.8rem;
    }

    .summary-grid,
    .detail-specs,
    .stats-grid,
    .shot-grid {
        grid-template-columns: 1fr;
    }

    .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .nav a,
    .button,
    button.button {
        width: 100%;
    }

    .nav a {
        width: auto;
        padding: 0.46rem 0.2rem;
        font-size: 0.9rem;
        text-align: center;
    }

    .admin-topbar .nav a {
        padding: 0.42rem 0.18rem;
        font-size: 0.82rem;
    }

    .section-title {
        margin-bottom: 0.45rem;
        font-size: 1.55rem;
    }

    .upload-panel-tools {
        margin-bottom: 0.2rem;
    }

    .upload-rule-trigger {
        min-height: 28px;
        padding: 0.24rem 0.58rem;
        font-size: 0.72rem;
        box-shadow: 0 6px 14px rgba(244, 63, 94, 0.16);
    }

    .upload-title {
        margin-top: 0.35rem;
        font-size: 1.35rem;
    }

    .upload-intro {
        margin: 0 auto 0.75rem;
        font-size: 0.9rem;
        line-height: 1.7;
    }

    .section-head {
        gap: 0.6rem;
        margin-bottom: 0.7rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .overview-card {
        min-height: 88px;
        border-radius: 14px;
    }

    .overview-value {
        margin: 0.14rem 0 0;
        font-size: clamp(1.45rem, 7vw, 1.75rem);
    }

    .field {
        gap: 0.32rem;
    }

    .field-inline-split {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 0.55rem;
    }

    .field label {
        font-size: 0.9rem;
    }

    .field input,
    .field textarea,
    .field select {
        padding: 0.62rem 0.72rem;
        font-size: 0.92rem;
    }

    .field textarea {
        min-height: 102px;
    }

    .button,
    button.button {
        min-height: 34px;
        padding: 0.54rem 0.8rem;
        font-size: 0.9rem;
    }

    .button-compact,
    button.button-compact {
        min-height: 30px;
        padding: 0.38rem 0.68rem;
        font-size: 0.82rem;
    }

    .modal-actions .button,
    .modal-actions button.button,
    .flash-modal-actions .button,
    .flash-modal-actions button.button {
        min-height: 30px;
        padding: 0.38rem 0.68rem;
        font-size: 0.82rem;
    }

    .script-list {
        gap: 0.6rem;
    }

    .script-row {
        gap: 0.55rem;
        padding: 0.62rem 0.72rem;
        border-radius: 14px;
    }

    .row-title {
        font-size: 0.9rem;
        margin-bottom: 0.16rem;
    }

    .row-summary {
        margin-bottom: 0.22rem;
        font-size: 0.86rem;
        line-height: 1.55;
    }

    .row-subtitle {
        gap: 0.35rem;
        font-size: 0.78rem;
    }

    .badge {
        font-size: 0.68rem;
    }

    .script-cell,
    .script-actions {
        gap: 0.24rem;
    }

    .home-banner-tools {
        margin-bottom: 0.3rem;
    }

    .home-banner-stack {
        gap: 0.75rem;
    }

    .home-banner-link {
        border-radius: 14px;
    }

    .home-banner-link img {
        width: 100%;
        height: auto;
    }

    .home-banner-close {
        padding: 0.14rem 0.34rem;
        gap: 0.22rem;
        font-size: 0.68rem;
    }

    .admin-user,
    .footer-card,
    .action-row,
    .detail-download,
    .modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .table-actions {
        white-space: normal;
    }

    .shot-card img,
    .shot-manage-card img {
        height: 168px;
    }

    .home-banner-count {
        min-width: 18px;
        height: 18px;
        font-size: 0.64rem;
    }

    .download-modal-card {
        padding: 0.9rem;
        max-height: calc(100vh - 0.8rem);
    }

    .script-preview-modal-card {
        width: min(100%, calc(100% - 0.4rem));
        max-height: calc(100vh - 0.9rem);
        padding: 0.85rem;
    }

    .script-preview-box {
        max-height: min(68vh, 620px);
        padding: 0.78rem;
        font-size: 0.84rem;
    }

    .rules-modal-card {
        width: min(100%, calc(100% - 0.4rem));
        max-height: calc(100vh - 0.9rem);
    }

    .rules-modal-card .site-modal-head {
        margin-bottom: 0.65rem;
    }

    .rules-modal-card .modal-close {
        top: 0.65rem;
        right: 0.65rem;
        width: 24px;
        height: 24px;
        font-size: 0.82rem;
    }

    .download-modal-title {
        font-size: 1.18rem;
    }

    .rules-modal-content {
        max-height: min(70vh, 520px);
        padding: 0.8rem 0.85rem;
        border-radius: 14px;
        font-size: 0.84rem;
        line-height: 1.75;
    }

    .download-modal-content {
        max-height: min(58vh, 460px);
        padding: 0.82rem 0.86rem;
        font-size: 0.9rem;
        line-height: 1.75;
    }

    .download-modal-card .modal-close {
        top: 0.75rem;
        right: 0.75rem;
    }
}

@media (max-width: 420px) {
    .container {
        width: min(var(--container), calc(100% - 0.75rem));
    }

    .page-content {
        padding: 0.75rem 0 1rem;
    }

    .topbar-inner {
        gap: 0.55rem;
        padding: 0.55rem 0;
    }

    .brand-text {
        font-size: 0.95rem;
    }

    .nav a {
        padding: 0.4rem 0.16rem;
        font-size: 0.86rem;
    }

    .admin-topbar .nav a {
        padding: 0.38rem 0.12rem;
        font-size: 0.78rem;
    }

    .panel,
    .section-panel,
    .site-modal-card,
    .login-card {
        padding: 0.72rem;
    }

    .section-title {
        font-size: 1.35rem;
    }

    .upload-rule-trigger {
        min-height: 26px;
        padding: 0.2rem 0.5rem;
        font-size: 0.68rem;
    }

    .upload-title {
        font-size: 1.18rem;
    }

    .upload-intro {
        font-size: 0.84rem;
        margin-bottom: 0.65rem;
    }

    .overview-card {
        min-height: 80px;
    }

    .overview-value {
        font-size: 1.38rem;
    }

    .field input,
    .field textarea,
    .field select {
        padding: 0.56rem 0.66rem;
        font-size: 0.88rem;
    }

    .button,
    button.button {
        min-height: 32px;
        padding: 0.5rem 0.72rem;
        font-size: 0.86rem;
    }

    .button-compact,
    button.button-compact {
        min-height: 28px;
        padding: 0.34rem 0.6rem;
        font-size: 0.78rem;
    }

    .modal-actions .button,
    .modal-actions button.button,
    .flash-modal-actions .button,
    .flash-modal-actions button.button {
        min-height: 28px;
        padding: 0.34rem 0.6rem;
        font-size: 0.78rem;
    }

    .captcha-panel {
        padding: 0.78rem 0.8rem;
        gap: 0.6rem;
    }

    .captcha-remote-head {
        flex-direction: column;
        align-items: stretch;
    }

    .script-row {
        padding: 0.56rem 0.64rem;
    }

    .row-title {
        font-size: 0.86rem;
    }

    .row-summary {
        font-size: 0.82rem;
    }

    .row-subtitle {
        font-size: 0.74rem;
    }

    .home-banner-close {
        padding: 0.12rem 0.3rem;
        font-size: 0.64rem;
    }

    .home-banner-count {
        min-width: 16px;
        height: 16px;
        font-size: 0.58rem;
    }

    .download-modal-title {
        font-size: 1.05rem;
    }

    .download-modal-content {
        max-height: min(56vh, 420px);
        padding: 0.74rem 0.76rem;
        font-size: 0.84rem;
        line-height: 1.68;
    }

    .rules-modal-card .modal-close {
        top: 0.55rem;
        right: 0.55rem;
        width: 22px;
        height: 22px;
        font-size: 0.76rem;
    }

    .rules-modal-content {
        padding: 0.72rem 0.76rem;
        font-size: 0.8rem;
        line-height: 1.68;
    }
}
