@import url('https://fonts.googleapis.com/css2?family=Jacquarda+Bastarda+9&display=swap');

body {
    font-family: 'Press Start 2P', cursive, monospace;
    min-height: 100vh;
    padding: 20px;
    color: #5fcaff;
    font-size: 16px;
    /* Match access overlay background: radial gradient with deep purple tones */
    background: radial-gradient(ellipse at 50% 40%, #000 0%, #1a0033 60%, #0f002c 100%);
    position: relative;
    overflow: hidden;
}
/* Tab preview images */
.tab-preview-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    margin-right: 8px;
    vertical-align: middle;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
/* Trait tab navigation */
.trait-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 5px 0 -10px 0;
    flex-wrap: wrap;
}
body.day .trait-tab-btn {
    background: #b8c1c4;
    color: #0b4a78;
}
.trait-tab-btn {
    background: #362f3e;
    border: none;
    color: #667eea;
    padding: 8px 10px 4px 10px;
    border-radius: 4px 0 0 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    outline: none;
    min-width: 70px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    text-align: center;
    white-space: normal;
}
.trait-tab-btn.active, .trait-tab-btn:hover {
    background: #240038;
    color: #fff;
    border-bottom: 2px solid #5a008b;
    z-index: 2;
}
body.day .trait-tab-btn.active, body.day .trait-tab-btn:hover {
    background: #7dafff;
    color: #0b2540;
    border-bottom: 2px solid #0b4a78;
}
.trait-tab {
    display: none;
}
.trait-tab[style*="display: block"], .trait-tab[style=""] {
    display: block;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}



button, .btn, .trait-tab-btn, .trait-option, .controls, .trait-group, .trait-options, nav, label, input, select, textarea {
    font-family: 'Press Start 2P', cursive, monospace !important;
    letter-spacing: 0;
    font-size: 0.5em !important;
    font-weight: normal !important;
}




.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1; /* ensure page content sits above decorative background layers */
}

/* Decorative animated background for the app (grid + floating particles)
   Mirrors the overlay visuals so the app has a matching background. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
 /*   background-image: 
        linear-gradient(rgba(95, 202, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(95, 202, 255, 0.03) 1px, transparent 1px); */
    background-size: 32px 32px;
    animation: gridScroll 15s linear infinite;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(circle, #5fcaff 1px, transparent 1px),
        radial-gradient(circle, #ff79b0 1px, transparent 1px),
        radial-gradient(circle, #a855f7 1px, transparent 1px);
    background-size: 80px 80px, 120px 120px, 100px 100px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.08;
    animation: particleFloat 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.wallet-check {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}
.wallet-check input[type="text"] {
    padding: 8px 10px;
    border-radius: 5px;
    border: 2px solid #ddd;
    min-width: 260px;
}
.wallet-check select {
    padding: 8px 10px;
    border-radius: 5px;
    border: 2px solid #ddd;
}
.wallet-result {
    margin-left: 8px;
    font-size: 0.65em;
    color: #fff;
    background: rgba(0,0,0,0.35);
    padding: 8px 14px;
    border-radius: 5px;
    min-width: 200px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Purple check wallet button */
#checkWalletBtn {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(92, 33, 182, 0.18);
    transition: transform 0.12s ease, filter 0.12s ease;
}

#checkWalletBtn:hover {
    filter: brightness(0.96);
    transform: translateY(-2px);
}

#checkWalletBtn:active {
    transform: translateY(0);
}

/* h1 styling moved earlier - see line ~75 */
h1.legacy-style-override {
    text-align: center;
    color: rgb(255, 62, 143);
    font-size: 7em;
    margin: -20px 0 0 0 ;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Use the requested decorative font for titles */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Jacquarda Bastarda 9', 'Press Start 2P', cursive;
    font-weight: normal !important;
}

/* Tagline directly under the main title */
.tagline {
    font-family: 'Press Start 2P', cursive, monospace;
    font-size: 0.7em;
    text-align: center;
    color: #79ffd0;
    margin-top: -20px;
    margin-bottom: 18px;
}

/* Main page title: use overlay title look but slightly larger for the page header */
.main-title {
    font-size: 3.2em;
    margin: 6px 0 0 0;
    text-align: center;
    letter-spacing: 4px;
}

.avatar-section {
    background: white;
    border-radius: 5px;
    padding: 30px;
    margin-bottom: 30px;
}

/* Main layout: avatar left, traits right on desktop */
.main-area {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 30px;
}
.main-area .avatar-section {
    flex: 0 0 48%;
}
.sidebar {
    flex: 1 1 52%;
    display: flex;
    flex-direction: row;
    gap: 0px;
    align-items: flex-start;
}

/* Sidebar: vertical nav on the left, selectors on the right */
.sidebar .trait-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 0 0 70px;
    align-items: stretch;
    justify-content: flex-start;
}

.sidebar .trait-selectors {
    flex: 1 1 auto;
}

.sidebar .trait-nav .trait-tab-btn {
    width: 100%;
    min-width: auto;
    min-height: 64px;
    padding: 5px;
    text-align: center;
}
/* Hover: move left effect */
.sidebar .trait-nav .trait-tab-btn {
    transition: transform 0.14s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.sidebar .trait-nav .trait-tab-btn:hover {
    /* Lift slightly on hover without shifting horizontally to avoid creating gaps */
    transform: translateY(-2px) scale(1.02);
}
.sidebar .trait-nav .trait-tab-btn:active {
    transform: translateY(0) scale(1.01);
}

.canvas-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

/* Canvas container setup (for overlaying animated layer images) */
.canvas-container {
    transform: translateZ(0);
    position: relative;
}

/* Trait option animation (tile) */
.trait-option.selected-anim {
    animation: option-pop 560ms cubic-bezier(.2,.9,.2,1);
    will-change: transform, box-shadow;
}
@keyframes option-pop {
    0% { transform: scale(1); box-shadow: none; }
    40% { transform: scale(1.08) translateX(-6px); box-shadow: 0 10px 24px rgba(118,75,162,0.15); }
    70% { transform: scale(0.98) translateX(0); }
    100% { transform: scale(1); box-shadow: none; }
}

/* Overlay animation for the specific trait layer that changed */
.trait-layer-anim {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    pointer-events: none;
    animation: layer-pop 520ms cubic-bezier(.2,.9,.2,1);
}

@keyframes layer-pop {
    0% { transform: scale(0.96); opacity: 0.0; filter: drop-shadow(0 0 0 rgba(0,0,0,0)); }
    45% { transform: scale(1.12) translateX(-6px); opacity: 1; filter: drop-shadow(0 18px 36px rgba(118,75,162,0.18)); }
    75% { transform: scale(0.98) translateX(0); }
    100% { transform: scale(1); opacity: 1; filter: none; }
}

/* Trait layer out animation: animate the removal of the old layer, then the JS will set the new trait */
.trait-layer-out {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    pointer-events: none;
    animation: layer-out 420ms cubic-bezier(.2,.9,.2,1);
}

@keyframes layer-out {
    0% { transform: scale(1); opacity: 1; }
    40% { transform: scale(0.94) translateX(-10px); opacity: 0.6; filter: drop-shadow(0 10px 24px rgba(0,0,0,0.08)); }
    100% { transform: scale(0.88) translateX(-20px); opacity: 0; }
}

#avatarCanvas {
    border: 1px solid #444444;
    border-radius: 5px;
    background: #f0f0f0;
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Make buttons inside .controls use a 14px font for better readability */
.controls .btn, .controls button {
    font-size: 10px !important;
}

.btn {
    padding: 12px 30px;
    font-size: .7em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.trait-selectors {
    display: grid;
    /* Ensure at least 3 columns on wider screens by using a max min-width of 33% per column,
       but cap each column to a reasonable pixel width so they don't grow too large. */
    grid-template-columns: repeat(auto-fit, minmax(min(33%, 220px), 1fr));
    gap: 20px;
}

.trait-group {
    background: #240038;
    border-radius: 5px;
    padding: 10px 8px 20px 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.trait-group h3 {
    margin-bottom: 15px;
    color: #eb02eb;
    font-size: 2.5em;
    border-bottom: 2px solid #5a008b;
    padding-bottom: 8px;
}

/* Theme toggle styles (copied from landing.css but scoped here to avoid importing landing.css) */
.theme-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(16,11,48,0.9), rgba(24,14,64,0.85));
    border: 1px solid rgba(95,202,255,0.12);
    color: #fff;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(6px);
}
.theme-toggle:active { transform: translateY(1px); }
.theme-toggle i { font-size: 18px; pointer-events: none; line-height: 1; }
body.day .theme-toggle{
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(62, 174, 255, 0.452);
    color: #0b2540;
}

/* Day theme: solid white background + subtle light grid */
body.day {
    background: #ffffff;
    color: #0b2540;
}

body.day::before {
    background-image: 
        linear-gradient(rgba(11, 37, 64, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(11, 37, 64, 0.03) 1px, transparent 1px);
    background-size: 12px 12px;
}

body.day h1 { color: #0b4a78; text-shadow: none; }

body.day .tagline { color: #3b6a9a; }

body.day .trait-group { background: #d6d6d6; color: #0b2540; border-color: #e6eefb; }

body.day .wallet-result { background: rgba(240,240,240,0.9); color: #0b2540; }

/* Ensure group headings also use the decorative font */
.trait-group h3 {
    font-family: 'Jacquarda Bastarda 9', 'Press Start 2P', cursive;
}

.trait-options {
    display: grid;
    /* Make preview tiles smaller so at least 3 fit per row on most desktop widths */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px;
    justify-items: center;
    align-items: center;
}

.trait-option {
    position: relative;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 3px;
    overflow: hidden;
    transition: all 0.3s ease;
    aspect-ratio: 1 / 1;
    min-width: 120px;
    min-height: 120px;
    max-width: 180px;
    max-height: 180px;
    background:#fff;
}

.trait-option img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.trait-option:hover {
    transform: scale(1.05);
    border-color: #667eea;
}

.trait-option.selected {
    border-color: #764ba2;
    box-shadow: 0 0 15px rgba(118, 75, 162, 0.5);
}

.trait-option.none {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    color: #666;
}

.tab-preview-img-large {
    width: 54px;
    height: 54px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Dim non-active tab preview images so only the active tab's image is fully visible */
.trait-tab-btn .tab-preview-img-large {
    opacity: 0.45;
    transition: opacity 160ms ease, transform 160ms ease;
}
.trait-tab-btn:hover .tab-preview-img-large {
    opacity: 0.75;
}
.trait-tab-btn.active .tab-preview-img-large {
    opacity: 1;
    transform: translateY(-2px);
}

.tab-preview-label {
    display: block;
    text-align: center;
    font-size: 0.45em;
    margin-top: 6px;
    color: #667eea;
    font-family: 'Press Start 2P', cursive, monospace;
    letter-spacing: 0;
    line-height: 1.1;
    word-break: break-word;
}

/* Hide visible label text on trait tab buttons (show image only) */
.tab-preview-label {
    display: none !important;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    
    .trait-selectors {
        grid-template-columns: 1fr;
    }

    #avatarCanvas {
        width: 100%;
    }

    /* stack main area on small screens */
    .main-area {
        flex-direction: column;
    }

    /* Sidebar becomes stacked: nav above selectors */
    .sidebar {
        flex-direction: column;
    }

    /* Mobile: make sidebar use full width so it lines up with avatar section */
    .sidebar {
        width: 100%;
        flex: none;
    }

    .sidebar .trait-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 6px;
    }

    .sidebar .trait-nav .trait-tab-btn {
        width: auto;
        min-width: 52px;
        min-height: 48px;
    }

    /* Mobile: make tab buttons feel like pills with a subtle border */
    .sidebar .trait-nav .trait-tab-btn {
        border-radius: 8px;
        border: 2px solid transparent;
        padding: 6px 8px;
        font-size: 0.65em;
    }

    /* On mobile, use border color to show active state instead of bottom border */
    .sidebar .trait-nav .trait-tab-btn.active,
    .sidebar .trait-nav .trait-tab-btn:hover {
        border-bottom: none;
        border-color: #5a008b;
        color: #fff;
        transform: none;
        box-shadow: 0 8px 18px rgba(90,0,139,0.12);
    }

    /* Make sidebar children full width and prevent trait tiles from forcing overflow */
    .sidebar {
        align-items: stretch;
    }

    .sidebar .trait-nav,
    .sidebar .trait-selectors,
    .trait-selectors {
        width: 100%;
    }

    .trait-option {
        /* allow grid items to shrink to container width */
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    /* Reduce large preview images on mobile to save horizontal space */
    .tab-preview-img-large {
        width: 40px;
        height: 40px;
    }
}

/* NFT identifier panel (separate from wallet status) */
.nft-info {
    margin-top: 8px;
    background: rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.08);
    padding: 10px;
    border-radius: 5px;
    max-width: 420px;
    word-break: break-word;
    font-size: 11px;
    color: #333;
}

.nft-info a {
    color: #2b8fbf;
    text-decoration: underline;
}