:root {
    --primary: #b026ff;
    --secondary: #00f0ff;
    --accent: #39ff14;
    --dark: #0a0a12;
    --light: #f0f0f0;
    --glass: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--dark);
    color: var(--light);
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 10px 40px;
    /* Reduced padding slightly for better fit */
    background: rgba(10, 10, 18, 0.9);
    /* Slightly darker/more opaque */
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid var(--glass);
}

nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary);
    /* Ensure logo stays on left */
    flex-shrink: 0;
}

nav ul {
    display: flex;
    gap: 30px;
    list-style: none;
    /* Center the nav links */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

nav a {
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
}

/* SNS Icons */
.header-sns {
    display: flex;
    gap: 15px;
    align-items: center;
    /* Ensure SNS stays on right */
    flex-shrink: 0;
}

.sns-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--light);
    transition: color 0.3s, transform 0.3s;
}

.sns-icon:hover {
    color: var(--secondary);
    transform: scale(1.1);
}

.sns-icon-small {
    width: 24px;
    height: 24px;
}

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

.sns-icon-large {
    width: 60px;
    height: 60px;
}

.sns-icon-large svg {
    width: 60px;
    height: 60px;
}

/* ... existing hero styles ... */

.hero-sns {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-top: 40px;
    margin-bottom: 80px;
    /* Increased from 40px */
}

.hero-sns .sns-icon {
    color: var(--dark);
    transition: color 0.3s, transform 0.3s;
}

.hero-sns .sns-icon:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.sns-icon-disabled {
    opacity: 0.4;
    cursor: default;
}

.sns-icon-disabled:hover {
    color: var(--light);
    transform: none;
    filter: none;
}

/* Hero */
#hero {
    height: auto;
    min-height: 100vh;
    padding-top: 60px;
    padding-bottom: 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    text-align: center;
    position: relative;
    overflow: hidden;
    background-color: #e8e4dc;
}

#hero::before {
    display: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    /* Ensure content container doesn't overflow */
    max-width: 800px;
    /* Optional: limit max width on large screens */
    margin: 0 auto;
}

.hero-logo img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    /* Center the image */
}


.cta-button {
    padding: 15px 40px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    border-radius: 30px;
    box-shadow: 0 0 20px var(--primary);
    transition: transform 0.3s, box-shadow 0.3s;
}

.cta-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px var(--primary);
}

/* Game UI Layer */
#game-ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas when no UI is active */
    z-index: 10;
}

#start-screen,
#game-over-screen,
#loading-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    text-align: center;
    background: rgba(0, 0, 0, 0.85);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid var(--secondary);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
    pointer-events: auto;
    /* Re-enable clicks for buttons */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#loading-screen {
    border: none;
    background: transparent;
    box-shadow: none;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #fff;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Sections */
section {
    padding: 100px 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

h2 {
    font-size: 3rem;
    margin-bottom: 50px;
    color: var(--light);
    text-shadow: 0 0 10px var(--glass);
}

/* Game Section */
#game-container {
    position: relative;
    width: 360px;
    height: 480px;
    margin: 0 auto;
    background-color: #050508;
    /* Dark background */
    border: 2px solid var(--secondary);
    box-shadow: 0 0 20px var(--secondary);
    overflow: hidden;
    border-radius: 10px;
    z-index: 0;
}

#bg-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    /* Constrain size */
    opacity: 0.15;
    /* Make it subtle gray */
    z-index: 0;
    pointer-events: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    /* Above logo */
}

/* Button Styles */
button {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    background: var(--secondary);
    color: var(--dark);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 0 15px var(--secondary);
    transition: 0.3s;
}

button:hover {
    background: white;
    box-shadow: 0 0 25px white;
}

/* Game UI Layer */
#game-ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Pass clicks to canvas */
    z-index: 10;
}

/* Enable pointer events for buttons/inputs inside UI layer */
#game-ui-layer>* {
    pointer-events: auto;
}

#end-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    font-size: 0.8rem;
    z-index: 100;
    margin: 0;
    background: rgba(255, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(2px);
    transition: 0.2s;
    cursor: pointer;
    display: none;
    /* Hidden until game starts */
}

#end-btn:hover {
    background: rgba(255, 0, 0, 0.9);
    box-shadow: 0 0 10px red;
    transform: scale(1.05);
}

#game-over-screen button {
    margin: 10px;
}

/* High Score Styles */
#high-score-list {
    margin: 15px 0;
    text-align: left;
    width: 100%;
    max-width: 200px;
}

#high-score-list h4 {
    color: var(--accent);
    border-bottom: 1px solid var(--accent);
    padding-bottom: 5px;
    margin-bottom: 10px;
    text-align: center;
}

#high-score-list ol {
    padding-left: 20px;
    color: var(--light);
}

#high-score-list li {
    margin-bottom: 5px;
    font-family: 'Zen Kaku Gothic New', sans-serif;
}

#high-score-input-container {
    margin: 15px 0;
}

#player-name {
    padding: 10px;
    border-radius: 5px;
    border: none;
    margin-right: 10px;
    font-family: 'Outfit', sans-serif;
}

/* Members */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    justify-content: center;
    /* Center items if they don't fill the row */
    justify-items: center;
    /* Center items within their grid cells if needed, though usually for grid-template-columns it's automatic */
}

.member-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
    border: 1px solid var(--glass);
    transition: transform 0.3s;
    width: 100%;
    max-width: 300px;
}

.member-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
}

.member-img {
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 20px;
}

.member-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.member-card:hover .member-img img {
    transform: scale(1.1);
}

.member-card h3 {
    color: var(--secondary);
    margin-bottom: 5px;
}

/* Biography */
.bio-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
    line-height: 1.8;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 40px;
    border-radius: 20px;
    border-left: 4px solid var(--primary);
}

.bio-content p {
    margin-bottom: 20px;
}

/* Footer */
footer {
    padding: 30px;
    text-align: center;
    background: #050508;
    color: #666;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    box-shadow: none;
    z-index: 1001;
}

.hamburger-line {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--light);
    border-radius: 3px;
    transition: transform 0.3s, opacity 0.3s;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

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

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 18, 0.98);
    backdrop-filter: blur(20px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.mobile-menu-content {
    text-align: center;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.4s 0.1s, opacity 0.4s 0.1s;
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateY(0);
    opacity: 1;
}

.mobile-nav-links {
    list-style: none;
    padding: 0;
    margin: 0 0 40px 0;
}

.mobile-nav-links li {
    margin: 20px 0;
}

.mobile-nav-link {
    font-size: 2rem;
    font-weight: 700;
    color: var(--light);
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: color 0.3s, text-shadow 0.3s;
    display: inline-block;
    padding: 10px 20px;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    color: var(--secondary);
    text-shadow: 0 0 20px var(--secondary);
}

.mobile-sns {
    display: flex;
    gap: 25px;
    justify-content: center;
}

.sns-icon-mobile {
    width: 40px;
    height: 40px;
}

.sns-icon-mobile svg {
    width: 40px;
    height: 40px;
}

/* Responsive - Tablet */
@media (max-width: 900px) {
    header {
        padding: 15px 30px;
    }

    nav ul.nav-links {
        gap: 20px;
    }

    nav a {
        font-size: 0.9rem;
    }

    .header-sns {
        gap: 10px;
        margin-left: 15px;
    }
}

/* Member Modal */
.member-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.member-modal.active {
    opacity: 1;
    visibility: visible;
}

.member-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.member-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(30, 30, 50, 0.95), rgba(10, 10, 20, 0.98));
    border-radius: 20px;
    border: 1px solid var(--glass);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(176, 38, 255, 0.2);
    transition: transform 0.3s;
}

.member-modal.active .member-modal-content {
    transform: translate(-50%, -50%) scale(1);
}

.member-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--light);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    box-shadow: none;
    transition: background 0.3s, transform 0.3s;
}

.member-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.member-modal-img {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
}

.member-modal-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-modal-info {
    padding: 25px;
    text-align: center;
}

.member-modal-info h3 {
    font-size: 1.8rem;
    color: var(--secondary);
    margin-bottom: 5px;
    text-shadow: 0 0 15px var(--secondary);
}

.member-modal-role {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 20px;
    font-weight: 600;
}

.member-modal-bio {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--light);
    opacity: 0.9;
}

/* Member card clickable cursor */
.member-card {
    cursor: pointer;
}

/* Responsive - Mobile */
@media (max-width: 768px) {

    /* Header */
    header {
        padding: 15px 20px;
    }

    nav {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .logo {
        font-size: 1.2rem;
    }

    .mobile-menu-btn {
        display: flex;
    }

    nav ul.nav-links {
        display: none;
    }

    .header-sns {
        display: none;
    }

    /* Hero */
    #hero {
        padding-top: 80px;
        min-height: auto;
        padding-bottom: 40px;
    }

    .hero-sns {
        margin-top: 60px;
        margin-bottom: 60px;
        gap: 20px;
    }

    .sns-icon-large {
        width: 50px;
        height: 50px;
    }

    .sns-icon-large svg {
        width: 50px;
        height: 50px;
    }

    /* Game Container */
    #game-container {
        width: calc(100% - 20px);
        max-width: 360px;
        height: auto;
        aspect-ratio: 3 / 4;
        max-height: 70vh;
    }

    .hero-content {
        width: 100%;
        padding: 0 10px;
    }

    /* Sections */
    section {
        padding: 60px 15px;
    }

    h2 {
        font-size: 2rem;
        margin-bottom: 30px;
    }

    /* Members - 3 columns on mobile */
    .members-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .member-card {
        padding: 6px;
        max-width: none;
    }

    .member-img {
        height: auto;
        aspect-ratio: 1 / 1.2;
        margin-bottom: 6px;
    }

    .member-card h3 {
        font-size: 0.7rem;
    }

    .member-card p {
        font-size: 0.6rem;
    }

    .member-card:hover {
        transform: none;
    }

    /* Biography */
    .bio-content {
        padding: 25px 20px;
        font-size: 0.95rem;
        line-height: 1.7;
        border-radius: 15px;
    }

    /* Footer */
    footer {
        padding: 20px 15px;
        font-size: 0.85rem;
    }
}

/* Game UI */
#start-screen h3,
#game-over-screen h3 {
    font-size: 1.2rem;
}

button {
    padding: 12px 24px;
    font-size: 1rem;
}

#high-score-list {
    max-width: 160px;
}

#player-name {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
}

#high-score-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Modal on mobile */
.member-modal-content {
    width: 95%;
    max-height: 85vh;
}

.member-modal-info {
    padding: 20px;
}

.member-modal-info h3 {
    font-size: 1.5rem;
}

.member-modal-bio {
    font-size: 0.9rem;
}
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
    .mobile-nav-link {
        font-size: 1.5rem;
    }

    /* Keep 3 columns on small mobile */
    .members-grid {
        gap: 3px;
    }

    .member-card {
        padding: 5px;
    }

    .member-img {
        margin-bottom: 5px;
    }

    .member-card h3 {
        font-size: 0.6rem;
    }

    .member-card p {
        font-size: 0.5rem;
    }

    .hero-sns {
        margin-top: 40px;
        margin-bottom: 40px;
    }

    .sns-icon-large {
        width: 40px;
        height: 40px;
    }

    .sns-icon-large svg {
        width: 40px;
        height: 40px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .member-card:hover {
        transform: none;
        border-color: var(--glass);
    }

    .member-card:hover .member-img img {
        transform: none;
    }

    .sns-icon:active {
        color: var(--secondary);
        transform: scale(1.1);
        filter: drop-shadow(0 0 8px var(--secondary));
    }

    .mobile-nav-link:active {
        color: var(--secondary);
        text-shadow: 0 0 20px var(--secondary);
    }
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
    header {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }

    .mobile-menu-overlay {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    footer {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}