/* CocoroQuest Photorealistic Edition - Dark Glassmorphism UI */

:root {
    --primary-purple: #9b59b6;
    --dark-purple: #2c1654;
    --accent-purple: #c084fc;
    --text-white: #f0e6ff;
    --text-dim: #b8a5d4;
    --glass-bg: rgba(20, 10, 40, 0.75);
    --glass-border: rgba(155, 89, 182, 0.3);
    --glass-shadow: rgba(0, 0, 0, 0.5);
    --name-aria: #c4a8e8;
    --name-sun: #ffcc44;
    --name-player: #88ccff;
}

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

body {
    font-family: 'Noto Sans JP', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: #0a0015;
    color: var(--text-white);
    -webkit-font-smoothing: antialiased;
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Title Screen */
#title-screen {
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.title-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('assets/backgrounds/bg_title.png') center/cover no-repeat;
    filter: brightness(0.6);
    z-index: 0;
}

.title-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(10, 0, 20, 0.8) 100%);
}

.title-content {
    position: relative;
    z-index: 1;
    text-align: center;
    animation: fadeInUp 1.5s ease;
}

.title-main {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 700;
    color: var(--text-white);
    text-shadow: 0 0 30px rgba(155, 89, 182, 0.6), 0 0 60px rgba(155, 89, 182, 0.3);
    margin-bottom: 0.3em;
    letter-spacing: 0.05em;
}

.title-sub {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 300;
    color: var(--text-dim);
    text-shadow: 0 0 10px rgba(155, 89, 182, 0.4);
    margin-bottom: 0.5em;
}

.title-version {
    font-size: 0.8rem;
    color: var(--accent-purple);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 2em;
    opacity: 0.7;
}

/* Glass Button */
.glass-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 48px;
    font-size: 1.2rem;
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-white);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.1);
}

.glass-btn:hover {
    background: rgba(155, 89, 182, 0.3);
    border-color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(155, 89, 182, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.glass-btn:active {
    transform: translateY(0);
}

/* Language Selector */
.language-selector {
    margin-top: 2em;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    background: rgba(20, 10, 40, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(155, 89, 182, 0.2);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    border-color: var(--accent-purple);
    color: var(--text-white);
}

.lang-btn.active {
    background: rgba(155, 89, 182, 0.25);
    border-color: var(--accent-purple);
    color: var(--text-white);
    box-shadow: 0 0 12px rgba(155, 89, 182, 0.3);
}

/* Game Screen */
#game-screen {
    position: relative;
}

.game-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: opacity 1s ease;
    z-index: 0;
}

/* Characters */
.character {
    position: absolute;
    bottom: 10%;
    width: 35%;
    max-width: 300px;
    height: 70%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    border-radius: 12px;
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    filter: drop-shadow(0 0 20px rgba(155, 89, 182, 0.3));
}

.character.visible {
    opacity: 1;
}

.character-left {
    left: 5%;
    transform: translateX(-30px);
}

.character-left.visible {
    transform: translateX(0);
    animation: breatheLeft 4s ease-in-out infinite;
}

.character-right {
    right: 5%;
    transform: translateX(30px);
}

.character-right.visible {
    transform: translateX(0);
    animation: breatheRight 4.5s ease-in-out infinite;
}

.character.speaking {
    animation: speak 0.3s ease, breatheLeft 4s ease-in-out infinite 0.3s;
}

.character-right.speaking {
    animation: speak 0.3s ease, breatheRight 4.5s ease-in-out infinite 0.3s;
}

/* Text Box */
.text-box {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 24px 32px 28px;
    z-index: 10;
    cursor: pointer;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 2px solid var(--glass-border);
    box-shadow: 0 -8px 32px var(--glass-shadow);
}

.speaker-name {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 8px;
    padding: 4px 12px;
    display: inline-block;
    border-radius: 4px;
    background: rgba(155, 89, 182, 0.15);
    border-left: 3px solid var(--accent-purple);
    min-height: 1.5em;
}

.speaker-name:empty {
    display: none;
}

.speaker-name.aria { color: var(--name-aria); border-left-color: var(--name-aria); }
.speaker-name.sun { color: var(--name-sun); border-left-color: var(--name-sun); }
.speaker-name.player { color: var(--name-player); border-left-color: var(--name-player); }

.dialogue-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-white);
    font-weight: 300;
    min-height: 3.6em;
}

.advance-indicator {
    position: absolute;
    bottom: 12px;
    right: 20px;
    font-size: 0.8rem;
    color: var(--accent-purple);
    animation: bounce 1.5s ease infinite;
    opacity: 0.7;
}

/* Choice Menu */
.choice-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    background: rgba(10, 0, 20, 0.5);
    backdrop-filter: blur(4px);
}

.choice-menu.hidden {
    display: none;
}

.choice-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 600px;
    width: 90%;
}

.choice-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 18px 24px;
    font-size: 1rem;
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-white);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    line-height: 1.6;
    box-shadow: 0 4px 16px var(--glass-shadow);
}

.choice-btn:hover {
    background: rgba(155, 89, 182, 0.25);
    border-color: var(--accent-purple);
    transform: translateX(8px);
    box-shadow: 0 4px 24px rgba(155, 89, 182, 0.3);
}

.choice-btn:active {
    transform: translateX(4px);
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes breatheLeft {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-4px) translateX(0); }
}

@keyframes breatheRight {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-3px) translateX(0); }
}

@keyframes speak {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

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

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

/* Hidden utility */
.hidden { display: none !important; }

/* Mobile responsive */
@media (max-width: 768px) {
    .character {
        width: 40%;
        max-width: 200px;
        height: 55%;
        bottom: 22%;
    }
    
    .character-left { left: 2%; }
    .character-right { right: 2%; }
    
    .text-box {
        padding: 18px 20px 22px;
        min-height: 160px;
    }
    
    .dialogue-text {
        font-size: 0.95rem;
    }
    
    .title-main {
        font-size: 2.5rem;
    }
    
    .choice-btn {
        padding: 14px 18px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .character {
        width: 35%;
        max-width: 150px;
        height: 45%;
        bottom: 25%;
    }
    
    .text-box {
        min-height: 140px;
        padding: 14px 16px 18px;
    }
    
    .dialogue-text {
        font-size: 0.88rem;
        line-height: 1.7;
    }
}
