
/* ==========================================
   BIOVERSE | MICRO WORLD
   Main Game Interface Styles
========================================== */

* {
    box-sizing: border-box;
}

:root {
    --mint: #8ce8cf;
    --mint2: #c8ffe9;
    --ink: #f4fff9;
    --muted: #c1d8ce;

    --glass: rgba(8, 28, 29, .76);
    --glass-dark: rgba(5, 22, 20, .92);

    --line: rgba(218, 255, 239, .18);
    --line-strong: rgba(140, 232, 207, .32);

    --green-dark: #142f2b;
    --green-panel: #14382f;

    --shadow: 0 15px 45px rgba(0, 0, 0, .28);
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--green-dark);
    color: var(--ink);
    font-family: "IBM Plex Sans Arabic", sans-serif;
}

button,
a {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

a {
    -webkit-tap-highlight-color: transparent;
}

/* ==========================================
   3D GAME
========================================== */

#game-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: #142f2b;
}

#game-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ==========================================
   TOP BAR
========================================== */

.topbar {
    position: fixed;
    z-index: 3;

    top: 0;
    left: 0;
    right: 0;

    height: 66px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 26px;

    background: linear-gradient(
        180deg,
        rgba(7, 23, 22, .88),
        rgba(7, 23, 22, .52)
    );

    border-bottom: 1px solid var(--line);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    pointer-events: none;
}

.logo {
    color: var(--mint);
    font-weight: 700;
    font-size: 19px;
    text-decoration: none;
    direction: ltr;
    pointer-events: auto;
    letter-spacing: .3px;
    transition: color .2s;
}

.logo:hover {
    color: var(--mint2);
}

.world-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.world-name small {
    color: var(--muted);
    font-size: 10px;
    direction: ltr;
    letter-spacing: 1px;
}

.live-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;

    background: #77efb8;
    border-radius: 50%;

    box-shadow: 0 0 12px #77efb8;
}

.player-level {
    background: rgba(34, 75, 62, .68);
    border: 1px solid var(--line);
    padding: 8px 13px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
}

/* ==========================================
   MISSION HUD
========================================== */

.mission-hud {
    position: fixed;
    z-index: 3;

    top: 88px;
    right: 18px;

    width: min(330px, calc(100vw - 36px));
    max-width: calc(100vw - 36px);

    padding: 18px 20px;

    background: var(--glass);
    border: 1px solid var(--line-strong);
    border-radius: 18px;

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    pointer-events: none;

    box-shadow: 0 12px 35px rgba(7, 27, 24, .19);

    overflow: hidden;
}

.mission-heading,
.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.mission-heading {
    color: var(--mint);
    font-size: 12px;
    font-weight: 700;
}

.mission-number {
    font-size: 10px;
    direction: ltr;
    color: #c3e7d7;
    white-space: nowrap;
}

.mission-hud h2 {
    font-size: 17px;
    margin: 12px 0 5px;
    overflow-wrap: anywhere;
}

.mission-hud p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.9;
    margin: 0 0 15px;
    overflow-wrap: anywhere;
}

.progress-label {
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 7px;
}

.progress-label strong {
    color: var(--mint);
    direction: ltr;
}

.progress-track {
    height: 6px;
    background: #29473e;
    border-radius: 20px;
    overflow: hidden;
}

.progress-track span {
    display: block;
    height: 100%;
    width: 0%;

    background: linear-gradient(
        90deg,
        #54caa9,
        #c2f4bd
    );

    border-radius: inherit;
    transition: width .45s ease;
}

/* ==========================================
   LOCATION LABEL
========================================== */

.location-label {
    position: fixed;
    z-index: 2;

    top: 88px;
    left: 24px;

    display: flex;
    align-items: center;
    gap: 11px;

    padding: 12px 16px;

    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 14px;

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    pointer-events: none;
}

.location-label > span {
    font-size: 25px;
}

.location-label div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.location-label strong {
    font-size: 13px;
}

.location-label small {
    color: var(--muted);
    font-size: 10px;
}

/* ==========================================
   GAME HINT
========================================== */

.game-hint {
    position: fixed;
    z-index: 2;

    bottom: 20px;
    left: 50%;

    transform: translateX(-50%);

    padding: 10px 18px;

    border-radius: 12px;

    background: rgba(5, 22, 20, .78);
    border: 1px solid var(--line);

    color: #e4fff2;
    font-size: 11px;
    white-space: nowrap;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    pointer-events: none;
}

.game-hint span {
    color: var(--mint);
    margin: 0 5px;
}

/* ==========================================
   DISCOVERY HUD
========================================== */

.discovery-hud {
    position: fixed;
    z-index: 2;

    bottom: 20px;
    right: 24px;

    padding: 12px 16px;

    border-radius: 12px;

    background: var(--glass);
    border: 1px solid var(--line);

    color: var(--muted);
    font-size: 12px;

    pointer-events: none;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#discoveryItem {
    color: var(--mint);
    font-weight: 700;
}

/* ==========================================
   BACK LINK
========================================== */

.back-link {
    position: fixed;
    z-index: 4;

    bottom: 20px;
    left: 24px;

    color: white;
    font-size: 11px;
    text-decoration: none;

    padding: 10px 14px;

    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 11px;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    transition:
        color .2s,
        background .2s,
        border-color .2s;
}

.back-link:hover {
    color: var(--mint);
    border-color: var(--line-strong);
    background: rgba(8, 38, 32, .9);
}

/* ==========================================
   INTERACTION PROMPT
========================================== */

.interaction-prompt {
    position: fixed;
    z-index: 5;

    bottom: 76px;
    left: 50%;

    transform: translateX(-50%);

    background: #d8ffed;
    color: #123c30;

    border-radius: 12px;

    padding: 12px 22px;

    font-size: 14px;
    font-weight: 700;

    box-shadow: 0 5px 25px #0005;

    white-space: nowrap;
    pointer-events: none;

    animation: bob 1.2s infinite alternate;
}

@keyframes bob {
    to {
        transform: translate(-50%, -5px);
    }
}

/* ==========================================
   HIDDEN
========================================== */

.hidden {
    display: none !important;
}

/* ==========================================
   START SCREEN
========================================== */

.start-screen {
    position: fixed;
    z-index: 8;
    inset: 0;

    display: grid;
    place-items: center;

    padding: 20px;

    background: linear-gradient(
        120deg,
        rgba(3, 19, 18, .52),
        rgba(4, 26, 23, .32)
    );

    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.start-card {
    width: min(470px, 100%);

    padding: 36px;

    text-align: center;

    border-radius: 25px;

    background: rgba(10, 34, 30, .94);

    border: 1px solid var(--line-strong);

    box-shadow: 0 25px 90px #0007;
}

.start-icon {
    font-size: 48px;
    filter: drop-shadow(0 0 18px #7ce7bd66);
}

.eyebrow {
    color: var(--mint);
    font-size: 11px;
    letter-spacing: 1.2px;
}

.start-card h1 {
    font-size: 23px;
    margin: 10px 0;
}

.start-card > p:not(.eyebrow) {
    color: var(--muted);
    font-size: 13px;
    line-height: 2;
}

.controls-guide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin: 22px 0;
}

.controls-guide span {
    padding: 10px 5px;
    border-radius: 11px;
    background: #1b4439;
    color: var(--muted);
    font-size: 11px;
}

.controls-guide b {
    display: block;
    color: var(--mint);
    margin-bottom: 4px;
}

.primary-button {
    border: 0;
    border-radius: 13px;

    background: linear-gradient(
        110deg,
        #8ce8cf,
        #b9f2bd
    );

    color: #10382d;

    padding: 13px 20px;

    font-weight: 700;
    cursor: pointer;
    width: 100%;

    transition:
        transform .2s,
        filter .2s,
        box-shadow .2s;
}

.primary-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 8px 25px rgba(140, 232, 207, .15);
}

.primary-button:active {
    transform: translateY(0);
}

.start-card > small {
    display: block;
    margin-top: 13px;
    color: var(--muted);
    font-size: 10px;
}

/* ==========================================
   PAUSE HINT
========================================== */

.pause-hint {
    position: fixed;
    z-index: 6;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    padding: 15px 22px;

    background: rgba(5, 22, 20, .88);
    border: 1px solid var(--line);
    border-radius: 12px;

    pointer-events: none;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    color: var(--ink);
    text-align: center;
}

/* ==========================================
   PAUSE SCREEN
========================================== */

.pause-screen {
    position: fixed;
    z-index: 9;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(5, 12, 25, .88);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.pause-screen.show {
    display: flex;
}

.pause-card {
    width: min(440px, 100%);

    padding: 35px 25px;

    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 22px;

    background: linear-gradient(
        145deg,
        #1c2d49,
        #101c32
    );

    color: #fff;
    text-align: center;

    box-shadow: 0 25px 80px rgba(0, 0, 0, .4);
}

.pause-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.pause-card h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

.pause-card p {
    color: #b5c5da;
    line-height: 1.9;
    font-size: 14px;
}

.pause-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 25px;
}

.pause-actions button,
.pause-actions a {
    display: block;
    width: 100%;

    padding: 13px 18px;

    border: 0;
    border-radius: 12px;

    font: inherit;
    font-weight: 700;

    text-decoration: none;
    cursor: pointer;

    transition:
        transform .2s,
        filter .2s;
}

.pause-actions button:hover,
.pause-actions a:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.resume-button {
    background: #8fc6ff;
    color: #102039;
}

.exit-button {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

/* ==========================================
   DISCOVERY MODAL
========================================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 10;

    display: grid;
    place-items: center;

    padding: 20px;

    background: rgba(3, 16, 14, .8);

    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
}

.modal-content {
    position: relative;

    width: min(440px, 100%);

    background: #14382f;

    border: 1px solid rgba(140, 232, 207, .3);
    border-radius: 23px;

    padding: 34px;

    text-align: center;

    box-shadow: 0 20px 70px #0008;

    animation: modalAppear .3s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close-modal {
    position: absolute;

    left: 15px;
    top: 10px;

    width: 35px;
    height: 35px;

    display: grid;
    place-items: center;

    border: 0;
    border-radius: 10px;

    background: transparent;

    color: white;
    font-size: 27px;

    cursor: pointer;

    transition:
        background .2s,
        color .2s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, .1);
    color: var(--mint);
}

.success-icon {
    font-size: 50px;
}

.modal-content h2 {
    font-size: 21px;
}

.modal-content > p:not(.eyebrow) {
    color: var(--muted);
    font-size: 13px;
    line-height: 2;
}

.sample-code {
    background: #205044;

    border: 1px solid var(--line);
    border-radius: 12px;

    padding: 12px;

    color: var(--mint);
    font-weight: 700;

    margin: 18px 0;

    direction: ltr;
}

.sample-code span {
    display: block;

    color: var(--muted);
    font-size: 11px;

    margin-top: 5px;

    direction: rtl;
    font-weight: 400;
}

/* ==========================================
   TOAST
========================================== */

.toast {
    position: fixed;
    z-index: 12;

    top: 78px;
    left: 50%;

    transform: translateX(-50%);

    max-width: calc(100vw - 30px);

    padding: 10px 18px;

    background: #d9ffed;
    color: #10382d;

    border-radius: 12px;

    font-size: 12px;
    font-weight: 700;

    box-shadow: 0 8px 30px #0004;

    text-align: center;
    overflow-wrap: anywhere;

    animation: toastAppear .25s ease;
}

@keyframes toastAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -8px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ==========================================
   FOCUS ACCESSIBILITY
========================================== */

button:focus-visible,
a:focus-visible {
    outline: 3px solid #8fc6ff;
    outline-offset: 4px;
}

/* ==========================================
   TABLET
========================================== */

@media (max-width: 900px) {

    .topbar {
        padding: 0 18px;
    }

    .mission-hud {
        right: 14px;
    }

    .location-label {
        left: 14px;
    }

}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 700px) {

    .topbar {
        height: 56px;
        padding: 0 12px;
    }

    .logo {
        font-size: 14px;
    }

    .world-name {
        font-size: 11px;
        gap: 5px;
    }

    .world-name small {
        display: none;
    }

    .player-level {
        font-size: 10px;
        padding: 6px 8px;
    }

    .mission-hud {
        top: 69px;
        right: 10px;

        width: min(260px, calc(100vw - 20px));

        padding: 12px;
    }

    .mission-hud h2 {
        font-size: 14px;
        margin-top: 8px;
    }

    .mission-hud p {
        font-size: 10px;
        margin-bottom: 9px;
    }

    .mission-heading {
        font-size: 11px;
    }

    .progress-label {
        font-size: 10px;
    }

    .location-label {
        top: 69px;
        left: 10px;
        padding: 8px;
    }

    .location-label > span {
        font-size: 18px;
    }

    .location-label strong {
        font-size: 11px;
    }

    .location-label small {
        font-size: 9px;
    }

    .discovery-hud {
        bottom: 12px;
        right: 10px;

        font-size: 10px;
        padding: 9px;
    }

    .back-link {
        bottom: 12px;
        left: 10px;

        font-size: 10px;
        padding: 8px;
    }

    .game-hint {
        bottom: 65px;
        font-size: 9px;
        padding: 8px 12px;
    }

    .interaction-prompt {
        bottom: 105px;
        font-size: 12px;
        padding: 10px 16px;
    }

    .start-card {
        padding: 25px 20px;
    }

    .start-card h1 {
        font-size: 20px;
    }

    .start-card > p:not(.eyebrow) {
        font-size: 12px;
    }

    .controls-guide {
        gap: 7px;
        margin: 16px 0;
    }

    .controls-guide span {
        font-size: 10px;
    }

    .modal-content {
        padding: 28px 20px;
    }

    .pause-card {
        padding: 28px 20px;
    }

}

/* ==========================================
   SMALL MOBILE
========================================== */

@media (max-width: 380px) {

    .world-name {
        display: none;
    }

    .mission-hud {
        width: 210px;
    }

    .location-label {
        top: 69px;
        left: 8px;
    }

    .game-hint {
        font-size: 8px;
        padding: 8px 10px;
    }

    .controls-guide {
        grid-template-columns: 1fr 1fr;
    }

    .start-card {
        padding: 22px 16px;
    }

}

/* ==========================================
   REDUCED MOTION
========================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

}
