body {
    font-family: 'Quintessential', cursive;
    background-color: #1a1a1a;
    color: #f0f0f0;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 1024px;
    height: 100%;
    max-height: 768px;
    position: relative;
    border: 2px solid #555;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    background: #222;
}

.hidden {
    display: none !important;
}

/* --- Creator View --- */
#creator-view {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    height: 100%;
    box-sizing: border-box;
}

#creator-view h1 {
    font-family: 'IM Fell English SC', serif;
    font-size: 3rem;
    color: #e0e0e0;
    margin-bottom: 20px;
}

#creator-view p {
    font-size: 1.2rem;
    color: #aaa;
    max-width: 600px;
}

#story-input {
    width: 80%;
    max-width: 600px;
    height: 150px;
    margin-top: 20px;
    background-color: #333;
    border: 1px solid #555;
    color: #f0f0f0;
    font-family: 'Quintessential', cursive;
    font-size: 1.1rem;
    padding: 10px;
    border-radius: 5px;
}

#style-input {
    width: 80%;
    max-width: 600px;
    margin-top: 15px;
    background-color: #333;
    border: 1px solid #555;
    color: #f0f0f0;
    font-family: 'Quintessential', cursive;
    font-size: 1.1rem;
    padding: 10px;
    border-radius: 5px;
}

.button-group {
    margin-top: 30px;
    display: flex;
    gap: 20px;
}

button {
    margin-top: 30px;
    padding: 12px 25px;
    font-family: 'IM Fell English SC', serif;
    font-size: 1.2rem;
    background-color: #8a6d3b;
    color: #f0f0f0;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    text-shadow: 1px 1px 2px #000;
}

button:hover {
    background-color: #a07f46;
}

/* --- Loading View --- */
#loading-view {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #8a6d3b;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
}

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

#loading-text {
    margin-top: 20px;
    font-size: 1.5rem;
    color: #ccc;
}


/* --- Game View --- */
#game-view {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: #000;
    cursor: pointer;
}

#background-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: background-image 1s ease-in-out, opacity 0.5s ease-in-out;
    z-index: 0;
}

#character-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    transition: opacity 0.5s ease-in-out;
    z-index: 1;
}

.character-sprite {
    max-height: 85%;
    max-width: 40%;
    object-fit: contain;
    position: absolute;
    bottom: 0;
    transition: transform 0.5s ease, opacity 0.5s ease, left 0.5s ease;
    transform-origin: bottom center;
    opacity: 0;
    z-index: 5;
    mix-blend-mode: multiply;
}

.character-sprite.active {
    opacity: 1;
    z-index: 10;
}

.character-sprite:not(.active) {
    opacity: 0.7;
    filter: brightness(0.7);
}

#dialogue-box {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 950px;
    height: 150px;
    background-color: rgba(0, 0, 0, 0.75);
    border: 2px solid #8a6d3b;
    border-radius: 10px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

#character-name {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.8rem;
    color: #f0e68c;
    margin-bottom: 10px;
    min-height: 30px;
}

#dialogue-text {
    font-size: 1.4rem;
    color: #fff;
    line-height: 1.5;
}

#restart-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    padding: 10px 20px;
    font-size: 1rem;
}