/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color palette */
    --bg-color: #000000;
    --primary-green: #00FF00;
    --cyan: #00FFFF;
    --yellow: #FFFF00;
    --magenta: #FF00FF;
    --red: #FF0000;
    --blue: #00D4FF;
    --white: #FFFFFF;
    --gray: #808080;

    /* Typography */
    /* Android-optimized monospace font stack with Unicode box-drawing support */
    --font-mono: 'Roboto Mono', 'Droid Sans Mono', 'Noto Sans Mono',
                 'Courier New', 'Courier', 'Consolas', 'Monaco', 'Menlo',
                 'Liberation Mono', 'DejaVu Sans Mono', 'Ubuntu Mono',
                 'Lucida Console', 'monospace';
    --font-size-base: 16px;
    --line-height: 1.5;
}

body {
    background-color: var(--bg-color);
    color: var(--primary-green);
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    /* Improve touch behavior on mobile */
    touch-action: pan-y;
    -webkit-text-size-adjust: 100%;
    /* Ensure monospace rendering */
    font-variant-ligatures: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Emoji support - use system emoji fonts */
body, .section-content {
    font-family: var(--font-mono), 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', 'Android Emoji', 'EmojiSymbols';
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Terminal container */
.terminal-container {
    width: 100%;
    min-height: 100vh;
    padding: 20px;
    background-color: var(--bg-color);
    position: relative;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Scanline effect (subtle) */
.terminal-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(0, 255, 0, 0.03) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1;
}

.terminal-container > * {
    position: relative;
    z-index: 2;
}

/* ASCII Art Header */
.ascii-header {
    margin-bottom: 20px;
    text-align: left;
    /* Force hardware acceleration for exact rendering */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Prevent any layout shifts */
    contain: layout style paint;
}

.ascii-header pre {
    color: var(--cyan);
    font-size: 14px;
    line-height: 1.0;
    text-shadow: 0 0 5px var(--cyan);
    overflow: hidden;
    max-width: 100%;
    /* Force monospace rendering */
    font-family: var(--font-mono);
    font-variant-ligatures: none;
    font-feature-settings: normal;
    /* Critical for Android: prevent ANY spacing adjustments */
    letter-spacing: 0 !important;
    word-spacing: 0 !important;
    white-space: pre !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Ensure Unicode characters render correctly */
    unicode-bidi: bidi-override;
    text-rendering: geometricPrecision;
    /* Prevent font substitution on Android */
    font-synthesis: none;
    -webkit-font-feature-settings: "liga" 0;
    font-feature-settings: "liga" 0;
    /* Force consistent character width - critical for ASCII art */
    tab-size: 1;
    -moz-tab-size: 1;
    /* Prevent any compression or expansion */
    text-align: left;
    text-justify: none;
    /* Disable text rendering optimizations that might affect spacing */
    font-variant-numeric: tabular-nums;
    font-variant-ligatures: no-common-ligatures;
    /* Force fixed width */
    font-stretch: 100%;
    /* Critical: prevent zoom adjustments on Android */
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    /* Ensure exact pixel rendering */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Terminal output area */
.terminal-output {
    margin-bottom: 20px;
}

.welcome-message {
    margin-bottom: 15px;
}

.output-line {
    margin-bottom: 5px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Prompt styling */
.prompt {
    color: var(--yellow);
    font-weight: bold;
    text-shadow: 0 0 3px var(--yellow);
}

.prompt::before {
    content: '';
}

/* Command text */
.command {
    color: var(--cyan);
    font-weight: bold;
}

/* Menu container */
.menu-container {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid var(--primary-green);
    border-radius: 3px;
    background-color: rgba(0, 255, 0, 0.05);
}

.menu-title {
    color: var(--magenta);
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 0 0 5px var(--magenta);
}

.menu-subtitle {
    color: var(--gray);
    text-align: center;
    margin-bottom: 20px;
    font-size: 14px;
}

.menu-options {
    margin: 20px 0;
}

.menu-item {
    padding: 10px 20px;
    margin: 5px 0;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.menu-item::before {
    content: '> ';
    color: transparent;
    font-weight: bold;
}

/* Only active menu items should be interactive */
#active-menu .menu-item {
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 255, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
}

#active-menu .menu-item:hover {
    background-color: rgba(0, 255, 0, 0.1);
    border-left-color: var(--cyan);
}

/* Active/touch state for menu items */
#active-menu .menu-item:active {
    background-color: rgba(0, 255, 0, 0.2);
    border-left-color: var(--primary-green);
}

/* Inactive menu items should not be interactive */
.menu-container:not(#active-menu) .menu-item {
    cursor: default;
    pointer-events: none;
}

.menu-item.selected {
    background-color: rgba(0, 255, 0, 0.15);
    border-left-color: var(--primary-green);
}

#active-menu .menu-item.selected::before {
    color: var(--primary-green);
    animation: blink 1s infinite;
}

.menu-item.selected::before {
    color: var(--primary-green);
}

.menu-number {
    color: var(--yellow);
    font-weight: bold;
    margin-right: 10px;
}

.menu-text {
    color: var(--primary-green);
}

.menu-hint {
    color: var(--gray);
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
}

/* Highlight text */
.highlight {
    color: var(--cyan);
    font-weight: bold;
    background-color: rgba(0, 255, 255, 0.1);
    padding: 2px 5px;
    border-radius: 2px;
}

.content-section {
    margin: 20px 0;
}

.section-title {
    color: var(--cyan);
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 0 0 5px var(--cyan);
}

.section-content {
    color: var(--primary-green);
    line-height: 1.6;
}

.section-content p {
    margin-bottom: 10px;
}

.section-content ul {
    list-style: none;
    padding-left: 20px;
}

.section-content li::before {
    content: '▸ ';
    color: var(--yellow);
    margin-right: 5px;
}

/* Command input area */
.command-input-container {
    margin: 20px 0;
    /* Ensure it's always at the bottom */
    padding-bottom: 20px;
}

.command-input-container.hidden {
    display: none;
}

.input-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.command-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--primary-green);
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    caret-color: transparent;
}

.command-input:focus {
    outline: none;
}

/* Blinking cursor */
.cursor {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 18px;
    background-color: var(--primary-green);
    animation: blink 1s infinite;
    pointer-events: none;
}

/* Continue prompt cursor */
.continue-cursor {
    display: inline-block;
    width: 10px;
    height: 18px;
    background-color: var(--blue);
    animation: blink 1s infinite;
    vertical-align: middle;
    margin-left: 5px;
}

/* Continue prompt interactivity */
.continue-prompt {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 212, 255, 0.3);
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.2s ease;
    padding: 8px;
    margin: -8px;
    border-radius: 3px;
}

.continue-prompt:hover {
    background-color: rgba(0, 212, 255, 0.1);
}

.continue-prompt:active {
    background-color: rgba(0, 212, 255, 0.2);
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* Error messages */
.error {
    color: var(--red);
    font-weight: bold;
}

.error::before {
    content: '[ERROR] ';
}

/* Success messages */
.success {
    color: var(--primary-green);
    font-weight: bold;
}

/* Info messages */
.info {
    color: var(--blue);
}

/* Build version */
.build-version {
    color: #6B9EC7;
    opacity: 0.8;
}

/* Links */
.link {
    color: var(--cyan);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.link:hover {
    color: var(--magenta);
    text-shadow: 0 0 5px var(--magenta);
    text-decoration: underline;
}

.link:active {
    color: var(--yellow);
}

/* Typing animation */
@keyframes typeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.typing-char {
    opacity: 0;
    animation: typeChar 0.05s forwards;
}

@keyframes typeChar {
    to {
        opacity: 1;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    :root {
        --font-size-base: 14px;
    }

    .terminal-container {
        padding: 15px;
    }

    .ascii-header pre {
        font-size: 10px;
    }

    .menu-title {
        font-size: 18px;
    }

    .menu-item {
        padding: 8px 15px;
    }

    .section-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-base: 12px;
    }

    .terminal-container {
        padding: 10px;
    }

    .ascii-header pre {
        font-size: 8px;
    }

    .menu-title {
        font-size: 16px;
    }

    .section-title {
        font-size: 16px;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Loading animation */
.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}
