/* ============================================================
   Handwriting Matcher — Girl Economy / TikTok UI
   ============================================================ */

/* ---------- Reset & Variables ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #080305;
    --bg-card: rgba(255, 60, 120, 0.04);
    --bg-glass: rgba(255, 60, 120, 0.05);
    --border: rgba(255, 60, 120, 0.10);
    --border-glow: rgba(255, 60, 120, 0.08);
    --text: #f5f0f2;
    --text-dim: #c48da0;
    --accent: #ff3c78;
    --accent-glow: rgba(255, 60, 120, 0.3);
    --accent2: #ff6ba0;
    --accent2-glow: rgba(255, 107, 160, 0.3);
    --gradient: linear-gradient(135deg, #ff3c78, #ff6ba0, #ffb6d9);
    --gradient-subtle: linear-gradient(135deg, rgba(255,60,120,0.15), rgba(255,107,160,0.08));
    --gradient-card: linear-gradient(160deg, rgba(255, 60, 120, 0.06), rgba(255, 107, 160, 0.03), transparent);
    --rose-gold: #f5a0b8;
    --blush: #ffe0ec;
    --pink-glass: rgba(255, 60, 120, 0.035);
    --font: 'Space Grotesk', 'Outfit', -apple-system, sans-serif;
    --font-display: 'Space Grotesk', 'Outfit', sans-serif;
    --font-handwritten: 'Caveat', cursive;
    --radius: 20px;
    --radius-sm: 14px;
    --pink-soft: #ffc0d6;
    --coral: #ffaed0;
    --gold: #ffb84d;
    --gold-glow: rgba(255, 184, 77, 0.25);
}

html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.admin-body {
    overflow-x: clip;
}

/* ---------- Screens ---------- */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    position: relative;
    overflow: hidden;
}
.screen.active { display: flex; }

/* ---------- Background Grid ---------- */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* ---------- Ambient Orbs ---------- */
.ambient-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(100px);
    opacity: 0.35;
}
.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 60, 120, 0.5), transparent 70%);
    top: -15%;
    right: -10%;
    animation: orbDrift1 18s ease-in-out infinite alternate;
}
.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(180, 40, 100, 0.45), transparent 70%);
    bottom: -10%;
    left: -12%;
    animation: orbDrift2 22s ease-in-out infinite alternate;
}
@keyframes orbDrift1 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-60px, 40px) scale(1.15); }
}
@keyframes orbDrift2 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -30px) scale(1.1); }
}

/* ---------- Grain Overlay ---------- */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---------- Vignette ---------- */
#landing::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(8, 3, 5, 0.7) 100%);
    pointer-events: none;
    z-index: 0;
}

/* ---------- Badge ---------- */
.badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 2px;
    background: var(--gradient);
    color: white;
    margin-bottom: 24px;
    text-transform: uppercase;
}

.badge-redflag {
    background: linear-gradient(135deg, #ff3c78, #e8445a, #ffb84d);
    box-shadow: 0 0 20px rgba(255, 60, 120, 0.3), 0 0 60px rgba(255, 60, 120, 0.1);
    animation: badgePulse 2s ease-in-out infinite;
    font-size: 0.75rem;
    letter-spacing: 2.5px;
    padding: 8px 24px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ============================================================
   LANDING
   ============================================================ */
#landing {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    z-index: 1;
    overflow: hidden;
}

.landing-content {
    max-width: 640px;
    position: relative;
    z-index: 2;
}

.landing-topbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.admin-entry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-entry:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
    box-shadow: 0 0 18px var(--accent-glow);
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 7vw, 3.8rem);
    line-height: 1.1;
    margin-bottom: 24px;
    font-weight: 800;
    text-transform: lowercase;
    text-shadow: 0 0 60px rgba(255, 60, 120, 0.12);
}
.hero-title .line1 {
    display: block;
    color: var(--text);
}
.hero-title .line2 {
    display: block;
}
.hero-title em {
    font-style: normal;
    font-weight: 900;
    background: linear-gradient(135deg, #ff3c78, #ff6ba0, #ffb84d);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmerText 4s ease-in-out infinite;
}
@keyframes shimmerText {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

.subtitle {
    font-size: 1.05rem;
    color: var(--text-dim);
    line-height: 1.7;
    margin-bottom: 28px;
    font-weight: 400;
}
.subtitle strong {
    color: var(--text);
    font-weight: 600;
}
.subtitle-kicker {
    display: block;
    margin-top: 8px;
    font-family: var(--font-handwritten);
    font-size: 1.35rem;
    color: var(--accent);
    font-weight: 600;
}

/* ---------- Social Proof Ticker ---------- */
.social-proof-ticker {
    width: calc(100% + 48px);
    margin-left: -24px;
    overflow: hidden;
    margin-bottom: 36px;
    padding: 14px 0;
    background: rgba(255, 60, 120, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 60, 120, 0.08);
    border-bottom: 1px solid rgba(255, 60, 120, 0.08);
    mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

.ticker-track {
    display: flex;
    gap: 40px;
    white-space: nowrap;
    animation: tickerScroll 30s linear infinite;
    width: max-content;
}

.ticker-item {
    font-family: var(--font-handwritten);
    font-size: 1.05rem;
    color: var(--pink-soft);
    font-weight: 600;
    flex-shrink: 0;
}

/* ---------- Dropzone ---------- */
.dropzone {
    border: 2px dashed rgba(255, 60, 120, 0.22);
    border-radius: var(--radius);
    padding: 52px 24px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    background: rgba(255, 60, 120, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 60px rgba(255, 60, 120, 0.03);
}
.dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.4s;
}
.dropzone:hover, .dropzone.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 48px var(--accent-glow), inset 0 0 80px rgba(255, 60, 120, 0.06);
    background: rgba(255, 60, 120, 0.06);
    transform: translateY(-2px);
}
.dropzone:hover::before, .dropzone.drag-over::before {
    opacity: 0.05;
}

.dropzone-inner {
    position: relative;
    z-index: 1;
}
.upload-icon {
    font-size: 2.8rem;
    margin-bottom: 14px;
    line-height: 1;
    filter: drop-shadow(0 0 12px rgba(255, 60, 120, 0.3));
}
.drop-text {
    font-size: 1.12rem;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: lowercase;
}
.drop-hint {
    color: var(--text-dim);
    font-size: 0.88rem;
    font-family: var(--font-handwritten);
    font-weight: 600;
}

/* ---------- OR Divider ---------- */
.or-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 32px 0;
}
.or-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}
.or-text {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 3px;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* ---------- Drawing Pad ---------- */
.draw-pad-section {
    background: rgba(255, 60, 120, 0.03);
    border: 1px solid rgba(255, 60, 120, 0.12);
    border-radius: var(--radius);
    padding: 24px;
    text-align: left;
    transition: all 0.3s ease;
}
.draw-pad-section:hover {
    border-color: rgba(255, 60, 120, 0.25);
}


.draw-pad-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.draw-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}
.draw-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: lowercase;
}
.draw-pad-header .draw-hint {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-family: var(--font-handwritten);
    font-weight: 600;
}

.draw-canvas-wrap {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid rgba(255, 60, 120, 0.22);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color 0.3s, box-shadow 0.3s;
    cursor: crosshair;
    flex: 1;
    display: flex;
    min-height: 200px;
    touch-action: none;
    overscroll-behavior: contain;
}
.draw-canvas-wrap:hover,
.draw-canvas-wrap.drawing {
    border-color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
}

#draw-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    background: transparent;
}

.draw-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.1rem;
    font-weight: 500;
    transition: opacity 0.3s;
}
.draw-placeholder.hidden {
    opacity: 0;
}

.draw-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}
.draw-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.draw-btn:hover {
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 12px var(--accent-glow);
}
.draw-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

.draw-analyze-btn {
    display: flex;
    flex-direction: column;
    margin-left: auto;
    font-size: 0.9rem;
    padding: 10px 24px;
}
.draw-analyze-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ---------- Drawing Modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(10, 4, 7, 0.82);
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
    overscroll-behavior: contain;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 520px;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #0f070b;
    border: 1px solid rgba(255, 60, 120, 0.25);
    border-radius: 28px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transform: translateY(0) scale(1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overscroll-behavior: contain;
}

.modal.is-drawing .modal-content {
    overflow: hidden;
}

.modal.hidden .modal-content {
    transform: translateY(30px) scale(0.95);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: var(--accent);
    color: white;
    transform: rotate(90deg);
}

.center-header {
    justify-content: center;
    text-align: center;
    margin-top: 4px;
    margin-bottom: 24px;
    padding-right: 24px; /* Avoid clear overlap with close button */
    padding-left: 24px;
}

/* ---------- Preview ---------- */
.preview-area {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: fadeSlideUp 0.4s ease;
}
.preview-area.hidden { display: none; }

.preview-trigger {
    border: 0;
    padding: 0;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.preview-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 28px var(--accent-glow);
}
.preview-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.preview-area img {
    display: block;
    max-width: 300px;
    max-height: 200px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    object-fit: contain;
    background: var(--bg-card);
    padding: 8px;
}

.preview-name {
    max-width: 320px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-hint {
    color: var(--text-dim);
    font-size: 0.82rem;
}

.preview-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    border: none;
    border-radius: 100px;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 24px var(--accent-glow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: ctaPulse 2.5s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}
.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -75%;
    width: 50%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-25deg);
    animation: btnShimmer 4s ease-in-out infinite;
}
@keyframes btnShimmer {
    0%, 100% { left: -75%; }
    50%      { left: 150%; }
}
.btn-primary:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 40px var(--accent-glow), 0 0 60px rgba(255, 45, 85, 0.15);
    animation: none;
}
.btn-primary:hover::after {
    animation: none;
    opacity: 0;
}
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled {
    animation: none;
}
.btn-primary:disabled::after {
    animation: none;
    opacity: 0;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
    box-shadow: none;
    animation: none;
}
.btn-outline::after {
    display: none;
}
.btn-outline:hover {
    border-color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
}

.btn-icon { font-size: 1.2rem; }

/* ============================================================
   SCANNING
   ============================================================ */
#scanning {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    padding: 24px;
}

#particle-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.scanning-content {
    position: relative;
    z-index: 1;
    width: 100%;
}

.scan-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    position: relative;
    margin: 0 auto 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ringRotate 3s linear infinite;
}
.scan-ring-inner {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient);
    opacity: 0.15;
    animation: innerPulse 1.5s ease-in-out infinite;
}
.scan-pulse {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    opacity: 0;
    animation: pulseOut 2s ease-out infinite;
}

.scan-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin-bottom: 32px;
    text-transform: lowercase;
    font-weight: 600;
}

.scan-steps { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.scan-step {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 0.95rem;
    transition: all 0.3s;
}
.scan-step.active { color: var(--text); }
.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}
.scan-step.active .step-dot {
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ============================================================
   RESULTS
   ============================================================ */
#results {
    flex-direction: column;
    align-items: center;
    padding: 60px 24px 80px;
}

#reject {
    flex-direction: column;
    align-items: center;
    padding: 60px 24px 80px;
}

.results-content {
    max-width: 720px;
    width: 100%;
    text-align: center;
}

.reject-content {
    max-width: 920px;
}

.results-header { margin-bottom: 40px; }
.results-title {
    font-family: var(--font-handwritten);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    text-transform: lowercase;
    color: var(--text);
}

.reject-badge {
    background: linear-gradient(135deg, #ff3c78, #ff6ba0);
}

.reject-message {
    max-width: 620px;
    margin: 16px auto 0;
    color: var(--text-dim);
    font-size: 1rem;
    line-height: 1.6;
}

.reject-card {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(260px, 1fr);
    gap: 28px;
    align-items: stretch;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 60, 120, 0.22);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
    animation: fadeSlideUp 0.6s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.reject-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(135deg, #ff3c78, #ff6ba0);
}

.reject-image-panel {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.reject-image-panel img {
    display: block;
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.reject-filename {
    margin-top: 12px;
    color: var(--text-dim);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    word-break: break-word;
}

.reject-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    gap: 18px;
}

.reject-chip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.reject-chip-label {
    color: var(--text-dim);
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.reject-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 60, 120, 0.12);
    border: 1px solid rgba(255, 107, 160, 0.28);
    color: #ffd0e6;
    font-size: 0.92rem;
    font-weight: 600;
}

.reject-reason {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
}

.reject-guidance {
    color: var(--text-dim);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* ---------- Top Match Card ---------- */
.match-card {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    position: relative;
    overflow: hidden;
    animation: fadeSlideUp 0.6s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.match-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient);
}

.top-card {
    margin-bottom: 48px;
}

.match-percentage {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    margin-bottom: 24px;
}
.pct-number {
    font-size: clamp(2.8rem, 7vw, 4rem);
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}
.pct-sign {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.pct-label {
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: var(--text-dim);
    margin-left: 8px;
}

.match-face {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0 auto 20px;
    border: 3px solid var(--accent);
    box-shadow: 0 0 40px var(--accent-glow);
    background: rgba(255, 255, 255, 0.05);
}
.match-face img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: var(--radius);
}

.match-name {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin-bottom: 12px;
    font-weight: 700;
}

.match-bio {
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 16px;
    max-height: 100px;
    overflow: hidden;
}

/* ---------- Wanted Badge ---------- */
.wanted-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(255, 60, 120, 0.18);
    border: 1px solid rgba(255, 60, 120, 0.45);
    color: #ff6ba0;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 12px;
    animation: wantedPulse 2s ease-in-out infinite;
}
.wanted-badge.hidden {
    display: none;
}
@keyframes wantedPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(255, 60, 120, 0.2); }
    50%      { box-shadow: 0 0 24px rgba(255, 60, 120, 0.45); }
}

/* ---------- Crimes List ---------- */
.crimes-container {
    margin-bottom: 20px;
}
.crimes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}
.crime-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 60, 120, 0.10);
    border: 1px solid rgba(255, 60, 120, 0.20);
    color: #ffd0e6;
    font-size: 0.76rem;
    font-weight: 600;
}
.crime-dot {
    color: var(--accent);
    font-size: 0.7rem;
}

.match-hw {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 8px;
}
.hw-label {
    display: block;
    font-size: 0.75rem;
    text-transform: lowercase;
    letter-spacing: 0;
    color: var(--text-dim);
    margin-bottom: 12px;
    font-family: var(--font-handwritten);
    font-weight: 600;
}
.match-hw img {
    max-width: 240px;
    max-height: 80px;
    border-radius: var(--radius-sm);
    opacity: 0.85;
    object-fit: contain;
}

.trait-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 60, 120, 0.12);
    border: 1px solid rgba(255, 60, 120, 0.24);
    color: #ffd0e6;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ---------- Controversial Cards ---------- */
.controversial-header {
    margin-bottom: 20px;
}
.controversial-header h3 {
    font-family: var(--font-handwritten);
    font-size: 1.2rem;
    text-transform: lowercase;
    letter-spacing: 0;
    color: var(--accent2);
    font-weight: 700;
}

.controversial-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 48px;
}

.controversial-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 28px 16px 22px;
    text-align: center;
    animation: fadeSlideUp 0.6s ease;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.controversial-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #ff3c78, #ff6ba0);
}

.controversial-card:hover {
    border-color: rgba(255, 60, 120, 0.28);
    box-shadow: 0 0 28px rgba(255, 60, 120, 0.12);
}

.controversial-card .controversial-pct {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ff3c78, #ff6ba0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 14px;
}

.controversial-card .controversial-face {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 14px;
    border: 2px solid rgba(255, 60, 120, 0.35);
    box-shadow: 0 0 20px rgba(255, 60, 120, 0.12);
}
.controversial-card .controversial-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.controversial-placeholder-face {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}
.controversial-placeholder-face::after {
    content: '?';
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-dim);
}

.controversial-card .controversial-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.controversial-reaction {
    font-size: 0.82rem;
    color: #ffaed0;
    font-style: italic;
    font-weight: 500;
    margin-bottom: 10px;
    line-height: 1.4;
}

.controversial-card .controversial-trait {
    display: flex;
    justify-content: center;
}

.controversial-trait-chip {
    background: rgba(255, 60, 120, 0.12) !important;
    border-color: rgba(255, 107, 160, 0.28) !important;
    color: #ffd0e6 !important;
    font-size: 0.75rem !important;
}

/* ---------- User Handwriting Preview ---------- */
.user-hw-preview {
    margin: 40px auto 36px;
    text-align: center;
    width: min(100%, 760px);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 60, 120, 0.18);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.user-hw-label {
    display: block;
    font-size: 0.85rem;
    text-transform: lowercase;
    letter-spacing: 0;
    color: var(--text-dim);
    margin-bottom: 14px;
    font-family: var(--font-handwritten);
    font-weight: 600;
}

.user-hw-preview img {
    display: block;
    width: 100%;
    min-height: 180px;
    max-height: 360px;
    object-fit: contain;
    object-position: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.045);
    padding: 16px;
    opacity: 1;
    transition: opacity 0.3s, filter 0.3s;
}

.user-hw-preview.is-drawn-preview img {
    max-height: 260px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border-color: rgba(255, 60, 120, 0.24);
}

.user-hw-preview img.is-drawn-signature {
    filter: invert(1) brightness(1.2);
    mix-blend-mode: normal;
}

/* ---------- Share Section ---------- */
.share-section {
    margin: 48px 0 40px;
    padding: 32px 28px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 60, 120, 0.18);
    border-radius: var(--radius);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 40px rgba(255, 60, 120, 0.06);
    animation: fadeSlideUp 0.6s ease;
    position: relative;
    overflow: hidden;
}
.share-section::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(135deg, #ff3c78, #ff6ba0, #ffb84d);
}
.share-section.hidden {
    display: none;
}

.share-header {
    text-align: center;
    margin-bottom: 24px;
}
.share-subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    font-family: var(--font-handwritten);
    font-weight: 600;
    margin-top: -12px;
}

.share-preview-wrap {
    margin: 0 auto 24px;
    max-width: 600px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid rgba(255, 60, 120, 0.18);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s, transform 0.3s;
}
.share-preview-wrap:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4), 0 0 40px rgba(255, 60, 120, 0.1);
    transform: translateY(-2px);
}
.share-preview-wrap img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #0f0508;
}

.share-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 100px;
    border: 1px solid rgba(255, 60, 120, 0.18);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}
.share-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
    background: rgba(255, 60, 120, 0.08);
}
.share-btn:active {
    transform: translateY(0) scale(0.97);
}

.share-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.share-btn-x {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}
.share-btn-x:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
    color: #fff;
}

.share-btn-download:hover {
    border-color: var(--gold);
    box-shadow: 0 0 20px var(--gold-glow);
    color: var(--gold);
}

.share-btn-copy:hover {
    border-color: rgba(245, 240, 242, 0.5);
    box-shadow: 0 0 20px rgba(245, 240, 242, 0.08);
}

.share-btn-native {
    display: none;
}

.share-btn-native.is-supported {
    display: inline-flex;
}

.share-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.share-ref-card {
    margin: 16px auto 0;
    max-width: 600px;
    padding: 0;
    text-align: center;
}

.share-ref-label {
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.share-ref-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.share-ref-link {
    color: var(--text);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
    word-break: break-word;
}

.share-ref-link:hover {
    color: var(--accent);
}

.share-ref-link.is-pending,
.share-ref-link.is-error {
    color: var(--text-dim);
    cursor: default;
}

.share-ref-hint {
    min-height: 1.2em;
    margin: 6px 0 0;
    color: rgba(245, 240, 242, 0.44);
    font-size: 0.72rem;
    line-height: 1.4;
}

@media (max-width: 640px) {
    .share-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .share-btn {
        width: 100%;
        justify-content: center;
    }
    .share-btn-native.is-supported {
        display: inline-flex;
    }
    .share-section {
        padding: 24px 18px;
    }
    .share-ref-row {
        gap: 6px;
    }
}


/* ---------- Retry Buttons ---------- */
.retry-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* ============================================================
   ADMIN
   ============================================================ */
.admin-shell {
    position: relative;
    z-index: 1;
    max-width: 1380px;
    margin: 0 auto;
    padding: 40px 24px 72px;
}

.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.admin-header-copy {
    max-width: 720px;
}

.admin-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.3rem);
    line-height: 1.1;
}

.admin-subtitle {
    margin-top: 14px;
    color: var(--text-dim);
    font-size: 1rem;
    line-height: 1.7;
}

.admin-back-link {
    flex-shrink: 0;
    text-decoration: none;
}

.admin-alert {
    margin-bottom: 24px;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    line-height: 1.5;
}

.admin-alert-success {
    border-color: rgba(34, 197, 94, 0.34);
    background: rgba(34, 197, 94, 0.12);
    color: #d7ffe1;
}

.admin-alert-error {
    border-color: rgba(255, 60, 120, 0.32);
    background: rgba(255, 60, 120, 0.12);
    color: #ffd0e6;
}

.admin-intro-grid {
    display: grid;
    grid-template-columns: minmax(340px, 560px) minmax(260px, 1fr);
    gap: 24px;
    align-items: start;
    margin-bottom: 32px;
}

.admin-form-card,
.admin-summary-card,
.database-section,
.profile-card {
    background: var(--gradient-card);
    border: 1px solid rgba(255, 60, 120, 0.12);
    border-radius: var(--radius);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2), 0 0 24px var(--border-glow);
    position: relative;
    overflow: hidden;
}

.database-section::before,
.profile-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient);
}

.admin-form-card,
.admin-summary-card,
.database-section {
    padding: 28px;
}

.admin-card-header {
    margin-bottom: 18px;
}

.admin-card-header h2 {
    font-size: 1.3rem;
}

.admin-eyebrow {
    margin-bottom: 8px;
    color: var(--accent2);
    font-size: 0.85rem;
    font-family: var(--font-handwritten);
    font-weight: 700;
    letter-spacing: 0;
    text-transform: lowercase;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.admin-field span {
    font-size: 0.88rem;
    font-weight: 600;
}

.admin-field input,
.admin-field textarea,
.admin-field select {
    width: 100%;
    border: 1px solid rgba(255, 60, 120, 0.12);
    border-radius: var(--radius-sm);
    background: rgba(255, 60, 120, 0.03);
    color: var(--text);
    font: inherit;
    padding: 14px 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.admin-field input[type="file"] {
    padding: 12px 14px;
    cursor: pointer;
}

.admin-field input:focus,
.admin-field textarea:focus,
.admin-field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 60, 120, 0.16), 0 0 20px var(--border-glow);
}

.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.admin-upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.admin-existing-media {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.admin-existing-card {
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.admin-existing-card img {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.admin-form-note {
    margin-top: 14px;
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.6;
}

.admin-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.admin-submit {
    flex: 1;
    justify-content: center;
}

.admin-cancel-link,
.admin-edit-link {
    text-decoration: none;
}

.admin-summary-copy {
    color: var(--text-dim);
    line-height: 1.7;
}

.admin-summary-note {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    line-height: 1.6;
}

.database-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.database-count {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 60, 120, 0.22);
    background: rgba(255, 60, 120, 0.08);
    color: var(--pink-soft);
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 0 12px var(--border-glow);
}

.database-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.profile-card {
    padding: 20px;
}

.profile-card-top {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.profile-name {
    font-size: 1.15rem;
    margin-bottom: 8px;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.profile-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 60, 120, 0.22);
    background: rgba(255, 60, 120, 0.12);
    color: #ffd0e6;
}

.profile-bio {
    margin: 16px 0 18px;
    color: var(--text-dim);
    font-size: 0.92rem;
    line-height: 1.65;
    min-height: 76px;
}

.profile-media-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.profile-media-card {
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.profile-media-label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.profile-media-card img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.profile-media-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 160px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
    padding: 12px;
}

/* ---------- Scan Error Inline ---------- */
.scan-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: fadeSlideUp 0.5s ease;
    overflow: hidden;
    padding: 16px;
}
.scan-error.hidden {
    display: none;
}
.scan-error-card {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 60, 120, 0.22);
    border-radius: var(--radius);
    padding: 48px 36px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    max-width: min(420px, calc(100vw - 32px));
    box-sizing: border-box;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}
.scan-error-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(135deg, #ff3c78, #ff6ba0);
}
.scan-error-icon {
    font-size: 2.8rem;
    margin-bottom: 16px;
}
.scan-error-title {
    font-family: var(--font-handwritten);
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffaed0;
    margin-bottom: 12px;
}
.scan-error-msg {
    color: var(--text-dim);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes innerPulse {
    0%, 100% { transform: scale(1); opacity: 0.15; }
    50%      { transform: scale(1.1); opacity: 0.25; }
}

@keyframes pulseOut {
    0%   { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(2); opacity: 0; }
}

@keyframes countUp {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 60, 120, 0.3), 0 0 60px rgba(255, 60, 120, 0.1); }
    50%      { box-shadow: 0 0 30px rgba(255, 60, 120, 0.5), 0 0 90px rgba(255, 184, 77, 0.12); }
}

@keyframes ctaPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 24px var(--accent-glow);
    }
    50% {
        transform: scale(1.04);
        box-shadow: 0 6px 32px rgba(255, 60, 120, 0.45), 0 0 60px rgba(255, 60, 120, 0.15);
    }
}

@keyframes tickerScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}



/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .controversial-cards { grid-template-columns: 1fr; }
    .match-card { padding: 28px 20px; }
    .retry-buttons { flex-direction: column; }
    .pct-number { font-size: 3rem; }
    .user-hw-preview {
        padding: 18px;
    }
    .user-hw-preview img {
        min-height: 140px;
        max-height: 240px;
        padding: 12px;
    }
    .user-hw-preview.is-drawn-preview img {
        max-height: 200px;
    }
    .reject-card {
        grid-template-columns: 1fr;
        padding: 22px 18px;
    }
    .reject-copy {
        align-items: stretch;
    }

    .admin-upload-grid,
    .admin-form-row,
    .admin-existing-media,
    .profile-media-grid {
        grid-template-columns: 1fr;
    }

    /* --- Modal mobile fixes --- */
    .modal {
        padding: 12px;
    }
    .modal-content {
        padding: 24px 16px;
        height: auto;
        border-radius: 20px;
    }
    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
        top: 12px;
        right: 12px;
    }
    .center-header {
        margin-bottom: 20px;
        margin-top: 12px;
        padding-right: 16px;
        padding-left: 16px;
    }
    .draw-title {
        font-size: 0.95rem;
    }
    .draw-canvas-wrap {
        min-height: 180px;
        max-height: 40vh;
    }
    .draw-controls {
        margin-top: 20px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas: 
            "undo clear"
            "expose expose";
        gap: 12px;
    }
    #undo-btn {
        grid-area: undo;
        width: 100%;
        justify-content: center;
    }
    #clear-btn {
        grid-area: clear;
        width: 100%;
        justify-content: center;
    }
    .draw-analyze-btn {
        grid-area: expose;
        width: 100%;
        margin-left: 0;
        justify-content: center;
        padding: 16px 20px;
        font-size: 1.05rem;
    }

    /* --- Landing Page Mobile Fixes --- */
    #landing {
        padding: 24px 16px;
    }
    .landing-topbar {
        margin-bottom: 10px;
    }
    .admin-entry {
        min-width: 60px;
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    .badge {
        margin-bottom: 16px;
        font-size: 0.65rem;
        padding: 6px 14px;
    }
    .hero-title {
        font-size: clamp(2rem, 9vw, 2.8rem);
        margin-bottom: 12px;
    }
    .subtitle {
        font-size: 0.92rem;
        margin-bottom: 16px;
        line-height: 1.55;
    }
    .subtitle-kicker {
        font-size: 1.1rem;
        margin-top: 4px;
    }
    .social-proof-ticker {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-bottom: 20px;
        padding: 10px 0;
    }
    .ticker-item {
        font-size: 0.9rem;
    }
    .dropzone {
        padding: 28px 16px;
    }
    .upload-icon {
        font-size: 2rem;
        margin-bottom: 8px;
    }
    .drop-text {
        font-size: 0.95rem;
    }
    .drop-hint {
        font-size: 0.8rem;
    }
    .or-divider {
        margin: 20px 0;
    }
    .draw-pad-section {
        padding: 16px;
    }
    .btn-primary.btn-outline {
        padding: 14px 18px;
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    /* Very small phones (iPhone SE, Galaxy S series mini) */
    .modal {
        padding: 6px;
    }
    .modal-content {
        padding: 16px 12px;
    }
    .draw-canvas-wrap {
        min-height: 160px;
        max-height: 35vh;
    }
    #landing {
        padding: 16px 12px;
    }
    .hero-title {
        font-size: 1.9rem;
    }
    .subtitle {
        font-size: 0.85rem;
    }
    .dropzone {
        padding: 22px 12px;
    }
}

@media (max-width: 900px) {
    .admin-header,
    .admin-intro-grid,
    .database-header {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .admin-back-link {
        width: 100%;
        justify-content: center;
    }
}

.utility-body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.utility-shell {
    position: relative;
    z-index: 1;
    width: min(720px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0 64px;
}

.utility-header,
.utility-nav,
.utility-inline-form,
.safe-topbar,
.safe-topbar-links,
.admin-header-actions,
.admin-alert-stack,
.stack-form,
.turnstile-wrap,
.consent-panel,
.history-preview-wrap,
.admin-card-actions,
.topbar-form,
.allowlist-row,
.allowlist-stack {
    display: flex;
}

.utility-header,
.safe-topbar,
.admin-header-actions {
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.utility-header {
    margin-bottom: 32px;
}

.utility-nav,
.safe-topbar-links,
.admin-header-actions,
.admin-card-actions,
.allowlist-row {
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.allowlist-stack {
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.allowlist-row {
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
}

.utility-nav a,
.safe-topbar a,
.utility-link-button,
.admin-entry-button {
    color: #f7dce5;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 18px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.utility-nav a:hover,
.safe-topbar a:hover,
.utility-link-button:hover,
.admin-entry-button:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
    box-shadow: 0 0 18px var(--accent-glow);
}

.utility-brand {
    text-decoration: none;
}

.panel-card,
.notice-card,
.auth-lock-card {
    background: var(--gradient-card);
    border: 1px solid rgba(255, 60, 120, 0.12);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28), 0 0 40px var(--border-glow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.panel-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient);
    border-radius: var(--radius) var(--radius) 0 0;
}

.panel-card {
    padding: 32px;
    margin-bottom: 24px;
}

.auth-panel,
.legal-panel {
    max-width: 560px;
    margin: 0 auto;
}

.utility-footer {
    margin-top: 48px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-dim);
    padding-top: 24px;
    border-top: 1px solid rgba(255, 60, 120, 0.08);
}

.utility-footer .footer-links {
    justify-content: center;
}

/* ---------- Legal Copy Typography ---------- */
.legal-copy {
    color: rgba(244, 238, 242, 0.82);
    line-height: 1.7;
    font-size: 0.95rem;
}

.legal-copy h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 32px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 60, 120, 0.12);
}

.legal-copy p {
    margin-bottom: 12px;
}

.legal-copy ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 12px;
}

.legal-copy ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
}

.legal-copy ul li::before {
    content: '·';
    position: absolute;
    left: 4px;
    color: var(--accent);
    font-weight: 800;
    font-size: 1.3em;
    line-height: 1.4;
}

.legal-copy a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.legal-copy a:hover {
    color: var(--accent2);
    text-decoration: underline;
}

.panel-copy {
    color: var(--text-dim);
    line-height: 1.65;
    font-size: 0.95rem;
}

.flash-stack,
.admin-alert-stack {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.flash-card {
    border-radius: var(--radius);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.92rem;
    position: relative;
    overflow: hidden;
}

.flash-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 3px;
    background: var(--gradient);
}

.flash-success {
    background: rgba(255, 60, 120, 0.08);
    border: 1px solid rgba(255, 60, 120, 0.18);
    color: var(--pink-soft);
}

.flash-error {
    background: rgba(255, 60, 120, 0.12);
    border: 1px solid rgba(255, 60, 120, 0.28);
    color: #ffd0e6;
}

.stack-form {
    flex-direction: column;
    gap: 16px;
}

.notice-card,
.auth-lock-card,
.consent-panel {
    padding: 18px 20px;
}

.notice-card,
.consent-panel,
.landing-footer-note,
.safe-results-copy {
    color: rgba(244, 238, 242, 0.82);
    line-height: 1.6;
}

.auth-lock-card {
    margin: 20px 0 24px;
    flex-direction: column;
    gap: 12px;
}

.disabled-dropzone {
    opacity: 0.55;
    cursor: not-allowed;
}

.consent-panel {
    margin-top: 18px;
    display: grid;
    gap: 12px;
}

.consent-checkbox,
.admin-checkbox-field {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    color: rgba(244, 238, 242, 0.9);
}

.turnstile-wrap {
    justify-content: center;
}

.landing-footer-note {
    margin-top: 20px;
    font-size: 0.95rem;
    text-align: center;
}

.safe-subtitle,
.safe-results-copy {
    max-width: 760px;
}

.runner-up-section {
    margin-top: 28px;
}

.history-section .database-grid {
    grid-template-columns: 1fr;
}

.history-card {
    background: var(--gradient-card) !important;
    border-color: rgba(255, 60, 120, 0.14) !important;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2), 0 0 30px var(--border-glow) !important;
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}

.history-card:hover {
    border-color: rgba(255, 60, 120, 0.28) !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3), 0 0 40px rgba(255, 60, 120, 0.12) !important;
    transform: translateY(-2px);
}

.history-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient);
}

.history-preview-wrap {
    margin: 16px 0;
    justify-content: center;
}

.history-preview-wrap img {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 60, 120, 0.18);
    background: rgba(255, 255, 255, 0.04);
    padding: 12px;
    box-shadow: 0 0 24px var(--border-glow);
    transition: box-shadow 0.3s;
}

.history-preview-wrap img:hover {
    box-shadow: 0 0 36px rgba(255, 60, 120, 0.15);
}

.admin-delete-link {
    color: var(--rose-gold) !important;
    border-color: rgba(255, 60, 120, 0.22) !important;
    background: rgba(255, 60, 120, 0.08) !important;
    font-size: 0.82rem;
    padding: 6px 16px;
    transition: all 0.2s ease;
}

.admin-delete-link:hover {
    background: rgba(255, 60, 120, 0.18) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 16px var(--accent-glow);
}

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

button.admin-entry {
    font: inherit;
    cursor: pointer;
}

.landing-footer-note {
    margin-top: 28px;
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.footer-links {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #ffd0e6;
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--text);
}

.login-prompt-card {
    max-width: 460px;
    text-align: center;
}

.quota-limit-card {
    max-width: 560px;
    text-align: center;
    overflow: hidden;
}

.quota-limit-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top center, rgba(255, 60, 120, 0.2), transparent 42%),
        radial-gradient(circle at bottom right, rgba(255, 184, 77, 0.08), transparent 28%);
    pointer-events: none;
}

.quota-limit-hero,
.quota-limit-header,
.quota-limit-copy,
.quota-limit-notes,
.quota-limit-actions {
    position: relative;
    z-index: 1;
}

.quota-limit-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.quota-limit-badge {
    box-shadow: 0 0 24px rgba(255, 60, 120, 0.22);
}

.quota-limit-meter {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 16px 24px;
    border-radius: 999px;
    border: 1px solid rgba(255, 107, 160, 0.26);
    background: rgba(255, 255, 255, 0.045);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.quota-limit-count,
.quota-limit-total {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 7vw, 3.5rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.04em;
}

.quota-limit-count {
    color: #fff4f8;
    text-shadow: 0 0 18px rgba(255, 107, 160, 0.28);
}

.quota-limit-total {
    color: rgba(255, 208, 230, 0.82);
}

.quota-limit-separator {
    color: rgba(255, 208, 230, 0.42);
    font-size: 1.8rem;
    font-weight: 600;
}

.quota-limit-label {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.login-prompt-header {
    margin-bottom: 14px;
}

.login-prompt-copy {
    color: rgba(244, 238, 242, 0.82);
    line-height: 1.65;
    margin-bottom: 20px;
}

.quota-limit-copy {
    max-width: 420px;
    margin: 0 auto 18px;
    color: rgba(244, 238, 242, 0.86);
    line-height: 1.75;
}

.quota-limit-copy strong {
    color: #fff3f7;
}

.quota-limit-notes {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.quota-limit-note {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(244, 238, 242, 0.74);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.login-prompt-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .utility-header,
    .safe-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .landing-topbar-actions,
    .footer-links,
    .login-prompt-actions {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .quota-limit-meter {
        padding: 14px 20px;
    }

    .login-prompt-actions {
        flex-direction: column;
    }

    .login-prompt-actions a,
    .login-prompt-actions button {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   AUTH: OAuth buttons, divider, toggle links
   ============================================================ */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.oauth-buttons {
    display: flex;
    gap: 12px;
}

.oauth-button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.25s ease, background 0.2s ease;
}
.oauth-button:active {
    transform: scale(0.97);
}
.oauth-button[aria-disabled="true"] {
    opacity: 0.4;
    pointer-events: none;
}

.oauth-icon {
    flex-shrink: 0;
}

.oauth-google {
    background: #fff;
    color: #3c4043;
    border: 1px solid rgba(0, 0, 0, 0.12);
}
.oauth-google:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.oauth-apple {
    background: #000;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.oauth-apple:hover {
    background: #1a1a1a;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.auth-link {
    text-align: center;
    margin-top: 22px;
    color: var(--text-dim);
    font-size: 0.88rem;
}
.auth-link a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.auth-link a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .oauth-buttons {
        flex-direction: column;
    }
}
