:root {
    --bg-base: #fafafa;
    --card-bg: #ffffff;
    --border-color: #eaeaea;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;
    --accent-color: #000000;
    --accent-hover: #333333;
    --accent-glow: rgba(0, 0, 0, 0.08);
    --error: #ef4444;
    --success: #10b981;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-display: 'Inter', -apple-system, sans-serif;
    /* Keep extremely clean */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
    background-size: 24px 24px;
}

/* App Layout - Mobile First & Elegant */
.app-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 30px 20px;
    position: relative;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* View State Management */
.view-section {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glass Panels / Cards */
.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 24px -6px rgba(0, 0, 0, 0.04);
}

/* --- HOME VIEW --- */
.app-header {
    text-align: center;
    margin-bottom: 24px;
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.logo-emoji {
    font-size: 2rem;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.logo-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
    margin-bottom: 16px;
}

/* Report Counter Layout */
.report-counter {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0px;
    margin-bottom: 20px;
    font-family: var(--font-display);
    white-space: nowrap;
}

.counter-label, .counter-unit {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0px;
}

/* Flip Counter Styling */
.flip-counter {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.flip-digit {
    position: relative;
    width: 20px;
    height: 28px;
    background: var(--accent-color);
    color: #fff;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 28px;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* The "Split" line */
.flip-digit::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 2;
}

/* Animation for entering numbers */
.flip-digit span {
    display: inline-block;
    animation: flipIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes flipIn {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.search-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* The Search Pill */
.search-pill {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 99px;
    padding: 4px 4px 4px 16px;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s, border-color 0.3s;
}

.search-pill:focus-within {
    border-color: #d1d5db;
    box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.1);
}

.search-icon {
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.search-pill input {
    flex-grow: 1;
    border: none;
    background: transparent;
    font-size: 1.05rem;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-sans);
}

.search-pill input::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

.pill-submit-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 99px;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    white-space: nowrap;
}

.pill-submit-btn:hover {
    background: var(--accent-hover);
}

.pill-submit-btn:active {
    transform: scale(0.96);
}

/* Accordions */
details {
    width: 100%;
    transition: all 0.3s;
}

details summary {
    cursor: pointer;
    outline: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

details summary::-webkit-details-marker {
    display: none;
}

.minimal-accordion {
    text-align: center;
}

.minimal-accordion summary {
    justify-content: center;
}

.minimal-accordion p {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
}

.advanced-settings-accordion {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 10px;
}

.advanced-settings-accordion summary {
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid transparent;
}

.advanced-settings-accordion[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.accordion-badge {
    background: #f3f4f6;
    color: var(--text-tertiary);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 99px;
    margin-left: auto;
}

.settings-panel {
    padding: 16px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.minimal-input {
    width: 100%;
    background: #f9fafb;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: all 0.2s;
    outline: none;
}

.minimal-input:focus {
    border-color: var(--text-tertiary);
    background: #fff;
}

.provider-links-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.api-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.api-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.api-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.error-toast {
    color: var(--error);
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
    animation: fadeIn 0.3s ease;
    text-align: center;
}

/* --- LOADING VIEW --- */
.loading-header {
    text-align: center;
    margin-bottom: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.stage-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.stage-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Comment Showcase */
.comment-showcase-wrapper {
    margin-bottom: 30px;
}

.stream-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.live-indicator {
    background: #000;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    animation: blink 2s infinite;
    letter-spacing: 0.5px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.comment-showcase {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px -6px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 20px;
    align-items: flex-start;
    transition: opacity 0.3s ease-in-out;
    min-height: 160px;
}

.showcase-empty {
    width: 100%;
    text-align: center;
    padding: 40px 0;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    font-style: italic;
}



.showcase-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.showcase-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.showcase-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.rating-badge {
    background: #f3f4f6;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.showcase-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    font-style: italic;
    margin-top: 6px;
    border-left: 2px solid #e5e7eb;
    padding-left: 12px;
}

.terminal-logs {
    background: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: 'Berkeley Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #6b7280;
    min-height: 100px;
    max-height: 260px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.log-entry {
    padding: 3px 0;
    border-left: 2px solid #e5e7eb;
    padding-left: 10px;
    margin-bottom: 8px;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}



/* --- FAVORITES SECTION --- */
.favorites-box {
    background: rgba(255, 255, 255, 0.5);
    border: 1.5px solid #000;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0 24px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.favorites-label {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.favorites-content {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    font-family: 'Outfit', sans-serif;
}

/* --- RESULT VIEW --- */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.result-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.secondary-btn {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.secondary-btn:hover {
    border-color: #d1d5db;
    background: #fafafa;
}

.report-canvas {
    background: #ffffff;
    padding: 32px 24px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

.report-header-brand {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 40px;
    color: #d1d5db;
    text-transform: uppercase;
}

.report-footer-brand {
    text-align: center;
    margin-top: 40px;
    font-size: 0.75rem;
    color: #d1d5db;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

/* Radar */
.radar-wrapper {
    position: relative;
    max-width: 440px;
    margin: 0 auto 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

canvas#radarChart {
    position: relative;
    z-index: 1;
    width: 100%;
    margin-bottom: 24px;
    min-height: 280px;
}

.radar-summary {
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: left;
    background: #fafafa;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px dashed #d1d5db;
    font-weight: 400;
    line-height: 1.6;
}

/* Markdown Styles */
.markdown-body {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-primary);
}

#report-global-profile {
    margin-bottom: 20px;
}

#report-global-profile h1 {
    font-size: 1.6rem;
    color: #000;
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -1px;
    text-align: left;
}

#report-global-profile p {
    margin-bottom: 8px;
    text-align: justify;
    color: #374151;
    font-size: 1.05rem;
    line-height: 1.6;
}

.report-section {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px -4px rgba(0, 0, 0, 0.03);
}

.section-heading {
    color: #000;
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.section-content p {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* User Characteristic Tags */
.user-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    justify-content: center;
}

.user-tag {
    background: #111827;
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-block;
    border: 1px solid #374151;
}

/* Expandable styles */
.report-section.expandable.collapsed .section-content {
    display: none;
}

.report-section.expandable {
    transition: all 0.3s ease;
}

.section-content hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

.section-content strong {
    color: #000;
    font-weight: 700;
}

.section-content blockquote {
    border-left: 3px solid #000;
    background: #fafafa;
    padding: 10px 14px;
    margin: 8px 0;
    border-radius: 0 6px 6px 0;
    color: #4b5563;
    font-style: italic;
    font-size: 0.8rem;
    line-height: 1.4;
}

.export-actions {
    text-align: center;
    margin-top: 30px;
}

.export-actions .primary-btn {
    display: inline-flex;
    justify-content: center;
    padding: 14px 32px;
    border-radius: 99px;
}

.app-footer {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    margin-top: auto;
    padding-top: 40px;
}

/* Desktop Enhancements */
@media (min-width: 600px) {
    .settings-grid {
        grid-template-columns: 1fr 1fr;
    }

    .search-pill {
        padding: 8px 8px 8px 24px;
    }

    .search-pill input {
        font-size: 1.1rem;
    }

    .pill-submit-btn {
        padding: 12px 32px;
        font-size: 1rem;
    }

    .showcase-header {
        flex-direction: row;
        align-items: center;
    }
}
/* CinePersona Promo Box */
.cp-promo-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border: 1.5px dashed var(--border-color);
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}
.cp-promo-box p {
    margin: 0;
    line-height: 1.5;
}
.cp-promo-box a {
    color: var(--accent-color);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}
.cp-promo-box a:hover {
    color: var(--text-tertiary);
}
.cp-badge {
    background: #000;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.beta-tag {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 400;
}
.result-footer-promo, .home-footer-promo {
    margin-top: 36px;
    opacity: 0.85;
    transition: opacity 0.3s;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}
.result-footer-promo:hover, .home-footer-promo:hover {
    opacity: 1;
}
@media (max-width: 480px) {
    .cp-promo-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        text-align: left;
    }
}
