:root {
    --primary-bg-original: #874FFF;
    --primary-bg: #2c0b6a;
    --primary-bg-light: #5d37af;
    --accent-color: #DDFD52;
    --text-dark: #1a1a1a;
    --text-light: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-bg-hover: rgba(255, 255, 255, 0.1);
    --card-bg-selected: rgba(221, 253, 82, 0.3);
    --modal-bg: rgba(0, 0, 0, 0.7);
    --correct-answer: #a7e92f;
    --incorrect-answer: #ff4d4d;
    --border-color-subtle: rgba(255, 255, 255, 0.1);
    --shadow-subtle: 0 2px 10px rgba(0, 0, 0, 0.2);
    --footer-link-color: rgba(255, 255, 255, 0.7);
    --gradient-start: #0f172a;
    --gradient-mid: var(--primary-bg);
    --gradient-end: #4c1d95;
    --step-card-glow-color: rgba(135, 79, 255, 0.2);
}

body.light-theme {
    --primary-bg-original: #874FFF;
    --primary-bg: #f0f4f8;
    --primary-bg-light: #dce7f3;
    --accent-color: #5d37af;
    --text-dark: #1a1a1a;
    --text-light: #333333;
    --card-bg: rgba(0, 0, 0, 0.05);
    --card-bg-hover: rgba(0, 0, 0, 0.1);
    --card-bg-selected: rgba(93, 55, 175, 0.15);
    --modal-bg: rgba(255, 255, 255, 0.7);
    --correct-answer: #4CAF50;
    --incorrect-answer: #F44336;
    --border-color-subtle: rgba(0, 0, 0, 0.1);
    --shadow-subtle: 0 2px 10px rgba(0, 0, 0, 0.1);
    --footer-link-color: rgba(51, 51, 51, 0.7);
    --gradient-start: #e0e6ec;
    --gradient-mid: var(--primary-bg);
    --gradient-end: #f7f9fb;
    --step-card-glow-color: rgba(93, 55, 175, 0.1);
}

@keyframes glow {
    0% { box-shadow: 0 0 5px var(--accent-color), 0 0 10px var(--accent-color); }
    50% { box-shadow: 0 0 20px var(--accent-color), 0 0 30px var(--accent-color); }
    100% { box-shadow: 0 0 5px var(--accent-color), 0 0 10px var(--accent-color); }
}

@keyframes subtle-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes float {
    0% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    25% { transform: translateY(-10px) translateX(5px) rotate(5deg); }
    50% { transform: translateY(-20px) translateX(0px) rotate(0deg); }
    75% { transform: translateY(-10px) translateX(-5px) rotate(-5deg); }
    100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes mic-pulse {
    0% { box-shadow: 0 0 0 0 rgba(221, 253, 82, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(221, 253, 82, 0); }
    100% { box-shadow: 0 0 0 0 rgba(221, 253, 82, 0); }
}

@keyframes page-turn-out {
    0% { transform: perspective(1000px) rotateY(0deg); opacity: 1; }
    100% { transform: perspective(1000px) rotateY(-90deg); opacity: 0; }
}

@keyframes page-turn-in {
    0% { transform: perspective(1000px) rotateY(90deg); opacity: 0; }
    100% { transform: perspective(1000px) rotateY(0deg); opacity: 1; }
}

.hidden { display: none !important; }

html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    color: var(--text-light);
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 50%, var(--gradient-end) 100%);
    position: relative;
    transition: background 0.5s ease, color 0.5s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before,
body::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(150px);
    z-index: -1;
    transition: background 0.5s ease, opacity 0.5s ease, filter 0.5s ease;
}

body::before {
    width: 350px;
    height: 350px;
    background: var(--accent-color);
    top: -150px;
    left: -150px;
    opacity: 0.2;
}

body::after {
    width: 450px;
    height: 450px;
    background: var(--primary-bg-original);
    bottom: -200px;
    right: -200px;
    opacity: 0.5;
}

h1 {
    font-family: 'Lilita One', cursive;
    font-weight: 400;
    font-size: 2.8rem;
}

.logo-light { display: none; }
body.light-theme .logo-light { display: block; }
body.light-theme .logo-dark { display: none; }

#header-logo img { height: 40px; }
.footer-logo { width: 16px; height: auto; margin-left: 2px; }
footer .logo-light { margin-right: 2px; }

#main-header-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0px 30px;
    box-sizing: border-box;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#credit-wallet {
    background-color: var(--card-bg);
    color: var(--text-light);
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
    border: 1px solid var(--border-color-subtle);
    box-shadow: var(--shadow-subtle);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

#credit-wallet:hover {
    background-color: var(--card-bg-hover);
    transform: scale(1.05);
}

#theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease-in-out;
}

#theme-toggle-btn svg {
    width: 24px;
    height: 24px;
}

#theme-toggle-btn:hover {
    color: var(--accent-color);
}

#progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 10;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--accent-color);
    transition: width 0.5s ease-in-out;
    border-radius: 0 4px 4px 0;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0 20px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1), transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, opacity;
}

#welcome-screen main {
    justify-content: flex-start;
    gap: 40px;
    max-width: 1000px;
}

.screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

main {
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: left;
}

.floating-emoji {
    position: absolute;
    animation: float 15s ease-in-out infinite;
    user-select: none;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(1px);
    box-shadow: 0 0 10px rgba(221, 253, 82, 0.05);
}
.light-theme .floating-emoji {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}


.floating-emoji span {
    font-size: 24px;
    opacity: 0.15;
}

.header {
    text-align: center;
    margin-bottom: 25px;
    width: 100%;
}

.header h1,
.header h2 {
    margin: 0;
    font-size: clamp(32px, 6vw, 42px);
    line-height: 1.2;
    font-family: 'Lilita One', cursive;
    font-weight: 400;
    transition: text-shadow 0.5s ease;
}

.subtitle,
.instruction-text {
    width: 100%;
    text-align: center;
    margin: 10px 0 15px 0;
    font-size: 12px;
    opacity: 0.9;
    color: var(--text-light);
    font-weight: 400;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    transition: color 0.5s ease;
}

.input-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.prompt-wrapper {
    position: relative;
    width: 100%;
}

.storybook-input {
    width: 100%;
    border: none;
    padding: 20px 15px;
    border-radius: 12px;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
    box-sizing: border-box;
    text-align: center;
    transition: background-color 0.5s ease, color 0.5s ease;
}
.light-theme .storybook-input {
    background-color: #ffffff;
    border: 1px solid var(--border-color-subtle);
}

#prompt-input {
    padding-right: 60px;
}

.mic-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-bg);
    transition: color 0.2s, transform 0.2s;
}
.light-theme .mic-btn {
    color: var(--accent-color);
}


.mic-btn svg {
    width: 32px;
    height: 32px;
}

.mic-btn:hover {
    transform: translateY(-50%) scale(1.1);
}

.mic-btn.listening {
    color: var(--accent-color);
    background-color: var(--primary-bg);
    border-radius: 50%;
    animation: mic-pulse 1.5s infinite;
}
.light-theme .mic-btn.listening {
    color: var(--primary-bg);
    background-color: var(--accent-color);
}

.button {
    border: none;
    padding: 16px 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    width: 100%;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s, border-bottom-width 0.1s, background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

.button.primary {
    background-color: #ddfd52;
    color: #1a1a1a;
    border-bottom: 4px solid #b2c944;
}

.button.primary:hover {
    background-color: #c8e64a;
}

.button.secondary {
    background-color: #874fff;
    color: #ffffff;
    border-bottom: 4px solid #5d37af;
}

.button.secondary:hover {
    background-color: #9d6bff;
}

.button.primary:active,
.button.secondary:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.light-theme .button.primary {
    background-color: #ddfd52;
    color: #1a1a1a;
    border-bottom: 4px solid #b2c944;
}

.light-theme .button.primary:hover {
    background-color: #c8e64a;
}

.light-theme .button.secondary {
    background-color: #874fff;
    color: #ffffff;
    border-bottom: 4px solid #5d37af;
}

.light-theme .button.secondary:hover {
    background-color: #9d6bff;
}

.button:disabled {
    cursor: not-allowed;
    background-color: #555 !important;
    color: #aaa !important;
    opacity: 0.6;
    border-bottom: 4px solid #333;
}
.light-theme .button:disabled {
    background-color: #ccc !important;
    color: #666 !important;
    border-bottom: 4px solid #999 !important;
}

.story-grid,
.option-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.story-grid {
    grid-template-columns: repeat(2, 1fr);
}

#protagonist-grid {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
}

#age-grid .option-card span {
    font-size: 14px;
}

.story-card,
.option-card {
    background-color: var(--card-bg);
    padding: 10px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease-out;
    text-align: center;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
}

.story-card:hover,
.option-card:hover {
    transform: translateY(-5px);
    background-color: var(--card-bg-hover);
}

.story-card.selected,
.option-card.selected {
    background-color: var(--card-bg-selected);
    border-color: var(--accent-color);
    animation: glow 1.5s infinite ease-in-out;
}

.story-card .icon,
.option-card .icon {
    font-size: 32px;
    display: block;
    margin-bottom: 6px;
    transition: transform 0.3s;
}

.story-card:hover .icon {
    animation: subtle-float 1.5s ease-in-out infinite;
}

.story-card h3 {
    margin: 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-card p {
    margin: 5px 0 0 0;
    font-size: 11px;
    opacity: 0.7;
}

.option-card span {
    font-size: 11px;
    font-weight: 600;
}

.secondary-actions {
    width: 100%;
    margin-top: 15px;
    margin-bottom: 20px;
}

.nav-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

.screen.slide-in-from-right { transform: translateX(40px); opacity: 0; }
.screen.slide-in-from-left { transform: translateX(-40px); opacity: 0; }
.screen.slide-out-to-left { transform: translateX(-40px); opacity: 0; }
.screen.slide-out-to-right { transform: translateX(40px); opacity: 0; }

#loading-screen { justify-content: flex-start; }
#loading-screen main { flex-grow: 1; justify-content: center; align-items: center; gap: 25px; }
#loading-intro { display: flex; flex-direction: column; align-items: center; gap: 15px; width: 100%; max-width: 400px; }

#loading-emoji {
    width: 100%;
    text-align: center;
    font-size: 80px;
    animation: pulse 3s infinite ease-in-out;
    margin-bottom: 20px;
    transition: opacity 0.5s ease-in-out;
}

#loading-screen .loading-message {
    font-size: 28px;
    font-weight: 400;
    transition: opacity 0.5s ease-in-out;
    text-align: center;
    font-family: 'Open Sans', sans-serif;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}
.light-theme #loading-screen .loading-message { text-shadow: 0 2px 2px rgba(0, 0, 0, 0.1); }

#start-game-btn, #stop-game-btn, #view-story-btn { width: 300px !important; max-width: 100%; }

#story-screen { justify-content: flex-start; }
#story-screen main { max-width: 90%; width: 100%; }

.story-header {
    text-align: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
}

.story-header h2 {
    font-family: 'Lilita One', cursive;
    font-weight: 400;
    font-size: clamp(24px, 5vw, 32px);
    color: var(--accent-color);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    margin: 0;
    padding: 10px 0;
}
.light-theme .story-header h2 { text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); }

#vertical-view { width: 100%; max-width: 600px; margin: 0 auto; }
#vertical-view h2 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 20px;
    font-family: 'Lilita One', cursive;
    font-weight: 400;
    text-shadow: 0px 2px 0px #1a053d;
}
.light-theme #vertical-view h2 { text-shadow: 0px 2px 0px #cad2d8; }

.cover-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1.6;
    margin: 0 auto 20px auto;
    flex-shrink: 0;
}

#cover-image {
    width: 100%;
    height: 100%;
    background-color: var(--card-bg);
    border-radius: 10px;
    object-fit: cover;
}

#cover-title {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 30px 20px 75px;
    box-sizing: border-box;
    text-align: center;
    font-family: 'Lilita One', cursive;
    font-weight: 400;
    font-size: clamp(28px, 7vw, 42px);
    color: var(--accent-color);
    text-shadow: -2px -2px 0 var(--primary-bg), 2px -2px 0 var(--primary-bg), -2px 2px 0 var(--primary-bg), 2px 2px 0 var(--primary-bg), 4px 4px 8px rgba(0, 0, 0, 0.8);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

#cover-publisher {
    position: absolute;
    bottom: 10px;
    top: auto;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
    z-index: 2;
}

#cover-logo-container {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 3;
}

#cover-logo-container img {
    width: 40px;
    height: auto;
    opacity: 1;
}

#cover-publisher { bottom: 40px; }
.pdf-publisher { padding-bottom: 30mm; }

.pdf-cover-logo {
    position: absolute;
    bottom: 15mm;
    left: 50%;
    transform: translateX(-50%);
    width: 30mm;
    height: auto;
    z-index: 3;
}

#audio-player-container {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
}

.tts-controls { display: flex; justify-content: center; align-items: center; }

.tts-play-pause-btn {
    background-color: var(--accent-color);
    color: var(--text-dark);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    border: none;
    border-bottom: 4px solid #b2c944;
    cursor: pointer;
    transition: transform 0.1s, border-bottom-width 0.1s, background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}
.light-theme .tts-play-pause-btn {
    background-color: var(--accent-color);
    color: #DDFD52;
    border-bottom: 4px solid #4a2b8e;
}

.tts-play-pause-btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.light-theme .tts-play-pause-btn:active { border-bottom-color: #3b226e; }

#story-text-container { font-family: 'Open Sans', sans-serif; }
#story-text-container p { line-height: 1.6; margin-bottom: 1em; text-align: justify; }
#story-text-container hr { border: none; border-top: 1px solid rgba(255, 255, 255, 0.3); margin: 20px 0; }
.light-theme #story-text-container hr { border-top: 1px solid rgba(0, 0, 0, 0.3); }

.image-wrapper { position: relative; width: 100%; max-width: 300px; margin: 20px auto; }
.mid-story-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    display: block;
    object-fit: cover;
    background-color: var(--card-bg);
}

.font-controls { display: flex; gap: 10px; width: 100%; justify-content: center; margin-bottom: 20px; }
.font-btn { width: 60px; padding: 8px; font-size: 18px; font-weight: bold; flex-grow: 0; flex-shrink: 0; font-family: 'Open Sans', sans-serif; }

.feedback-box { background-color: transparent; padding: 0; margin-bottom: 20px; text-align: center; transition: background-color 0.5s ease, color 0.5s ease; }
.social-share-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.2); text-align: center; transition: border-top-color 0.5s ease; }
.light-theme .social-share-section { border-top-color: rgba(0, 0, 0, 0.2); }
.social-icons { display: flex; justify-content: center; gap: 25px; margin-top: 15px; }
.social-icons a { color: var(--text-light); transition: transform 0.2s, color 0.2s; }
.light-theme .social-icons a { color: var(--text-dark); }
.social-icons a:hover { transform: scale(1.2); color: var(--accent-color); }
.social-share-section p { font-size: 12px; margin-bottom: 10px; font-weight: 600;}

#instagram-share img {
    content: url('../img/instagram.svg');
}
body.light-theme #instagram-share img {
    content: url('../img/instagram-colors.svg');
}


#style-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 20px; }
#style-grid .story-card { padding: 0; overflow: hidden; position: relative; }
#style-grid .story-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
#style-grid .story-card:hover img { transform: scale(1.05); }

.style-card-label {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 8px 8px 8px;
    box-sizing: border-box;
    text-align: center;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
    color: var(--text-light);
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.3s, background 0.5s ease, color 0.5s ease;
}
.light-theme .style-card-label {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.85), transparent);
    color: var(--text-dark);
}

.story-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 30px; }
.story-actions-grid .button.full-width { grid-column: 1 / -1; }

.hero-section { display: flex; align-items: center; justify-content: center; gap: 40px; width: 100%; padding: 20px 0 64px 0; }
.hero-text { flex: 1; max-width: 500px; text-align: left; }
.hero-text h1 { font-size: 3.2rem; }
.hero-text .subtitle { text-align: left; margin: 20px 0 30px 0; font-size: 16px; }
.hero-text .nav-buttons { flex-direction: row; justify-content: flex-start; gap: 15px; }
.hero-text .nav-buttons .button { width: auto; padding: 18px 30px; }

.hero-image { position: relative; display: flex; justify-content: center; align-items: center; }
.hero-image .carousel-image { cursor: pointer;}
.carousel-image { max-width: 100%; height: auto; animation: subtle-float 3.5s ease-in-out infinite; position: absolute; top: 0; left: 0; opacity: 0; transition: opacity 1s ease-in-out; }
.carousel-image.active { opacity: 1; position: relative; }
.hero-image img { max-width: 100%; height: auto; animation: subtle-float 3.5s ease-in-out infinite; }

.steps-section { display: flex; flex-direction: column; gap: 20px; width: 100%; }

.step-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    isolation: isolate;
}

.step-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 25% 25%, 
        var(--step-card-glow-color), 
        transparent 40%
    );
    z-index: -1;
    transition: opacity 0.3s ease;
}

.step-card:hover { transform: translateY(-5px); }
.step-card:hover::before { opacity: 0.8; }
.step-card p { font-size: 12px; }
.step-icon { font-size: 36px; margin-bottom: 10px; }

.section-title { font-family: 'Lilita One', cursive; font-size: 28px; margin-bottom: 20px; text-align: center; text-shadow: none; border: none; }

#story-screen:fullscreen { background-color: #1a1a1a; padding-top: 20px; }
.light-theme #story-screen:fullscreen { background-color: var(--primary-bg); }
#story-screen:fullscreen .story-header,
#story-screen:fullscreen #view-vertical-btn,
#story-screen:fullscreen #view-book-btn { display: none; }

.fullscreen-btn { background: none; border: none; color: var(--text-light); cursor: pointer; padding: 8px; }
.light-theme .fullscreen-btn { color: var(--text-dark); }
.fullscreen-btn svg { width: 24px; height: 24px; }

#storybook-view { display: none; flex-direction: column; align-items: center; width: 100%; height: 100%; }
.book-container { display: flex; width: 100%; height: 75vh; max-height: 700px; margin-bottom: 15px; position: relative; align-items: center; justify-content: center; }
#book-page-right { display: none; }

.book-page {
    width: 100%;
    max-width: 450px;
    height: 100%;
    background-color: #f3f3f3;
    color: #333;
    padding: 30px;
    box-sizing: border-box;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    transition: background-color 0.5s ease, color 0.5s ease;
}
.light-theme .book-page { background-color: var(--primary-bg); color: var(--text-dark); }

.book-page.text-only {
    justify-content: center;
}

.book-page.image-page {
    padding: 0;
}
.book-page.image-page img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

.book-page .page-text {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.1rem;
    line-height: 1.7;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    text-align: justify;
    overflow: hidden; 
}

.book-page.cover-page #cover-title { font-size: clamp(24px, 5vw, 36px); padding: 20px 10px 30px; }
.book-page .page-text h2 { font-family: 'Lilita One', cursive; font-weight: 400; color: var(--primary-bg); transition: color 0.5s ease; }
.light-theme .book-page .page-text h2 { color: var(--accent-color); }

.book-page .page-image-text-container { display: flex; flex-direction: column; gap: 15px; width: 100%; height: 100%; justify-content: flex-start; align-items: center; overflow-y: auto; padding: 0px 5px; }
.book-page .page-image-text-container img { width: 100%; max-width: 350px; height: 300px; object-fit: contain; border-radius: 8px; flex-shrink: 0; margin-bottom: 15px; background-color: #eee; }
.light-theme .book-page .page-image-text-container img { background-color: var(--primary-bg-light); }
.book-page.actions-page { background-color: transparent; padding: 0; color: var(--text-light); }
.light-theme .book-page.actions-page { color: var(--text-dark); }
.actions-page .shared-actions { margin: 0; width: 100%; }

.storybook-nav-container { text-align: center; }
.storybook-nav { display: flex; justify-content: center; gap: 15px; width: 100%; max-width: 90vw; margin: 0 auto 10px auto; }
.storybook-nav .button { width: 120px; }
#page-counter { font-size: 14px; opacity: 0.8; }
.light-theme #page-counter { color: var(--text-dark); }

#story-screen .shared-actions { width: 100%; max-width: 600px; margin: 0 auto; }
#story-screen.storybook-mode #vertical-view { display: none; }
#story-screen.storybook-mode #storybook-view { display: flex; }
#story-screen.vertical-mode #vertical-view { display: block; }
#story-screen.vertical-mode #storybook-view { display: none; }
#story-screen.storybook-mode .font-controls { display: none; }

#story-text-container mark, #story-text-container .suggestion,
.book-page .page-text mark, .book-page .page-text .suggestion {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    padding: 2px 5px;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.5s ease, color 0.5s ease;
}
.light-theme #story-text-container mark, .light-theme #story-text-container .suggestion,
.light-theme .book-page .page-text mark, .light-theme .book-page .page-text .suggestion {
    background-color: var(--accent-color);
    color: var(--text-light);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--modal-bg);
    backdrop-filter: blur(5px);
    transition: background 0.5s ease;
}

.modal-content {
    background-color: #ffffff;
    color: var(--primary-bg);
    font-family: 'Open Sans', sans-serif;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
    border: none;
    transition: background-color 0.5s ease, color 0.5s ease;
}
.light-theme .modal-content {
    background-color: var(--primary-bg);
    color: var(--text-dark);
}

.modal-content .header h2 { font-family: 'Lilita One', cursive; color: var(--primary-bg); text-shadow: none; }
.light-theme .modal-content .header h2 { color: var(--text-dark); }

#alert-text, #moral-text {
    font-size: clamp(14px, 3.5vw, 16px);
    line-height: 1.6;
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-bg);
    transition: color 0.5s ease;
}
.light-theme #alert-text, .light-theme #moral-text { color: var(--text-dark); }
#credit-text { margin-bottom: 20px; }
.light-theme #credit-text { color: var(--text-dark); }

#credit-modal .modal-content {
    background: linear-gradient(160deg, #3a1e7a 0%, #2c0b6a 100%);
    border: 1px solid var(--primary-bg-light);
    color: var(--text-light);
    transition: background 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}
.light-theme #credit-modal .modal-content {
    background: linear-gradient(160deg, #dce7f3 0%, #f0f4f8 100%);
    border: 1px solid var(--border-color-subtle);
    color: var(--text-dark);
}

#credit-modal .modal-content .header h2 { color: var(--accent-color); text-shadow: 0 2px 2px rgba(0, 0, 0, 0.3); }
.light-theme #credit-modal .modal-content .header h2 { text-shadow: 0 2px 2px rgba(0, 0, 0, 0.1); }

.wallet-visual { background-color: rgba(0, 0, 0, 0.2); padding: 20px; border-radius: 15px; text-align: center; transition: background-color 0.5s ease; }
.light-theme .wallet-visual { background-color: var(--card-bg); }
.wallet-visual p { margin: 8px 0; font-size: 16px; line-height: 1.5; color: var(--text-light); transition: color 0.5s ease; }
.light-theme .wallet-visual p { color: var(--text-dark); }
.wallet-visual strong { font-size: 20px; font-weight: 700; color: var(--accent-color); vertical-align: middle; margin: 0 5px; }

#share-card {
    aspect-ratio: 9 / 16;
    width: 72%;
    max-width: 320px;
    margin: 0 auto;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #2c0b6a 0%, #1a053d 70%);
    border: 1px solid rgba(221, 253, 82, 0.2);
    transition: all 0.5s ease;
}
.light-theme #share-card {
    background: linear-gradient(160deg, #f0f4f8 0%, #e0e6ec 70%);
    border: 1px solid var(--border-color-subtle);
}

#share-card::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(221, 253, 82, 0.2);
    border-radius: 12px;
    pointer-events: none;
    transition: border-color 0.5s ease;
}
.light-theme #share-card::before { border: 1px solid var(--border-color-subtle); }

#share-card-image { 
    width: 100%; 
    height: 45%; 
    display: block; 
    object-fit: cover; 
    position: relative; 
    clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%); 
}

#share-card-text { 
    padding: 0 20px 20px 20px; 
    text-align: center; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    flex-grow: 1; 
    position: relative; 
    z-index: 2; 
    margin-top: -10%; 
}

#share-card-theme {
    font-size: 10px;
    font-weight: 700;
    color: #1a1a1a;
    opacity: 1;
    margin: 0 auto 10px auto;
    padding: 5px 15px;
    background-color: var(--accent-color);
    border-radius: 20px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: background-color 0.5s ease, color 0.5s ease;
}
.light-theme #share-card-theme { background-color: var(--accent-color); color: #DDFD52; }

#share-card-text h3 {
    font-family: 'Lilita One', cursive;
    font-weight: 400;
    font-size: clamp(20px, 5.5vw, 32px);
    margin: 0 0 8px 0;
    color: var(--text-light);
    line-height: 1.1;
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
    transition: color 0.5s ease, text-shadow 0.5s ease;
}
.light-theme #share-card-text h3 { color: var(--text-dark); text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1); }

#share-card-promo-text { margin: 0; font-size: clamp(11px, 2.2vw, 12px); opacity: 0.8; line-height: 1.4; color: var(--text-light); font-weight: 300; transition: color 0.5s ease; }
.light-theme #share-card-promo-text { color: var(--text-dark); }

#nps-widget { display: flex; flex-direction: column; align-items: center; gap: 15px; width: 100%; }
#nps-emoji { font-size: 48px; transition: transform 0.3s ease; }
#nps-scale { display: flex; justify-content: center; gap: 5px; width: 100%; flex-wrap: wrap; }
.nps-rating { background: none; border: 1px solid #ddd; color: var(--primary-bg); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; transition: all 0.2s; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.light-theme .nps-rating { border: 1px solid var(--border-color-subtle); color: var(--text-dark); }
.nps-rating:hover { background-color: var(--accent-color); color: var(--text-dark); }
.nps-rating.selected { color: var(--text-dark); font-weight: bold; transform: scale(1.1); }
.nps-rating.selected.nps-red { background-color: #E53935; border-color: #E53935; color: white;}
.nps-rating.selected.nps-orange { background-color: #FFB300; border-color: #FFB300; }
.nps-rating.selected.nps-yellow { background-color: #FDD835; border-color: #FDD835; }
.nps-rating.selected.nps-light-green { background-color: #9CCC65; border-color: #9CCC65; }
.nps-rating.selected.nps-green { background-color: #43A047; border-color: #43A047; }
.nps-labels { display: flex; justify-content: space-between; width: 100%; font-size: 10px; color: var(--primary-bg); opacity: 0.8; }
.light-theme .nps-labels { color: var(--text-dark); }

.feedback-textarea { width: 100%; height: 80px; background-color: #f0f0f0; border: 1px solid #ddd; border-radius: 10px; padding: 10px; color: var(--text-dark); font-family: 'Open Sans', sans-serif; font-size: 14px; resize: vertical; box-sizing: border-box; transition: background-color 0.5s ease, border-color 0.5s ease; }
.light-theme .feedback-textarea { background-color: #ffffff; border: 1px solid var(--border-color-subtle); }
.feedback-textarea::placeholder { color: #999; }
#feedback-response { text-align: center; font-weight: bold; }
#feedback-modal .modal-content .header.hidden { display: none; }

#download-share-card-btn, #feedback-close-btn { background-color: var(--accent-color); color: var(--text-dark); border-bottom: 4px solid #b2c944; }
.light-theme #download-share-card-btn, .light-theme #feedback-close-btn { background-color: var(--accent-color); color: #DDFD52; border-bottom: 4px solid #4a2b8e; }

#quiz-modal .header h2 { font-size: clamp(24px, 5vw, 30px); }
.light-theme #quiz-modal .header h2 { color: var(--text-dark); }

#quiz-question-counter { color: var(--primary-bg-light); text-align: center; margin-bottom: 20px; transition: color 0.5s ease; }
.light-theme #quiz-question-counter { color: var(--text-dark); }
#quiz-question-text { font-size: clamp(16px, 4.5vw, 18px); font-weight: bold; text-align: center; margin-bottom: 20px; color: var(--primary-bg); transition: color 0.5s ease; }
.light-theme #quiz-question-text { color: var(--text-dark); }

#quiz-options-container { display: flex; flex-direction: column; gap: 10px; }
.quiz-option-btn { font-family: 'Open Sans', sans-serif; font-size: clamp(14px, 3.8vw, 16px); background-color: #f0f0f0; border: 2px solid #ddd; color: var(--text-dark); padding: 15px; border-radius: 10px; text-align: left; width: 100%; cursor: pointer; transition: all 0.2s; }
.light-theme .quiz-option-btn { background-color: var(--card-bg); border: 2px solid var(--border-color-subtle); color: var(--text-dark); }
.quiz-option-btn.correct { background-color: var(--correct-answer); border-color: #5a9d00; color: var(--text-dark); font-weight: bold; }
.quiz-option-btn.incorrect { background-color: var(--incorrect-answer); border-color: #c00; color: #fff; font-weight: bold; }
.quiz-option-btn:disabled:not(.correct):not(.incorrect) { opacity: 0.6; cursor: not-allowed; }
#quiz-nav-buttons { display: flex; justify-content: space-between; margin-top: 20px; }
#quiz-nav-buttons .button { width: 100%; }

@media (max-width: 820px) {
    .hero-section { flex-direction: column; gap: 20px; padding: 20px 0 10px 0; }
    .hero-text { order: 2; text-align: center; }
    .hero-text h1 { font-size: 2.5rem; }
    .hero-text .subtitle { text-align: center; }
    .hero-text .nav-buttons { flex-direction: column; justify-content: center; }
    .hero-text .nav-buttons .button { width: 100%; }
    .hero-image { order: 1; max-width: 300px; }
    @media (max-width: 820px) { .hero-image { min-height: 300px; } }
}

@media (min-width: 768px) {
    main, .screen footer { max-width: 800px; }
    #welcome-screen main { max-width: 1000px; }
    .story-grid { grid-template-columns: repeat(4, 1fr); }
    #protagonist-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
    #style-grid { grid-template-columns: repeat(3, 1fr); }
    .steps-section { display: grid; grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) { #vertical-view { max-width: 550px; } }

#pdf-render-container { position: absolute; left: -9999px; top: 0; width: 210mm; background: white; font-family: 'Open Sans', sans-serif; color: var(--text-light); }
.light-theme #pdf-render-container { color: var(--text-dark); }

.pdf-page {
    width: 210mm;
    height: 297mm;
    box-sizing: border-box;
    padding: 0;
    position: relative;
    overflow: hidden;
    background-color: transparent;
}

.pdf-page-story {
    padding: 15mm;
}

.pdf-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.pdf-page-content { position: relative; z-index: 2; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }

.pdf-cover-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.pdf-cover-image-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.pdf-cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 15mm;
    box-sizing: border-box;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 40%);
}

.pdf-title {
    font-family: 'Lilita One', cursive;
    font-size: 28pt;
    color: #FFD900;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    text-align: center;
    line-height: 1.2;
    margin: 0;
}

.pdf-credits {
    text-align: center;
    margin-top: 5mm;
}

.pdf-publisher {
    font-family: 'Open Sans', sans-serif;
    font-size: 8pt;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.pdf-story-title { font-family: 'Lilita One', cursive; font-size: 22pt; color: var(--accent-color); text-align: center; margin-bottom: 10mm; }
.pdf-story-image { max-width: 90%; max-height: 100mm; object-fit: contain; margin-bottom: 8mm; border-radius: 8px; }
.pdf-story-text {
    font-size: 11pt;
    line-height: 1.6;
    text-align: left;
}
.enter-fullscreen-icon { display: none !important; }
.pdf-page-content.centered-text { justify-content: center; }
.pdf-story-text.centered { text-align: center; font-weight: 600; }
#alert-modal { z-index: 101; }

.quiz-close-x-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background-color: var(--incorrect-answer);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 22px;
    font-weight: bold;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s, border-color 0.5s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.light-theme .quiz-close-x-btn { border: 2px solid rgba(0, 0, 0, 0.2); }
.quiz-close-x-btn:hover { transform: scale(1.1); background-color: #e63939; }
#quiz-nav-buttons { justify-content: center; }
.quiz-option-btn.selected { background-color: #dbeafe; border-color: #60a5fa; font-weight: bold; }
.light-theme .quiz-option-btn.selected { background-color: var(--primary-bg-light); border-color: var(--accent-color); color: var(--text-light); }

.congrats-message { text-align: center; width: 100%; color: var(--accent-color); opacity: 1; transition: opacity 0.5s ease-out; }
.congrats-message h2 {
    font-family: 'Lilita One', cursive;
    font-weight: normal;
    font-size: clamp(24px, 5vw, 32px);
    margin: 0;
    padding: 10px 0;
}
.congrats-message.fade-out { opacity: 0; }

#story-screen { padding-top: 0; }
#storybook-view .book-page.cover-page { aspect-ratio: 1 / 1.6; height: auto; max-height: 100%; background-color: #000; }
.light-theme #storybook-view .book-page.cover-page { background-color: var(--primary-bg-light); }
#storybook-view .book-page.cover-page img { object-fit: cover; }
.book-page.cover-page #cover-title { font-size: clamp(22px, 4.5vw, 32px); padding: 15px 10px 72px; }

.tribute-container {
    width: 100%;
    margin-top: 42px;
    padding: 20px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color-subtle);
    border-radius: 15px;
    box-sizing: border-box;
    text-align: left;
}

.light-theme .tribute-container { background-color: rgba(93, 55, 175, 0.08); border-color: rgba(93, 55, 175, 0.2); }
h4.tribute-title { font-family: 'Lilita One', cursive; font-weight: 400; font-size: 1rem; color: var(--accent-color); margin: 0 0 5px 0; text-shadow: none; }
.tribute-text { font-family: 'Open Sans', sans-serif; font-size: 0.75rem; opacity: 0.9; }
.tribute-name { font-family: 'Open Sans', sans-serif; font-weight: 700; color: var(--accent-color); display: inline-block; transition: opacity 0.4s ease-in-out; }

.invite-section {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    padding: 15px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color-subtle);
    border-radius: 15px;
    text-align: center;
    box-sizing: border-box;
}

.light-theme .invite-section { background-color: rgba(93, 55, 175, 0.08); border-color: rgba(93, 55, 175, 0.2); }
.invite-text { font-size: 12px; font-weight: 600; margin: 0 0 10px 0; opacity: 0.9; }
.copy-link-container { position: relative; width: 100%; }

.copy-link-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color-subtle);
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
}

.light-theme .copy-link-button { background-color: rgba(255, 255, 255, 0.8); border-color: #ccc; }
.copy-link-button:hover { background-color: rgba(0, 0, 0, 0.3); }
.light-theme .copy-link-button:hover { background-color: #fff; }
.copy-link-button span { font-size: 14px; font-family: monospace; color: var(--text-light); opacity: 0.8; }
.light-theme .copy-link-button span { color: var(--text-dark); }
.copy-link-button svg { color: var(--accent-color); flex-shrink: 0; }

.copy-confirmation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--accent-color);
    color: var(--text-dark);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    z-index: 10;
}

.copy-confirmation.show { opacity: 1; }

.input-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.disclaimer-text {
    font-size: 11px;
    text-align: center;
    opacity: 0.8;
    margin-top: 10px;
    min-height: 30px;
}

.input-disclaimer {
    font-size: 11px;
    text-align: center;
    opacity: 0.7;
    margin-top: -5px;
}

.prompt-wrapper {
    position: relative;
    width: 100%;
}


footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    flex-shrink: 0;
}

footer p {
    font-size: 11px;
    margin-bottom: 8px;
    opacity: 0.6;
    color: var(--text-light);
    transition: color 0.5s ease;
}

body.light-theme footer p {
    color: var(--text-dark);
}

.footer-links {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.footer-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-logo {
    width: 16px;
    height: auto;
    margin-left: 2px;
}

body.legal-page {
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.legal-page #main-header-container {
    top: 0;
    z-index: 100;
    width: 100%;
    flex-shrink: 0;
    padding-left: 20px;
    padding-right: 20px;
}

.legal-page main.legal-content {
    flex-shrink: 0;
    width: 100%;
    max-width: 800px;
    margin-top: 40px;
    margin-bottom: 40px;
    padding: 20px 30px;
    box-sizing: border-box;
    text-align: left;
    align-items: left!important;
}

.legal-page footer {
    flex-shrink: 0;
    width: 100%;
    max-width: 800px;
    margin-top: auto;
    padding-bottom: 20px;
}

.legal-page footer p {
    font-size: 11px;
    opacity: 0.6;
    margin-bottom: 8px;
}

.legal-page .footer-links {
    margin-bottom: 20px;
}

.view-controls-header {
    text-align: center;
    margin-bottom: 8px;
}

.view-controls-header span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    opacity: 0.8;
}

.light-theme .view-controls-header span {
    color: var(--text-dark);
}

.view-controls { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 20px; 
}

.view-controls .button {
    width: auto;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 700;
    background-color: #874fff;
    color: #ffffff;
    border-bottom: 4px solid #5d37af;
}

.view-controls .button:hover {
    background-color: #9d6bff;
}

.view-controls .button.active {
    background-color: #DDFD52;
    color: #1a1a1a;
    border-bottom: 4px solid #b2c944;
}

.view-controls .button.active:hover {
    background-color: #DDFD52;
}

.light-theme .view-controls .button.active {
    background-color: #DDFD52;
    color: #1a1a1a;
    border-bottom: 4px solid #b2c944;
}

.wait-alert {
    width: 100%;
    max-width: 400px;
    margin-top: 25px;
    padding: 15px 20px;
    background-color: rgba(221, 253, 82, 0.1);
    border: 1px solid rgba(221, 253, 82, 0.3);
    border-radius: 12px;
    position: relative;
    box-sizing: border-box;
    text-align: center;
}

.light-theme .wait-alert {
    background-color: rgba(93, 55, 175, 0.08);
    border-color: rgba(93, 55, 175, 0.2);
}

.wait-alert p {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    color: var(--text-light);
    padding-right: 20px;
}

.light-theme .wait-alert p {
    color: var(--text-dark);
}

.wait-alert-close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: var(--text-light);
    opacity: 0.7;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 5px;
}

.light-theme .wait-alert-close-btn {
    color: var(--text-dark);
}

.wait-alert-close-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

#age-screen main,
#protagonist-screen main,
#details-screen main,
#style-screen main {
    flex-grow: 1;
    justify-content: center;
}


body.pdf-generating #pdf-render-container,
body.pdf-generating .pdf-page-content,
body.pdf-generating .pdf-story-text {
    color: #ffffff !important;
}

body.pdf-generating .pdf-title {
    color: #FFD900 !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7) !important;
}

body.pdf-generating .pdf-story-title {
    color: var(--accent-color) !important;
}

body.pdf-generating .pdf-publisher {
    color: rgba(255, 255, 255, 0.9) !important;
}

.app-download-section {
    width: 100%;
    max-width: 1000px;
    margin: 60px 0;
    padding: 40px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color-subtle);
    border-radius: 20px;
    text-align: center;
    box-sizing: border-box;
}

.light-theme .app-download-section {
    background-color: rgba(93, 55, 175, 0.08);
    border-color: rgba(93, 55, 175, 0.2);
}

.app-download-section h2 {
    font-family: 'Lilita One', cursive;
    font-weight: normal;
    font-size: 2rem;
    color: var(--text-light);
    margin: 0 0 10px 0;
}

.light-theme .app-download-section h2 {
    color: var(--text-dark);
}

.app-download-section p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0 0 30px 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.app-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.app-download-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: #DDFD52;
    color: #1a1a1a;
    padding: 15px 30px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    border-bottom: 4px solid #b2c944;
    transition: transform 0.1s, border-bottom-width 0.1s;
}

.app-download-button:hover {
    background-color: #c8e64a;
}

.app-download-button:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.app-download-button .store-icon {
    width: 24px;
    height: 24px;
    fill: #1a1a1a;
}

.app-download-section .stores-text {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 20px;
}

@media (max-width: 767px) {
    #age-grid {
        grid-template-columns: 1fr !important; /* Força uma única coluna */
    }

    #age-grid .option-card {
        aspect-ratio: auto; /* Remove a proporção 1:1 para que a altura se ajuste */
        padding-top: 15px;
        padding-bottom: 15px;
    }
}


/* --- Estilos para os botões do Modal de Compartilhamento --- */
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

.modal-actions-main {
    display: flex;
    flex-direction: row; /* Alinha os botões horizontalmente */
    gap: 10px;
    width: 100%;
}

.modal-actions-main .button {
    flex: 1; /* Distribui o espaço igualmente */
    width: auto; /* Sobrescreve o width: 100% padrão da classe .button */
}