@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
    --duo-green: #58CC02;
    --duo-green-dark: #46A302;
    --duo-green-shadow: #3A8201;
    --duo-green-light: #D7FFB8;
    --duo-blue: #1CB0F6;
    --duo-blue-dark: #1899D6;
    --duo-blue-shadow: #1576A8;
    --duo-red: #FF4B4B;
    --duo-red-dark: #EA2B2B;
    --duo-orange: #FF9600;
    --duo-orange-dark: #E08600;
    --duo-purple: #CE82FF;
    --duo-purple-dark: #A855F7;
    --duo-gold: #FFC800;
    --duo-gold-dark: #E6B400;
    --duo-bg: #FFFFFF;
    --duo-bg-grey: #F7F7F7;
    --duo-border: #E5E5E5;
    --duo-border-dark: #CDCDCD;
    --duo-text: #3C3C3C;
    --duo-text-light: #AFAFAF;
    --duo-text-medium: #777777;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-lg: 20px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--duo-bg);
    color: var(--duo-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 2px solid var(--duo-border);
    margin-bottom: 24px;
    gap: 12px;
}

/* Settings button in top-bar */
.settings-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--duo-text-light);
    padding: 4px 6px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.settings-btn:hover {
    color: var(--duo-text);
    background: rgba(0,0,0,0.06);
}

/* Settings overlay */
.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 900;
}

.settings-overlay.open {
    display: block;
}

/* Settings panel */
.settings-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-radius: 0 0 0 0;
}

.settings-panel.open {
    right: 0;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 18px;
    font-weight: 800;
    color: var(--duo-text);
}

.settings-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #aaa;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.settings-close:hover {
    background: #f5f5f5;
    color: var(--duo-text);
}

.settings-section {
    padding: 20px;
}

.settings-label {
    font-size: 12px;
    font-weight: 800;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.settings-lang-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-lang-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 2px solid #eee;
    background: #fafafa;
    font-size: 15px;
    font-weight: 700;
    color: var(--duo-text);
    text-decoration: none;
    font-family: 'Nunito', sans-serif;
    transition: all 0.15s;
    cursor: pointer;
    box-sizing: border-box;
}

.settings-lang-btn:hover {
    border-color: #ccc;
    background: #f0f0f0;
}

.settings-lang-btn.active {
    border-color: var(--duo-green);
    background: rgba(88, 204, 2, 0.08);
    color: #3a8a00;
}

/* Language toggle on index/login page */
.lang-toggle-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.lang-toggle-btn {
    padding: 4px 10px;
    border-radius: 8px;
    border: 2px solid transparent;
    background: none;
    font-size: 12px;
    font-weight: 800;
    color: var(--duo-text-light);
    text-decoration: none;
    font-family: 'Nunito', sans-serif;
    transition: all 0.15s;
    line-height: 1.5;
}

.lang-toggle-btn:hover {
    border-color: #ccc;
    color: var(--duo-text);
}

.lang-toggle-btn.active {
    border-color: var(--duo-green);
    color: var(--duo-green);
    background: rgba(88, 204, 2, 0.1);
}

/* ── Mode selection cards ──────────────────────── */
.mode-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mode-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    border-radius: 18px;
    border: 2.5px solid #e8e8e8;
    background: white;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    text-align: left;
    transition: all 0.18s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.mode-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}

.mode-card-work:hover    { border-color: #1CB0F6; }
.mode-card-rel:hover     { border-color: #FFCB40; }
.mode-card-mixed:hover   { border-color: #9B59B6; }

.mode-card-icon {
    font-size: 32px;
    flex-shrink: 0;
    line-height: 1;
}

.mode-card-content {
    flex: 1;
}

.mode-card-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--duo-text);
    margin-bottom: 2px;
}

.mode-card-desc {
    font-size: 13px;
    color: var(--duo-text-light);
    line-height: 1.4;
}

.mode-card-arrow {
    font-size: 22px;
    color: #ccc;
    font-weight: 900;
    flex-shrink: 0;
}

/* ── Mode badge on dashboard ──────────────────── */
.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.2px;
}

.mode-badge-work {
    background: rgba(28, 176, 246, 0.15);
    color: #0e7ab5;
}

.mode-badge-rel {
    background: rgba(255, 203, 64, 0.2);
    color: #a07000;
}

.mode-badge-mixed {
    background: rgba(155, 89, 182, 0.12);
    color: #7d3bab;
}

.top-bar-logo {
    font-size: 24px;
    font-weight: 900;
    color: var(--duo-green);
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
}

.top-bar-logo svg {
    width: 32px;
    height: 32px;
}

.card {
    background: var(--duo-bg);
    border: 2px solid var(--duo-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--duo-border-dark);
}

h1 {
    font-size: 28px;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 8px;
    color: var(--duo-text);
}

h2 {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 8px;
}

h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
}

p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--duo-text-medium);
}

.btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    text-align: center;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    position: relative;
    user-select: none;
}

.btn-primary {
    background: var(--duo-green);
    color: white;
    border-bottom: 4px solid var(--duo-green-shadow);
}

.btn-primary:hover {
    background: var(--duo-green-dark);
}

.btn-primary:active {
    border-bottom-width: 0;
    margin-top: 4px;
}

.btn-secondary {
    background: var(--duo-blue);
    color: white;
    border-bottom: 4px solid var(--duo-blue-shadow);
}

.btn-secondary:hover {
    background: var(--duo-blue-dark);
}

.btn-secondary:active {
    border-bottom-width: 0;
    margin-top: 4px;
}

.btn-outline {
    background: white;
    color: var(--duo-blue);
    border: 2px solid var(--duo-border);
    border-bottom: 4px solid var(--duo-border-dark);
}

.btn-outline:hover {
    background: var(--duo-bg-grey);
}

.btn-outline:active {
    border-bottom-width: 2px;
    margin-top: 2px;
}

.btn-gold {
    background: var(--duo-gold);
    color: var(--duo-text);
    border-bottom: 4px solid var(--duo-gold-dark);
}

.btn-gold:hover {
    background: var(--duo-gold-dark);
}

.btn-gold:active {
    border-bottom-width: 0;
    margin-top: 4px;
}

.btn-disabled {
    background: var(--duo-border);
    color: var(--duo-text-light);
    border-bottom: 4px solid var(--duo-border-dark);
    cursor: not-allowed;
}

.input-field {
    width: 100%;
    padding: 14px 18px;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid var(--duo-border);
    border-radius: var(--radius-sm);
    background: var(--duo-bg-grey);
    color: var(--duo-text);
    outline: none;
    transition: var(--transition);
}

.input-field:focus {
    border-color: var(--duo-blue);
    background: white;
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.15);
}

.input-field::placeholder {
    color: var(--duo-text-light);
}

.progress-bar-container {
    width: 100%;
    height: 16px;
    background: var(--duo-border);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 6px;
    margin-bottom: 14px;
}

.progress-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 6%;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    right: 6px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.3);
}

.progress-bar.orange { background: var(--duo-orange); }
.progress-bar.blue { background: var(--duo-blue); }
.progress-bar.green { background: var(--duo-green); }
.progress-bar.purple { background: var(--duo-purple); }

.skill-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
}

.skill-label .xp {
    color: var(--duo-text-light);
    font-weight: 700;
    font-size: 13px;
}

.emoji-icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 800;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-orange { background: #FFF3E0; color: var(--duo-orange); }
.tag-blue { background: #E3F2FD; color: var(--duo-blue-dark); }
.tag-green { background: var(--duo-green-light); color: var(--duo-green-dark); }
.tag-purple { background: #F3E5F5; color: var(--duo-purple-dark); }

.radio-choice {
    display: block;
    background: white;
    border: 2px solid var(--duo-border);
    border-bottom: 4px solid var(--duo-border-dark);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}

.radio-choice:hover {
    border-color: var(--duo-blue);
    background: rgba(28, 176, 246, 0.05);
}

.radio-choice:has(input:checked) {
    border-color: var(--duo-blue);
    background: rgba(28, 176, 246, 0.08);
    border-bottom-color: var(--duo-blue);
}

.radio-choice input[type="radio"] {
    margin-right: 10px;
    accent-color: var(--duo-blue);
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.back-link {
    display: inline-block;
    color: var(--duo-text-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 0;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.back-link:hover {
    color: var(--duo-blue);
}

.hero-card {
    background: var(--duo-green);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    color: white;
    margin-bottom: 16px;
    border-bottom: 4px solid var(--duo-green-shadow);
}

.hero-card h1,
.hero-card h2 {
    color: white;
}

.hero-card p {
    color: rgba(255, 255, 255, 0.85);
}

.quest-card {
    background: white;
    border: 2px solid var(--duo-gold);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.quest-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--duo-gold);
}

.result-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 800;
}

.result-badge.success {
    background: var(--duo-green-light);
    color: var(--duo-green-dark);
}

.result-badge.fail {
    background: #FFE5E5;
    color: var(--duo-red);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.4s ease forwards;
}

.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.08s; }
.animate-in:nth-child(3) { animation-delay: 0.16s; }
.animate-in:nth-child(4) { animation-delay: 0.24s; }
.animate-in:nth-child(5) { animation-delay: 0.32s; }
.animate-in:nth-child(6) { animation-delay: 0.40s; }

.spacer-sm { height: 8px; }
.spacer-md { height: 16px; }
.spacer-lg { height: 24px; }

.game-level-card {
    background: white;
    border: 2px solid var(--duo-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    transition: var(--transition);
    border-bottom: 4px solid var(--duo-border-dark);
}

.game-level-card:hover {
    border-color: var(--duo-border-dark);
}

.game-level-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.level-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    border-bottom: 3px solid;
}

.level-icon.blue {
    background: var(--duo-blue);
    border-color: var(--duo-blue-shadow);
}

.level-icon.green {
    background: var(--duo-green);
    border-color: var(--duo-green-shadow);
}

.level-icon.orange {
    background: var(--duo-orange);
    border-color: var(--duo-orange-dark);
}

.level-icon.red {
    background: var(--duo-red);
    border-color: var(--duo-red-dark);
}

.level-icon.purple {
    background: #9B59B6;
    border-color: #7D3C98;
}

.level-info h3 {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 2px;
}

.level-info p {
    font-size: 13px;
    margin: 0;
}

.level-reward {
    display: inline-block;
    background: var(--duo-green-light);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 800;
    color: var(--duo-green-dark);
}

.play-btn {
    display: inline-block;
    background: var(--duo-green);
    border: none;
    border-radius: var(--radius-sm);
    border-bottom: 3px solid var(--duo-green-shadow);
    padding: 8px 22px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: white;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.play-btn:active {
    border-bottom-width: 0;
    margin-top: 3px;
}

.play-btn.blue-btn {
    background: var(--duo-blue);
    border-bottom-color: var(--duo-blue-shadow);
}

.play-btn.orange-btn {
    background: var(--duo-orange);
    border-bottom-color: var(--duo-orange-dark);
}

.play-btn.purple-btn {
    background: #9B59B6;
    border-bottom-color: #7D3C98;
}

.section-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--duo-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.duo-mascot {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.15); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.game-canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.game-ui {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    box-sizing: border-box;
}

.game-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

.game-progress-bar {
    flex: 1;
    height: 14px;
    background: rgba(255,255,255,0.2);
    border-radius: 7px;
    overflow: hidden;
}

.game-progress-fill {
    height: 100%;
    background: var(--duo-green);
    border-radius: 7px;
    transition: width 0.5s ease;
    position: relative;
}

.game-progress-fill::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 4px;
    right: 4px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.3);
}

.game-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.game-close-btn:hover {
    background: rgba(255,255,255,0.1);
}

.dialogue-bubble {
    background: white;
    border-radius: var(--radius-lg);
    padding: 22px 22px 28px 22px;
    position: relative;
    z-index: 20;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 16px;
    min-height: 100px;
}

.name-tag {
    position: absolute;
    top: -14px;
    left: 22px;
    background: var(--duo-green);
    color: white;
    padding: 4px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 800;
    z-index: 25;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.name-tag.blue { background: var(--duo-blue); }
.name-tag.green { background: var(--duo-green); }
.name-tag.orange { background: var(--duo-orange); }

.dialogue-text {
    font-size: 17px;
    color: var(--duo-text);
    line-height: 1.55;
    margin: 0;
    font-weight: 700;
}

.choices-container {
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
    animation-delay: 3s;
}

.choices-container.instant {
    animation-delay: 0s;
}

.btn-choice {
    background: white;
    border: 2px solid var(--duo-border);
    border-bottom: 4px solid var(--duo-border-dark);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 15px;
    color: var(--duo-text);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.btn-choice:hover {
    border-color: var(--duo-blue);
    background: rgba(28, 176, 246, 0.05);
}

.btn-choice:active {
    border-bottom-width: 2px;
    margin-top: 2px;
    background: rgba(28, 176, 246, 0.1);
}

.btn-choice.correct {
    border-color: var(--duo-green);
    background: var(--duo-green-light);
    border-bottom-color: var(--duo-green-dark);
}

.btn-choice.incorrect {
    border-color: var(--duo-red);
    background: #FFE5E5;
    border-bottom-color: var(--duo-red-dark);
}

.scene-description {
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 14px;
    color: white;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
    z-index: 20;
    border: 1px solid rgba(255,255,255,0.1);
}

.scene-description strong {
    color: var(--duo-gold);
}

.result-body {
    font-family: 'Nunito', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--duo-bg);
}

.result-ui {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.result-panel {
    background: white;
    border-radius: var(--radius-lg);
    border: 2px solid var(--duo-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 36px 28px;
    text-align: center;
    width: 100%;
    position: relative;
}

.result-emoji {
    font-size: 56px;
    margin-bottom: 8px;
    display: block;
}

.result-title {
    font-size: 26px;
    font-weight: 900;
    color: var(--duo-text);
    margin-bottom: 4px;
}

.result-title.success { color: var(--duo-green); }
.result-title.fail { color: var(--duo-text-light); }

.result-subtitle {
    font-size: 14px;
    font-weight: 700;
    color: var(--duo-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.stars-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 16px 0;
}

.star-icon {
    font-size: 48px;
    opacity: 0;
    transform: scale(0);
}

.star-icon.earned {
    animation: starBounce 0.5s ease forwards;
}

.star-icon:nth-child(1) { animation-delay: 0.2s; }
.star-icon:nth-child(2) { animation-delay: 0.45s; }
.star-icon:nth-child(3) { animation-delay: 0.7s; }

.star-icon.dim {
    opacity: 0.15;
    transform: scale(1);
    filter: grayscale(100%);
}

@keyframes starBounce {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; }
    60% { transform: scale(1.3) rotate(5deg); opacity: 1; }
    80% { transform: scale(0.9); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.feedback-text {
    font-size: 15px;
    color: var(--duo-text-medium);
    line-height: 1.6;
    margin: 16px 0;
    font-weight: 600;
}

.xp-badge {
    display: inline-block;
    background: var(--duo-green);
    color: white;
    padding: 8px 24px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 800;
    border-bottom: 3px solid var(--duo-green-shadow);
    margin: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.xp-badge.fail-badge {
    background: var(--duo-border);
    color: var(--duo-text-light);
    border-bottom-color: var(--duo-border-dark);
}

.result-divider {
    height: 2px;
    background: var(--duo-border);
    margin: 20px 0;
    border-radius: 1px;
}

@keyframes confettiFloat {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-120vh) rotate(720deg); opacity: 0; }
}

.confetti {
    position: fixed;
    bottom: -10px;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confettiFloat 3s ease-out forwards;
    z-index: 1000;
}

.btn-result {
    background: var(--duo-green);
    border: none;
    border-bottom: 4px solid var(--duo-green-shadow);
    border-radius: var(--radius);
    padding: 14px 28px;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: white;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    width: 100%;
    display: block;
}

.btn-result:active {
    border-bottom-width: 0;
    margin-top: 4px;
}

.btn-result.blue { background: var(--duo-blue); border-bottom-color: var(--duo-blue-shadow); }

@keyframes breathe {
    0% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.02) translateY(-3px); }
    100% { transform: scale(1) translateY(0); }
}

.character-img {
    position: absolute;
    bottom: 35%;
    left: -20px;
    width: 200px;
    height: auto;
    z-index: 10;
    animation: breathe 3s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FFF5E5;
    border: 2px solid var(--duo-orange);
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 800;
    color: var(--duo-orange);
}

.section-divider {
    height: 2px;
    background: var(--duo-border);
    margin: 24px 0;
}

/* ===== JUNE'S JOURNEY STYLE GAME UI ===== */

.jj-body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    background: #0a0a1a;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Skip button top-right */
.jj-skip {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    background: rgba(40, 40, 60, 0.65);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255,255,255,0.18);
    border-radius: 20px;
    color: rgba(255,255,255,0.85);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 800;
    padding: 8px 16px;
    cursor: pointer;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    transition: all 0.2s;
}

.jj-skip:hover {
    background: rgba(60, 60, 80, 0.85);
}

.jj-skip-icon {
    font-size: 16px;
    opacity: 0.9;
}

/* Game UI overlay */
.jj-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    max-width: 520px;
    margin: 0 auto;
    padding: 0 16px 20px;
    box-sizing: border-box;
    pointer-events: none;
}

/* For single-char games: UI anchored to right half, character visible on left */
.jj-ui-right {
    left: 33%;
    right: 0;
    margin: 0;
    max-width: none;
    padding: 0 20px 20px;
}

.jj-ui > * {
    pointer-events: auto;
}

/* Dialogue bubble - cream/warm white, JJ style */
.jj-bubble {
    background: #FDF4E3;
    border-radius: 20px;
    padding: 22px 22px 46px 22px;
    position: relative;
    box-shadow:
        0 -2px 0 #D4B88A,
        0 4px 24px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.8);
    border: 2px solid #E8CFA0;
    min-height: 110px;
    margin-bottom: 0;
    cursor: pointer;
    transition: all 0.15s;
    animation: bubbleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.jj-bubble:active {
    transform: scale(0.99);
}

@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Name tag - teal rounded pill */
.jj-name {
    position: absolute;
    top: -18px;
    left: 18px;
    background: linear-gradient(135deg, #2BAE8E, #1F8A70);
    color: white;
    padding: 7px 22px;
    border-radius: 30px;
    font-size: 17px;
    font-weight: 900;
    border: 2.5px solid rgba(255,255,255,0.3);
    box-shadow: 0 3px 10px rgba(31,138,112,0.4), 0 1px 0 rgba(255,255,255,0.15) inset;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.jj-name.blue {
    background: linear-gradient(135deg, #1CB0F6, #0E8DC8);
    box-shadow: 0 3px 10px rgba(28,176,246,0.4), 0 1px 0 rgba(255,255,255,0.15) inset;
}

.jj-name.orange {
    background: linear-gradient(135deg, #FF9600, #E07800);
    box-shadow: 0 3px 10px rgba(255,150,0,0.4), 0 1px 0 rgba(255,255,255,0.15) inset;
}

/* Dialogue text */
.jj-text {
    font-size: 17px;
    color: #2C1A0E;
    line-height: 1.6;
    margin: 0;
    font-weight: 700;
    min-height: 52px;
}

/* Tap to continue heart indicator */
.jj-tap-hint {
    position: absolute;
    bottom: 14px;
    right: 18px;
    color: #C8A060;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}

.jj-tap-hint.visible {
    opacity: 1;
    animation: tapPulse 1.4s infinite ease-in-out;
}

@keyframes tapPulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
}

.jj-tap-arrow {
    font-size: 12px;
    animation: arrowBounce 1s infinite;
}

@keyframes arrowBounce {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(3px); }
}

/* Scene description (narrator box) */
.jj-narration {
    background: rgba(20, 15, 40, 0.72);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 12px;
    color: #F5E5C8;
    font-size: 14px;
    font-weight: 700;
    font-style: italic;
    line-height: 1.6;
    border: 1px solid rgba(255,220,150,0.15);
    text-align: center;
    animation: fadeIn 0.4s ease forwards;
}

/* Choices container */
.jj-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.jj-choices.visible {
    opacity: 1;
}

/* Individual choice button - JJ style */
.jj-choice-btn {
    background: linear-gradient(180deg, #FFFFFF 0%, #F5EDD8 100%);
    border: 2px solid #D4B880;
    border-bottom: 4px solid #B8976A;
    border-radius: 16px;
    padding: 14px 20px;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #2C1A0E;
    text-align: left;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.15s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInUp 0.3s ease forwards;
}

.jj-choice-btn:nth-child(1) { animation-delay: 0.05s; }
.jj-choice-btn:nth-child(2) { animation-delay: 0.12s; }
.jj-choice-btn:nth-child(3) { animation-delay: 0.19s; }

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.jj-choice-btn:hover {
    border-color: #2BAE8E;
    background: linear-gradient(180deg, #FFFFFF 0%, #E8F8F3 100%);
    transform: translateY(-1px);
}

.jj-choice-btn:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.jj-choice-btn.correct {
    background: linear-gradient(180deg, #D7FFB8 0%, #B8F0A0 100%);
    border-color: #58CC02;
    border-bottom-color: #3A8201;
}

.jj-choice-btn.incorrect {
    background: linear-gradient(180deg, #FFE0E0 0%, #FFC8C8 100%);
    border-color: #FF4B4B;
    border-bottom-color: #CC0000;
}

.jj-choice-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2BAE8E;
    color: white;
    font-size: 13px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Question prompt above choices */
.jj-prompt {
    background: rgba(20, 15, 40, 0.78);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,220,150,0.25);
    border-radius: 14px;
    padding: 12px 18px;
    color: #FFE8A0;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 10px;
    line-height: 1.4;
    animation: fadeIn 0.4s ease forwards;
}

/* VN progress dots */
.jj-progress {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-bottom: 10px;
}

.jj-progress-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: all 0.3s;
}

.jj-progress-dot.active {
    background: #FFD700;
    box-shadow: 0 0 6px rgba(255,215,0,0.6);
    transform: scale(1.4);
    width: 14px;
    border-radius: 3px;
}

.jj-progress-dot.done {
    background: #58CC02;
}

/* Auto badge */
.jj-auto-badge {
    position: fixed;
    top: 52px;
    right: 16px;
    z-index: 100;
    background: rgba(20,20,40,0.6);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: rgba(255,255,255,0.7);
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.jj-auto-badge .dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #58CC02;
    margin-right: 5px;
    animation: pulse 1.5s infinite;
    vertical-align: middle;
}

/* Chapter overlay */
.jj-chapter-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    transition: opacity 0.8s ease;
}

.jj-chapter-overlay h1 {
    color: white;
    font-size: 26px;
    font-weight: 900;
    text-shadow: 0 4px 20px rgba(0,0,0,0.6);
    margin-bottom: 10px;
    opacity: 0;
    animation: fadeIn 0.8s 0.3s forwards;
}

.jj-chapter-line {
    width: 60px;
    height: 3px;
    background: #2BAE8E;
    border-radius: 2px;
    margin: 0 auto 10px;
    opacity: 0;
    animation: fadeIn 0.8s 0.6s forwards;
}

.jj-chapter-overlay p {
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    opacity: 0;
    animation: fadeIn 0.8s 0.8s forwards;
}

/* Result screen - JJ style */
.jj-result-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.jj-result-panel {
    background: #FDF4E3;
    border: 2px solid #E8CFA0;
    border-radius: 28px;
    box-shadow:
        0 -3px 0 #D4B88A inset,
        0 10px 40px rgba(0,0,0,0.35);
    padding: 36px 28px;
    text-align: center;
    width: 100%;
    max-width: 420px;
    animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.jj-result-title {
    font-size: 28px;
    font-weight: 900;
    color: #2C1A0E;
    margin-bottom: 4px;
}

.jj-result-title.success { color: #1F8A70; }
.jj-result-title.fail { color: #8B6B4A; }

.jj-result-sub {
    font-size: 13px;
    font-weight: 700;
    color: #A08060;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.jj-stars {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 16px 0;
}

.jj-result-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #D4B880, transparent);
    margin: 16px 0;
}

.jj-result-text {
    font-size: 15px;
    color: #5A3E28;
    line-height: 1.6;
    margin-bottom: 16px;
    font-weight: 600;
}

.jj-xp-badge {
    display: inline-block;
    background: linear-gradient(135deg, #2BAE8E, #1F8A70);
    color: white;
    padding: 10px 26px;
    border-radius: 30px;
    font-size: 17px;
    font-weight: 900;
    border-bottom: 3px solid #155A48;
    box-shadow: 0 4px 15px rgba(31,138,112,0.35);
    margin-bottom: 16px;
    letter-spacing: 0.3px;
}

.jj-xp-badge.fail {
    background: linear-gradient(135deg, #C8A87A, #A88A60);
    border-bottom-color: #7A6040;
    box-shadow: 0 4px 15px rgba(168,138,96,0.3);
}

.jj-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #2BAE8E, #1F8A70);
    color: white;
    border: none;
    border-bottom: 4px solid #155A48;
    border-radius: 16px;
    padding: 15px 24px;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: all 0.15s;
    box-shadow: 0 4px 15px rgba(31,138,112,0.25);
}

.jj-btn:active {
    border-bottom-width: 0;
    margin-top: 4px;
}

/* ── MODULE CARDS ─────────────────────────────────── */
.module-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1.5px solid #eee;
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: all 0.2s;
    cursor: pointer;
}
.module-unlocked:hover {
    border-color: #ccc;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.module-locked {
    opacity: 0.65;
    cursor: default;
    background: #fafafa;
}
.module-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.module-info {
    flex: 1;
    min-width: 0;
}
.module-title {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    margin-bottom: 3px;
}
.module-desc {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.module-level-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 5px;
}
.module-arrow {
    font-size: 22px;
    color: #ccc;
    font-weight: 300;
}
.module-lock {
    font-size: 18px;
}
