/* ============================================
   ppuzzl.bid - Puzzle Auction House
   Candy-Bright Gaming Aesthetic
   ============================================ */

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

:root {
    --deep-purple: #1E0A3C;
    --candy-pink: #FF69B4;
    --lemon-drop: #FFE135;
    --mint-green: #00E676;
    --electric-blue: #448AFF;
    --soft-white: #F0F0F0;
    --hex-size: 180px;
    --hex-gap: 8px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--deep-purple);
    color: var(--soft-white);
    overflow-x: hidden;
    line-height: 1.5;
}

/* --- Puzzle Background Pattern --- */
.puzzle-bg-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M60 10C55 10 55 20 60 20C65 20 65 10 60 10ZM30 40H55V20H65V40H90V50H75C75 60 85 60 85 50H90V90H65V75C55 75 55 85 65 85V90H30V50H45C45 40 35 40 35 50H30Z' fill='%23F0F0F0' /%3E%3C/svg%3E");
    background-size: 120px 120px;
    pointer-events: none;
}

/* --- Hero Section --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #2D1456 0%, var(--deep-purple) 70%);
}

.hero-content {
    position: relative;
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Central Hexagon */
.central-hex {
    width: 240px;
    height: 240px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, var(--candy-pink), #a83279);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    animation: hexPulse 3s ease-in-out infinite;
}

.central-hex-inner {
    width: 230px;
    height: 230px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--deep-purple);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-title {
    font-size: clamp(1.8rem, 4vw, 3.4rem);
    font-weight: 700;
    color: var(--soft-white);
    letter-spacing: -0.02em;
    text-align: center;
}

.accent-dot {
    color: var(--candy-pink);
}

.hero-tagline {
    font-size: clamp(0.8rem, 1.4vw, 1rem);
    font-weight: 400;
    color: var(--lemon-drop);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 4px;
}

@keyframes hexPulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 105, 180, 0.3)); }
    50% { filter: drop-shadow(0 0 40px rgba(255, 105, 180, 0.6)); }
}

/* Orbital Hexagons */
.orbital-ring {
    position: absolute;
    width: 320px;
    height: 320px;
    animation: orbitSpin 20s linear infinite;
    z-index: 1;
}

.orbital-hex {
    position: absolute;
    width: 40px;
    height: 40px;
}

.orbital-hex-1 { top: 0; left: 50%; transform: translateX(-50%); }
.orbital-hex-2 { top: 15%; right: 0; }
.orbital-hex-3 { bottom: 15%; right: 0; }
.orbital-hex-4 { bottom: 0; left: 50%; transform: translateX(-50%); }
.orbital-hex-5 { bottom: 15%; left: 0; }
.orbital-hex-6 { top: 15%; left: 0; }

@keyframes orbitSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Scroll Hint */
.scroll-hint {
    position: absolute;
    bottom: 30px;
    animation: bounceDown 2s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* --- Categories Bar --- */
#categories {
    padding: 40px 20px 20px;
    display: flex;
    justify-content: center;
}

.category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 800px;
}

.category-btn {
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 8px 20px;
    border: 2px solid rgba(240, 240, 240, 0.2);
    border-radius: 30px;
    background: transparent;
    color: var(--soft-white);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.category-btn:hover {
    border-color: var(--candy-pink);
    color: var(--candy-pink);
    transform: scale(1.05);
}

.category-btn.active {
    background: var(--candy-pink);
    border-color: var(--candy-pink);
    color: var(--deep-purple);
}

/* --- Section Title --- */
.section-title {
    text-align: center;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--soft-white);
    margin: 50px 0 30px;
    letter-spacing: 0.02em;
}

/* --- Honeycomb Grid --- */
#honeycomb {
    padding: 20px 20px 60px;
    max-width: 1100px;
    margin: 0 auto;
}

.hex-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.hex-row {
    display: flex;
    gap: var(--hex-gap);
    justify-content: center;
    flex-wrap: wrap;
}

.hex-row-offset {
    margin-top: -30px;
    margin-left: calc(var(--hex-size) / 2 + var(--hex-gap) / 2);
}

/* Hex Tile */
.hex-tile {
    width: var(--hex-size);
    height: calc(var(--hex-size) * 1.1547);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(180deg, rgba(240, 240, 240, 0.08) 0%, rgba(240, 240, 240, 0.03) 100%);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
    position: relative;
    opacity: 0;
    animation: hexEntrance 0.5s ease-out forwards;
}

.hex-tile:nth-child(1) { animation-delay: 0.05s; }
.hex-tile:nth-child(2) { animation-delay: 0.1s; }
.hex-tile:nth-child(3) { animation-delay: 0.15s; }
.hex-tile:nth-child(4) { animation-delay: 0.2s; }

.hex-row:nth-child(2) .hex-tile:nth-child(1) { animation-delay: 0.25s; }
.hex-row:nth-child(2) .hex-tile:nth-child(2) { animation-delay: 0.3s; }
.hex-row:nth-child(2) .hex-tile:nth-child(3) { animation-delay: 0.35s; }
.hex-row:nth-child(2) .hex-tile:nth-child(4) { animation-delay: 0.4s; }

.hex-row:nth-child(3) .hex-tile:nth-child(1) { animation-delay: 0.45s; }
.hex-row:nth-child(3) .hex-tile:nth-child(2) { animation-delay: 0.5s; }
.hex-row:nth-child(3) .hex-tile:nth-child(3) { animation-delay: 0.55s; }
.hex-row:nth-child(3) .hex-tile:nth-child(4) { animation-delay: 0.6s; }

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

.hex-tile:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 15px rgba(255, 105, 180, 0.5));
    z-index: 10;
}

.hex-tile[data-difficulty="easy"]:hover {
    filter: drop-shadow(0 0 15px rgba(0, 230, 118, 0.6));
}

.hex-tile[data-difficulty="medium"]:hover {
    filter: drop-shadow(0 0 15px rgba(68, 138, 255, 0.6));
}

.hex-tile[data-difficulty="hard"]:hover {
    filter: drop-shadow(0 0 15px rgba(255, 105, 180, 0.6));
}

.hex-tile.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.hex-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 15px 20px;
    text-align: center;
    gap: 2px;
}

/* Difficulty Badges */
.difficulty-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.difficulty-badge.easy {
    background: var(--mint-green);
    color: var(--deep-purple);
}

.difficulty-badge.medium {
    background: var(--electric-blue);
    color: var(--soft-white);
}

.difficulty-badge.hard {
    background: var(--candy-pink);
    color: var(--deep-purple);
}

.hex-icon {
    margin: 4px 0;
}

.hex-title {
    font-size: clamp(0.75rem, 1.1vw, 0.95rem);
    font-weight: 700;
    color: var(--soft-white);
    line-height: 1.2;
}

.hex-category {
    font-size: 0.65rem;
    font-weight: 400;
    color: rgba(240, 240, 240, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hex-bid {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--lemon-drop);
    margin-top: 2px;
}

/* --- Leaderboard --- */
#leaderboard {
    padding: 20px 20px 60px;
    max-width: 700px;
    margin: 0 auto;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leader-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: rgba(240, 240, 240, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(240, 240, 240, 0.06);
    transition: background 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.leader-row:hover {
    background: rgba(240, 240, 240, 0.08);
    transform: translateX(6px);
}

.leader-rank {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--candy-pink);
    min-width: 36px;
}

.leader-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--soft-white);
    flex: 1;
}

.leader-score {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--lemon-drop);
}

.leader-badge {
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Game HUD Footer --- */
#game-hud {
    background: linear-gradient(180deg, rgba(30, 10, 60, 0.9) 0%, rgba(10, 3, 20, 1) 100%);
    border-top: 2px solid rgba(255, 105, 180, 0.3);
    padding: 20px 20px 12px;
}

.hud-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.hud-label {
    font-size: 0.65rem;
    font-weight: 400;
    color: rgba(240, 240, 240, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.hud-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--soft-white);
}

#hud-level {
    color: var(--electric-blue);
}

#hud-score {
    color: var(--candy-pink);
}

#hud-solved {
    color: var(--mint-green);
}

/* XP Bar */
.hud-xp-bar-container {
    min-width: 160px;
}

.hud-xp-bar {
    width: 100%;
    height: 10px;
    background: rgba(240, 240, 240, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.hud-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mint-green), var(--electric-blue));
    border-radius: 5px;
    transition: width 1s ease;
}

.hud-xp-text {
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(240, 240, 240, 0.5);
}

.hud-bottom {
    text-align: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(240, 240, 240, 0.06);
}

.hud-copyright {
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(240, 240, 240, 0.3);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .hex-row-offset {
        margin-left: 0;
        margin-top: 10px;
    }

    :root {
        --hex-size: 150px;
    }
}

@media (max-width: 640px) {
    :root {
        --hex-size: 130px;
    }

    .hex-row {
        gap: 4px;
    }

    .hex-row-offset {
        margin-left: 0;
        margin-top: 6px;
    }

    .hero-content {
        width: 260px;
        height: 260px;
    }

    .central-hex {
        width: 200px;
        height: 200px;
    }

    .central-hex-inner {
        width: 190px;
        height: 190px;
    }

    .orbital-ring {
        width: 260px;
        height: 260px;
    }

    .hud-bar {
        gap: 16px;
    }

    .hud-xp-bar-container {
        min-width: 120px;
    }
}

@media (max-width: 420px) {
    :root {
        --hex-size: 110px;
    }

    .hex-content {
        padding: 20px 8px 15px;
    }

    .hex-title {
        font-size: 0.7rem;
    }

    .hex-category, .hex-bid {
        font-size: 0.6rem;
    }

    .difficulty-badge {
        font-size: 0.55rem;
        padding: 1px 6px;
    }

    .hex-icon svg {
        width: 24px;
        height: 24px;
    }
}
