/* ============================================= */
/* Reset Dasar & Pengaturan Global               */
/* ============================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #0c0c14;
    color: #fff;
    overflow: hidden;
}

.hidden {
    display: none !important;
}


/* ============================================= */
/* Tampilan Prolog (Input Nama)                  */
/* ============================================= */
#prologue-screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
}

#prologue-title {
    font-size: 2em;
    color: #D1D8E0;
    text-align: center;
}

#name-input {
    font-size: 1.2em;
    padding: 10px 15px;
    border-radius: 20px;
    border: 2px solid #D1D8E0;
    background-color: transparent;
    color: #fff;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

#prologue-button {
    font-size: 1em;
    padding: 10px 30px;
    border-radius: 20px;
    border: none;
    background-color: #D1D8E0;
    color: #28283c;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

#prologue-button:hover {
    transform: scale(1.05);
}


/* ============================================= */
/* Layout Utama Game (Struktur Kartu Yugioh)     */
/* ============================================= */
#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    overflow: hidden;
}

/* --- Area Visual (Bagian Atas, Rasio 4) --- */
#visual-container {
    height: 66.6vh;
    position: relative;
    width: 100%;
    background-color: #000;
    padding: 15px;
    overflow: hidden;
}

#scene-background {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 1.5s ease-in-out;
    border: 3px solid #a39161;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    z-index: 1;
    animation: kenburns 20s ease-in-out infinite alternate;
}

/* --- Area UI (Bagian Bawah, Rasio 2) --- */
#ui-container {
    height: 33.4vh;
    width: 100%;
    background-color: #1e1e2f;
    border-top: 3px solid #a39161;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    /* [PERBAIKAN] Menambah padding-bottom jadi 90px untuk ruang scroll maksimal */
    padding: 20px 15px 90px 15px;
    gap: 15px;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}


/* ============================================= */
/* Elemen UI (Kotak Dialog & Tombol)             */
/* ============================================= */
#dialogue-box {
    position: relative;
    width: 95%;
    max-width: 800px;
    background-color: rgba(12, 12, 20, 0.5);
    border: 2px solid #a39161;
    border-radius: 10px;
    padding: 15px;
    flex-shrink: 0;
    
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    gap: 0 15px;
    align-items: start;
}

#speaker-portrait {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    width: 70px;
    height: 70px;
    border: 3px solid #a39161;
    border-radius: 10px;
    object-fit: cover;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.4s, transform 0.4s;
}

#speaker-portrait.visible {
    opacity: 1;
    transform: scale(1);
}

#dialogue-content {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
}

#speaker-name {
    font-weight: bold;
    color: #f7d794;
    margin-bottom: 10px;
    font-size: 1.1em;
}

#dialogue-text {
    font-family: 'Lora', serif;
    font-size: 1.1em;
    line-height: 1.6;
}

#swan-response-box {
    font-family: 'Lora', serif;
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    font-style: italic;
    color: #ccc;
    min-height: 24px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

#choices-container {
    width: 95%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.choice-btn {
    font-family: 'Poppins', sans-serif;
    padding: 12px 20px;
    font-size: 0.9em;
    cursor: pointer;
    border: 2px solid #a39161;
    background-color: #1e1e2f;
    color: #f7d794;
    border-radius: 30px;
    transition: background-color 0.3s, color 0.3s, transform 0.2s ease-out, box-shadow 0.3s;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
    font-weight: bold;
    flex-shrink: 0;
}

.choice-btn:hover {
    background-color: #f7d794;
    color: #1e1e2f;
    transform: translateY(-3px);
    box-shadow: 0px 5px 15px rgba(247, 215, 148, 0.2);
}


/* ============================================= */
/* Elemen Fungsional Lainnya                     */
/* ============================================= */
#transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
}

#transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}


/* ============================================= */
/* Animasi & Efek Tambahan                       */
/* ============================================= */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes kenburns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.1) translate(-2%, 2%);
    }
}

@keyframes float {
    0% { transform: translateY(0); }
    100% { transform: translateY(-1000px); }
}

#particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

#particles::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 200%;
    top: 0;
    left: 0;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 30%, rgba(255,255,255,0.15) 1px, transparent 1px),
        radial-gradient(circle at 50% 70%, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 100px 100px, 120px 120px, 80px 80px;
    animation: float 25s linear infinite;
}


/* ============================================= */
/* [REVISI TOTAL] Layar Penutup (Credits)        */
/* ============================================= */
@keyframes credit-roll {
    from {
        transform: translateY(100vh);
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

@keyframes fadeInFinal {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

#credits-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0c0c14;
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    pointer-events: none;
    overflow: hidden;
}

#credits-screen.visible {
    opacity: 1;
    pointer-events: all;
}

#credits-screen.visible .credits-content {
    animation: credit-roll 25s linear forwards;
    animation-delay: 1.5s;
}

.credits-content {
    position: absolute;
    width: 100%;
    max-width: 600px;
    padding: 0 20px;
    transform: translateY(100vh);
}

.credits-content h1 {
    font-family: 'Lora', serif;
    font-size: 3em;
    color: #f7d794;
    margin-bottom: 30px;
}

.credits-content p {
    font-size: 1.1em;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 30px;
}

.credit-section-title {
    margin-top: 40px;
    font-weight: bold;
    color: #a39161;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9em !important;
    margin-bottom: 15px !important;
}

.credits-content hr {
    border: 0;
    border-top: 1px solid #a39161;
    margin: 30px auto;
    width: 50%;
}

.credits-copyright {
    margin-top: 50px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.5);
}

.gemini-text {
    font-weight: bold;
}

.g-char-1 { color: #4285F4; } /* Biru */
.g-char-2 { color: #EA4335; } /* Merah */
.g-char-3 { color: #FBBC05; } /* Kuning */
.g-char-4 { color: #4285F4; } /* Biru */
.g-char-5 { color: #34A853; } /* Hijau */
.g-char-6 { color: #EA4335; } /* Merah */

#final-thank-you {
    font-family: 'Lora', serif;
    font-size: 4em;
    color: #f7d794;
    opacity: 0;
    animation: fadeInFinal 2s ease-out forwards;
    animation-delay: 23s;
}