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

:root {
    --bg: #fef5f0;
    --bg-card: #ffffff;
    --primary: #ff6b6b;
    --primary-light: #ffa8a8;
    --primary-dark: #e85d5d;
    --secondary: #845ef7;
    --secondary-light: #b197fc;
    --accent: #ffd43b;
    --text: #2b2b2b;
    --text-light: #868e96;
    --border: #f1e4de;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.1);
    --radius: 20px;
    --radius-sm: 12px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ===== Floating Paws Background ===== */
.paw-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.paw {
    position: absolute;
    font-size: 2rem;
    opacity: 0.07;
    animation: floatPaw 20s infinite linear;
}

.paw-1 { left: 5%; animation-delay: 0s; font-size: 1.5rem; }
.paw-2 { left: 15%; animation-delay: -3s; font-size: 2.5rem; }
.paw-3 { left: 30%; animation-delay: -6s; font-size: 1.8rem; }
.paw-4 { left: 50%; animation-delay: -9s; font-size: 2.2rem; }
.paw-5 { left: 65%; animation-delay: -12s; font-size: 1.6rem; }
.paw-6 { left: 80%; animation-delay: -15s; font-size: 2rem; }
.paw-7 { left: 90%; animation-delay: -4s; font-size: 1.4rem; }
.paw-8 { left: 40%; animation-delay: -18s; font-size: 2.8rem; }

@keyframes floatPaw {
    0%   { transform: translateY(110vh) rotate(0deg); }
    100% { transform: translateY(-10vh) rotate(360deg); }
}

/* ===== Container ===== */
.container {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 2.8rem;
    animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

.logo h1 {
    font-family: 'Baloo 2', cursive;
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ===== Upload Area ===== */
.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.upload-area {
    width: 100%;
    background: var(--bg-card);
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-light);
    background: #fff5f5;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: #ffe8e8;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    color: var(--primary-light);
    margin-bottom: 8px;
}

.upload-area h3 {
    font-family: 'Baloo 2', cursive;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.upload-area p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.browse-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.file-types {
    font-size: 0.8rem;
    color: var(--text-light);
    opacity: 0.7;
    margin-top: 4px;
}

/* ===== Preview ===== */
.preview-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.preview-state img {
    max-width: 100%;
    max-height: 320px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    box-shadow: var(--shadow-sm);
}

.change-btn {
    background: none;
    border: 2px solid var(--border);
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.change-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

/* ===== Gender Picker ===== */
.gender-picker {
    width: 100%;
    text-align: center;
}

.gender-label {
    font-family: 'Baloo 2', cursive;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    display: block;
    margin-bottom: 10px;
}

.optional-tag {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-light);
}

.gender-options {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.gender-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.25s ease;
}

.gender-btn:hover {
    border-color: var(--primary-light);
    color: var(--text);
    transform: translateY(-1px);
}

.gender-btn[aria-pressed="true"] {
    border-color: var(--primary);
    background: linear-gradient(135deg, #fff0f0, #ffe8f5);
    color: var(--primary-dark);
    box-shadow: 0 2px 12px rgba(255, 107, 107, 0.2);
}

/* ===== Analyze Button ===== */
.analyze-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50px;
    font-family: 'Baloo 2', cursive;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
}

.analyze-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.5);
}

.analyze-btn:active {
    transform: translateY(0) scale(0.98);
}

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

/* ===== Loading ===== */
.loading-section {
    text-align: center;
    padding: 60px 0;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.cat-loader span {
    display: inline-block;
    font-size: 4rem;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

.loading-text {
    font-family: 'Baloo 2', cursive;
    font-size: 1.2rem;
    color: var(--text-light);
    animation: pulse 2s ease-in-out infinite;
}

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

/* ===== Profile Card ===== */
.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    gap: 0;
    margin-bottom: 36px;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.profile-image {
    flex: 0 0 240px;
    min-height: 240px;
    overflow: hidden;
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    flex: 1;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-info h2 {
    font-family: 'Baloo 2', cursive;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.traits {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.trait-tag {
    display: inline-block;
    padding: 4px 14px;
    background: linear-gradient(135deg, #fff0f0, #f8f0ff);
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--secondary);
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.detail-item {
    font-size: 0.85rem;
    color: var(--text-light);
}

.detail-item strong {
    color: var(--text);
    font-weight: 600;
}

/* ===== Names ===== */
.names-title {
    font-family: 'Baloo 2', cursive;
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text);
    animation: slideUp 0.7s ease-out;
}

.names-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.name-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 24px 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    cursor: default;
    transition: all 0.3s ease;
    animation: popIn 0.5s ease-out backwards;
    border: 2px solid transparent;
}

.name-card:nth-child(1) { animation-delay: 0.1s; }
.name-card:nth-child(2) { animation-delay: 0.2s; }
.name-card:nth-child(3) { animation-delay: 0.3s; }
.name-card:nth-child(4) { animation-delay: 0.4s; }
.name-card:nth-child(5) { animation-delay: 0.5s; }
.name-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.name-card:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.name-card h3 {
    font-family: 'Baloo 2', cursive;
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.name-card p {
    font-size: 0.82rem;
    color: var(--text-light);
    line-height: 1.4;
}

/* ===== Results Actions ===== */
.results-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    animation: slideUp 0.8s ease-out;
}

.more-names-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--secondary), #6c3ce0);
    color: white;
    border: none;
    border-radius: 50px;
    font-family: 'Baloo 2', cursive;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(132, 94, 247, 0.35);
}

.more-names-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 30px rgba(132, 94, 247, 0.45);
}

.more-names-btn:active {
    transform: translateY(0) scale(0.98);
}

.more-names-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.dice-rolling {
    display: inline-block;
    animation: rollDice 1.2s ease-in-out infinite;
}

@keyframes rollDice {
    0%   { transform: rotate(0deg) scale(1); }
    25%  { transform: rotate(90deg) scale(1.2); }
    50%  { transform: rotate(180deg) scale(1); }
    75%  { transform: rotate(270deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

.try-again-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 50px;
    font-family: 'Baloo 2', cursive;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.try-again-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #fff;
    border: 2px solid #ffc9c9;
    border-radius: 50px;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    transition: transform 0.4s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    font-size: 1.3rem;
}

/* ===== Footer ===== */
.footer {
    margin-top: 60px;
    padding: 36px 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-inner {
    max-width: 480px;
    margin: 0 auto;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Baloo 2', cursive;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.footer-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 14px;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.footer-links a {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.footer-dot {
    color: var(--text-light);
    font-size: 0.7rem;
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--text-light);
    opacity: 0.7;
}

/* ===== Legal Pages ===== */
.legal-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.legal-page .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 24px;
    transition: color 0.2s;
}

.legal-page .back-link:hover {
    color: var(--primary-dark);
}

.legal-page h1 {
    font-family: 'Baloo 2', cursive;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.legal-page .updated {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 28px;
}

.legal-page h2 {
    font-family: 'Baloo 2', cursive;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 24px 0 10px;
    color: var(--text);
}

.legal-page p,
.legal-page ul {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 12px;
}

.legal-page ul {
    padding-left: 20px;
}

.legal-page li {
    margin-bottom: 6px;
}

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

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .container { padding: 24px 16px 60px; }

    .logo h1 { font-size: 2rem; }
    .logo-icon { font-size: 2.2rem; }
    .tagline { font-size: 0.95rem; }

    .upload-area { padding: 36px 20px; }

    .profile-card {
        flex-direction: column;
    }

    .profile-image {
        flex: none;
        height: 220px;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .names-grid {
        grid-template-columns: 1fr 1fr;
    }

    .name-card {
        padding: 18px 14px;
    }

    .name-card h3 {
        font-size: 1.15rem;
    }
}

@media (max-width: 400px) {
    .names-grid {
        grid-template-columns: 1fr;
    }
}
