/* --- 1. GLOBAL STYLES --- */
body { background-color: #121212; color: #e0e0e0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 20px; line-height: 1.6; }
.container { max-width: 1100px; margin: 0 auto; padding-bottom: 100px; }

/* HEADER */
header { border-bottom: 2px solid #27ae60; padding-bottom: 20px; margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; }
h1 { margin: 0; font-size: 1.8rem; color: #fff; }
.back-link { text-decoration: none; color: #888; border: 1px solid #444; padding: 5px 10px; border-radius: 4px; }
.back-link:hover { color: #fff; border-color: #fff; }

/* NAVIGATION */
.nav-container { display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
button.nav-btn { background: #1e1e1e; border: 1px solid #333; color: #aaa; padding: 10px 16px; cursor: pointer; border-radius: 4px; transition: 0.3s; font-weight: bold; font-size: 0.95rem; }
button.nav-btn.active, button.nav-btn:hover { background: #27ae60; color: white; border-color: #27ae60; }

/* SECTIONS */
.section-box { display: none; background: #1e1e1e; border: 1px solid #333; border-top: 4px solid #27ae60; border-radius: 8px; padding: 30px; margin-bottom: 40px; animation: fadeIn 0.4s ease; }
.section-box.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* HELPERS */
h2 { color: #2ecc71; margin-top: 0; border-bottom: 1px solid #444; padding-bottom: 10px; }
h3 { color: #f39c12; margin-top: 40px; border-left: 3px solid #f39c12; padding-left: 10px; }
h4 { color: #27ae60; border-bottom: 1px solid #444; padding-bottom: 5px; margin-top: 30px; }
.rule-box { background: #202c38; border: 1px solid #34495e; padding: 15px; margin-top: 15px; border-radius: 5px; }

/* TABLES */
table.vocab-table { width: 100%; border-collapse: collapse; margin-top: 15px; background: #252525; border-radius: 6px; overflow: hidden; margin-bottom: 30px;}
table.vocab-table th, table.vocab-table td { text-align: left; padding: 12px 15px; border-bottom: 1px solid #333; }
table.vocab-table th { background: #1a1a1a; color: #2ecc71; text-transform: uppercase; font-size: 0.9rem; }
table.vocab-table tr:hover { background: #2c2c2c; }
.ipa { font-family: 'Lucida Sans Unicode', 'Arial Unicode MS', sans-serif; color: #aaa; font-size: 0.9rem; }
.tts-btn { background: none; border: 1px solid #555; color: #2ecc71; cursor: pointer; border-radius: 50%; width: 25px; height: 25px; display: inline-flex; align-items: center; justify-content: center; margin-left: 10px; font-size: 0.8rem;}
.tts-btn:hover { background: #2ecc71; color: #000; }

/* QUIZ COMPONENTS */
.mini-quiz-item { margin-bottom: 10px; padding: 15px; background: #222; border-radius: 4px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; border: 1px solid #333;}
.quiz-input { background: #333; border: 1px solid #555; color: #fff; padding: 8px 10px; border-radius: 4px; width: 280px; font-size: 1rem;}
.check-btn { background: #f39c12; color: black; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; margin-left: auto; }
.feedback-icon { font-weight: bold; font-size: 1.2rem; margin-left: 10px; }

/* EXERCISE BLOCKS */
.exercise-block { background: #252525; padding: 25px; border-radius: 8px; margin-bottom: 30px; border: 1px solid #444; }
.ex-item { margin-bottom: 20px; border-bottom: 1px solid #333; padding-bottom: 15px; }
.ex-q { font-size: 1.05rem; margin-bottom: 10px; display: block; font-weight: bold; }
.ex-options { display: flex; gap: 10px; flex-wrap: wrap; }
.ex-btn { 
    background: #333; border: 1px solid #555; color: #ccc; padding: 10px 20px; 
    border-radius: 4px; cursor: pointer; transition: 0.2s; font-size: 0.95rem;
}
.ex-btn:hover { background: #444; }
.ex-btn.correct { background: #27ae60; color: white; border-color: #2ecc71; }
.ex-btn.wrong { background: #c0392b; color: white; border-color: #e74c3c; opacity: 0.6; }

/* LISTENING/READING */
.audio-player { background: #1a1a1a; padding: 20px; border-radius: 8px; margin-bottom: 20px; display: flex; align-items: center; gap: 15px; border: 1px solid #444; justify-content: space-between;}
.big-play-btn { background: #2ecc71; color: #000; border: none; padding: 10px 20px; border-radius: 5px; font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 10px;}
.big-play-btn:hover { background: #27ae60; }
.transcript-box { margin-top: 15px; background: #222; padding: 15px; border-radius: 4px; font-size: 0.95rem; line-height: 1.6; color: #ccc; }
.reading-text { background: #eee; color: #333; padding: 20px; border-radius: 4px; margin-bottom: 20px; font-family: 'Georgia', serif; line-height: 1.7; border-left: 5px solid #2ecc71;}

/* WRITING TASK */
.writing-task { background: #2c3e50; padding: 20px; border-radius: 8px; border-left: 5px solid #f39c12; margin-top: 30px; }
.writing-example { background: rgba(0,0,0,0.3); padding: 15px; margin-top: 10px; border-radius: 4px; font-style: italic; color: #aaa; }

/* --- LIGHT NOVEL STYLES --- */
.novel-stage { background: #222; border: 2px solid #444; border-radius: 10px; overflow: hidden; max-width: 900px; margin: 0 auto; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.novel-header { background: #111; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; }
.novel-location { color: #f39c12; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }

.novel-bg-container {
    width: 100%; height: 200px; background-size: cover; background-position: center; border-bottom: 4px solid #000;
    display: flex; align-items: flex-end; padding: 20px; position: relative;
}
.novel-bg-overlay {
    background: rgba(0,0,0,0.7); color: white; padding: 5px 15px; border-radius: 4px; font-weight: bold; font-size: 1.2rem;
}

.novel-scene { padding: 20px; min-height: 400px; display: grid; grid-template-columns: 120px 1fr 120px; gap: 20px; align-items: flex-start; background: linear-gradient(180deg, #2c3e50 0%, #000 100%); }
.novel-avatar { width: 120px; height: 120px; border-radius: 50%; border: 4px solid #555; object-fit: cover; background: #333; transition: 0.3s; opacity: 0.5; filter: grayscale(80%); }
.novel-avatar.active { border-color: #2ecc71; opacity: 1; filter: grayscale(0%); transform: scale(1.1); box-shadow: 0 0 20px rgba(46, 204, 113, 0.3); }
.novel-name-tag { text-align: center; font-size: 0.8rem; font-weight: bold; margin-top: 5px; color: #888; }
.active + .novel-name-tag { color: #2ecc71; }
.novel-dialogue-box { background: rgba(0, 0, 0, 0.8); border: 2px solid #fff; border-radius: 8px; padding: 20px; min-height: 200px; display: flex; flex-direction: column; justify-content: space-between; margin-top: 20px; }
.novel-speaker-name { color: #f1c40f; font-weight: bold; margin-bottom: 10px; font-size: 1.1rem; }
.novel-text { font-size: 1.1rem; line-height: 1.5; color: #fff; margin-bottom: 20px; }
.novel-choices { display: flex; flex-direction: column; gap: 8px; }
.novel-btn { background: #34495e; color: white; border: 1px solid #7f8c8d; padding: 12px; text-align: left; border-radius: 4px; cursor: pointer; transition: 0.2s; font-size: 0.95rem; }
.novel-btn:hover { background: #2ecc71; border-color: #2ecc71; color: black; font-weight: bold; }
.novel-btn.wrong { background: #c0392b; border-color: #e74c3c; color: white; opacity: 0.5; cursor: not-allowed; }
.chapter-splash { text-align: center; padding: 60px 20px; }
.chapter-title { font-size: 2.5rem; color: #f39c12; margin-bottom: 20px; text-transform: uppercase; }
.start-chap-btn { background: #27ae60; color: white; padding: 15px 40px; font-size: 1.2rem; border: none; border-radius: 50px; cursor: pointer; font-weight: bold; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }

/* --- MINI GAMES STYLES --- */
.game-wrapper { display: none; margin-top: 20px; }

/* App Game */
.phone-frame { background: #000; border: 4px solid #333; border-radius: 20px; max-width: 400px; margin: 0 auto; overflow: hidden; height: 400px; display: flex; flex-direction: column; }
.chat-screen { background: #e5e5e5; flex-grow: 1; padding: 15px; overflow-y: auto; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 8px; clear: both; }
.msg.emma { background: #fff; float: left; color: #333; }
.msg.jake { background: #2ecc71; float: right; color: white; }
.keyboard-area { background: #333; padding: 10px; text-align: center; }
.word-key { display: inline-block; background: #fff; color: #333; padding: 5px 10px; margin: 2px; border-radius: 4px; cursor: pointer; font-size: 0.9rem; }

/* Airport Choices Game */
.airport-scene { background: #34495e; padding: 20px; border-radius: 10px; text-align: center; border: 4px solid #2c3e50; }
.airport-npc { font-size: 4rem; display: block; margin-bottom: 10px; }
.npc-bubble { background: white; color: black; padding: 15px; border-radius: 15px; display: inline-block; margin-bottom: 20px; font-weight: bold; position: relative; }
.npc-bubble::after { content: ''; position: absolute; bottom: -10px; left: 50%; border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 10px solid white; transform: translateX(-50%); }
.response-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.response-btn { padding: 15px; background: #222; border: 1px solid #555; color: white; cursor: pointer; border-radius: 5px; font-size: 1rem; text-align: left; }
.response-btn:hover { background: #444; }

/* Problem Game */
.problem-container { background: #c0392b; padding: 20px; border-radius: 10px; text-align: center; max-width: 500px; margin: 0 auto; border: 2px solid #e74c3c; }
.prob-title { color: #fff; font-size: 1.5rem; margin-bottom: 10px; text-transform: uppercase; }
.prob-desc { background: white; color: #333; padding: 15px; margin-bottom: 20px; border-radius: 5px; font-weight: bold; }
.prob-btn { width: 100%; padding: 12px; margin-bottom: 10px; background: #2c3e50; color: white; border: none; cursor: pointer; border-radius: 4px; font-size: 1rem; transition: 0.2s; }
.prob-btn:hover { background: #34495e; }

/* --- THE PLANNING DESK & CHECKLIST UI --- */

/* Checklist Panel */
.checklist-panel {
    background: #252525;
    border: 1px solid #444;
    border-top: 4px solid #f39c12;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    position: sticky;
    top: 10px;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.checklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}
.check-item {
    font-size: 0.95rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}
.check-box {
    width: 18px;
    height: 18px;
    border: 2px solid #555;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    transition: 0.3s;
}
.check-item.done { color: #2ecc71; font-weight: bold; }
.check-item.done .check-box {
    border-color: #2ecc71;
    background: #2ecc71;
}
.check-item.done .check-box::after {
    content: '✔';
    position: absolute;
    color: #111;
    font-size: 14px;
    top: -2px;
    left: 2px;
    font-weight: bold;
}

/* Dialogue Reading Element */
.dialogue-line {
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tooltips for Translation */
.bg-hint {
    border-bottom: 1px dotted #ccc;
    cursor: help;
    color: #f1c40f;
    position: relative;
}
.bg-hint:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    border: 1px solid #555;
    z-index: 10;
}

/* Custom Select Dropdown for UI consistency */
.quiz-select {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}
.quiz-select:focus { border-color: #f39c12; }

/* Inlines & Scrambles */
.inline-input { width: 130px; text-align: center; margin: 0 5px; }
.scramble-row { flex-direction: column; align-items: flex-start; }

/* Approved Stamp Animation */
.stamp-approved {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(3) rotate(-15deg);
    color: #e74c3c;
    border: 5px solid #e74c3c;
    padding: 10px 20px;
    font-size: 3rem;
    font-weight: bold;
    letter-spacing: 5px;
    text-transform: uppercase;
    border-radius: 10px;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(30, 30, 30, 0.8);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.4);
}
.stamp-approved.active {
    transform: translate(-50%, -50%) scale(1) rotate(-15deg);
    opacity: 1;
}

/* --- VIRTUAL FOLDER & DOSSIER STYLES --- */
.virtual-folder {
    background: #1e272e;
    border: 2px solid #485460;
    border-radius: 10px;
    padding: 20px;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.tracker-sidebar {
    background: #2d3436;
    border: 1px solid #636e72;
    border-top: 4px solid #f1c40f;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
    position: sticky;
    top: 10px;
    z-index: 100;
}
.stamp-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.stamp-slot {
    background: #111;
    color: #555;
    padding: 8px 12px;
    border-radius: 4px;
    border: 2px dashed #555;
    font-size: 0.9rem;
    font-weight: bold;
    transition: 0.3s;
}
.stamp-slot.stamped {
    color: #2ecc71;
    border: 2px solid #2ecc71;
    background: rgba(46, 204, 113, 0.1);
    position: relative;
}
.stamp-slot.stamped::after {
    content: '✔ DONE';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%) rotate(-10deg);
    color: #2ecc71;
    font-size: 0.7rem;
    border: 1px solid #2ecc71;
    padding: 2px;
    border-radius: 2px;
}

.narrative-stage {
    background: #222f3e;
    border: 2px solid #576574;
    border-left: 5px solid #3498db;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    transition: 0.3s ease;
}
.narrative-stage.completed {
    border-color: #2ecc71;
    border-left: 5px solid #2ecc71;
}
.stage-header {
    background: #3498db;
    color: #fff;
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    margin-bottom: 15px;
}
.completed .stage-header { background: #2ecc71; }

.dialogue-box {
    background: #1a252f;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 3px solid #f1c40f;
}
.vocab-bank {
    background: #333;
    padding: 10px;
    border-radius: 4px;
    color: #f1c40f;
    font-family: monospace;
    text-align: center;
    border: 1px dashed #777;
}
/* --- TAB 4: PROBLEMS & COMPLAINTS STYLES --- */

/* The Panic Meter */
.panic-meter-bg {
    background: #333;
    height: 25px;
    width: 100%;
    border-radius: 12px;
    border: 2px solid #fff;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}
.panic-meter-fill {
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    height: 100%;
    transition: width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.8s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Heat Map Borders */
.problem-stage-1 { border-color: #f1c40f; border-left: 6px solid #f1c40f; }
.problem-stage-2 { border-color: #f39c12; border-left: 6px solid #f39c12; }
.problem-stage-3 { border-color: #e67e22; border-left: 6px solid #e67e22; }
.problem-stage-4 { border-color: #e74c3c; border-left: 6px solid #e74c3c; }
.problem-stage-5 { border-color: #c0392b; border-left: 6px solid #c0392b; }

/* Formal Complaint Cloze Form */
.cloze-container {
    background-color: #f9f9f9;
    color: #2c3e50;
    padding: 20px 30px;
    border-radius: 8px;
    font-family: 'Georgia', serif;
    font-size: 1.1rem;
    line-height: 2.2;
    background-image: repeating-linear-gradient(transparent, transparent 31px, #bdc3c7 31px, #bdc3c7 32px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}
.cloze-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid #2980b9;
    color: #c0392b;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 1.1rem;
    text-align: center;
    width: 120px;
    outline: none;
    margin: 0 5px;
    transition: 0.3s;
}
.cloze-input:focus {
    border-bottom-color: #e74c3c;
    background: rgba(41, 128, 185, 0.1);
}
.cloze-container p { margin: 0; }
/* --- TAB 5: HOME & REVIEWS (DIGITAL SCRAPBOOK) --- */

.scrapbook-completion .stamp-slot {
    background: #111;
    color: #555;
    border: 2px dashed #9b59b6;
    transition: 0.4s ease;
}
.scrapbook-completion .stamp-slot.stamped {
    color: #f1c40f;
    border: 2px solid #f1c40f;
    background: rgba(241, 196, 15, 0.1);
    position: relative;
    font-weight: bold;
    transform: scale(1.05);
}
.scrapbook-completion .stamp-slot.stamped::after {
    content: '⭐';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.review-card {
    background: #2c3e50;
    border: 1px solid #34495e;
    border-top: 5px solid #2ecc71;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a252f;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 1.2rem;
}
.star-rating {
    letter-spacing: 2px;
    color: #f1c40f;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
}

/* Certificate Overlay Pop-up */
.certificate-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.5s;
}
.certificate-box {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    border: 8px solid #fff;
    border-radius: 10px;
    padding: 50px;
    text-align: center;
    color: #111;
    max-width: 500px;
    box-shadow: 0 0 50px rgba(241, 196, 15, 0.5);
    animation: dropIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.certificate-box h1 { margin-top: 0; color: #111; font-size: 2.5rem; text-transform: uppercase; }
.certificate-box p { font-size: 1.2rem; font-weight: bold; }
.certificate-bonus {
    background: #111;
    color: #2ecc71;
    font-size: 2rem;
    padding: 15px 30px;
    border-radius: 50px;
    margin: 20px 0;
    display: inline-block;
    border: 2px solid #2ecc71;
}

@keyframes dropIn { 0% { transform: translateY(-100vh) rotate(-10deg); } 100% { transform: translateY(0) rotate(0); } }
/* --- SECTION IMAGES --- */
.section-image {
    width: 100%;
    height: 550px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 25px;
    display: block;
    border: 2px solid #333;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* --- STAR RATING WIDGET --- */
.star-rating-widget {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 15px 0;
    padding: 15px;
    background: #1a252f;
    border-radius: 8px;
    border: 1px solid #34495e;
}
.star-rating-widget label {
    color: #aaa;
    font-size: 0.95rem;
    margin-bottom: 4px;
}
.star-rating-stars {
    display: flex;
    gap: 6px;
}
.star-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 2rem;
    color: #444;
    transition: color 0.15s, transform 0.15s;
    line-height: 1;
    padding: 0 2px;
}
.star-btn.hovered,
.star-btn.selected {
    color: #f1c40f;
    transform: scale(1.15);
    text-shadow: 0 0 8px rgba(241,196,15,0.6);
}
.star-rating-display {
    font-size: 1rem;
    font-weight: bold;
    color: #888;
    min-height: 1.2em;
    transition: color 0.3s;
}

/* --- STICKY NOTES --- */
.sticky-note {
    background: var(--sn-bg);
    border-left: 5px solid var(--sn-border);
    border-radius: 4px 8px 8px 4px;
    padding: 14px 16px 12px 16px;
    margin: 16px 0 20px 0;
    position: relative;
    box-shadow: 3px 3px 10px rgba(0,0,0,0.25);
    font-size: 0.92rem;
    line-height: 1.65;
    color: #1a1a1a;
    /* subtle tape effect at top */
}
.sticky-note::before {
    content: '';
    display: block;
    width: 48px;
    height: 10px;
    background: rgba(255,255,255,0.55);
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.sn-title {
    font-weight: 800;
    font-size: 0.97rem;
    color: var(--sn-title);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.sn-body {
    color: #222;
}
.sn-body b {
    color: var(--sn-title);
}