/* Ping the Panda - Visual Novel Styles */

:root {
    --bg-mint: #a8e6cf;
    --bg-mint-dark: #7fcdbb;
    --primary-dark: #2d3436;
    --accent-coral: #ff6b6b;
    --accent-yellow: #ffeaa7;
    --white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.15);
    --font-cn: 'Noto Sans SC', sans-serif;
    --font-en: 'Nunito', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-cn);
    background: linear-gradient(135deg, var(--bg-mint) 0%, var(--bg-mint-dark) 100%);
    min-height: 100vh;
    overflow: hidden;
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* ============ START SCREEN ============ */
#start-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-mint) 0%, #88d8b0 50%, var(--bg-mint-dark) 100%);
}

.start-content {
    text-align: center;
    padding: 2rem;
}

.panda-mascot {
    font-size: 8rem;
    animation: bounce 2s infinite ease-in-out;
    filter: drop-shadow(0 10px 20px var(--shadow));
}

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

.start-content h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-dark);
    text-shadow: 3px 3px 0 var(--white);
    margin: 0.5rem 0;
}

.subtitle {
    font-family: var(--font-en);
    font-size: 1.3rem;
    color: var(--primary-dark);
    opacity: 0.8;
    margin-bottom: 2rem;
}

.difficulty-select {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 300px;
    margin: 0 auto;
}

.select-label {
    font-size: 1rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.diff-btn {
    background: var(--white);
    border: none;
    border-radius: 20px;
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.diff-btn:hover, .diff-btn:focus {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px var(--shadow);
}

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

.diff-btn .stars {
    font-size: 1.5rem;
}

.diff-btn .level-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-dark);
    flex: 1;
    text-align: left;
}

.diff-btn .age {
    font-size: 0.9rem;
    color: #666;
}

/* ============ STORY SELECT SCREEN ============ */
#story-screen {
    background: var(--bg-mint);
}

.story-header, .vocab-header {
    background: var(--white);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 10px var(--shadow);
}

.story-header h2, .vocab-header h2 {
    font-size: 1.3rem;
    color: var(--primary-dark);
}

.story-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.story-card {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 6px 20px var(--shadow);
    cursor: pointer;
    transition: transform 0.2s;
}

.story-card:hover {
    transform: translateY(-5px);
}

.story-card-image {
    height: 140px;
    background: linear-gradient(135deg, #dfe6e9, #b2bec3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.story-card-content {
    padding: 1.2rem;
}

.story-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.3rem;
}

.story-card-title-en {
    font-family: var(--font-en);
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.story-card-meta {
    display: flex;
    gap: 0.8rem;
    font-size: 0.85rem;
    color: #888;
}

.story-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ============ GAME SCREEN ============ */
#game-screen {
    background: #1a1a2e;
}

.scene-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: opacity 0.5s;
}

.character-area {
    position: absolute;
    bottom: 200px;
    left: 0;
    width: 100%;
    height: 50%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
}

.character-sprite {
    font-size: 12rem;
    filter: drop-shadow(0 10px 30px rgba(0,0,0,0.3));
    transition: transform 0.3s;
}

/* Dialogue Box */
.dialogue-box {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(255,255,255,0.98), rgba(255,255,255,0.95));
    border-radius: 30px 30px 0 0;
    padding: 1.5rem;
    padding-bottom: 2rem;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.2);
    min-height: 180px;
}

.speaker-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-coral);
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
}

.dialogue-content {
    padding: 0 0.5rem;
}

.english-text {
    font-family: var(--font-en);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.chinese-text {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.5;
}

.dialogue-controls {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.8rem;
}

/* Vocab word highlighting */
.vocab-highlight {
    color: var(--accent-coral);
    background: rgba(255, 107, 107, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.vocab-highlight:hover {
    background: rgba(255, 107, 107, 0.25);
}

/* Choices */
.choices-container {
    position: absolute;
    bottom: 200px;
    left: 0;
    width: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
}

.choices-container.hidden {
    display: none;
}

.choice-btn {
    background: var(--white);
    border: 3px solid var(--accent-coral);
    border-radius: 50px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
    cursor: pointer;
    min-width: 250px;
    transition: all 0.2s;
    font-family: var(--font-en);
}

.choice-btn:hover {
    background: var(--accent-coral);
    color: var(--white);
    transform: scale(1.05);
}

.choice-btn .choice-cn {
    font-family: var(--font-cn);
    font-size: 0.9rem;
    font-weight: 500;
    display: block;
    margin-top: 0.3rem;
    opacity: 0.8;
}

/* Vocab Popup */
.vocab-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    z-index: 100;
    min-width: 280px;
}

.vocab-popup.hidden {
    display: none;
}

.vocab-word {
    font-family: var(--font-en);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-coral);
    margin-bottom: 0.5rem;
}

.vocab-pinyin {
    font-size: 1rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.vocab-meaning {
    font-size: 1.3rem;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
}

.vocab-audio {
    background: var(--accent-coral);
    color: var(--white);
    border: none;
    border-radius: 50px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

/* Top UI */
.game-ui-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), transparent);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-yellow);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s;
}

.vocab-count {
    color: var(--white);
    font-weight: 700;
    font-size: 1rem;
}

/* Pause Menu */
.pause-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

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

.pause-content {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    min-width: 280px;
}

.pause-content h3 {
    font-size: 1.5rem;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
}

.pause-content button {
    display: block;
    width: 100%;
    background: var(--bg-mint);
    border: none;
    border-radius: 15px;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
    cursor: pointer;
    margin-bottom: 0.8rem;
    transition: background 0.2s;
}

.pause-content button:hover {
    background: var(--bg-mint-dark);
}

.pause-content button:last-child {
    margin-bottom: 0;
    background: #ffcccc;
}

/* Icon Button */
.icon-btn {
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50px;
    padding: 0.6rem 1rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.icon-btn:hover {
    transform: scale(1.1);
}

/* ============ VOCAB SCREEN ============ */
#vocab-screen {
    background: var(--bg-mint);
}

.vocab-list {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.vocab-item {
    background: var(--white);
    border-radius: 15px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 15px var(--shadow);
}

.vocab-item-word {
    font-family: var(--font-en);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-coral);
    min-width: 100px;
}

.vocab-item-meaning {
    flex: 1;
    color: var(--primary-dark);
}

.vocab-item-audio {
    font-size: 1.5rem;
    cursor: pointer;
}

/* ============ RESPONSIVE ============ */
@media (min-width: 768px) {
    .dialogue-box {
        max-width: 700px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 30px;
        bottom: 20px;
    }

    .choices-container {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ============ BRENDA THE BUTTERFLY ============ */
.brenda-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* Mobile: smaller & tucked away */
@media (max-width: 768px) {
    .brenda-container {
        bottom: auto;
        top: 10px;
        right: 10px;
    }

    .brenda-emoji {
        font-size: 2rem;
    }

    .brenda-name {
        font-size: 0.6rem;
    }

    .brenda-speech {
        max-width: 220px;
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
        position: fixed;
        top: 50px;
        right: 10px;
    }
}

/* Minimized state - smaller but visible */
.brenda-container.minimized .brenda {
    opacity: 0.85;
}

.brenda-container.minimized .brenda-emoji {
    font-size: 2.2rem;
    animation: flutter 3s infinite ease-in-out;
}

.brenda-container.minimized .brenda-name {
    display: none;
}

.brenda {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 5px 15px rgba(147, 112, 219, 0.4));
}

.brenda:hover {
    transform: scale(1.1) translateY(-5px);
}

.brenda-emoji {
    font-size: 3.5rem;
    animation: flutter 2s infinite ease-in-out;
}

@keyframes flutter {
    0%, 100% {
        transform: translateY(0) rotate(-5deg);
    }
    25% {
        transform: translateY(-8px) rotate(5deg);
    }
    50% {
        transform: translateY(-3px) rotate(-3deg);
    }
    75% {
        transform: translateY(-10px) rotate(3deg);
    }
}

.brenda-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #9370db;
    text-shadow: 1px 1px 0 white;
    margin-top: -5px;
}

.brenda-speech {
    background: white;
    border-radius: 20px;
    padding: 1rem 1.2rem;
    max-width: 280px;
    box-shadow: 0 8px 30px rgba(147, 112, 219, 0.3);
    position: relative;
    border: 3px solid #dda0dd;
    animation: speechPop 0.3s ease-out;
}

.brenda-speech.hidden {
    display: none;
}

@keyframes speechPop {
    0% { transform: scale(0.8) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.brenda-speech::after {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 30px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #dda0dd;
}

.brenda-speech::before {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 32px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
    z-index: 1;
}

.brenda-speech-content {
    font-size: 0.95rem;
    color: var(--primary-dark);
    line-height: 1.5;
}

.brenda-speech-content .brenda-title {
    font-weight: 700;
    color: #9370db;
    margin-bottom: 0.5rem;
    display: block;
}

.brenda-speech-content .brenda-tip {
    margin: 0.5rem 0;
    padding-left: 1rem;
    border-left: 3px solid #dda0dd;
}

.brenda-speech-content .brenda-btn {
    display: inline-block;
    background: linear-gradient(135deg, #dda0dd, #9370db);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 0.5rem;
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.brenda-speech-content .brenda-btn:hover {
    transform: scale(1.05);
}

.brenda-close {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.brenda-close:hover {
    color: #666;
}

/* Brenda notification dot */
.brenda.has-tip::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #ff6b6b;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .panda-mascot,
    .character-sprite,
    .brenda-emoji {
        animation: none;
    }
}
