/* ===== Design Tokens ===== */
:root {
    --bg-dark: #050510;
    --bg-gradient: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #050510 100%);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 12px;
    --text-main: #ffffff;
    --text-muted: #a0a0b0;
    --accent-glow: rgba(100, 200, 255, 0.4);
    --accent-color: #64c8ff;
    --snake-color: #00ffcc;
    --comet-color: #ffaa00;
}

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hide scrollbar across all browsers */
html {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    background-image: var(--bg-gradient);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ===== Canvas Layer ===== */
#game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== UI Layer ===== */
#ui-layer {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

@media (max-width: 1024px) {
    #ui-layer {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    #ui-layer {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    #ui-layer {
        padding: 1rem 0.75rem;
    }
}

/* ===== Header ===== */
header {
    text-align: center;
    margin-top: 4vh;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(-30px);
    animation: fadeInDown 1.2s ease-out forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

@media (max-width: 768px) {
    header {
        margin-top: 2vh;
        margin-bottom: 1.5rem;
        gap: 1rem;
    }
}

h1 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.75rem, 5vw + 0.5rem, 4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    line-height: 1.15;
    padding: 0 0.5rem;
}

/* ===== Header Actions ===== */
.header-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    width: 100%;
    max-width: 500px;
    justify-content: center;
}

@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        gap: 0.8rem;
        max-width: 320px;
        width: 100%;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .header-actions {
        max-width: 280px;
    }
}

/* ===== Buttons ===== */
.btn {
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1rem;
    display: inline-block;
    text-align: center;
}

@media (max-width: 768px) {
    .btn {
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 0.9rem 1.2rem;
        font-size: 0.9rem;
    }
}

.btn-primary {
    background: var(--accent-color);
    color: #000;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
    transform: translateY(-3px);
}

/* ===== Social Links ===== */
.social-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
    justify-content: center;
}

.social-icon {
    color: var(--text-muted);
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .social-links {
        gap: 2rem;
        margin-top: 0.8rem;
    }

    .social-icon {
        width: 28px;
        height: 28px;
        padding: 6px;
    }

    .social-icon svg {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .social-links {
        gap: 2.5rem;
    }
}

.social-icon:hover {
    color: var(--accent-color);
    transform: scale(1.2);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* ===== Filter Buttons ===== */
.filter-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeIn 1s ease-out 0.5s forwards;
    margin-top: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

@media (max-width: 768px) {
    .filter-container {
        margin-top: 1.5rem;
        margin-bottom: 2rem;
        gap: 0.6rem;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .filter-container {
        margin-top: 1rem;
        margin-bottom: 1.5rem;
        gap: 0.5rem;
    }
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

@media (max-width: 768px) {
    .filter-btn {
        padding: 0.65rem 1.6rem;
        font-size: 0.85rem;
        min-width: 85px;
        flex: 1;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .filter-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.82rem;
    }
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.filter-btn.active {
    background: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* ===== Grid / Masonry ===== */
.grid-container {
    position: relative;
    width: 100%;
    margin-bottom: 6rem;
    min-height: 0;
    transition: height 0.15s ease;
}

@media (max-width: 768px) {
    .grid-container {
        margin-bottom: 5rem;
    }
}

@media (max-width: 480px) {
    .grid-container {
        margin-bottom: 4.5rem;
    }
}

/* ===== Glass Cards ===== */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    position: absolute;
    top: 0;
    left: 0;
    transition:
        top 0.12s cubic-bezier(0.2, 0.8, 0.2, 1),
        left 0.12s cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 0.1s ease,
        filter 0.1s ease;
    overflow: visible;
    opacity: 0;
    filter: blur(10px);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
}

.glass-card.hidden {
    display: none !important;
}

.glass-card.visible {
    opacity: 1;
    filter: blur(0);
    animation: dance 3s ease-in-out infinite alternate;
}

/* Strange Variations */
.glass-card:nth-child(odd) {
    border-radius: 63% 37% 39% 61% / 46% 56% 44% 54%;
    border-top: 1px solid rgba(0, 255, 204, 0.3);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(0, 255, 204, 0.05));
}

.glass-card:nth-child(even) {
    border-radius: 36% 64% 60% 40% / 61% 39% 61% 39%;
    border-bottom: 1px solid rgba(255, 0, 255, 0.3);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 0, 255, 0.05));
}

.glass-card:nth-child(3n) {
    border-radius: 73% 27% 29% 71% / 59% 74% 26% 41%;
    border-left: 1px solid rgba(255, 255, 0, 0.3);
}

/* Card Hover */
.glass-card:hover {
    z-index: 100 !important;
    background: rgba(255, 255, 255, 0.15);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(100, 200, 255, 0.2),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    transform: translateY(-10px) scale(1.02);
    cursor: pointer;
}

.glass-card:hover .card-title {
    color: #fff;
    text-shadow: 0 0 10px var(--accent-color);
}

@media (max-width: 768px) {
    .glass-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .glass-card {
        padding: 1.25rem;
    }
}

/* ===== Card Content ===== */
.card-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .card-title {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 480px) {
    .card-title {
        font-size: 1.15rem;
    }
}

.card-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #d1d5db;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .card-text {
        font-size: 0.9rem;
        line-height: 1.55;
        margin-bottom: 1.2rem;
    }
}

@media (max-width: 480px) {
    .card-text {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }
}

/* ===== Tags ===== */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e7ff;
    transition: 0.2s;
}

.tag:hover {
    background: rgba(100, 200, 255, 0.15);
    border-color: var(--accent-color);
}

@media (max-width: 480px) {
    .tag {
        font-size: 0.7rem;
        padding: 0.35rem 0.7rem;
    }
}

/* ===== HUD / Progress Bar ===== */
.hud-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 100;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeIn 1s ease-out 1s forwards;
}

@media (max-width: 768px) {
    .hud-container {
        width: calc(100% - 2rem);
        max-width: 100%;
        padding: 0.7rem 1.1rem;
        bottom: 1rem;
        gap: 0.7rem;
        justify-content: space-between;
        border-radius: 40px;
        left: 1rem;
        right: 1rem;
        transform: none;
    }
}

@media (max-width: 480px) {
    .hud-container {
        padding: 0.6rem 0.9rem;
        gap: 0.5rem;
        bottom: 0.75rem;
        left: 0.75rem;
        right: 0.75rem;
        width: calc(100% - 1.5rem);
        border-radius: 30px;
    }
}

@media (max-width: 360px) {
    .hud-container {
        padding: 0.5rem 0.75rem;
        gap: 0.4rem;
        bottom: 0.5rem;
        left: 0.5rem;
        right: 0.5rem;
        width: calc(100% - 1rem);
    }
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .progress-info {
        font-size: 0.8rem;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .progress-info {
        font-size: 0.75rem;
        gap: 0.4rem;
    }
}

@media (max-width: 360px) {
    .progress-info {
        font-size: 0.7rem;
        gap: 0.35rem;
    }
}

.comet-icon {
    width: 20px;
    height: 20px;
    background: var(--comet-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--comet-color);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .comet-icon {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .comet-icon {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 360px) {
    .comet-icon {
        width: 12px;
        height: 12px;
    }
}

.progress-bar {
    width: 150px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .progress-bar {
        width: 90px;
        height: 5px;
    }
}

@media (max-width: 480px) {
    .progress-bar {
        width: 70px;
        height: 4px;
    }
}

@media (max-width: 360px) {
    .progress-bar {
        width: 55px;
        height: 4px;
    }
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--snake-color), var(--accent-color));
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px var(--snake-color);
}

/* ===== CTA Button ===== */
.cta-btn {
    padding: 0.8rem 2rem;
    border-radius: 30px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: not-allowed;
    transition: all 0.2s ease;
    text-decoration: none;
    opacity: 0.6;
    pointer-events: none;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .cta-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.8rem;
        border-radius: 25px;
    }
}

@media (max-width: 480px) {
    .cta-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
        border-radius: 22px;
        letter-spacing: 0.02em;
    }
}

@media (max-width: 360px) {
    .cta-btn {
        padding: 0.45rem 0.8rem;
        font-size: 0.7rem;
    }
}

.cta-btn.active {
    background: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
    box-shadow: 0 0 20px var(--accent-glow);
    cursor: pointer;
    opacity: 1;
    pointer-events: auto;
    animation: shake 0.5s ease-in-out;
}

.cta-btn.active:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--accent-glow);
}

/* ===== Animations ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dance {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-15px); }
}

@keyframes pulse {
    0%   { transform: scale(1);   opacity: 1; }
    50%  { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1);   opacity: 1; }
}

@keyframes shake {
    0%, 100%            { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80%      { transform: translateX(2px); }
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(100, 200, 255, 0.3);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.27);
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(100, 200, 255, 0.1);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--accent-color);
}

.modal-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.modal-subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--accent-glow);
}

.modal-body {
    font-size: 1rem;
    line-height: 1.7;
    color: #e0e0e0;
    text-align: center;
}

@media (max-width: 768px) {
    .modal-content {
        padding: 2rem 1.5rem;
        width: 92%;
        border-radius: 18px;
    }

    .modal-subtitle {
        font-size: 0.95rem;
    }

    .modal-body {
        font-size: 0.92rem;
        line-height: 1.65;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem 1.25rem;
        width: 95%;
        border-radius: 16px;
    }

    .modal-subtitle {
        font-size: 0.85rem;
        letter-spacing: 1.5px;
    }

    .modal-body {
        font-size: 0.85rem;
        line-height: 1.6;
    }

    .form-input,
    .form-textarea {
        padding: 0.75rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .form-label {
        font-size: 0.82rem;
    }

    .form-group {
        margin-bottom: 1.2rem;
    }

    .send-btn {
        padding: 0.85rem;
        font-size: 0.9rem;
    }
}

/* ===== Form ===== */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(100, 200, 255, 0.2);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.send-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(90deg, var(--accent-color), var(--snake-color));
    border: none;
    border-radius: 30px;
    color: #000;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.send-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px var(--accent-glow);
}

/* ===== Modal Traveler (Ball) ===== */
.modal-traveler {
    position: absolute;
    width: 15px;
    height: 15px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--accent-color), 0 0 40px var(--accent-color);
    z-index: 20;
    pointer-events: none;
    transition: border-radius 0.5s ease, transform 0.5s ease, background-color 0.5s ease;
}

/* ===== Thank You Toast ===== */
.thank-toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: rgba(10, 10, 25, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 255, 204, 0.4);
    border-radius: 16px;
    padding: 1.2rem 1.8rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 2000;
    opacity: 0;
    transform: translateX(120%);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(0, 255, 204, 0.15);
}

.thank-toast.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.thank-toast-icon {
    font-size: 1.8rem;
    line-height: 1;
    animation: pulse 2s infinite;
}

.thank-toast-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.thank-toast-text strong {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    color: var(--snake-color);
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.4);
}

.thank-toast-text span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .thank-toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        padding: 1rem 1.2rem;
    }
}

/* ===== Portfolio Toast Extra ===== */
.portfolio-toast {
    border-color: rgba(255, 170, 0, 0.4);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(255, 170, 0, 0.15);
}

.portfolio-toast .thank-toast-text strong {
    color: var(--comet-color);
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.4);
}

.toast-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.toast-hint a {
    color: var(--accent-color);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.toast-hint a:hover {
    color: #fff;
}
