:root {
    --bg-main: #FBFBF9;
    --bg-section: #FFFFFF;
    --accent: #2D3FE7;
    --accent-light: #eef0ff;
    --text-primary: #0f172a;
    --text-secondary: #4A4A4A;
    --text-muted: #94a3b8;
    --border-soft: #EEEEEE;
    --radius-lg: 24px;
    --radius-md: 16px;
    --green: #10B981;
    --orange: #F59E0B;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100dvh;
}

/* Grain texture */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
}

/* ── Link Page (Mobile-first) ── */

.link-page {
    max-width: 480px;
    margin: 0 auto;
    padding: 32px 16px 24px;
    padding-top: max(32px, env(safe-area-inset-top, 32px));
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100dvh;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.logo-area img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.logo-area span {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}

.headline {
    font-size: clamp(1.6rem, 7vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.15;
}

.subline {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 28px;
    max-width: 400px;
    line-height: 1.6;
}

.cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.product-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: var(--bg-section);
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 0 0 20px;
    transition: border-color 0.25s, box-shadow 0.25s;
    position: relative;
    overflow: hidden;
}

.product-card:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

/* Card preview image */
.card-preview {
    width: 100%;
    height: 120px;
    object-fit: cover;
    object-position: center 30%;
    display: block;
    border-bottom: 1px solid var(--border-soft);
}

/* Card inner padding for text content */
.product-card .card-badge,
.product-card .card-title,
.product-card .card-desc,
.product-card .card-features,
.product-card .card-cta {
    margin-left: 20px;
    margin-right: 20px;
}

.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 6px;
    margin-top: 16px;
}

.card-badge.studio-badge {
    color: #D97706;
}

.card-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    line-height: 1.2;
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    flex: 1;
}

.card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 16px;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-main);
    border: 1px solid var(--border-soft);
    border-radius: 100px;
    padding: 4px 9px;
}

.feature-tag svg {
    width: 11px;
    height: 11px;
    color: var(--accent);
    flex-shrink: 0;
}

.feature-tag.studio-tag svg {
    color: #D97706;
}

/* ── Ask AI Highlight ── */

.ask-ai-highlight {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px;
    margin-right: 20px;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #fef3c7 0%, #fff7ed 100%);
    border: 2px solid #F59E0B;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}

.ask-ai-highlight::before {
    content: "";
    position: absolute;
    top: -1px;
    right: -1px;
    width: 48px;
    height: 48px;
    background: radial-gradient(circle at top right, rgba(245,158,11,0.15), transparent 70%);
    pointer-events: none;
}

.ask-ai-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #F59E0B;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ask-ai-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

.ask-ai-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ask-ai-label {
    font-size: 14px;
    font-weight: 800;
    color: #92400e;
    letter-spacing: -0.01em;
}

.ask-ai-sub {
    font-size: 11px;
    color: #b45309;
    line-height: 1.3;
}

.card-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: auto;
}

.card-cta.community-cta {
    background: var(--accent);
    color: white;
}

.card-cta.studio-cta {
    background: var(--text-primary);
    color: white;
}

.card-cta svg {
    width: 16px;
    height: 16px;
}

/* ── Testimonials ── */

.testimonials-section {
    width: 100%;
    margin-top: 28px;
}

.testimonials-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 12px;
}

.testimonials-scroll {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.testimonial-card {
    background: var(--bg-section);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 14px;
}

.testimonial-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.testimonial-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.testimonial-initial {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}

.testimonial-initial.studio-initial {
    background: #fef3c7;
    color: #D97706;
}

.testimonial-name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.testimonial-role {
    font-size: 11px;
    color: var(--text-muted);
}

.testimonial-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.testimonial-text strong {
    color: var(--text-primary);
}

.footer {
    margin-top: auto;
    padding-top: 32px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* ── Tablet + Desktop (640px+) ── */

@media (min-width: 640px) {
    .link-page {
        max-width: 720px;
        padding: 48px 32px 40px;
    }

    .logo-area {
        margin-bottom: 32px;
    }

    .logo-area img {
        width: 40px;
        height: 40px;
    }

    .logo-area span {
        font-size: 18px;
    }

    .headline {
        margin-bottom: 8px;
    }

    .subline {
        font-size: 15px;
        margin-bottom: 36px;
        max-width: 460px;
    }

    .cards {
        flex-direction: row;
        gap: 20px;
    }

    .product-card {
        flex: 1;
        min-width: 0;
        padding-bottom: 24px;
    }

    .cards {
        align-items: stretch;
    }

    .product-card:hover {
        border-color: var(--accent);
        box-shadow: 0 8px 32px rgba(45, 63, 231, 0.12);
        transform: translateY(-2px);
    }

    .product-card:hover .card-cta svg {
        transform: translateX(3px);
    }

    .card-preview {
        height: 160px;
    }

    .product-card .card-badge,
    .product-card .card-title,
    .product-card .card-desc,
    .product-card .card-features,
    .product-card .card-cta {
        margin-left: 24px;
        margin-right: 24px;
    }

    .card-badge {
        margin-top: 20px;
        margin-bottom: 8px;
    }

    .card-title {
        font-size: 20px;
        margin-bottom: 6px;
    }

    .card-desc {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .card-features {
        margin-bottom: 20px;
    }

    .ask-ai-highlight {
        margin-left: 24px;
        margin-right: 24px;
        padding: 14px 16px;
    }

    .testimonials-section {
        margin-top: 36px;
    }

    .testimonials-scroll {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .testimonial-card {
        padding: 16px;
    }

    .testimonial-avatar,
    .testimonial-initial {
        width: 36px;
        height: 36px;
    }

    .testimonial-text {
        font-size: 13px;
    }

    .footer {
        padding-top: 40px;
        font-size: 12px;
    }
}

/* ── Large Desktop (900px+) ── */

@media (min-width: 900px) {
    .link-page {
        max-width: 800px;
        padding: 56px 40px 48px;
    }

    .card-preview {
        height: 180px;
    }

    .card-cta {
        padding: 16px;
        font-size: 15px;
    }

    .card-cta.community-cta:hover {
        background: #2234c8;
    }

    .card-cta.studio-cta:hover {
        background: #000;
    }
}

/* ── Very small phones (< 360px) ── */

@media (max-width: 359px) {
    .link-page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .product-card .card-badge,
    .product-card .card-title,
    .product-card .card-desc,
    .product-card .card-features,
    .product-card .card-cta {
        margin-left: 16px;
        margin-right: 16px;
    }

    .card-title {
        font-size: 17px;
    }

    .card-desc {
        font-size: 12px;
    }

    .feature-tag {
        font-size: 10px;
        padding: 3px 7px;
    }

    .card-cta {
        padding: 12px;
        font-size: 13px;
        border-radius: 12px;
    }

    .ask-ai-highlight {
        margin-left: 16px;
        margin-right: 16px;
        padding: 10px 12px;
        gap: 10px;
    }

    .ask-ai-icon {
        width: 32px;
        height: 32px;
    }

    .ask-ai-icon svg {
        width: 16px;
        height: 16px;
    }

    .ask-ai-label {
        font-size: 13px;
    }

    .ask-ai-sub {
        font-size: 10px;
    }

    .testimonial-text {
        font-size: 11px;
    }
}

/* ── Analytics Dashboard (kept for analytics.html) ── */

.analytics-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 20px;
}

.analytics-page h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.analytics-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

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

.stat-card {
    background: var(--bg-section);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 20px;
}

.stat-card.winner {
    border-color: var(--green);
    box-shadow: 0 0 0 1px var(--green);
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-number.community-color { color: var(--accent); }
.stat-number.studio-color { color: var(--text-primary); }

.stat-today {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-today strong {
    color: var(--green);
}

.split-bar-wrapper {
    margin-bottom: 28px;
}

.split-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}

.split-bar {
    display: flex;
    height: 32px;
    border-radius: 100px;
    overflow: hidden;
    background: var(--border-soft);
}

.split-bar-fill {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: white;
    transition: width 0.6s ease;
    min-width: 40px;
}

.split-bar-fill.community-fill { background: var(--accent); }
.split-bar-fill.studio-fill { background: var(--text-primary); }

.section-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 140px;
    margin-bottom: 28px;
    padding: 0 4px;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    height: 100%;
    justify-content: flex-end;
}

.chart-stack {
    width: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
}

.chart-segment {
    width: 100%;
    min-height: 2px;
    transition: height 0.4s ease;
}

.chart-segment.community-seg { background: var(--accent); }
.chart-segment.studio-seg { background: #cbd5e1; }

.chart-label {
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-top: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 28px;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-soft);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-soft);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table .product-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.data-table .product-dot.community-dot { background: var(--accent); }
.data-table .product-dot.studio-dot { background: var(--text-primary); }

.loading-state {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
}

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

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

.auth-gate {
    max-width: 320px;
    margin: 120px auto;
    text-align: center;
}

.auth-gate input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.auth-gate input:focus {
    border-color: var(--accent);
}

.auth-gate button {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-gate button:hover {
    background: #2234c8;
}
