:root {
    /* Identidade Visual Sage Owl */
    color-scheme: dark; /* Força o Modo Escuro no navegador iOS Safari */
    --bg-color-start: #111424; /* Azul Escuro Profundo (Noite) */
    --bg-color-end: #09281e; /* Verde Escuro Floresta */
    --color-primary: #C29C57; /* Dourado Escuro / Ouro envelhecido (Logo/Moldura) */
    --color-secondary: #3B8857; /* Verde da Coruja */
    --color-accent: #ECE5D3; /* Off-White / Creme (Estrelas/Texto) */
    
    --text-color: #ECE5D3;
    --text-dark: #111424;
    --color-danger: #ea580c; /* Laranja Escuro (warnings) */
    --color-success: #3B8857; /* Verde Coruja para Sucesso */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);

    --card-fire: linear-gradient(135deg, rgba(244, 63, 94, 0.15), rgba(249, 115, 22, 0.1));
    --card-game: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.1));
    --card-light: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(252, 211, 77, 0.1));
    --card-challenge: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.1));
}

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

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    min-height: 100vh;
    background-color: var(--bg-color-start); /* Fallback robusto para iOS */
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
    -webkit-text-size-adjust: 100%;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-color-start) 0%, var(--bg-color-end) 100%);
    z-index: -3;
    pointer-events: none;
}

/* --- Starry Night Background Effect --- */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
    background: transparent url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400"><circle cx="10" cy="10" r="1" fill="%23ECE5D3" opacity="0.6"/><circle cx="150" cy="80" r="1.5" fill="%23C29C57" opacity="0.8"/><circle cx="300" cy="150" r="1" fill="%23ECE5D3" opacity="0.4"/><circle cx="80" cy="300" r="2" fill="%23ECE5D3" opacity="0.7"/><circle cx="350" cy="380" r="1" fill="%23C29C57" opacity="0.5"/></svg>') repeat;
    background-size: 200px 200px;
    animation: moveStars 60s linear infinite;
}

.twinkling {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    background: transparent url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600"><circle cx="45" cy="120" r="1" fill="%23ffffff" opacity="0.9"/><circle cx="250" cy="220" r="1" fill="%23ffffff" opacity="0.5"/><circle cx="450" cy="90" r="1.5" fill="%23ffffff" opacity="0.7"/><circle cx="500" cy="400" r="1" fill="%23ffffff" opacity="0.8"/><circle cx="120" cy="500" r="2" fill="%23ffffff" opacity="0.6"/></svg>') repeat;
    background-size: 300px 300px;
    animation: moveTwinkling 40s linear infinite;
}

@keyframes moveStars {
    from { background-position: 0 0; }
    to { background-position: -400px 400px; }
}

@keyframes moveTwinkling {
    from { background-position: 0 0; }
    to { background-position: -300px 300px; }
}

/* Remover Blobs antigos para usar o novo fundo noturno */
.blob { display: none; }

/* Background Animations */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    filter: blur(100px);
    opacity: 0.6;
}

.blob {
    position: absolute;
    border-radius: 50%;
    animation: float 20s infinite alternate cubic-bezier(0.5, 0, 0.5, 1);
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--color-primary), transparent 70%);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--color-secondary), transparent 70%);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--color-accent), transparent 70%);
    top: 40%;
    left: 30%;
    opacity: 0.5;
    animation-duration: 25s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(100px) scale(1.1); }
}

/* Header Controls */
.header-controls {
    z-index: 100;
}

.header-action-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-premium {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(252, 211, 77, 0.1));
    border: 1px solid rgba(252, 211, 77, 0.4);
    color: #fcd34d;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1);
}

.btn-premium:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(252, 211, 77, 0.2));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.2);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.btn-logout {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fb7185;
}

.btn-logout:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.5);
    color: #ffe4e6;
    transform: translateY(-2px);
}

.glass-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 20px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.glass-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-primary);
}

.glass-select:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.glass-select option {
    background: var(--bg-color-start); /* Fundo escuro explícito para o dropdown nativo */
    color: #ffffff;
    font-weight: 500;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    margin-top: 2rem;
    animation: fadeInDown 0.8s ease-out forwards;
}

.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.1);
    background: #111;
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

.avatar:hover {
    transform: scale(1.05) rotate(-5deg);
}

.avatar-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: conic-gradient(from 0deg, var(--color-primary), var(--color-secondary), var(--color-primary));
    border-radius: 50%;
    z-index: 1;
    filter: blur(20px);
    opacity: 0.7;
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.gradient-text {
    background: linear-gradient(to right, var(--color-secondary), var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2.gradient-text {
    font-size: 2.2rem;
    margin-bottom: 0.2rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* Glass Panel Input */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.glass-panel:focus-within {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 8px 32px 0 rgba(139, 92, 246, 0.15);
}

textarea {
    width: 100%;
    min-height: 120px;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    resize: none;
    outline: none;
    padding: 0.5rem;
    -webkit-appearance: none;
    appearance: none;
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.media-actions {
    display: flex;
    gap: 0.8rem;
}

.media-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 0.6rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.media-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

#media-preview-container {
    margin-top: 1rem;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    max-width: fit-content;
}

#media-preview-container:not(.hidden) {
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#media-preview {
    display: block;
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
}

/* Document Preview */
.doc-preview-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    min-width: 200px;
}

#doc-icon {
    font-size: 2rem;
}

.doc-info {
    display: flex;
    flex-direction: column;
}

#doc-name {
    font-weight: 600;
    color: var(--text-color);
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#doc-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Webcam Container */
#webcam-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    background: #000;
}

#webcam-video {
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
    transform: scaleX(-1); /* Mirror effect */
}

#capture-photo-btn {
    width: 200px;
    height: 40px;
    font-size: 0.9rem;
}

#remove-media-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    color: white;
}

#remove-media-btn:hover {
    background: var(--color-danger);
    transform: scale(1.1);
}

.btn-container {
    display: flex;
    justify-content: flex-end;
}

/* Glowing Button */
.glow-on-hover {
    width: 100%;
    min-height: 55px;
    border: none;
    outline: none;
    color: #fff;
    background: #111;
    cursor: pointer;
    position: relative;
    z-index: 0;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 1px;
    transition: transform 0.2s ease;
}

.glow-on-hover:hover {
    transform: translateY(-2px);
}

.glow-on-hover:active {
    transform: translateY(2px);
}

.glow-on-hover:before {
    content: '';
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    position: absolute;
    top: -2px;
    left:-2px;
    background-size: 400%;
    z-index: -1;
    filter: blur(5px);
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    animation: glowing 20s linear infinite;
    opacity: 1;
    transition: opacity .3s ease-in-out;
    border-radius: 14px;
}

.glow-on-hover:after {
    z-index: -1;
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: #111;
    left: 0;
    top: 0;
    border-radius: 12px;
}

.btn-text {
    position: relative;
    z-index: 2;
}

@keyframes glowing {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}

/* Loader */
#loading-section {
    text-align: center;
    padding: 3rem 0;
}

.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.loader-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--color-primary);
    animation: bounce 0.5s alternate infinite ease;
}

.loader-circle:nth-child(2) {
    background-color: var(--color-secondary);
    animation-delay: 0.16s;
}

.loader-circle:nth-child(3) {
    background-color: var(--color-accent);
    animation-delay: 0.32s;
}

.loading-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
    background: linear-gradient(to right, var(--text-color), var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse 1.5s infinite;
}

@keyframes bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-15px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Results */
.hidden {
    display: none !important;
}

/* Error Box */
.error-box {
    background: rgba(244, 63, 94, 0.15); /* Red (Danger) da paleta */
    border: 1px solid rgba(244, 63, 94, 0.4);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeInDown 0.6s ease-out;
}

.error-icon {
    font-size: 2rem;
}

#error-message-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

/* Results section */
.results-header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeIn 0.8s ease-out;
}

.results-subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

/* Pagination Controls */
#pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--color-primary);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#trail-counter {
    font-weight: 800;
    color: var(--color-primary);
    font-size: 1.1rem;
}

/* Correct Answer Box */
.correct-answer-box {
    background: rgba(16, 185, 129, 0.15); /* Verde Emerald da paleta */
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeInDown 0.6s ease-out;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
}

.correct-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.correct-title {
    color: var(--color-primary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.4rem;
    font-weight: 800;
}

#correct-answer-text {
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.5;
    color: #fff;
    margin: 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    perspective: 1000px;
}

/* Cards Base */
.sage-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) rotateX(10deg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sage-card.show {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

.sage-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.2);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.card-content {
    font-size: 1.05rem;
    line-height: 1.5;
    color: #e2e8f0;
    flex-grow: 1;
}

/* Card Specifics */
.card-type-resumo_o_brabo {
    background: var(--card-fire);
}
.card-type-resumo_o_brabo .card-icon {
    animation: wiggle 2s infinite ease-in-out;
}

.card-type-analogia_na_pratica {
    background: var(--card-game);
}
.card-type-analogia_na_pratica .card-icon {
    animation: bounce-small 2s infinite;
}

.card-type-pulo_do_gato {
    background: var(--card-light);
}
.card-type-pulo_do_gato .card-icon {
    animation: flash 3s infinite;
}

.card-type-desafio_vibe {
    background: var(--card-challenge);
    border-color: rgba(16, 185, 129, 0.3);
}
.card-type-desafio_vibe .card-icon {
    animation: shake 4s infinite;
}

/* Challenge Interaction */
.challenge-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-challenge {
    flex: 1;
    padding: 0.8rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-challenge:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.btn-challenge.btn-yes:hover { border-color: var(--color-accent); box-shadow: 0 0 15px rgba(16, 185, 129, 0.3); }
.btn-challenge.btn-no:hover { border-color: var(--color-danger); box-shadow: 0 0 15px rgba(244, 63, 94, 0.3); }

.feedback-msg {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
}

.feedback-error {
    background: rgba(244, 63, 94, 0.2);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
}

/* Footer */
footer {
    text-align: center;
    color: rgba(255,255,255,0.3);
    font-size: 0.9rem;
    padding: 1rem 0 2rem;
}

/* Micro Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

@keyframes bounce-small {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes flash {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.7; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* --- Export Card Button --- */
.btn-export-card {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-color);
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    z-index: 5;
}

.btn-export-card:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-export-card:active {
    transform: translateY(0);
}


@keyframes popIn {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* Responsiveness */
@media (max-width: 600px) {
    h1 { font-size: 2.8rem; }
    .glass-panel { padding: 1.5rem; }
    .action-bar { flex-direction: column; align-items: stretch; }
    .media-actions { justify-content: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
    .hide-mobile { display: none; }
    .media-btn { padding: 0.6rem; }
    .glow-on-hover { width: 100%; }
}

/* --- Premium Modal & Overlay New Styles --- */

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85); /* dim background */
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    padding: 2rem 0;
}

.premium-modal-content {
    background: #111424;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 2rem;
    position: relative;
    max-width: 1250px;
    width: 95%;
    margin: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    z-index: 20;
    transition: 0.2s;
}
.close-btn:hover { color: #ff4757; }

/* Pricing Grid */
.pricing-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin: 2rem auto 0;
    max-width: 800px;
}

.pricing-card {
    background: #161822; /* very dark grey/blue */
    border-radius: 8px;
    padding: 1.5rem;
    position: relative;
    border-top: 4px solid #fff;
    display: flex;
    flex-direction: column;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.pricing-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); }

.pricing-card.essential { border-top-color: #ffffff; }
.pricing-card.advanced { border-top-color: #00d8ff; }
.pricing-card.infinite { border-top-color: #ff00d4; }
.pricing-card.wonder { border-top-color: #ffcc00; }

.plan-header h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #fff;
    font-weight: 800;
}

.price-container {
    display: flex;
    align-items: baseline;
    margin-bottom: 1.5rem;
}

.old-price {
    color: #6a7280;
    text-decoration: line-through;
    margin-right: 0.5rem;
    font-size: 1rem;
}

.price {
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    margin-right: 0.2rem;
}

.period {
    color: #6a7280;
    font-size: 0.85rem;
}

.btn-subscribe {
    width: 100%;
    padding: 0.8rem;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 4px;
    font-weight: 800;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: 0.2s;
    font-size: 1rem;
}
.btn-subscribe:hover { background: #e2e8f0; }

.plan-desc {
    color: #9ca3af;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
    min-height: 48px;
}

.credits-box {
    background: rgba(16, 185, 129, 0.1); /* transparent green */
    border-radius: 6px;
    padding: 1rem;
    color: #34d399; /* Green text */
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}
.credits-icon { font-size: 1rem; margin-right: 0.3rem; }
.infinity-icon { font-size: 1.2rem; margin-right: 0.3rem; }

.features-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.features-list li {
    font-size: 0.85rem;
    color: #d1d5db;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.4;
}

.check {
    color: #34d399;
    font-weight: bold;
    font-size: 1rem;
}

.badge-popular, .badge-value {
    position: absolute;
    top: -14px;
    right: 20px;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.badge-popular { background: #ffc4ef; color: #000; }
.badge-value { background: #eaff8f; color: #000; }

/* Checkout Overlay Style */
.checkout-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(17, 20, 36, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.checkout-overlay-content {
    background: #1e2133;
    padding: 2.5rem;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.checkout-overlay-content h3 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
    color: #fff;
}

.checkout-overlay-content p {
    color: #9ca3af;
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

.checkout-overlay-content input {
    width: 100%;
    padding: 1rem;
    background: #0b0d17;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #fff;
    margin-bottom: 2rem;
    outline: none;
    font-size: 1rem;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.checkout-overlay-content input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.checkout-actions {
    display: flex;
    gap: 1rem;
}

.btn-cancel, .btn-confirm {
    flex: 1;
    padding: 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 800;
    font-size: 1rem;
    font-family: inherit;
    transition: 0.2s;
}

.btn-cancel {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
}
.btn-cancel:hover { background: rgba(255,255,255,0.1); }

.btn-confirm {
    background: #3b82f6;
    color: #fff;
}
.btn-confirm:hover { background: #2563eb; }

/* Responsive Grid Adjustments */
@media (max-width: 1200px) {
    .pricing-container { grid-template-columns: repeat(2, 1fr); gap: 2rem; }
}

@media (max-width: 768px) {
    .pricing-container { grid-template-columns: 1fr; }
    .premium-modal-content { padding: 1.5rem; }
}

/* Authentication Overlay Styles */
#auth-overlay {
    display: flex;
    z-index: 2000;
    backdrop-filter: blur(8px);
    background: transparent; /* Remove dark solid base */
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow: hidden;
}

/* Background animated circles */
.auth-circles-bg {
    position: absolute;
    width: 700px;
    height: 700px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

.circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    transform-origin: center;
    transform: translate(-50%, -50%);
    animation: spinCircle 20s linear infinite;
}
.circle-1 {
    width: 100%;
    height: 100%;
    animation-duration: 25s;
}
.circle-2 {
    width: 90%;
    height: 90%;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation-duration: 20s;
    animation-direction: reverse;
}
.circle-3 {
    width: 80%;
    height: 80%;
    border-radius: 40% 60% 50% 50% / 50% 50% 50% 50%;
    animation-duration: 30s;
}
.circle-4 {
    width: 110%;
    height: 110%;
    border-radius: 50% 50% 50% 50% / 40% 60% 70% 30%;
    animation-duration: 35s;
    animation-direction: reverse;
}

@keyframes spinCircle {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.auth-modal-content {
    max-width: 380px;
    width: 100%;
    text-align: center;
    padding: 3rem 2rem;
    background: transparent;
    z-index: 1;
    position: relative;
}

.auth-title {
    font-size: 2.2rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 2.5rem;
    color: #fff;
    letter-spacing: 0.5px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: fadeIn 0.4s ease forwards;
}

.auth-form.hidden {
    display: none;
}

.auth-form input {
    width: 100%;
    padding: 14px 20px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    color: #fff;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.auth-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.auth-form input:focus {
    outline: none;
    border-color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.auth-btn {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-danger) 100%);
    border: none;
    border-radius: 30px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3);
    transition: transform 0.2s, background 0.3s, box-shadow 0.2s;
}

.auth-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(90deg, var(--color-danger) 0%, var(--color-primary) 100%);
    box-shadow: 0 6px 20px rgba(194, 156, 87, 0.4);
}

.auth-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-footer-links {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding: 0 10px;
}

.auth-link {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.auth-link:hover {
    color: #fff;
}

/* --- Ranking Sidebar Responsive --- */
.ranking-sidebar {
    position: static;
    flex-shrink: 0; /* Prevents it from being squished */
    width: 280px;
    background: rgba(19, 21, 26, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    z-index: 50;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: fadeIn 0.5s ease-out;
}

/* On smaller screens make it take full width but constrained */
@media (max-width: 800px) {
    .ranking-sidebar {
        width: 100%;
        max-width: 400px;
        margin: 0 auto 1.5rem auto;
    }
}
