:root {
    --bg: #f4efe6;
    --bg-accent: #efe3d0;
    --panel: rgba(255, 252, 246, 0.82);
    --panel-strong: #fffaf1;
    --line: rgba(76, 51, 27, 0.12);
    --text: #2f2317;
    --muted: #6e5d4a;
    --accent: #b55d2f;
    --accent-strong: #8d3d1b;
    --accent-soft: #f1d5bb;
    --success: #2d8053;
    --danger: #9b2d2d;
    --shadow: 0 24px 60px rgba(73, 48, 20, 0.12);
    --radius-lg: 28px;
    --radius-md: 20px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(232, 171, 120, 0.32), transparent 28%),
        radial-gradient(circle at top right, rgba(128, 179, 154, 0.2), transparent 24%),
        linear-gradient(135deg, var(--bg), var(--bg-accent));
}

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

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

.page-shell {
    width: min(1380px, calc(100vw - 40px));
    margin: 0 auto;
    padding: 36px 0 48px;
}

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

.topbar-brand,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.topbar-brand strong,
.topbar-brand span {
    display: block;
}

.topbar-brand span {
    font-size: 13px;
    color: var(--muted);
}

.topbar-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--accent), var(--accent-strong));
    color: #fffaf1;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.topbar-link {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(47, 35, 23, 0.06);
}

.user-pill {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(45, 128, 83, 0.1);
    color: var(--success);
    font-size: 13px;
    font-weight: 700;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(340px, 0.9fr);
    gap: 24px;
    align-items: stretch;
}

.hero-copy,
.hero-panel,
.search-panel,
.results-panel,
.query-card,
.image-card {
    backdrop-filter: blur(14px);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero-copy {
    border-radius: var(--radius-lg);
    padding: 38px;
    position: relative;
    overflow: hidden;
}

.hero-copy::after {
    content: "";
    position: absolute;
    inset: auto -10% -35% auto;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(181, 93, 47, 0.18), transparent 65%);
}

.eyebrow,
.section-eyebrow,
.query-label {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 12px;
    color: var(--accent-strong);
}

.hero h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.hero-text {
    max-width: 620px;
    margin: 20px 0 0;
    font-size: 16px;
    line-height: 1.75;
    color: var(--muted);
}

.hero-panel {
    border-radius: var(--radius-lg);
    padding: 24px;
}

.stat-grid {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.stat-card {
    min-height: 120px;
    padding: 20px;
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.66), rgba(248, 237, 221, 0.8));
    border: 1px solid rgba(97, 68, 40, 0.1);
}

.stat-wide {
    grid-column: 1 / -1;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

.stat-card strong {
    display: block;
    margin-top: 18px;
    font-size: clamp(24px, 3vw, 40px);
    line-height: 1.1;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.search-panel,
.results-panel {
    border-radius: var(--radius-lg);
    padding: 24px;
}

.search-form {
    display: grid;
    gap: 18px;
}

.text-search-form {
    display: grid;
    gap: 12px;
    margin-top: 6px;
    padding: 18px;
    border-radius: 22px;
    background: var(--panel-strong);
    border: 1px solid rgba(76, 51, 27, 0.08);
}

.text-search-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-strong);
}

.text-search-input {
    width: 100%;
    appearance: none;
    border: 1px solid rgba(76, 51, 27, 0.14);
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.82);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-search-input:focus {
    border-color: rgba(181, 93, 47, 0.5);
    box-shadow: 0 0 0 4px rgba(181, 93, 47, 0.12);
}

.search-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.search-divider span {
    padding: 0 12px;
}

.dropzone {
    position: relative;
    min-height: 320px;
    padding: 28px;
    border: 2px dashed rgba(181, 93, 47, 0.34);
    border-radius: 26px;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.88), rgba(242, 225, 204, 0.76));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 10px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 18px 45px rgba(181, 93, 47, 0.16);
}

.dropzone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.4;
}

.dropzone-subtitle {
    font-size: 14px;
    color: var(--muted);
}

.dropzone-preview {
    display: none;
    width: min(100%, 280px);
    max-height: 180px;
    margin-top: 12px;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(47, 35, 23, 0.12);
}

.dropzone.has-preview .dropzone-preview {
    display: block;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.primary-button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff8f2;
    padding: 14px 26px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 16px 32px rgba(139, 67, 29, 0.22);
}

.secondary-button {
    appearance: none;
    border: 1px solid rgba(76, 51, 27, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--accent-strong);
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.secondary-link {
    color: var(--accent-strong);
    font-weight: 600;
}

.message {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.message.success {
    background: rgba(45, 128, 83, 0.1);
    color: var(--success);
}

.message.error {
    background: rgba(155, 45, 45, 0.08);
    color: var(--danger);
}

.tips {
    margin-top: 26px;
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--panel-strong);
    border: 1px solid rgba(76, 51, 27, 0.08);
}

.tips h2,
.section-head h2,
.query-meta h2 {
    margin: 0;
    font-size: 24px;
}

.tips ul {
    margin: 14px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.8;
}

.query-card {
    border-radius: var(--radius-md);
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
    gap: 22px;
    padding: 20px;
}

.text-query-card {
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 18px;
    backdrop-filter: blur(14px);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.text-query-card h2 {
    margin: 0;
    font-size: 24px;
}

.text-query-copy {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.query-image-wrap {
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.78);
    min-height: 220px;
}

.query-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.query-meta {
    display: grid;
    align-content: center;
    gap: 12px;
}

.meta-row,
.hash-block,
.card-actions,
.image-card-top,
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.meta-row {
    justify-content: flex-start;
    color: var(--muted);
}

.hash-block code {
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(47, 35, 23, 0.06);
    font-size: 13px;
}

.section-head {
    margin: 24px 0 18px;
}

.section-count {
    color: var(--muted);
    font-size: 14px;
}

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

.empty-state {
    padding: 42px 28px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px dashed rgba(181, 93, 47, 0.25);
    text-align: center;
}

.empty-state h3 {
    margin: 0 0 10px;
    font-size: 22px;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.image-card {
    border-radius: 22px;
    overflow: hidden;
}

.image-link {
    display: block;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.7);
}

.image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-card-body {
    padding: 16px;
}

.tone-chip {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.score-badge,
.size-badge {
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(47, 35, 23, 0.07);
    color: var(--accent-strong);
}

.image-card h3 {
    margin: 14px 0 8px;
    font-size: 15px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-card p {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--muted);
}

.image-description {
    margin: 0 0 10px;
    min-height: 42px;
    color: var(--text);
    line-height: 1.6;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.image-meta {
    margin: 0 0 14px;
}

.card-actions a {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-strong);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 440px);
    gap: 24px;
}

.auth-copy,
.auth-form-card {
    backdrop-filter: blur(14px);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.auth-copy {
    border-radius: 30px;
    padding: 42px;
    align-self: stretch;
}

.auth-copy h1 {
    margin: 0 0 18px;
    font-size: clamp(36px, 5vw, 56px);
    line-height: 1.04;
    letter-spacing: -0.04em;
}

.auth-copy p:last-child {
    margin: 0;
    max-width: 560px;
    color: var(--muted);
    line-height: 1.8;
    font-size: 16px;
}

.auth-form-panel {
    display: flex;
    align-items: stretch;
}

.auth-form-card {
    width: 100%;
    border-radius: 30px;
    padding: 28px;
}

.auth-form-card h2 {
    margin: 0 0 20px;
    font-size: 28px;
}

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

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

.field span {
    font-size: 14px;
    font-weight: 600;
}

.field input {
    width: 100%;
    appearance: none;
    border: 1px solid rgba(76, 51, 27, 0.14);
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.82);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
    border-color: rgba(181, 93, 47, 0.5);
    box-shadow: 0 0 0 4px rgba(181, 93, 47, 0.12);
}

.auth-submit {
    width: 100%;
    margin-top: 4px;
}

.auth-note {
    margin-top: 18px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(47, 35, 23, 0.05);
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.auth-note strong {
    color: var(--text);
    font-size: 14px;
}

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

.admin-layout {
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.5fr);
}

.panel-card {
    border-radius: 28px;
    padding: 24px;
    backdrop-filter: blur(14px);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.panel-card-wide {
    min-width: 0;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-head h2 {
    margin: 0;
    font-size: 28px;
}

.panel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.panel-meta span {
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(47, 35, 23, 0.06);
    color: var(--muted);
    font-size: 13px;
}

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

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

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

.compact-checkbox {
    white-space: nowrap;
}

.table-shell {
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 880px;
}

.user-table th,
.user-table td {
    text-align: left;
    vertical-align: top;
    padding: 14px 12px;
    border-bottom: 1px solid rgba(76, 51, 27, 0.08);
}

.user-table th {
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
}

.user-table td strong {
    display: block;
    margin-bottom: 6px;
}

.muted-text {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-chip.is-active {
    background: rgba(45, 128, 83, 0.1);
    color: var(--success);
}

.status-chip.is-inactive {
    background: rgba(155, 45, 45, 0.08);
    color: var(--danger);
}

.inline-form {
    display: grid;
    gap: 10px;
}

.inline-form input[type="text"],
.inline-form input[type="password"] {
    width: 100%;
    appearance: none;
    border: 1px solid rgba(76, 51, 27, 0.14);
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.82);
    outline: none;
}

.inline-form input[type="text"]:focus,
.inline-form input[type="password"]:focus {
    border-color: rgba(181, 93, 47, 0.5);
    box-shadow: 0 0 0 4px rgba(181, 93, 47, 0.12);
}

.inline-form-password {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-form-password .secondary-button {
    grid-column: 1 / -1;
}

@media (max-width: 1080px) {
    .topbar,
    .hero,
    .content-grid,
    .query-card,
    .auth-card,
    .dashboard-grid,
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .page-shell {
        width: min(100vw - 24px, 1380px);
        padding-top: 20px;
    }
}

@media (max-width: 720px) {
    .topbar {
        padding: 14px 16px;
    }

    .hero-copy,
    .hero-panel,
    .search-panel,
    .results-panel,
    .auth-copy,
    .auth-form-card,
    .panel-card {
        padding: 18px;
        border-radius: 24px;
    }

    .dropzone {
        min-height: 240px;
        padding: 22px;
    }

    .dropzone-title {
        font-size: 20px;
    }

    .query-image-wrap {
        min-height: 160px;
    }
}
