/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    background-color: #050505;
    color: #f9f9f9;
    line-height: 1.6;
}

/* Hide html2canvas temporary iframes */
iframe[style*="position: fixed"] {
    visibility: hidden !important;
    opacity: 0 !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2%;
}

/* Navigation */
.navbar {
    background-color: #050505;
    border-bottom: 1px solid rgba(163, 163, 163, 0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    font-size: 20px;
    font-weight: 700;
    color: #f9f9f9;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    color: #a3a3a3;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #f9f9f9;
}

/* Hamburger Menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.hamburger-menu span {
    width: 25px;
    height: 2px;
    background-color: #f9f9f9;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 5, 5, 0.98);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.mobile-menu-link {
    color: #f9f9f9;
    text-decoration: none;
    font-size: 32px;
    font-weight: 400;
    transition: color 0.3s ease;
}

.mobile-menu-link:hover {
    color: #a855f7;
}

/* Hero Section */
.hero-section {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0 20px;
}

.hero-container {
    text-align: center;
    max-width: 90%;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 24px;
    line-height: 1.2;
    color: #e0e0e0;
}

.typing-text {
    font-size: 18px;
    color: #a3a3a3;
    min-height: 30px;
    margin-bottom: 40px;
}

.input-group {
    display: flex;
    gap: 12px;
    max-width: 90%;
    margin: 0 auto 32px;
}

.username-input {
    flex: 1;
    padding: 16px 24px;
    background-color: #1a1a1a;
    border: 1px solid rgba(163, 163, 163, 0.2);
    border-radius: 50px;
    color: #f9f9f9;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.username-input:focus {
    border-color: #a855f7;
}

.username-input::placeholder {
    color: #a3a3a3;
}

/* Buttons */
.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #9333ea;
    color: #f9f9f9;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.btn-primary:hover:not(:disabled) {
    background-color: #a855f7;
    box-shadow: 0 6px 16px rgba(168, 85, 247, 0.5);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-donate {
    background-color: #facc15;
    color: #050505;
}

.btn-donate:hover {
    background-color: #eab308;
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.4);
}

/* Loading State */
.loading-state {
    text-align: center;
    margin-top: 24px;
}

.spinner {
    border: 3px solid rgba(163, 163, 163, 0.2);
    border-top: 3px solid #a855f7;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-state {
    color: #ef4444;
    margin-top: 16px;
    padding: 12px;
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
}

/* Carousel Section */
.carousel-section {
    padding: 10px 0 0;
    overflow: hidden;
}

.carousel-container {
    overflow: hidden;
    position: relative;
}

.carousel-track {
    display: flex;
    gap: 16px;
    animation: carousel-scroll 40s linear infinite;
    padding: 20px 0;
}

.carousel-item {
    flex: 0 0 auto;
    width: 140px;
    height: 210px;
    object-fit: cover;
    border-radius: 8px;
    opacity: 0.7;
    transition: all 0.3s ease;
    transform-origin: center center;
}

.carousel-item:hover {
    transform: scale(1.15);
    opacity: 1;
    z-index: 1;
}

/* Left/right fade */
.carousel-container::before,
.carousel-container::after {
    content: "";
    position: absolute;
    top: 0;
    width: 80px;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.carousel-container::before {
    left: 0;
    background: linear-gradient(to right, rgba(5, 5, 5, 1), rgba(5, 5, 5, 0));
}

.carousel-container::after {
    right: 0;
    background: linear-gradient(to left, rgba(5, 5, 5, 1), rgba(5, 5, 5, 0));
}

/* Keyframes: move by half the track width (because we duplicate once) */
@keyframes carousel-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Stats Section */
.stats-section {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.stats-number {
    font-size: 96px;
    font-weight: 700;
    color: #e0e0e0;
    margin-bottom: 16px;
}

.stats-label {
    font-size: 20px;
    color: #a3a3a3;
    margin-bottom: 8px;
}

.stats-sublabel {
    font-size: 14px;
    color: #6b7280;
}

/* Donate Section */
.donate-section {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donate-container {
    text-align: center;
    max-width: 90%;
}

.donate-message {
    font-size: 24px;
    color: #f9f9f9;
    margin-bottom: 20px;
}

.donate-thanks {
    font-size: 20px;
    color: #a3a3a3;
    margin-bottom: 32px;
}

#donateButton {
    margin-top: 60px;
}

.donate-description {
    font-size: 18px;
    color: #a3a3a3;
    margin-top: 80px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: #f9f9f9;
    margin-left: 2px;
    animation: blink-cursor 1s steps(2, jump-none) infinite;
    vertical-align: baseline;
}

@keyframes blink-cursor {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

/* Contact Section */
.contact-section {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
}

.contact-container {
    max-width: 100%;
    width: 100%;
    padding: 0 20px;
}

.contact-card {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px;
    background-color: rgba(26, 26, 26, 0.5);
    border-radius: 16px;
}

.contact-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 32px;
    text-align: center;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.form-group label {
    font-size: 16px;
    color: #f9f9f9;
    font-weight: 600;
}

.form-input,
.form-textarea {
    padding: 14px 18px;
    background-color: #1a1a1a;
    border: 1px solid rgba(163, 163, 163, 0.2);
    border-radius: 8px;
    color: #f9f9f9;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-input:focus,
.form-textarea:focus {
    border-color: #a855f7;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #6b7280;
}

.form-textarea {
    resize: none;
    min-height: 120px;
}

.btn-contact {
    margin-top: 8px;
}

.success-message {
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    text-align: center;
}

/* Profile Hero Section */
.profile-hero {
    padding: 40px 0 30px;
}

.profile-hero .container {
    text-align: center;
}

.archetype-title {
    font-size: 56px;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
}

.archetype-rarity {
    font-size: 20px;
    color: #a3a3a3;
    margin-bottom: 0px;
    text-align: center;
}

.radar-chart-container {
    max-width: 70%;
    margin: -60px auto 8px;
    padding: 16px;
    position: relative;
    width: 100%;
}

.radar-chart-container canvas {
    display: block;
    width: 100% !important;
    height: auto !important;
}

.radar-legend {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: -90px;
    margin-bottom: 80px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* Profile Description Section */
.profile-description-section {
    padding: 60px 0 40px;
}

.profile-description-text {
    font-size: 20px;
    line-height: 1.7;
    color: #f5f5f5;
    text-align: center;
    max-width: 80%;
    margin: 0 auto 60px;
}

.profile-traits {
    max-width: 70%;
    margin: 0 auto 32px;
}

.traits-heading {
    font-size: 24px;
    font-weight: 600;
    color: #f9f9f9;
    margin-bottom: 16px;
}

.traits-list {
    list-style: none;
    padding-left: 0;
}

.traits-list li {
    font-size: 18px;
    line-height: 1.8;
    color: #d1d1d1;
    padding-left: 28px;
    position: relative;
    margin-bottom: 12px;
}

.traits-list li::before {
    content: "•";
    color: var(--archetype-color, #a855f7);
    font-size: 24px;
    position: absolute;
    left: 0;
    top: -8px;
}

/* Badges Section */
.badges-section {
    padding: 80px 0 40px;
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 40px;
}

.badge-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.badge-chip {
    padding: 8px 20px;
    background-color: transparent;
    border: 2px solid #facc15;
    color: #facc15;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 0 1 auto;
    text-align: center;
    white-space: nowrap;
}

.badge-chip.active,
.badge-chip:hover {
    background-color: #facc15;
    color: #050505;
}

.badge-detail-card {
    max-width: 70%;
    margin: 0 auto;
    padding: 32px;
    background-color: rgba(40, 40, 40, 0.6);
    border-radius: 16px;
    position: relative;
    min-height: 200px;
}

.badge-detail {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
}

.badge-detail.active {
    display: block;
    animation: fadeInDown 1s ease-out forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.rec-card.fade-in {
    animation: fadeInRec 0.5s ease-out forwards;
}

.badge-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.badge-rarity {
    font-size: 16px;
    color: #a3a3a3;
    margin-bottom: 16px;
}

.rarity-label {
    font-weight: 600;
}

.rarity-common {
    color: #facc15;
}

.rarity-uncommon {
    color: #64b5f6;
}

.rarity-rare {
    color: #a855f7;
}

.rarity-legendary {
    background: linear-gradient(90deg, #ff0080, #ff8c00, #ffd700, #00ff00, #00bfff, #8a2be2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow-shift 3s ease-in-out infinite;
    background-size: 200% 100%;
}

@keyframes rainbow-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.badge-description {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.badge-behavior {
    font-size: 16px;
    line-height: 1.6;
    color: #a3a3a3;
    font-style: italic;
}

/* 3x3 Section */
.threebythree-section {
    padding: 40px 0 80px;
}

.toggle-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
}

.toggle-btn {
    padding: 12px 32px;
    background-color: transparent;
    border: 2px solid #a3a3a3;
    color: #a3a3a3;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover:not(.active) {
    border-color: var(--archetype-color, #a855f7);
    color: var(--archetype-color, #a855f7);
}

.toggle-btn.active {
    background-color: var(--archetype-color, #a855f7);
    border-color: var(--archetype-color, #a855f7);
    color: #f9f9f9;
}

.threebythree-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-width: 42%;
    margin: 0 auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Base cell (applies to both real items and placeholders) */
.grid-cell {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    border-radius: 8px;
}

/* Real item version */
.grid-cell--filled {
    cursor: pointer;
}

.grid-cell--filled img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: brightness(0.88) saturate(0.92);
}

.grid-cell--filled:hover img {
    transform: scale(1.05);
    filter: brightness(1) saturate(1);
}

/* Placeholder version */
.grid-cell--placeholder {
    background-color: rgba(26, 26, 26, 0.15);
    border: 1px solid rgba(163, 163, 163, 0.1);
}

/* Message overlay over the entire 3x3 */
.grid-message-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #a3a3a3;
    font-style: italic;
    line-height: 1.6;
    pointer-events: none;
}

.threebythree-grid.slide-out-left {
    opacity: 0;
    transform: translateX(-20px);
}

.threebythree-grid.slide-out-right {
    opacity: 0;
    transform: translateX(20px);
}

.threebythree-grid.slide-in-left {
    animation: slideInLeft 0.4s ease-out forwards;
}

.threebythree-grid.slide-in-right {
    animation: slideInRight 0.4s ease-out forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    display: flex;
    align-items: flex-end;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.grid-cell--filled:hover .grid-overlay,
.grid-cell--filled.active .grid-overlay {
    opacity: 1;
}

.grid-title {
    color: #f9f9f9;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

/* Recommendations Section */
.recommendations-section {
    padding: 80px 0 40px;
}

.recommendations-wrapper {
    max-width: 70%;
    margin: 0 auto;
    position: relative;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.recommendations-list.scrollable {
    max-height: 1010px;
    overflow-y: auto;
    padding-right: 4px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.recommendations-list.slide-out-left {
    opacity: 0;
    transform: translateX(-20px);
}

.recommendations-list.slide-out-right {
    opacity: 0;
    transform: translateX(20px);
}

.recommendations-list.slide-in-left {
    animation: slideInLeft 0.4s ease-out forwards;
}

.recommendations-list.slide-in-right {
    animation: slideInRight 0.4s ease-out forwards;
}

/* Custom scrollbar */
.recommendations-list.scrollable::-webkit-scrollbar {
    width: 8px;
}

.recommendations-list.scrollable::-webkit-scrollbar-track {
    background: rgba(163, 163, 163, 0.1);
    border-radius: 4px;
}

.recommendations-list.scrollable::-webkit-scrollbar-thumb {
    background: var(--archetype-color-shadow-5, rgba(168, 85, 247, 0.5));
    border-radius: 4px;
}

.recommendations-list.scrollable::-webkit-scrollbar-thumb:hover {
    background: var(--archetype-color, rgba(168, 85, 247, 0.7));
}

.rec-card {
    display: flex;
    gap: 16px;
    padding: 12px;
    background-color: #1a1a1a;
    border-radius: 12px;
    transition: opacity 0.2s ease;
    align-items: center;
    text-decoration: none;
    color: inherit;
    opacity: 0.9;
}

.rec-card:hover {
    opacity: 1;
}

.rec-cover {
    width: 100px;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    transition: filter 0.3s ease;
    filter: brightness(0.88) saturate(0.92);
}

.rec-card:hover .rec-cover {
    filter: brightness(1) saturate(1);
}

.rec-content {
    flex: 1;
}

.rec-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.rec-confidence {
    color: #a855f7;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.rec-meta {
    font-size: 14px;
    margin-bottom: 4px;
}

.rec-label {
    color: #a3a3a3;
}

.rec-because {
    font-size: 14px;
    margin-top: 8px;
}

.load-more-btn {
    margin-top: 24px;
    text-align: center;
}

.btn-load-more {
    background-color: transparent;
    border: 2px solid var(--archetype-color, #a855f7);
    color: var(--archetype-color, #a855f7);
}

.btn-load-more:hover {
    background-color: var(--archetype-color, #a855f7);
    color: #f9f9f9;
}

/* Star Rating Section */
.rating-section {
    max-width: 95%;
    margin: 100px auto 0px;
    text-align: center;
}

.rating-question {
    font-size: 20px;
    color: #f9f9f9;
    margin-bottom: 16px;
    font-weight: 500;
}

.rating-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 0px;
}

.star-rating {
    display: flex;
    gap: 8px;
}

.star {
    font-size: 40px;
    color: #a3a3a3;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.star:hover,
.star.hovered {
    color: #facc15;
    transform: scale(1.1);
}

.star.selected {
    color: #facc15;
}

.btn-rating-send {
    background-color: var(--archetype-color, #a855f7);
    color: #f9f9f9;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--archetype-color-shadow-4, rgba(168, 85, 247, 0.4));
}

.btn-rating-send:hover {
    filter: brightness(0.85);
    box-shadow: 0 6px 16px var(--archetype-color-shadow-5, rgba(168, 85, 247, 0.5));
}

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

.rating-thanks {
    font-size: 18px;
    color: #22c55e;
    margin-top: 16px;
    font-weight: 500;
}

/* Profile Actions */
.profile-actions {
    max-width: 95%;
    margin: 40px auto 0;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
}

.btn-save {
    background-color: transparent;
    border: 2px solid var(--archetype-color, #a855f7);
    color: var(--archetype-color, #a855f7);
}

.btn-save:hover {
    background-color: var(--archetype-color, #a855f7);
    color: #f9f9f9;
}

.btn-share {
    background-color: var(--archetype-color, #a855f7);
    border: 2px solid var(--archetype-color, #a855f7);
    color: #f9f9f9;
}

.btn-share:hover {
    filter: brightness(0.85);
}

/* Fade animations */
.fade-section {
    opacity: 0;
    transform: translateY(24px);
    transition: all 0.5s ease-out;
}

.fade-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive - Medium Screens */
@media (max-width: 1024px) {
    .threebythree-grid {
        max-width: 55%;
    }

    .recommendations-wrapper {
        max-width: 85%;
    }
}

/* Responsive - Tablets */
@media (max-width: 768px) {
    .container {
        padding: 0 3%;
    }

    .hero-section {
        padding: 30px 0 15px;
    }

    .hero-title {
        font-size: 36px;
    }

    .typing-text {
        font-size: 18px;
    }

    .input-group {
        flex-direction: column;
    }

    .nav-links {
        gap: 16px;
        font-size: 14px;
    }

    .carousel-section {
        padding: 10px 0 0;
    }

    .carousel-item {
        width: 120px;
        height: 180px;
    }

    .stats-number {
        font-size: 64px;
    }

    .section-title {
        font-size: 28px;
    }

    .archetype-title {
        font-size: 40px;
    }

    .archetype-rarity {
        font-size: 18px;
    }

    .radar-chart-container {
        max-width: 85%;
        padding: 12px;
    }

    .legend-item {
        font-size: 13px;
    }

    .legend-color {
        width: 18px;
        height: 18px;
    }

    .radar-legend {
        margin-top: -70px;
    }

    .profile-description-text {
        font-size: 18px;
        max-width: 90%;
    }

    .profile-traits {
        max-width: 85%;
    }

    .traits-heading {
        font-size: 22px;
    }

    .traits-list li {
        font-size: 16px;
    }

    .badge-name {
        font-size: 24px;
    }

    .badge-description {
        font-size: 16px;
    }

    .badge-behavior {
        font-size: 14px;
    }

    .threebythree-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        max-width: 85%;
    }

    .grid-message-text {
        font-size: 20px;
    }

    .recommendations-wrapper {
        max-width: 90%;
    }

    .rec-card {
        padding: 14px;
    }

    .rec-cover {
        width: 90px;
        height: 135px;
    }

    .rec-title {
        font-size: 20px;
    }

    .rec-confidence {
        font-size: 15px;
    }

    .rec-meta {
        font-size: 14px;
    }

    .recommendations-list.scrollable {
        max-height: 850px;
    }

    .badge-chips {
        gap: 8px;
    }

    .badge-chip {
        font-size: 14px;
        padding: 10px 18px;
        flex: 0 1 auto;
    }

    .profile-actions {
        gap: 12px;
    }

    .btn-action {
        font-size: 14px;
        padding: 10px 20px;
    }
}

/* Responsive - Mobile Phones */
@media (max-width: 425px) {
    .container {
        padding: 0 4%;
    }

    .navbar {
        padding: 12px 0;
    }

    .nav-brand a {
        font-size: 18px;
    }

    .nav-links {
        display: none;
    }

    .hamburger-menu {
        display: flex;
    }

    .hero-section {
        padding: 20px 0 10px;
        min-height: 60vh;
    }

    .hero-title {
        font-size: 28px;
        margin-bottom: 16px;
    }

    .typing-text {
        font-size: 16px;
        min-height: 40px;
    }

    .username-input {
        font-size: 14px;
        padding: 12px 16px;
    }

    .btn-primary {
        font-size: 14px;
        padding: 12px 24px;
    }

    .carousel-section {
        padding: 10px 0;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .carousel-track {
        gap: 12px;
        padding: 15px 0;
    }

    .carousel-item {
        width: 100px;
        height: 150px;
    }

    .carousel-item:hover {
        transform: scale(1.1);
    }

    .stats-section {
        padding: 40px 0;
        min-height: 50vh;
    }

    .stats-number {
        font-size: 48px;
    }

    .stats-label {
        font-size: 16px;
    }

    .section-title {
        font-size: 24px;
        margin-bottom: 24px;
    }

    .archetype-title {
        font-size: 32px;
        margin-bottom: 8px;
    }

    .archetype-rarity {
        font-size: 16px;
    }

    .radar-chart-container {
        max-width: 100%;
        padding: 8px;
    }

    .radar-legend {
        gap: 20px;
        margin-top: -40px;
    }

    .legend-item {
        font-size: 11px;
    }

    .legend-color {
        width: 14px;
        height: 14px;
    }

    .profile-description-section {
        padding: 40px 0 30px;
    }

    .profile-description-text {
        font-size: 16px;
        max-width: 95%;
        line-height: 1.6;
        margin-bottom: 32px;
    }

    .profile-traits {
        max-width: 95%;
        margin-bottom: 24px;
    }

    .traits-heading {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .traits-list li {
        font-size: 15px;
        line-height: 1.6;
        padding-left: 24px;
        margin-bottom: 10px;
    }

    .traits-list li::before {
        font-size: 20px;
    }

    .badges-section {
        padding: 60px 0 30px;
    }

    .badge-chips {
        gap: 6px;
    }

    .badge-chip {
        font-size: 13px;
        padding: 8px 16px;
        flex: 0 1 auto;
    }

    .badge-detail-card {
        max-width: 90%;
        padding: 24px;
    }

    .badge-name {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .badge-rarity {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .badge-description {
        font-size: 15px;
        line-height: 1.5;
        margin-bottom: 12px;
    }

    .badge-behavior {
        font-size: 13px;
    }

    .threebythree-section {
        padding: 30px 0 60px;
    }

    .threebythree-grid {
        gap: 6px;
        max-width: 90%;
    }

    .grid-message-text {
        font-size: 18px;
    }

    .toggle-buttons {
        gap: 8px;
        margin-bottom: 20px;
    }

    .toggle-btn {
        font-size: 14px;
        padding: 8px 20px;
    }

    .recommendations-section {
        padding: 60px 0 80px;
    }

    .recommendations-list {
        gap: 10px;
    }

    .recommendations-list.scrollable {
        max-height: 700px;
    }

    .rec-card {
        padding: 12px;
        gap: 12px;
    }

    .rec-cover {
        width: 80px;
        height: 120px;
    }

    .rec-title {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .rec-confidence {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .rec-meta {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .rec-because {
        font-size: 13px;
    }

    .rec-label {
        font-weight: 600;
    }

    .btn-load-more {
        font-size: 14px;
        padding: 10px 24px;
    }

    .rating-question {
        font-size: 16px;
    }

    .rating-controls {
        flex-direction: column;
        gap: 16px;
    }

    .star {
        font-size: 32px;
    }

    .star-rating {
        gap: 4px;
    }

    .btn-rating-send {
        font-size: 14px;
        padding: 10px 24px;
    }

    .rating-thanks {
        font-size: 16px;
    }

    .profile-actions {
        flex-direction: column;
        gap: 10px;
        padding: 20px;
    }

    .btn-action {
        font-size: 14px;
        padding: 10px 20px;
        width: 100%;
        justify-content: center;
    }

    .contact-form input,
    .contact-form textarea {
        font-size: 14px;
    }

    .donate-section,
    .contact-section {
        padding: 40px 0;
    }

    .donate-section h1,
    .contact-section h1 {
        font-size: 32px;
    }

    .donate-section p {
        font-size: 16px;
    }
}

/* ==================== SHARE/EXPORT SECTION ==================== */

/* Share/Export Section */
.share-export-section {
    padding: 2rem 0 5rem;
    text-align: center;
}

.btn-share-export {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: #fff;
    background: linear-gradient(145deg, var(--archetype-color), var(--archetype-color-hover));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.btn-share-export svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-share-export:hover {
    background: linear-gradient(145deg, var(--archetype-color-hover), var(--archetype-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.btn-share-export:active {
    transform: translateY(0px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Share Modal */
.share-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.share-modal.active {
    display: flex;
}

.share-modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 36px;
    max-width: 900px;
    width: 90%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

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

.share-modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 32px;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.share-modal-close:hover {
    color: #fff;
}

.share-modal-title {
    font-size: 1.75rem;
    margin-bottom: 24px;
    color: #f9f9f9;
}

.share-username-option {
    margin-bottom: 24px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label {
    font-size: 1rem;
    color: #d1d1d1;
}

/* Layout selection */
.share-layout-option {
    margin-bottom: 32px;
}

.layout-option-label {
    display: block;
    font-size: 0.95rem;
    color: #d1d1d1;
    margin-bottom: 12px;
    font-weight: 500;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.radio-container:hover {
    background: rgba(255, 255, 255, 0.05);
}

.radio-container input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--archetype-color);
}

.radio-label {
    font-size: 0.95rem;
    color: #d1d1d1;
}

/* Modal header */
.share-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.share-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #f5f5f5;
    margin: 0 0 8px 0;
}

.share-modal-subtitle {
    font-size: 14px;
    color: #a3a3a3;
    margin: 0;
}

/* Layout selector - segmented control */
.share-layout-selector {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.layout-pill {
    padding: 10px 20px;
    border-radius: 999px;
    border: 2px solid #444;
    background: transparent;
    color: #d1d1d1;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layout-pill:hover {
    border-color: #666;
    background: rgba(255, 255, 255, 0.05);
}

.layout-pill.active {
    border-color: var(--archetype-color, #a855f7);
    background: var(--archetype-color, #a855f7);
    color: #fff;
}

/* Preview frame */
.share-preview-frame {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: radial-gradient(ellipse at center, rgba(100, 100, 100, 0.12) 0%, rgba(50, 50, 50, 0.08) 100%);
    padding: 20px;
    margin-bottom: 24px;
}

.share-preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    max-height: 500px;
    position: relative;
}

.share-preview-container img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    border-radius: 8px;
    animation: fadeIn 0.3s ease-in;
}

.share-preview-container img.no-fade {
    animation: none;
}

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

/* Loading spinner */
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #999;
}

.preview-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--archetype-color, #a855f7);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Action buttons */
.share-action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.btn-action svg {
    flex-shrink: 0;
}

.btn-action-download {
    background: var(--archetype-color, #a855f7);
    color: #fff;
}

.btn-action-twitter {
    background: #000;
    color: #fff;
}

.btn-action-reddit {
    background: #ff4500;
    color: #fff;
}

.share-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-modal-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-preview {
    background: #333;
    color: #fff;
    border: 1px solid #555;
}

.btn-preview:hover {
    background: #444;
    border-color: #666;
}

.btn-download {
    background: var(--archetype-color);
    color: #fff;
}

.btn-download:hover {
    background: var(--archetype-color-hover);
    transform: translateX(4px);
}

.btn-twitter {
    background: #000;
    color: #fff;
    border: 1px solid #333;
}

.btn-twitter:hover {
    background: #1a1a1a;
    border-color: #555;
}

.btn-reddit {
    background: #ff4500;
    color: #fff;
}

.btn-reddit:hover {
    background: #ff5722;
}

/* Preview Modal */
.preview-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(100, 100, 100, 0.92);
    align-items: center;
    justify-content: center;
}

.preview-modal.active {
    display: flex;
}

.preview-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    background: #0a0a0a;
    border-radius: 12px;
    padding: 32px;
}

.preview-modal-close {
    position: absolute;
    right: 16px;
    top: 16px;
    font-size: 32px;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    z-index: 10;
}

.preview-modal-close:hover {
    color: #fff;
}

.preview-modal-title {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: #f9f9f9;
    text-align: center;
}

.preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.preview-container img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Share Card (Offscreen) - Dynamic Layout */
.share-card {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 1200px;
    height: 675px;
    background: #050505;
    color: #f5f5f5;
    font-family: system-ui, -apple-system, "SF Pro Text", sans-serif;
    box-sizing: border-box;
    padding: 32px 36px 18px;

    display: grid;
    grid-template-columns: 3fr 2fr;
    grid-template-rows: 1fr auto;
    gap: 12px;
    overflow: hidden;
}

/* Three column layout for both 3×3 - keep same 16:9 ratio */
.share-card.layout-both {
    height: 675px;
    padding: 32px 36px 8px;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr auto;
}

/* Left Column: Archetype Info */
.card-left {
    grid-row: 1;
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-left__header {
    display: flex;
    flex-direction: column;
    text-align: center;
    margin-top: 8px;
}

.card-left__title-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-title {
    margin: 0;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    word-spacing: 0.15em;
}

.card-username {
    font-size: 15px;
    color: #a3a3a3;
    font-weight: 500;
}

.card-subtitle {
    margin: 4px 0 0;
    font-size: 15px;
    opacity: 0.85;
}

.card-left__radar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin-top: -24px;
    margin-left: -40px;
}

/* Increase radar canvas size */
#radarChartCard {
    width: 440px !important;
    height: 440px !important;
}

.card-left__legend {
    margin-top: -20px;
    margin-left: 40px;
    font-size: 12px;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

.card-left__legend .legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot--you {
    background: var(--archetype-color);
}

.legend-dot--community {
    background: #a3a3a3;
}

.card-left__badges {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 12px;
}

.card-left__badges .badges-label {
    font-size: 13px;
    color: #d1d1d1;
    margin-bottom: 7px;
    text-align: center;
}

.badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.share-card .badge {
    padding: 3px 12px 6px;
    border-radius: 999px;
    background: #e7c94a;
    color: #000;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Right Column: 3×3 Grids */
.card-right {
    grid-row: 1;
    grid-column: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 16px 16px 16px 0;
}

.card-right__section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Hide sections by default (shown via JS based on layout) */
.card-right__section {
    display: none;
}

.card-right__section.visible {
    display: flex;
    border-radius: 12px;
    padding: 16px;
}

.grid-title {
    margin: 0 0 9px;
    padding-top: 8px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    color: #999999;
    letter-spacing: 0.5px;
}

.archetype-motto {
    margin: 8px 0 0;
    font-size: 13px;
    font-style: italic;
    color: #d1d1d1;
    text-align: center;
    line-height: 1.4;
    max-width: 330px;
}

/* Single 3×3 layout (anime only or manga only) - 1/3 width */
.share-card:not(.layout-both) .grid3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    width: 330px;
}

.share-card:not(.layout-both) .grid3x3 img {
    width: 100%;
    aspect-ratio: 225 / 318;
    object-fit: cover;
    border-radius: 4px;
    background: #1a1a1a;
    filter: brightness(0.88) saturate(0.92);
}

/* Both 3×3 layout - three column grid */
/* Anime goes directly into column 1 */
.share-card.layout-both .card-right__section--anime {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    align-self: start;
    margin: 0;
    padding: 0;
    padding-top: 50px;
}

/* Center card (radar) in column 2 */
.share-card.layout-both .card-left {
    grid-column: 2;
    grid-row: 1;
    gap: 2px;
    align-self: start;
    padding-top: 16px;
}

/* Manga goes directly into column 3 */
.share-card.layout-both .card-right__section--manga {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    align-self: start;
    margin: 0;
    padding: 0;
    padding-top: 50px;
}

/* Hide the card-right wrapper for both layout - sections are direct grid children */
.share-card.layout-both .card-right {
    display: contents;
}

.share-card.layout-both .grid3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    width: 335px;
}

.share-card.layout-both .grid3x3 img {
    width: 100%;
    aspect-ratio: 225 / 318;
    object-fit: cover;
    border-radius: 3px;
    background: #1a1a1a;
    filter: brightness(0.88) saturate(0.92);
}

/* Footer */
.card-footer {
    grid-column: 1 / 3;
    grid-row: 2;
    text-align: center;
    font-size: 17px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 700;
    padding-top: 0;
    margin-top: 0;
    transform: translateY(-8px);
}

.share-card.layout-both .card-footer {
    grid-column: 1 / 4;
    padding-top: 0;
    margin-top: 0;
    transform: translateY(-18px);
}

/* Adjust center column (radar/badges) sizing for both layout */
.share-card.layout-both .card-left__header {
    margin-top: 0;
}

.share-card.layout-both .card-title {
    font-size: 28px;
}

.share-card.layout-both .card-subtitle {
    font-size: 13px;
}

.share-card.layout-both #radarChartCard {
    width: 340px !important;
    height: 340px !important;
}

.share-card.layout-both .card-left__radar {
    margin-top: 0px;
    margin-left: -30px;
}

.share-card.layout-both .card-left__legend {
    margin-top: -16px;
    margin-left: 30px;
    font-size: 12px;
    gap: 16px;
    margin-bottom: 16px;
}

.share-card.layout-both .card-left__legend .legend-item {
    font-size: 12px;
}

.share-card.layout-both .card-left__badges .badges-label {
    font-size: 12px;
}

.share-card.layout-both .badge {
    font-size: 12px;
    padding: 3px 10px 5px;
}

.share-card.layout-both .grid-title {
    font-size: 14px;
    margin-bottom: 12px;
    padding-top: 0;
}

.card-footer a {
    color: #e0e0e0;
    text-decoration: none;
    transition: color 0.2s;
}

.card-footer a:hover {
    color: #f5f5f5;
}

/* Responsive for Share/Export */
@media (max-width: 768px) {
    .share-modal-content {
        padding: 32px 24px;
    }

    .btn-share-export {
        padding: 14px 32px;
        font-size: 1rem;
    }
}
