/* ============================================
   EroticaMaker — Design System
   Premium Dark Mode with Glass Effects
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

/* --- CSS Variables --- */
:root {
    --bg-primary: #07060b;
    --bg-secondary: #0f0d15;
    --bg-card: rgba(18, 16, 28, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.05);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-active: rgba(200, 120, 255, 0.4);

    --text-primary: #f0edf5;
    --text-secondary: #9b95a8;
    --text-muted: #7a7490;
    /* LW-27: WCAG AA contrast fix */
    --text-accent: #d4a0ff;

    --accent-primary: #b44dff;
    --accent-secondary: #ff4d8d;
    --accent-tertiary: #4dc8ff;
    --accent-gold: #ffd84d;

    --gradient-main: linear-gradient(135deg, #b44dff 0%, #ff4d8d 100%);
    --gradient-dark: linear-gradient(180deg, #07060b 0%, #12101e 100%);
    --gradient-card: linear-gradient(145deg, rgba(180, 77, 255, 0.08) 0%, rgba(255, 77, 141, 0.04) 100%);
    --gradient-glow: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), rgba(180, 77, 255, 0.06), transparent 40%);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(180, 77, 255, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;

    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* WC-03: Typography Scale */
    --text-2xs: 0.625rem;
    /* 10px */
    --text-xs: 0.75rem;
    /* 12px */
    --text-sm: 0.875rem;
    /* 14px */
    --text-base: 1rem;
    /* 16px */
    --text-lg: 1.25rem;
    /* 20px */
    --text-xl: 1.5rem;
    /* 24px */
    --text-2xl: 2rem;
    /* 32px */
    --text-3xl: 3rem;
    /* 48px */

    /* WC-04: Semantic Colors */
    --color-success: #4dff8c;
    --color-warning: #ffd84d;
    --color-error: #ff5555;
    --color-info: #4dc8ff;
    --color-ai: #b44dff;

    /* WC-24: Status Colors */
    --status-draft: var(--color-warning);
    --status-generating: var(--color-ai);
    --status-completed: var(--color-success);
    --status-error: var(--color-error);
}

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

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-primary);
}

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

button {
    cursor: pointer;
    font-family: inherit;
}

input,
select,
textarea {
    font-family: inherit;
}

/* --- Accessibility --- */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: 9999;
    font-weight: 600;
    transition: top var(--transition);
}

.skip-link:focus {
    top: 0;
    outline: 2px solid #fff;
}

/* --- Layout: Auth Pages (full-screen centered) --- */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-dark);
    position: relative;
    overflow: hidden;
}

.auth-layout::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(180, 77, 255, 0.12) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    pointer-events: none;
}

.auth-layout::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 77, 141, 0.08) 0%, transparent 70%);
    bottom: -100px;
    left: -50px;
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    animation: fadeUp 0.6s ease-out;
}

/* --- Layout: App (Sidebar + Main) --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--gradient-dark);
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-main);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.sidebar-nav a:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: rgba(180, 77, 255, 0.12);
    color: var(--accent-primary);
    border: 1px solid rgba(180, 77, 255, 0.15);
}

.sidebar-nav .nav-section {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 20px 14px 8px;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-subtle);
}

.credits-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    padding: 12px 14px;
    border-radius: var(--radius-md);
}

.credits-badge .credits-count {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.credits-badge .credits-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-bar {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(7, 6, 11, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.page-content {
    padding: 32px;
    width: 100%;
}

/* --- Typography --- */
.heading-xl {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
}

.heading-lg {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
}

.heading-md {
    font-size: 1.15rem;
    font-weight: 600;
}

.heading-sm {
    font-size: 0.95rem;
    font-weight: 600;
}

.text-sm {
    font-size: 0.85rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-muted {
    color: var(--text-secondary);
}

.text-accent {
    color: var(--text-accent);
}

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

.font-serif {
    font-family: var(--font-serif);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-main);
    color: #fff;
    box-shadow: 0 4px 15px rgba(180, 77, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(180, 77, 255, 0.4);
    color: #fff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(180, 77, 255, 0.5);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.btn-danger {
    background: rgba(255, 77, 77, 0.15);
    color: #ff5555;
    border: 1px solid rgba(255, 77, 77, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 77, 77, 0.25);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* --- Inputs --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(180, 77, 255, 0.1);
    background: rgba(255, 255, 255, 0.07);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    cursor: pointer;
}

.form-select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.form-error {
    font-size: 0.8rem;
    color: var(--accent-secondary);
    margin-top: 4px;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
    border-color: rgba(180, 77, 255, 0.15);
    box-shadow: var(--shadow-glow);
}

/* WC-06: Clickable card elevation */
.project-card {
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(180, 77, 255, 0.12);
}

.project-card:active {
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

/* --- Chips / Tags --- */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.chip:hover {
    background: rgba(180, 77, 255, 0.08);
    border-color: rgba(180, 77, 255, 0.25);
    color: var(--text-accent);
}

/* WC-07: Pulse on selection */
.chip.active {
    background: rgba(180, 77, 255, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(180, 77, 255, 0.15);
    animation: chipPulse 0.3s ease-out;
}

@keyframes chipPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.06);
    }

    100% {
        transform: scale(1);
    }
}

.chip .chip-remove {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

/* --- Wizard Progress --- */
.wizard-progress {
    display: flex;
    align-items: center;
    padding: 24px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    gap: 4px;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    transition: all var(--transition);
}

.wizard-step .step-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.wizard-step.completed {
    color: var(--text-secondary);
}

.wizard-step.completed .step-number {
    background: rgba(77, 200, 255, 0.15);
    border-color: var(--accent-tertiary);
    color: var(--accent-tertiary);
}

.wizard-step.active {
    color: var(--text-primary);
}

.wizard-step.active .step-number {
    background: var(--gradient-main);
    border: none;
    color: #fff;
}

.wizard-connector {
    width: 20px;
    height: 1px;
    background: var(--border-subtle);
    flex-shrink: 0;
}

.wizard-connector.completed {
    background: var(--accent-tertiary);
}

.wizard-content {
    padding: 32px;
    max-width: 800px;
    margin: 0 auto;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    backdrop-filter: blur(10px);
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Project Cards Grid --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    cursor: pointer;
    transition: opacity 0.3s, transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

.project-card .project-cover {
    background: var(--gradient-card);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: -24px -24px 0 -24px;
}

.project-card .project-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.project-card:hover .project-cover img {
    transform: scale(1.05);
}

.project-card .project-info {
    padding: 14px 0 0 0;
}

.project-card .project-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.project-card .project-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- Badge / Status --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(77, 255, 140, 0.12);
    color: #4dff8c;
}

.badge-warning {
    background: rgba(255, 216, 77, 0.12);
    color: var(--accent-gold);
}

.badge-danger {
    background: rgba(255, 77, 77, 0.12);
    color: #ff5555;
}

.badge-info {
    background: rgba(77, 200, 255, 0.12);
    color: var(--accent-tertiary);
}

.badge-purple {
    background: rgba(180, 77, 255, 0.12);
    color: var(--accent-primary);
}

/* --- Alert Messages --- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 20px;
    border: 1px solid;
}

.alert-error {
    background: rgba(255, 55, 55, 0.08);
    border-color: rgba(255, 55, 55, 0.2);
    color: #ff5555;
}

.alert-success {
    background: rgba(55, 255, 120, 0.08);
    border-color: rgba(55, 255, 120, 0.2);
    color: #4dff8c;
}

.alert-warning {
    background: rgba(255, 200, 55, 0.08);
    border-color: rgba(255, 200, 55, 0.2);
    color: var(--accent-gold);
}

.alert-info {
    background: rgba(77, 200, 255, 0.08);
    border-color: rgba(77, 200, 255, 0.2);
    color: var(--accent-tertiary);
}

/* --- Divider --- */
.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 24px 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 16px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin: 24px 0;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
}

/* --- Animations --- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.fade-up {
    animation: fadeUp 0.5s ease-out;
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* --- Loader --- */
.loader {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.generating-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 6, 11, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: 20px;
}

.generating-overlay .gen-text {
    font-size: 1.1rem;
    color: var(--text-accent);
    animation: pulse 1.5s ease-in-out infinite;
}

/* --- Utilities --- */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

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

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-24 {
    gap: 24px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.p-16 {
    padding: 16px;
}

.p-24 {
    padding: 24px;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 20px 0;
}

details summary {
    list-style: none;
    cursor: pointer;
}

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

details[open] summary {
    margin-bottom: 16px;
}

/* --- Sidebar Toggle (Mobile) --- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0, 0, 0, 0.5);
}

.sidebar-overlay.active {
    display: block;
}

/* --- Lucide icon alignment in nav --- */
.sidebar-nav a i,
.sidebar-nav a svg {
    flex-shrink: 0;
}

/* --- Toast notification --- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    max-width: 420px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    animation: fadeUp 0.3s ease-out;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast-success {
    background: rgba(55, 255, 120, 0.12);
    border: 1px solid rgba(55, 255, 120, 0.25);
    color: #4dff8c;
}

.toast-error {
    background: rgba(255, 55, 55, 0.12);
    border: 1px solid rgba(255, 55, 55, 0.25);
    color: #ff5555;
}

.toast-info {
    background: rgba(77, 200, 255, 0.12);
    border: 1px solid rgba(77, 200, 255, 0.25);
    color: var(--accent-tertiary);
}

.toast-warning {
    background: rgba(255, 200, 55, 0.12);
    border: 1px solid rgba(255, 200, 55, 0.25);
    color: var(--accent-gold);
}

/* --- Modal (replaces alert()) --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(7, 6, 11, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 440px;
    width: 90%;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.3s ease-out;
}

.modal-card h3 {
    margin-bottom: 12px;
}

.modal-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 16px;
        overflow-x: hidden;
    }

    .top-bar {
        padding: 12px 16px 12px 64px;
        height: auto;
        flex-wrap: wrap;
        gap: 12px;
        min-height: var(--header-height);
    }

    .top-bar>div>p {
        display: none;
    }

    /* Esconder descrições longas no header mobile */
    .auth-card {
        margin: 0 auto;
        padding: 32px 20px;
        width: 100%;
    }

    .wizard-content {
        padding: 16px;
    }

    /* LW-02: Progress text-only on mobile */
    .wizard-progress {
        padding: 12px 16px;
    }

    .wizard-step .step-label {
        display: none;
    }

    /* LW-04: Stats 2-col on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* LW-03: Project cards 1-col */
    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Dashboard CTA stacking */
    .flex.gap-8 {
        flex-wrap: wrap;
    }

    .btn-lg {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .wizard-step .step-number {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }

    .heading-lg {
        font-size: 1.2rem;
    }

    .heading-xl {
        font-size: 1.5rem;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Story Typography (LW-21/22/23) --- */
.story-content {
    font-family: var(--font-serif) !important;
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.story-content p,
.story-content br+br {
    margin-bottom: 1.2em;
}

/* SK-25: Project Cover (consolidated above in .project-card .project-cover) */

/* WC-08: Wizard progress fill animation */
.wizard-step.completed .step-number,
.wizard-step.active .step-number {
    animation: stepFill 0.4s ease-out;
}

@keyframes stepFill {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Status Filter Tabs (SK-24) --- */
.filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
}

.filter-tab {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    background: transparent;
}

.filter-tab:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.filter-tab.active {
    background: rgba(180, 77, 255, 0.12);
    color: var(--accent-primary);
    border-color: rgba(180, 77, 255, 0.2);
}

/* --- 404 Page (NN-25) --- */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 48px;
}

.error-page .error-code {
    font-size: 6rem;
    font-weight: 800;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

/* --- Confirmation Modal (NN-18) --- */
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.3s ease-out;
    overflow: hidden;
    width: 90%;
    max-width: 480px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* --- Alert Messages --- */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(255, 55, 55, 0.1);
    border: 1px solid rgba(255, 55, 55, 0.2);
    color: #ff6666;
}

.alert-success {
    background: rgba(55, 255, 120, 0.1);
    border: 1px solid rgba(55, 255, 120, 0.2);
    color: #4dff8c;
}

.alert-warning {
    background: rgba(255, 200, 55, 0.1);
    border: 1px solid rgba(255, 200, 55, 0.2);
    color: var(--accent-gold);
}

.alert-info {
    background: rgba(77, 200, 255, 0.1);
    border: 1px solid rgba(77, 200, 255, 0.2);
    color: var(--accent-tertiary);
}

/* --- Relative Time Helper --- */
.time-relative {
    cursor: help;
}

/* --- Type option card (step 4 explicitness) --- */
.type-option {
    transition: all var(--transition);
    cursor: pointer;
}

.type-option:hover {
    transform: translateY(-2px);
}

/* ======================================================
   BATCH 3 — Mass CSS improvements (~30 checklist items)
   ====================================================== */

/* LW-05: Touch Targets (min 44px) */
.chip {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.btn-sm {
    min-height: 36px;
}

.btn,
.btn-lg {
    min-height: 44px;
}

/* LW-24: Fullscreen Reading Mode */
.fullscreen-mode .sidebar,
.fullscreen-mode .top-bar,
.fullscreen-mode .sidebar-toggle {
    display: none !important;
}

.fullscreen-mode .main-content {
    margin-left: 0 !important;
}

.fullscreen-mode .page-content {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px 32px;
}

/* LW-28: Focus Rings for all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.chip:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* LW-30: Skip-to-content */
.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 9999;
    padding: 12px 24px;
    background: var(--gradient-main);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 16px;
}

/* SK-26: Radio chip visual indicator (dot) */
.chip.radio-chip::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    transition: all var(--transition);
    flex-shrink: 0;
}

.chip.radio-chip.active::before {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    box-shadow: 0 0 6px var(--accent-primary);
}

/* SK-27: Optional label styling */
.form-label .optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.78rem;
    margin-left: 4px;
}

/* SK-28: Character counter */
.char-counter {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

/* SK-29: Autofill shimmer */
.shimmer {
    background: linear-gradient(90deg, var(--bg-input) 0%, rgba(180, 77, 255, 0.08) 50%, var(--bg-input) 100%);
    background-size: 200% 100%;
    animation: shimmerAnim 1.5s ease infinite;
}

@keyframes shimmerAnim {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* WC-09: Page transition */
.page-content {
    animation: pageFade 0.3s ease-out;
}

@keyframes pageFade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

/* WC-10: Skeleton loading */
.skeleton {
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.04) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: shimmerAnim 1.5s ease infinite;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-card {
    height: 200px;
}

/* WC-13: Genre-based gradient on hover */
.project-card[data-genre="romance"]:hover {
    border-color: rgba(255, 77, 141, 0.3);
}

.project-card[data-genre="bdsm"]:hover {
    border-color: rgba(180, 77, 255, 0.3);
}

.project-card[data-genre="fantasia"]:hover {
    border-color: rgba(77, 200, 255, 0.3);
}

/* WC-14: Book layout for reading */
.book-layout {
    max-width: 680px;
    margin: 0 auto;
    font-family: var(--font-serif);
    font-size: 1.1rem;
    line-height: 2;
    color: var(--text-primary);
    padding: 48px 0;
}

.book-layout .chapter-title {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
    color: var(--text-accent);
}

.book-layout .scene-break {
    text-align: center;
    margin: 32px 0;
    color: var(--text-muted);
    font-size: 1.5rem;
    letter-spacing: 1em;
}

.book-layout .scene-break::after {
    content: '⁂';
}

/* WC-15: Redesigned credits badge */
.credits-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.credits-badge .credits-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-main);
    transition: width 0.5s ease;
}

/* WC-16: Credit package cards */
.credit-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 32px;
    margin-bottom: 40px;
    align-items: start;
}

.credit-card {
    position: relative;
    text-align: center;
    padding: 32px 24px;
    transition: all var(--transition);
}

.credit-card.popular {
    border: 2px solid var(--accent-primary);
    position: relative;
    box-shadow: 0 0 30px rgba(180, 77, 255, 0.15), 0 0 60px rgba(180, 77, 255, 0.05);
}

.popular-badge {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gradient-main);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    white-space: nowrap;
    animation: popularPulse 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(180, 77, 255, 0.3);
    z-index: 2;
    text-transform: uppercase;
}

@keyframes popularPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(180, 77, 255, 0.3)
    }

    50% {
        box-shadow: 0 0 0 6px rgba(180, 77, 255, 0)
    }
}

@media (min-width: 768px) {
    .credit-card-grid {
        align-items: center;
        gap: 24px;
    }

    .credit-card.popular {
        transform: scale(1.06);
        z-index: 1;
    }
}

.credit-card .price {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* NN-19: Required asterisk */
.form-label.required::after {
    content: ' *';
    color: var(--accent-secondary);
}

/* NN-20: Uniform card padding via override */
.card {
    padding: 24px;
}

/* ID-03: Typewriter animation for generation */
.typewriter-text {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    overflow: hidden;
    border-right: 2px solid var(--accent-primary);
    white-space: nowrap;
    animation: typing 3s steps(40) infinite, blink 0.7s step-end infinite;
    max-width: 300px;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* ID-05: Confetti celebration */
.confetti-container {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall 3s ease-in forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ID-10: Cover thumbnail in project cards */
.project-cover img {
    transition: transform 0.3s ease;
}

.project-card:hover .project-cover img {
    transform: scale(1.05);
}

/* NN-22: Credits warning */
.credits-warning {
    background: rgba(255, 200, 55, 0.08);
    border: 1px solid rgba(255, 200, 55, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--color-warning);
    margin-bottom: 16px;
}

/* NN-11: Clickable wizard steps */
.wizard-step.completed {
    cursor: pointer;
}

.wizard-step.completed:hover {
    background: var(--bg-glass-hover);
}

/* NN-12: Save and exit */
.wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* NN-13: Regenerate button */
.btn-regenerate {
    background: rgba(255, 77, 141, 0.1);
    border: 1px solid rgba(255, 77, 141, 0.2);
    color: var(--accent-secondary);
}

.btn-regenerate:hover {
    background: rgba(255, 77, 141, 0.2);
    transform: translateY(-2px);
}

/* FD-09: Print stylesheet */
@media print {

    .sidebar,
    .top-bar,
    .sidebar-toggle,
    .btn,
    .wizard-progress,
    .sidebar-overlay,
    .toast,
    .modal-overlay,
    .credits-badge {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
        max-width: 100% !important;
    }

    .card {
        border: none !important;
        background: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .story-content {
        color: #000 !important;
        font-size: 12pt !important;
        line-height: 1.8 !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }
}

/* WC-30 / FD-09: Print optimization */
@page {
    margin: 2cm;
}

/* FD-14: Security-conscious styles */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* LW-26: Aria labels for hidden radios (selector-based visual) */
input[type="radio"][style*="display:none"]+span,
input[type="radio"][style*="display:none"]~* {
    cursor: pointer;
}

/* WC-18: Tabs for settings */
.tab-list {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.tab-item {
    padding: 12px 20px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}

.tab-item:hover {
    color: var(--text-primary);
}

.tab-item.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* NN-24: Tooltips */
.tooltip-wrap {
    position: relative;
    display: inline-flex;
}

.tooltip-wrap .tooltip-text {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.tooltip-wrap:hover .tooltip-text {
    opacity: 1;
}

/* FD-29: Env indicator */
.env-badge {
    position: fixed;
    bottom: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 0.65rem;
    background: rgba(255, 77, 77, 0.15);
    color: var(--color-error);
    border-radius: var(--radius-sm);
    z-index: 9999;
    font-weight: 700;
    text-transform: uppercase;
}

/* ID-04: Paper texture for reading */
.paper-bg {
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='.02'/%3E%3C/svg%3E");
}

/* Generating overlay animation (ID-03 enhanced) */
.generating-overlay .gen-text {
    animation: genPulse 2s ease-in-out infinite;
}

@keyframes genPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ======= BATCH 4 ======= */

/* LW-25: Light Mode */
body.light-mode {
    --bg-base: #f5f3f8;
    --bg-card: #ffffff;
    --bg-glass: rgba(0, 0, 0, 0.03);
    --bg-glass-hover: rgba(0, 0, 0, 0.06);
    --bg-input: #f0edf5;
    --gradient-card: linear-gradient(135deg, #fff 0%, #f5f0ff 100%);
    --text-primary: #1a1525;
    --text-secondary: #5a5466;
    --text-muted: #8a8494;
    --text-accent: #8b3cd4;
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-active: rgba(180, 77, 255, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1);
}

body.light-mode .sidebar {
    background: #fff;
    border-right: 1px solid var(--border-subtle);
}

body.light-mode .top-bar {
    background: rgba(255, 255, 255, 0.9);
}

body.light-mode .card {
    box-shadow: var(--shadow-sm);
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-glass-hover);
}

/* NN-16: Consistent gradient */
.btn-primary {
    background: var(--gradient-main) !important;
}

/* WC-20: Celebration card */
.celebration-card {
    text-align: center;
    padding: 48px 32px;
    background: var(--gradient-card);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.celebration-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(180, 77, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(255, 77, 141, 0.08) 0%, transparent 50%);
}

/* WC-28: Splash screen */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    transition: opacity 0.5s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-logo {
    animation: splashPulse 1.5s ease-in-out infinite;
}

@keyframes splashPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* WC-29: Empty states */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state .empty-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* NN-10: Explicitness examples */
.explicitness-example {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
    padding-left: 12px;
    border-left: 2px solid var(--border-subtle);
}

/* ID-20: Author stats */
.author-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.author-stat .stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* LW-14: AI hook cards */
.hook-card {
    padding: 16px;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    font-size: 0.88rem;
}

.hook-card:hover {
    border-color: var(--accent-primary);
    background: var(--bg-glass-hover);
    transform: translateY(-2px);
}

/* LW-12: Tags collapsed */
.tags-collapsed {
    max-height: 88px;
    overflow: hidden;
    position: relative;
}

.tags-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: linear-gradient(transparent, var(--bg-base));
}

/* ID-08: Template cards */
.template-card {
    padding: 20px;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition);
}

.template-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
}

/* ID-18: Continue story */
.btn-continue-story {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    border: none;
}

/* ID-15: Theme Palettes */
body.theme-vinho {
    --accent-primary: #9b2335;
    --accent-secondary: #c0392b;
    --accent-tertiary: #e74c3c;
    --gradient-main: linear-gradient(135deg, #9b2335, #c0392b);
    --bg-base: #1a0f14;
    --bg-card: #2a1520;
}

body.theme-oceano {
    --accent-primary: #0077b6;
    --accent-secondary: #00b4d8;
    --accent-tertiary: #48cae4;
    --gradient-main: linear-gradient(135deg, #0077b6, #00b4d8);
    --bg-base: #0a1628;
    --bg-card: #122240;
}

body.theme-rose {
    --accent-primary: #e07a9e;
    --accent-secondary: #f0a0c0;
    --accent-tertiary: #ffd1dc;
    --gradient-main: linear-gradient(135deg, #e07a9e, #f0a0c0);
    --bg-base: #1a1018;
    --bg-card: #2a1a28;
}

/* ID-22: Story feedback buttons */
.feedback-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.feedback-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-glass);
    color: var(--text-primary);
}

.feedback-btn:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.feedback-btn.liked {
    border-color: var(--color-success);
    background: rgba(77, 255, 140, 0.08);
}

.feedback-btn.disliked {
    border-color: var(--color-error);
    background: rgba(255, 77, 77, 0.08);
}

/* ID-19: Favorite highlight */
.favorite-mark {
    background: rgba(255, 215, 0, 0.08);
    border-left: 3px solid var(--accent-gold);
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    position: relative;
}

.favorite-mark .fav-icon {
    position: absolute;
    right: 8px;
    top: 8px;
    color: var(--accent-gold);
}

/* LW-11: Quick/Detailed mode toggle */
.mode-toggle {
    display: flex;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.mode-toggle-btn {
    flex: 1;
    padding: 10px 16px;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
    background: var(--bg-glass);
    color: var(--text-secondary);
}

.mode-toggle-btn.active {
    background: var(--accent-primary);
    color: #fff;
}

.mode-toggle-btn:hover:not(.active) {
    background: var(--bg-glass-hover);
}

/* FD-10: Lazy loading skeleton rows */
.skeleton-row {
    height: 80px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.load-more-trigger {
    text-align: center;
    padding: 24px;
}

/* ID-12: Collection badge */
.collection-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* ID-23: Version selector */
.version-selector {
    display: flex;
    gap: 4px;
    align-items: center;
}

.version-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition);
}

.version-dot.active {
    background: var(--accent-primary);
    transform: scale(1.3);
}

.version-dot:hover {
    background: var(--accent-secondary);
}

/* ID-24: Quality score */
.quality-score {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
}

.quality-score.score-high {
    background: rgba(77, 255, 140, 0.1);
    color: var(--color-success);
}

.quality-score.score-medium {
    background: rgba(255, 215, 0, 0.1);
    color: var(--accent-gold);
}

.quality-score.score-low {
    background: rgba(255, 77, 77, 0.1);
    color: var(--color-error);
}

/* === Modal Overlay === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

/* === Delete Button on Cards === */
.project-card {
    position: relative;
}

.btn-delete-project {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 55, 55, 0.15);
    border: 1px solid rgba(255, 55, 55, 0.3);
    color: var(--color-error);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 5;
}

.project-card:hover .btn-delete-project {
    opacity: 1;
}

.btn-delete-project:hover {
    background: var(--color-error);
    color: white;
    transform: scale(1.1);
}

/* === Spin Animation === */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* --- Landing Page --- */
.landing {
    background: #0a0a0f;
    min-height: 100vh;
}

.landing-hero {
    position: relative;
    padding: 100px 24px 80px;
    text-align: center;
    overflow: hidden;
}

.landing-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(180, 77, 255, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.landing-hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #b44dff, #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-hero .subtitle {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

.landing-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-hero-primary {
    background: linear-gradient(135deg, #b44dff, #ff6b9d);
    color: #fff;
    box-shadow: 0 4px 20px rgba(180, 77, 255, 0.3);
}

.btn-hero-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(180, 77, 255, 0.4);
}

.btn-hero-secondary {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-hero-secondary:hover {
    border-color: rgba(180, 77, 255, 0.5);
    background: rgba(180, 77, 255, 0.05);
}

.landing-stats {
    display: flex;
    gap: 48px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.landing-stat {
    text-align: center;
}

.landing-stat .num {
    font-size: 2rem;
    font-weight: 800;
    color: #b44dff;
}

.landing-stat .lbl {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.landing-section {
    padding: 80px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.landing-section h2 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    color: #e8e4f0;
}

.landing-section .section-sub {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 48px;
    font-size: 1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 24px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 32px;
    transition: border-color 0.3s, transform 0.3s;
}

.feature-card:hover {
    border-color: rgba(180, 77, 255, 0.3);
    transform: translateY(-4px);
}

.feature-card .icon {
    font-size: 2rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #e8e4f0;
}

.feature-card p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 32px;
    counter-reset: step;
}

.step-card {
    text-align: center;
    position: relative;
}

.step-card::before {
    counter-increment: step;
    content: counter(step);
    display: flex;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b44dff, #ff6b9d);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #e8e4f0;
    margin-bottom: 8px;
}

.step-card p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 24px;
}

.testimonial {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 24px;
}

.testimonial .quote {
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.testimonial .author {
    font-size: 0.85rem;
    color: var(--accent-primary);
}

.landing-final-cta {
    text-align: center;
    padding: 80px 24px;
    background: linear-gradient(180deg, transparent, rgba(180, 77, 255, 0.05));
}

.landing-final-cta h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #e8e4f0;
    margin-bottom: 16px;
}

.landing-final-cta p {
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 32px;
    font-size: 1rem;
}

.landing-footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.landing-footer a {
    color: rgba(255, 255, 255, 0.3);
    text-decoration: none;
    font-size: 0.8rem;
}

/* --- Auth Layout (Login/Register) --- */
.login-split {
    display: flex;
    min-height: 100vh;
}

.login-hero {
    flex: 1;
    background: linear-gradient(135deg, #0a0015 0%, #1a0030 40%, #2d1050 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

.login-hero::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(180, 77, 255, 0.15), transparent 70%);
    top: 10%;
    right: -10%;
    animation: heroFloat 8s ease-in-out infinite;
}

.login-hero::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 107, 157, 0.1), transparent 70%);
    bottom: 10%;
    left: -5%;
    animation: heroFloat 6s ease-in-out infinite reverse;
}

@keyframes heroFloat {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-20px)
    }
}

.login-hero-content {
    position: relative;
    z-index: 1;
    max-width: 480px;
}

.login-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #b44dff, #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-hero .tagline {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 32px;
}

.login-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 40px;
}

.login-stats .stat {
    text-align: center;
}

.login-stats .stat-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: #b44dff;
}

.login-stats .stat-txt {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.login-quote {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 20px;
    border-left: 3px solid #b44dff;
}

.login-quote p {
    font-style: italic;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    line-height: 1.6;
}

.login-quote .author {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    margin-top: 8px;
    font-style: normal;
}

.login-form-side {
    flex: 0 0 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: var(--bg-base);
}

@media (max-width:900px) {
    .login-split {
        flex-direction: column;
    }

    .login-hero {
        display: none;
    }

    .login-form-side {
        flex: 1;
        padding: 24px 16px;
    }
}

@media (max-width:480px) {
    .login-form-side {
        padding: 16px;
    }

    .auth-layout {
        padding: 16px;
    }

    .auth-card {
        padding: 32px 16px;
    }

    .landing-hero {
        padding: 60px 16px 40px;
    }

    .landing-stats {
        gap: 24px;
    }

    .landing-stat .num {
        font-size: 1.5rem;
    }
}

/* --- Public & Legal Pages (Terms, Privacy, FAQ, Contact) --- */
.legal-page,
.faq-page,
.contact-page {
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 60px 24px;
}

.legal-container,
.faq-container,
.contact-container {
    margin: 0 auto;
}

.legal-container {
    max-width: 800px;
    background: var(--bg-card);
    padding: 48px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
}

.legal-container h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.legal-container h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-accent);
    margin-top: 40px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
}

.legal-container p,
.legal-container li {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.legal-container ul {
    margin-left: 24px;
    margin-bottom: 24px;
}

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

.faq-container {
    max-width: 800px;
}

.faq-header {
    text-align: center;
    margin-bottom: 48px;
}

.faq-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.faq-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow: hidden;
}

.faq-question {
    padding: 20px 24px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}

.faq-question:hover {
    background: rgba(255, 255, 255, 0.02);
}

.faq-answer {
    padding: 0 24px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    color: var(--text-secondary);
    line-height: 1.7;
}

.faq-item.active .faq-answer {
    padding: 0 24px 24px 24px;
    max-height: 500px;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-question i {
    transition: transform 0.3s;
    color: var(--accent-primary);
}

.contact-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-container {
    max-width: 600px;
    width: 100%;
    text-align: center;
    background: var(--bg-card);
    padding: 48px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
}

.contact-container .icon {
    width: 64px;
    height: 64px;
    background: rgba(180, 77, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: var(--accent-primary);
}

.contact-container h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.contact-container p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 32px;
}

.contact-email {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s;
}

.contact-email:hover {
    border-color: var(--accent-primary);
    background: rgba(180, 77, 255, 0.05);
    transform: translateY(-2px);
}

/* --- Dashboard & Layout --- */
.card-alert-warning {
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 107, 60, 0.06));
    border: 1px solid rgba(255, 215, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-alert-error {
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.08), rgba(255, 68, 68, 0.04));
    border: 1px solid rgba(255, 68, 68, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-hero {
    padding: 28px;
    border: 1px solid rgba(180, 77, 255, 0.2);
}

.card-gamification {
    padding: 16px 20px;
    animation-delay: 0.05s;
}

.card-empty-state {
    padding: 48px;
    background: linear-gradient(135deg, rgba(180, 77, 255, 0.04), rgba(255, 107, 157, 0.03));
}

.onboarding-highlight {
    position: relative;
    z-index: 10000;
    box-shadow: 0 0 0 4px rgba(180, 77, 255, 0.4), 0 0 20px rgba(180, 77, 255, 0.2) !important;
    border-radius: 8px;
    animation: onboardPulse 2s ease-in-out infinite;
}

@keyframes onboardPulse {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(180, 77, 255, 0.4)
    }

    50% {
        box-shadow: 0 0 0 8px rgba(180, 77, 255, 0.2)
    }
}

.onboarding-tip-container {
    position: fixed;
    z-index: 10001;
    background: #1a1530;
    border: 1px solid rgba(180, 77, 255, 0.3);
    border-radius: 12px;
    padding: 16px;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* --- Wizard Flow --- */
.wizard-content {
    max-width: 900px;
    margin: 0 auto;
}

.wizard-preview-box {
    margin-top: 16px;
    padding: 20px;
    background: rgba(180, 77, 255, 0.04);
    border: 1px solid rgba(180, 77, 255, 0.15);
    border-radius: 12px;
}

.wizard-progress-wrap {
    width: 280px;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.wizard-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--gradient-main);
    transition: width 0.5s ease;
}

/* Category-colored chips */
.chip[data-category="personality"] {
    --chip-hue: 340;
}

.chip[data-category="physical"] {
    --chip-hue: 25;
}

.chip[data-category="sexual"] {
    --chip-hue: 0;
}

.chip[data-category="body_type"] {
    --chip-hue: 200;
}

.chip[data-category="ethnicity"] {
    --chip-hue: 45;
}

.chip[data-category="zodiac"] {
    --chip-hue: 280;
}

.chip.active[data-category] {
    background: hsla(var(--chip-hue), 70%, 50%, 0.2);
    border-color: hsla(var(--chip-hue), 70%, 50%, 0.6);
    color: hsla(var(--chip-hue), 70%, 70%, 1);
}

/* Character preview card */
#char-preview {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    display: none;
    transition: all 0.3s ease;
}

#char-preview.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

#char-preview .preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

#char-preview .preview-tag {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
}

/* Chemistry badge */
.chemistry-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    background: linear-gradient(135deg, rgba(255, 107, 129, 0.2), rgba(255, 193, 7, 0.2));
    border: 1px solid rgba(255, 107, 129, 0.3);
    color: var(--text-primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

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

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

/* Mobile responsive chips */
@media (max-width: 640px) {
    .chips {
        gap: 4px !important;
    }

    .chip {
        font-size: 0.7rem !important;
        padding: 4px 8px !important;
    }
}

/* --- GLOBAL MOBILE RESPONSIVENESS FIXES (SK-MobileGuard) --- */
@media (max-width: 768px) {

    /* Força limites de tela absolutos */
    .app-layout,
    .main-content,
    body,
    .page-content {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    /* Top bar sempre empilha para evitar vazamentos laterais */
    .top-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
        height: auto !important;
    }

    .top-bar>div:last-child,
    .top-bar>span {
        width: 100% !important;
        display: block !important;
    }

    /* Tabelas sempre roláveis horizontalmente, sem empurrar o layout pai */
    table {
        display: block !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
    }

    /* Sobrescreve classes grid engessadas (.stats-grid) com classes flexíveis auto-fit */
    .stats-grid[style*="grid-template-columns: repeat(3"],
    .stats-grid[style*="grid-template-columns: repeat(4"],
    .stats-grid[style*="grid-template-columns: repeat(5"],
    .stats-grid[style*="grid-template-columns: repeat(6"] {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
    }

    .stats-grid[style*="grid-template-columns: 1fr 1fr"],
    .stats-grid[style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
    }

    /* Proteções genéricas de flex para forçar wrap em telas pequenas */
    .flex,
    .flex.gap-8,
    .flex.gap-16,
    .flex.gap-20,
    .flex.gap-24,
    .flex.gap-12 {
        flex-wrap: wrap !important;
    }

    /* Captura Divs aleatórias com grid manual via atributo style e força 1 coluna */
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:repeat(3"],
    div[style*="grid-template-columns: repeat(3"],
    div[style*="grid-template-columns:repeat(4"],
    div[style*="grid-template-columns: repeat(4"],
    div[style*="grid-template-columns:1fr 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr 1fr auto"],
    div[style*="grid-template-columns: 1fr 2fr"] {
        grid-template-columns: 1fr !important;
        display: grid !important;
    }
}

/* --- Premium Language Toggle & Mobile First Legal Page --- */
.legal-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.lang-toggle-premium {
    display: flex;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 4px;
    backdrop-filter: blur(10px);
}

.lang-toggle-premium .lang-btn {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.lang-toggle-premium .lang-btn:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.lang-toggle-premium .lang-btn.active {
    background: rgba(180, 77, 255, 0.15);
    color: var(--text-primary);
    border-color: rgba(180, 77, 255, 0.3);
    box-shadow: 0 0 12px rgba(180, 77, 255, 0.15);
}

@media (max-width: 768px) {

    .legal-page,
    .faq-page,
    .contact-page {
        padding: 24px 16px !important;
    }

    .legal-container,
    .faq-container,
    .contact-container {
        padding: 24px 20px !important;
    }

    .legal-container h1 {
        font-size: 1.8rem !important;
        margin-bottom: 16px !important;
    }

    .legal-container h2 {
        font-size: 1.2rem !important;
        margin-top: 32px !important;
    }

    .legal-container p,
    .legal-container li {
        font-size: 0.95rem !important;
    }

    .lang-toggle-premium {
        width: 100%;
        justify-content: space-between;
    }

    .lang-toggle-premium .lang-btn {
        flex: 1;
        text-align: center;
        padding: 8px 12px;
    }
}

/* --- Back to Top FAB --- */
.fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(180, 77, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0) scale(1);
}

.fab:hover {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 0 12px 28px rgba(180, 77, 255, 0.6);
}

.fab.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.9);
}

@media(max-width: 768px) {
    .fab {
        bottom: 24px;
        right: 24px;
        width: 48px;
        height: 48px;
    }
}