:root {
    --navbar-height: 68px;
    --ink: #14131a;
    --sun: #ffd54a;
    --panel: rgba(17, 20, 28, 0.72);
    --accent: #fdb515;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    padding-top: var(--navbar-height);
    background: radial-gradient(circle at 0% 0%, #fff6cc, #f3f7ff 45%, #f0f3fa 100%);
    font-family: "Trebuchet MS", "Noto Sans Sinhala", sans-serif;
}

.app-navbar {
    min-height: var(--navbar-height);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
}

.navbar-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 12px;
    flex: 0 0 auto;
}

.navbar-title {
    font-size: .95rem;
    font-weight: 800;
    letter-spacing: .02em;
    color: #172033;
    line-height: 1.1;
}

.app-shell {
    min-height: 100vh;
}

.app-logo {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 24px;
    background: #fff;
    font-size: 2.4rem;
    box-shadow: 0 12px 28px rgba(20, 19, 26, 0.12);
}

.student-card {
    padding: 1.25rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgba(253, 181, 21, 0.13), rgba(39, 174, 96, 0.16));
    border: 1px solid rgba(20, 19, 26, 0.08);
}

.student-photo,
.game-student-photo {
    object-fit: cover;
    background: #e9ecef;
    border: 4px solid #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

.student-photo {
    width: 112px;
    height: 112px;
    border-radius: 28px;
}

.game-student-photo {
    width: 50px;
    height: 50px;
    border-radius: 14px;
}

.student-meta {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.game-screen {
    min-height: calc(100vh - var(--navbar-height));
    padding: .5rem;
}

.game-top-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    padding: .45rem .65rem;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 245, 205, 0.92));
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    margin-bottom: .5rem;
}

.scene-canvas {
    position: relative;
    width: 100%;
    height: calc(100vh - var(--navbar-height) - 86px);
    border-radius: 18px;
    overflow: hidden;
    background-color: #dee6ee;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border: 2px solid rgba(20, 19, 26, 0.18);
}

.scene-items {
    position: absolute;
    inset: 0;
    z-index: 6;
}

.scene-item {
    position: absolute;
    cursor: pointer;
    transition: transform .2s ease;
    user-select: none;
    background: transparent;
    border: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}

.scene-item:hover {
    transform: scale(1.06);
}

.scene-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.item-marker {
    position: absolute;
    width: 34px;
    height: 34px;
    right: -14px;
    top: -14px;
    pointer-events: none;
}

.soldier-sprite {
    position: absolute;
    left: 2%;
    bottom: 2%;
    width: min(26vw, 240px);
    z-index: 10;
    pointer-events: none;
}

.speech-bubble {
    position: absolute;
    left: min(22%, 270px);
    bottom: 13%;
    max-width: min(66vw, 720px);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    padding: 1rem 1rem 2.5rem;
    border: 2px solid rgba(20, 19, 26, 0.15);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.22);
    z-index: 11;
}

.speech-bubble::after {
    content: "";
    position: absolute;
    left: -14px;
    bottom: 18px;
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-right: 14px solid rgba(255, 255, 255, 0.72);
}

#bubbleText {
    font-size: clamp(.92rem, 1.6vw, 1.25rem);
    line-height: 1.5;
    color: #212529;
}

.bubble-next-btn {
    border: 0;
    background: transparent;
    padding: 0;
    position: absolute;
    right: .8rem;
    bottom: -1rem;
    z-index: 2;
}

.bubble-next-btn img {
    width: 32px;
    max-width: 42vw;
    height: auto;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(4, 11, 24, 0.86);
    display: grid;
    place-items: center;
    z-index: 50;
}

.loading-box {
    width: min(520px, 92vw);
    color: #fff;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    padding: 1.2rem;
}

.bottom-panel {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 3%;
    width: min(920px, 94vw);
    background: rgba(11, 13, 20, 0.72);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    z-index: 13;
    padding: .95rem;
    backdrop-filter: blur(4px);
}

.panel-title {
    margin: 0 0 .6rem;
    font-size: clamp(.9rem, 1.5vw, 1.15rem);
    line-height: 1.45;
}

.objective3-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    gap: .75rem;
}

.option-card {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.09);
    padding: .55rem;
    text-align: center;
    color: #fff;
    cursor: pointer;
}

.option-card img {
    width: 100%;
    max-height: 78px;
    object-fit: contain;
}

.typing-row {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}

.typing-row input {
    flex: 1 1 420px;
    min-width: 240px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    padding: .55rem .9rem;
}

.typing-compare {
    margin-top: .65rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    padding: .6rem .7rem;
    font-size: .9rem;
}

.typing-compare-line {
    margin-bottom: .3rem;
}

.typing-compare-word {
    display: inline-block;
    margin: 0 .2rem .2rem 0;
    padding: .1rem .35rem;
    border-radius: 6px;
    background: rgba(16, 24, 36, 0.4);
}

.typing-compare-word.ok {
    background: rgba(24, 160, 88, 0.45);
}

.typing-compare-word.bad {
    background: rgba(200, 47, 64, 0.62);
    border: 1px solid rgba(255, 214, 220, 0.75);
}

.typing-compare-word.missing {
    background: rgba(241, 170, 16, 0.56);
    border: 1px solid rgba(255, 243, 205, 0.75);
}

.send-btn {
    border: 0;
    background: transparent;
    padding: 0;
}

.send-btn img {
    width: 108px;
    max-width: 28vw;
    height: auto;
}

.send-btn-text {
    display: inline-block;
    border-radius: 999px;
    background: var(--accent);
    color: #1f1d14;
    font-weight: 700;
    padding: .45rem .95rem;
}

.scene-message {
    position: absolute;
    top: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: .65rem .95rem;
    border-radius: 12px;
    font-weight: 700;
    z-index: 14;
    background: rgba(16, 24, 36, 0.88);
    color: #fff;
}

.scene-message.error {
    background: rgba(186, 33, 44, 0.9);
}

.scene-message.success {
    background: rgba(20, 136, 73, 0.92);
}

.scene5-wrap {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 12;
}

.scene5-card {
    width: min(860px, 92vw);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    border: 1px solid rgba(20, 19, 26, 0.15);
    padding: 1.2rem;
    text-align: center;
    box-shadow: 0 20px 36px rgba(0, 0, 0, 0.2);
}

@media (max-width: 992px) {
    :root {
        --navbar-height: 60px;
    }

    .navbar-title {
        font-size: .84rem;
    }

    .navbar-logo {
        width: 36px;
        height: 36px;
    }

    .scene-canvas {
        height: calc(100vh - var(--navbar-height) - 132px);
    }

    .soldier-sprite {
        width: min(40vw, 190px);
    }

    .speech-bubble {
        left: 50%;
        transform: translateX(-50%);
        bottom: 18%;
        width: min(92vw, 720px);
        max-width: none;
    }

    .speech-bubble::after {
        display: none;
    }

    .objective3-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

.summary-grid div {
    padding: 1rem;
    background: rgba(13, 110, 253, .08);
    border: 1px solid rgba(13, 110, 253, .12);
    border-radius: 1rem;
}

.summary-grid strong,
.summary-grid span {
    display: block;
}

.summary-grid span {
    margin-top: .35rem;
    font-size: 1.5rem;
    font-weight: 900;
    color: #0d6efd;
}

@media (max-width: 576px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .game-topbar {
        padding: .5rem .6rem;
    }
}
