:root {
    --green: #00ff6a;
    --bg: #000;
    --muted-green: #0c6b39;
    --glass: rgba(255, 255, 255, 0.03);
    --mono: "Fira Mono", "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    background: radial-gradient(circle at 10% 10%, rgba(0, 255, 122, 0.03), transparent 10%),
        linear-gradient(180deg, #001100 0%, #000 50%, #000000 100%);
    color: var(--green);
    font-family: var(--mono);
    -webkit-font-smoothing: antialiased;
}

.page {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.terminal {
    width: 100%;
    max-width: 1200px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.98));
    box-shadow: 0 10px 40px rgba(0, 255, 138, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.02);
    padding: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 138, 0.08);
    animation: flicker 8s infinite;
}

@keyframes flicker {

    0%,
    10%,
    100% {
        opacity: 1;
        filter: brightness(1);
    }

    5% {
        opacity: 0.98;
        filter: brightness(0.95) contrast(1.02);
    }

    7% {
        opacity: 0.96;
        filter: brightness(0.92);
    }
}

/* Header */
.term-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.title {
    flex: 1;
    font-weight: 800;
    font-size: 16px;
    color: var(--green);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0, 255, 140, 0.1);
    min-width: 200px;
}

.controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.small-btn,
select {
    font-family: var(--mono);
    border: 1px solid rgba(0, 255, 138, 0.1);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7));
    color: var(--green);
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    opacity: 0.95;
}

.small-btn:hover,
select:hover {
    box-shadow: 0 6px 24px rgba(0, 255, 138, 0.08);
    transform: translateY(-1px);
    opacity: 1;
}

.small-btn:active {
    transform: translateY(1px);
}

/* Main layout */
.main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 18px;
    align-items: start;
}

@media (max-width: 960px) {
    .main {
        grid-template-columns: 1fr 260px;
    }
}

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

    .side {
        order: 2;
    }
}

/* Output area */
#output {
    height: 450px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.05));
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 138, 0.06);
    padding: 14px;
    overflow: auto;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    backdrop-filter: blur(1px);
}

/* CRT effects */
.crt::before {
    pointer-events: none;
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.06) 50%, rgba(255, 255, 255, 0.02) 51%);
    background-size: 100% 4px;
    mix-blend-mode: overlay;
    opacity: 0.5;
    z-index: 1;
}

.crt::after {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0, 255, 140, 0.02) 0%, rgba(0, 0, 0, 0.5) 80%);
    opacity: 0.6;
    mix-blend-mode: multiply;
    z-index: 1;
}

/* Text lines */
.line {
    margin: 0 0 10px 0;
    white-space: pre-wrap;
    opacity: 0;
    transform: translateY(6px);
    animation: fadeInUp 0.3s forwards;
    position: relative;
    z-index: 2;
}

.line.comment {
    color: #9fcfa3;
    font-style: italic;
    opacity: 0.95;
}

.line.system {
    color: #7fbf92;
    font-size: 14px;
}

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

.typing {
    display: inline-block;
    border-right: 2px solid var(--green);
    padding-right: 2px;
    animation: blinkCursor 0.9s steps(1) infinite;
}

@keyframes blinkCursor {
    50% {
        border-color: transparent;
    }
}

/* Input area */
.input-wrap {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
}

#command {
    flex: 1;
    min-width: 0;
    font-family: var(--mono);
    font-size: 15px;
    padding: 11px 14px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.35));
    color: var(--green);
    border: 1px solid rgba(0, 255, 138, 0.08);
    outline: none;
    transition: all 0.2s ease;
    caret-color: var(--green);
}

#command:focus {
    box-shadow: 0 8px 30px rgba(0, 255, 140, 0.1);
    transform: translateY(-1px);
    border-color: rgba(0, 255, 138, 0.15);
}

.go-btn {
    padding: 11px 18px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 138, 0.1);
    background: linear-gradient(180deg, rgba(0, 255, 140, 0.15), rgba(0, 0, 0, 0.6));
    color: var(--green);
    font-family: var(--mono);
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.06em;
    transition: all 0.2s ease;
}

.go-btn:hover {
    box-shadow: 0 8px 30px rgba(0, 255, 140, 0.08);
    transform: translateY(-2px);
}

/* Side panel */
.side {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.02));
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(0, 255, 138, 0.06);
    min-height: 450px;
}

.side h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--green);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0, 255, 138, 0.1);
    padding-bottom: 6px;
}

.stat {
    font-size: 14px;
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
}

.stat-value {
    font-weight: 700;
    text-shadow: 0 2px 6px rgba(0, 255, 140, 0.08);
}

/* Progress bars */
.bar {
    height: 12px;
    background: rgba(0, 0, 0, 0.4);
    margin: 8px 0 14px 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 138, 0.06);
    position: relative;
}

.bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #00ff6a, #00aa44);
    transition: width 0.4s ease;
    box-shadow: 0 0 10px rgba(0, 255, 140, 0.3);
}

.bar-label {
    font-size: 11px;
    color: #9fd9b0;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Inventory */
.inventory-list {
    font-size: 13px;
    color: #9fd9b0;
    margin-top: 8px;
    line-height: 1.6;
}

/* Map */
.map {
    font-family: monospace;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border-radius: 6px;
    color: #bff8ca;
    margin-top: 10px;
    line-height: 1.3;
    white-space: pre;
    font-size: 13px;
    letter-spacing: 2px;
}

/* Hints */
.hint {
    font-size: 12px;
    color: #7fbf92;
    margin-top: 10px;
    opacity: 0.9;
    line-height: 1.4;
}

/* Grid floor decoration */
.grid {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -80px;
    height: 160px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.6)),
        repeating-linear-gradient(90deg, rgba(0, 255, 100, 0.04) 0 1px, transparent 1px 40px),
        repeating-linear-gradient(0deg, rgba(0, 255, 100, 0.03) 0 1px, transparent 1px 40px);
    opacity: 0.7;
    transform: perspective(600px) rotateX(30deg) translateZ(0);
    filter: blur(0.6px);
    pointer-events: none;
}

/* Glitch effect */
.glitch {
    animation: glitchAnim 0.35s steps(2) 3;
}

@keyframes glitchAnim {
    20% {
        transform: translateX(-2px) skewX(-1deg);
    }

    40% {
        transform: translateX(2px) skewX(1deg);
    }

    60% {
        transform: translateX(-2px) skewX(-1deg);
    }

    80% {
        transform: translateX(2px) skewX(1deg);
    }

    100% {
        transform: none;
    }
}

/* Boot overlay */
.boot {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, #001100ee, #000000dd);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.boot .logo {
    font-weight: 800;
    font-size: 24px;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
    text-shadow: 0 4px 16px rgba(0, 255, 140, 0.2);
}

.boot .sub {
    font-size: 13px;
    color: #9fd9b0;
    margin-bottom: 20px;
}

.boot .progress {
    width: 280px;
    height: 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.6);
    overflow: hidden;
    border: 1px solid rgba(0, 255, 138, 0.1);
}

.boot .progress-inner {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(0, 255, 140, 0.4), rgba(0, 255, 140, 1));
    box-shadow: 0 0 20px rgba(0, 255, 140, 0.5);
    transition: width 0.1s linear;
}

/* Loading indicator */
.loading {
    display: none;
    color: #888;
    font-size: 13px;
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading.active {
    display: inline-block;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Scrollbar styling */
#output::-webkit-scrollbar {
    width: 8px;
}

#output::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
}

#output::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 140, 0.3);
    border-radius: 4px;
}

#output::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 140, 0.5);
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .terminal {
        padding: 12px;
    }

    #output {
        height: 350px;
        font-size: 14px;
    }

    .title {
        font-size: 13px;
    }

    .controls {
        width: 100%;
    }

    .small-btn,
    select {
        font-size: 11px;
        padding: 6px 10px;
    }
}