:root {
    --bg-primary: #fbf7f0;
    --card-bg: #ffffff;
    --text-color: #3e2723;
    --brand-color: #ff7043;
    --brand-hover: #f4511e;
    --accent-color: #ffca28;
    --border-color: #d7ccc8;
    --radius: 20px;
    --shadow: 0 12px 30px rgba(93, 64, 55, 0.15);
}

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

body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    background: radial-gradient(circle, #fffde7 0%, #fff3e0 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-color);
    overflow-x: hidden;
}

/* Header */
.app-header {
    width: 100%;
    max-width: 1000px;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.home-btn {
    text-decoration: none;
    background: #fff;
    border: 2px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 25px;
    font-weight: bold;
    color: #5d4037;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.home-btn:hover {
    transform: translateY(-2px);
}

.header-title {
    font-size: 1.6rem;
    color: #4e342e;
    text-shadow: 1px 1px 0px #fff;
}

.icon-btn {
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
    color: #5d4037;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn.active {
    background: #fff8e1;
    border-color: #ffb300;
    color: #e65100;
}

/* Book Viewport */
.book-viewport {
    flex: 1;
    width: 100%;
    max-width: 960px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
}

.book-wrapper {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 4px solid #efebe9;
    overflow: hidden;
}

.book-container {
    position: relative;
    width: 100%;
    min-height: 540px;
}

.book-page {
    display: none;
    width: 100%;
    height: 100%;
}

.book-page.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.99); }
    to { opacity: 1; transform: scale(1); }
}

.page-spread {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: 540px;
}

@media (max-width: 768px) {
    .page-spread {
        flex-direction: column;
    }
}

.page-left {
    flex: 1;
    background: #fffde7;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    border-right: 2px dashed #ffe082;
}

.page-right {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Illustration */
.illustration-wrapper {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
}

.illustration-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    border: 3px solid #fff;
}

.clay-shadow {
    box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

/* Cover Page Specific */
.cover-design {
    background: #fff8e1;
}

.cover-title-page {
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #fffde7 100%);
}

.badge {
    background: #ffe082;
    color: #e65100;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.book-title {
    font-size: 2.2rem;
    color: #4e342e;
    line-height: 1.3;
}

.highlight {
    color: var(--brand-color);
}

.author {
    font-size: 1.1rem;
    color: #6d4c41;
    line-height: 1.6;
}

.start-btn {
    background: linear-gradient(to right, #ff7043, #ff5722);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(255, 112, 67, 0.4);
    transition: transform 0.2s ease;
}

.start-btn:hover {
    transform: scale(1.05);
}

/* Text Layout */
.page-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tts-btn {
    background: #e8f5e9;
    color: #2e7d32;
    border: 2px solid #a5d6a7;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tts-btn:hover {
    background: #c8e6c9;
}

.page-number {
    font-weight: bold;
    color: #8d6e63;
    font-size: 0.95rem;
}

.story-text {
    font-size: 1.25rem;
    line-height: 1.8;
    color: #3e2723;
    flex: 1;
}

.dialogue {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 8px;
}

.dialogue.siyoon {
    color: #d84315;
    background: #fbe9e7;
}

.dialogue.rabbit {
    color: #c2185b;
    background: #fce4ec;
}

.dialogue.turtle {
    color: #2e7d32;
    background: #e8f5e9;
}

.highlight-text {
    font-weight: bold;
    color: var(--brand-color);

}

.lesson-box {
    display: block;
    background: #fff8e1;
    border: 2px dashed #ffb300;
    padding: 16px;
    border-radius: 12px;
    font-weight: bold;
    color: #e65100;
}

/* Interactive Area */
.interactive-area {
    margin: 15px 0;
    text-align: center;
}

.cheer-btn, .goal-btn {
    background: #ffb74d;
    color: #e65100;
    border: 2px solid #ffa726;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 183, 77, 0.4);
    transition: transform 0.2s ease;
}

.cheer-btn:hover, .goal-btn:hover {
    transform: scale(1.05);
    background: #ffa726;
}

.restart-btn {
    background: #8d6e63;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
}

/* Nav Bar */
.page-nav-bar {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.nav-btn {
    background: #efebe9;
    border: 2px solid #d7ccc8;
    color: #4e342e;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
    background: #d7ccc8;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer */
.app-footer {
    padding: 20px;
    font-size: 0.95rem;
    color: #8d6e63;
    font-weight: bold;
}

/* Particle Effects */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1000;
}

.particle {
    position: absolute;
    font-size: 1.8rem;
    animation: floatUp 1.2s forwards ease-out;
}

@keyframes floatUp {
    0% { transform: translate(0, 0) scale(0.5); opacity: 1; }
    100% { transform: translate(var(--mx), var(--my)) scale(1.4); opacity: 0; }
}
