@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Quicksand:wght@300;400;500;700&display=swap');

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

body {
    background-color: #000;
    color: #fff;
    font-family: 'Quicksand', sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 100%;
    height: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at center, #111 0%, #000 100%);
}

.banner-container {
    width: 100%;
    height: 35vh;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    filter: grayscale(0.2) brightness(0.9);
    transition: opacity 1s ease;
}

.banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, #000 100%);
}

.category-tag {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: #FFD700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.5), 2px 2px 4px #000;
}

.story-container {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.narration-text {
    max-width: 800px;
    font-size: 1.3rem;
    line-height: 1.8;
    text-align: center;
    font-weight: 300;
    color: #e0e0e0;
    margin-bottom: 40px;
    min-height: 100px;
}

.choices-container {
    display: none; /* Removed as user wants free action only */
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 40px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.choices-container.visible {
    opacity: 1;
}

.choice-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.choice-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: #FFD700;
    color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.2);
}

.input-area {
    width: 100%;
    max-width: 600px;
    position: relative;
    margin-top: auto;
    padding-bottom: 20px;
}

#user-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 15px 60px 15px 25px;
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

#user-input:focus {
    border-color: #FFD700;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
}

#send-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #FFD700;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

#send-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
}

.controls button {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.controls button:hover {
    background: #fff;
    color: #000;
}

.overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Immersive Background */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    overflow: hidden;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #FFF;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle 5s infinite ease-in-out;
}

@keyframes twinkle {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 0.7; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(0.5); }
}

/* Animated Title */
.overlay-content h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: linear-gradient(to right, #FFD700 20%, #FFF 50%, #FFD700 80%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    animation: shine 5s linear infinite, letterSpacing 1.5s ease-out forwards;
    opacity: 0;
    transform: translateY(-20px);
}

@keyframes shine {
    to { background-position: 200% center; }
}

@keyframes letterSpacing {
    from { letter-spacing: 0.5em; opacity: 0; transform: translateY(-20px); }
    to { letter-spacing: 0.1em; opacity: 1; transform: translateY(0); }
}

/* Custom Cursor */
body {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23FFD700" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="3"/></svg>') 12 12, auto;
}

button, a, .category-card {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="%23FFD700" stroke="none"><circle cx="12" cy="12" r="6"/></svg>') 12 12, pointer;
}

.overlay-content p {
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: #888;
    margin-bottom: 40px;
}

/* Auth UI */
#auth-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tab {
    background: transparent;
    border: none;
    color: #888;
    padding: 10px 20px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.auth-tab.active {
    color: #FFD700;
    border-bottom-color: #FFD700;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 20px;
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.auth-form input:focus {
    border-color: #FFD700;
    background: rgba(255, 255, 255, 0.1);
}

.action-btn {
    background: transparent;
    border: 1px solid #FFD700;
    color: #FFD700;
    padding: 12px;
    font-size: 1rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.4s ease;
    margin-top: 10px;
    border-radius: 8px;
}

.action-btn:hover {
    background: #FFD700;
    color: #000;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.warning-text {
    color: #ffaa00;
    font-size: 0.9rem;
    margin-bottom: 10px;
    text-align: center;
}

.error-msg {
    color: #ff4d4d;
    margin-top: 15px;
    font-size: 0.9rem;
    min-height: 20px;
}

.success-msg {
    color: #4dff4d;
    margin-top: 15px;
    font-size: 0.9rem;
    min-height: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-top: 60px;
    width: 100%;
    max-width: 1100px;
    perspective: 1000px; /* 3D Perspective */
}

.category-card {
    position: relative;
    height: 420px;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.1s ease, box-shadow 0.4s ease, border-color 0.4s ease; /* Fast transform for tilt */
    transform-style: preserve-3d;
    background: rgba(255, 255, 255, 0.02);
    opacity: 0; /* For stagger animation */
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Stagger Animations */
.category-card:nth-child(1) { animation-delay: 0.2s; }
.category-card:nth-child(2) { animation-delay: 0.4s; }
.category-card:nth-child(3) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(50px) rotateX(10deg); }
    to { opacity: 1; transform: translateY(0) rotateX(0); }
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
    transform: scale(1.05); /* Slightly zoomed in by default */
}

.category-card .card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 60%);
    transition: background 0.5s ease;
}

.category-card span {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    letter-spacing: 0.2em;
    color: #fff;
    text-shadow: 0 4px 15px rgba(0,0,0,0.8);
    z-index: 2;
    transition: transform 0.4s ease, color 0.4s ease;
}

/* Specific Glows per Category */
.category-card[data-category="Naruto"]:hover {
    border-color: #FFA500;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 30px rgba(255, 165, 0, 0.4);
}
.category-card[data-category="One Piece"]:hover {
    border-color: #00BFFF;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 30px rgba(0, 191, 255, 0.4);
}
.category-card[data-category="Cyberpunk"]:hover {
    border-color: #FF00FF;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 30px rgba(255, 0, 255, 0.4);
}

.category-card:hover img {
    transform: scale(1.15);
}

.category-card:hover .card-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.category-card:hover span {
    transform: translateY(-10px) scale(1.1);
    color: #FFF;
}

.black-fade {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease;
}

/* Dark Mode & Immersive Experience */
.black-fade.active {
    opacity: 1;
    pointer-events: all;
    background: #000 !important;
    z-index: 2000;
}

/* Zoom & Blur Transition */
@keyframes zoomAndBlur {
    0% { transform: scale(1); filter: blur(0); opacity: 1; }
    50% { transform: scale(1.5); filter: blur(5px); opacity: 0.5; }
    100% { transform: scale(3); filter: blur(20px); opacity: 0; }
}

.category-card.selecting {
    animation: zoomAndBlur 1.5s cubic-bezier(0.7, 0, 0.3, 1) forwards !important;
    z-index: 100;
}

.category-grid.fading-out .category-card:not(.selecting) {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.5s ease;
}

/* Hide background and unnecessary UI during narration */
body.narration-mode .banner-container,
body.narration-mode .category-tag {
    display: none !important;
}

body.narration-mode .game-container {
    background: #000;
    justify-content: center;
}

body.narration-mode .story-container {
    background: transparent;
    border: none;
    box-shadow: none;
    max-width: 800px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.narration-text {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem; /* Increased for better readability on black */
    line-height: 1.6;
    color: #e0e0e0;
    text-align: center;
    min-height: auto;
    margin-bottom: 60px;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.narration-text.visible {
    opacity: 1;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .overlay-content h1 {
        font-size: 2.2rem;
    }

    .category-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        margin-top: 30px;
    }

    .category-card {
        height: 250px;
    }

    .narration-text {
        font-size: 1.3rem;
        padding: 0 20px;
        line-height: 1.5;
    }

    #auth-container {
        width: 90%;
    }

    .auth-form input, .action-btn {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Input Area for Narration Mode */
body.narration-mode .input-area {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

body.narration-mode .input-area.visible {
    opacity: 1;
    pointer-events: all;
}

/* Mute Button on Black Screen */
body.narration-mode .controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2001;
}#mute-btn.playing {
    color: #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: #FFD700;
    margin-left: 2px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}    vertical-align: middle;
}

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

/* Animations */
.fade-in {
    animation: fadeIn 1.5s forwards;
}

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

@media (max-width: 768px) {
    .overlay-content h1 { font-size: 2.5rem; }
    .category-tag { font-size: 1.8rem; }
    .narration-text { font-size: 1.1rem; }

    /* Click to Mute Feature */
    .game-container.muted #mute-btn {
        opacity: 0.5;
    }
}

/* Ensure body is full black in narration mode */
body.narration-mode {
    background-color: #000 !important;
    overflow: hidden;
}

/* Phrase by Phrase Animation */
@keyframes fadeInSentence {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.narration-text span {
    display: inline-block;
    animation: fadeInSentence 0.5s ease forwards;
}
