body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: linear-gradient(135deg, #061f3a, #0b3b5f 55%, #102a43);
    color: #10233d;
}

img {
    max-width: 100%;
    display: block;
}

.app-logo {
    width: 94px;
    height: 94px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 26px;
    background: linear-gradient(135deg, #e0f2fe, #dbeafe);
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.16);
    font-size: 2.7rem;
}

.page-title {
    color: #ffffff;
}

.page-subtitle {
    color: rgba(255, 255, 255, 0.85);
}

.student-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 1.5rem;
    padding: 1rem 1.2rem;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
}

.student-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    background: #eff6ff;
    border: 3px solid rgba(37, 99, 235, 0.22);
}

.student-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

button {
    border: none;
    background: none;
}

.app-shell {
    min-height: 100vh;
    padding-top: 72px;
}

.app-navbar {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(16, 35, 61, 0.08);
}

.navbar-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 12px;
}

.navbar-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #17355e;
    text-transform: uppercase;
}

.game-screen {
    max-width: 1100px;
    margin: 0 auto;
    min-height: calc(100vh - 72px);
    display: block;
    padding: 0 0.5rem 0.5rem;
}

.game-topbar {
    background: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.09);
    max-width: 1040px;
    margin: 0 auto;
    border-radius: 0 0 18px 18px;
}

.game-student-photo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid rgba(22, 101, 216, 0.3);
    object-fit: cover;
    background: #f2f7ff;
}

.health-tracker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(239, 68, 68, 0.18);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.heart {
    font-size: 1.5rem;
    line-height: 1;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.heart.filled {
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.heart.empty {
    color: rgba(148, 163, 184, 0.85);
}

.scene-stage {
    position: relative;
    width: min(1040px, calc(100vw - 28px));
    min-height: 420px;
    height: calc(100vh - 190px);
    max-height: 560px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    margin: 0.75rem auto 0;
    border-radius: 20px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
}

.scene-backdrop {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: saturate(1.05) contrast(1.05);
}

.warning-overlay {
    position: absolute;
    inset: 0;
    background: rgba(158, 3, 14, 0.45);
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.38);
}

.warning-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.09),
        rgba(255, 255, 255, 0.09) 2px,
        transparent 2px,
        transparent 4px
    );
    opacity: 0.7;
    animation: flicker 1.3s steps(2, end) infinite;
}

@keyframes flicker {
    0%, 49% { opacity: 0.25; }
    50%, 100% { opacity: 0.8; }
}

.scene-character {
    position: absolute;
    left: 0.5%;
    bottom: -2%;
    width: 230px;
    z-index: 2;
}

.scene-character img {
    width: 100%;
    filter: drop-shadow(0 12px 25px rgba(0, 0, 0, 0.25));
}

.speech-bubble {
    position: absolute;
    left: 16%;
    bottom: 20%;
    width: min(500px, 52vw);
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #dfeaf8;
    border-radius: 22px;
    box-shadow: 0 18px 30px rgba(31, 41, 55, 0.22);
    padding: 1rem 1.25rem;
    font-size: 2.1rem;
    line-height: 1.8;
    color: #1d3557;
    z-index: 3;
}

.speech-bubble::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 50%;
    width: 28px;
    height: 28px;
    margin-top: -14px;
    background: rgba(255, 255, 255, 0.95);
    border-left: 3px solid #dfeaf8;
    border-bottom: 3px solid #dfeaf8;
    transform: rotate(45deg);
}

.bottom-textbox {
    position: absolute;
    left: 50%;
    bottom: 7%;
    transform: translateX(-50%);
    width: min(720px, 86vw);
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #dfeaf8;
    border-radius: 22px;
    box-shadow: 0 18px 30px rgba(31, 41, 55, 0.22);
    padding: 1rem 1.5rem;
    font-size: 1.6rem;
    line-height: 1.7;
    color: #1d3557;
    text-align: center;
    z-index: 3;
}

.next-button {
    position: absolute;
    right: 4%;
    bottom: 10%;
    width: 98px;
    height: 44px;
    z-index: 4;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.next-button:hover {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(1.05);
}

.scene-panel {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.question-panel {
    width: min(760px, 90vw);
    background: rgba(8, 20, 36, 0.62);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 26px;
    padding: 1.5rem 1.5rem 1.2rem;
    backdrop-filter: blur(2px);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.22);
}

.question-text {
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    color: #f8fbff;
    font-weight: 700;
    margin-bottom: 1.2rem;
    text-align: center;
    line-height: 1.6;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 1rem;
}

.option-btn {
    background: rgba(255, 255, 255, 0.94);
    color: #153863;
    border-radius: 16px;
    border: 2px solid rgba(20, 94, 167, 0.15);
    padding: 0.9rem 1rem;
    min-height: 82px;
    font-weight: 700;
    font-size: 1rem;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.option-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.12);
}

.option-btn.correct {
    border-color: #2fbf71;
    background: rgba(224, 255, 238, 0.98);
}

.option-btn.wrong {
    border-color: #ef4444;
    background: rgba(255, 234, 234, 0.98);
}

.option-mark {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
}

.option-btn-wrap {
    position: relative;
}

.objective-scene {
    position: absolute;
    inset: 0;
    z-index: 2;
    padding: 2rem;
}

.objective-grid {
    position: absolute;
    inset: 0;
    padding-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    align-content: start;
    justify-items: center;
    gap: 1.5rem;
}

.objective-card {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(1px);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.objective-card:hover {
    transform: translateY(-2px) scale(1.02);
}

.objective-card img {
    width: 86px;
    height: 86px;
    object-fit: contain;
}

.objective-card .item-mark {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 34px;
    height: 34px;
}

.email-card .item-mark {
    position: absolute;
    right: 0.6rem;
    top: 0.6rem;
    width: 16px;
    height: 16px;
}

.email-grid {
    position: absolute;
    left: 50%;
    top: 1.5rem;
    bottom: 1.5rem;
    transform: translateX(-50%);
    width: min(720px, 92vw);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow-y: auto;
}

.email-card {
    background: rgba(255, 255, 255, 0.94);
    border: 2px solid rgba(30, 64, 175, 0.15);
    border-radius: 16px;
    padding: 0.65rem 0.9rem;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.email-card.opened {
    opacity: 0.55;
    cursor: default;
}

.email-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.3rem;
    font-weight: 700;
    color: #123c72;
}

.email-card h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.email-card small {
    color: #5577a8;
}

.email-card strong {
    font-size: 0.9rem;
    color: #0f172a;
}

.email-card p {
    margin: 0;
    line-height: 1.6;
    color: #274d75;
}

.report-box {
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%);
    width: min(82vw, 900px);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 1.2rem 1.25rem 1rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    z-index: 3;
}

.report-box textarea {
    width: 100%;
    min-height: 160px;
    resize: none;
    border: 2px solid #dbe7ff;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #193760;
    background: #fbfdff;
}

.report-box textarea:focus {
    outline: 3px solid rgba(56, 189, 248, 0.25);
    border-color: #60a5fa;
}

.report-feedback:empty {
    display: none;
}

.report-feedback {
    margin-top: 0.8rem;
}

.report-diff {
    font-size: 1rem;
    line-height: 1.8;
    color: #193760;
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 14px;
    padding: 0.8rem 1rem;
}

.word-correct {
    color: #193760;
}

.word-wrong {
    color: #dc2626;
    text-decoration: underline wavy;
    font-weight: 700;
}

.word-missing {
    color: #dc2626;
    text-decoration: line-through;
    opacity: 0.7;
}

.send-button {
    width: 140px;
    position: absolute;
    right: 1.2rem;
    bottom: 1rem;
}

.final-scene {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
}

.final-panel {
    width: min(860px, 92vw);
    background: rgba(255, 255, 255, 0.93);
    border-radius: 28px;
    padding: 2rem 1.8rem;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.2);
    text-align: center;
}

.final-panel h2 {
    font-size: clamp(2rem, 3vw, 2.8rem);
    color: #123d76;
    font-weight: 800;
    margin-bottom: 1rem;
}

.final-panel p {
    font-size: 1.2rem;
    line-height: 1.9;
    color: #244d7a;
    margin-bottom: 0.5rem;
}

.back-begin {
    margin-top: 1.2rem;
    background: linear-gradient(135deg, #1d4ed8, #166534);
    color: #fff;
    border-radius: 14px;
    font-weight: 700;
    padding: 0.8rem 1.5rem;
    box-shadow: 0 10px 18px rgba(22, 101, 52, 0.2);
}

@media (max-width: 991px) {
    .speech-bubble {
        left: 20%;
        width: min(66vw, 440px);
        font-size: 0.98rem;
    }

    .option-grid,
    .email-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .scene-character {
        width: 170px;
        left: 4%;
    }

    .speech-bubble {
        left: 18%;
        bottom: 16%;
        width: calc(100% - 6rem);
        font-size: 0.9rem;
        padding: 0.8rem 1rem;
    }

    .next-button {
        width: 90px;
        height: 42px;
    }

    .question-panel {
        padding: 1.1rem 0.9rem;
    }

    .option-btn {
        min-height: 70px;
        font-size: 0.9rem;
    }
}
