:root {
    /* Color scheme - cyber/neon theme */
    --bg: #04120a;
    --neon: #14ff7d;
    --neon-dim: #06381f;
    --neon-bright: #2dffb2;
    --accent: #ff3b3b;
    --panel-bg: rgba(0, 0, 0, 0.35);
    --border-color: rgba(20, 255, 125, 0.06);
    
    /* Typography */
    --font-mono: "Consolas", "Courier New", "Monaco", monospace;
    --font-size-base: 14px;
    --line-height: 1.6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--neon);
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
}

/* Background canvas */
#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: var(--bg);
}

/* Shortcut hint overlay */
.shortcut-hint {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--neon-dim);
    opacity: 0.7;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.shortcut-hint:hover {
    opacity: 1;
}

.shortcut-hint div {
    margin: 4px 0;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    position: relative;
    z-index: 10;
}

.container.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.container.bottom-half {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    height: 50vh;
    padding: 16px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
    overflow: hidden;
}

/* Adjust header/footer size in bottom-half mode */
.container.bottom-half .terminal-header,
.container.bottom-half .terminal-footer {
    padding: 8px 12px;
    font-size: 11px;
}

.container.bottom-half .connection-status {
    padding: 4px 8px;
    font-size: 10px;
}

.container.bottom-half .status-dot {
    width: 6px;
    height: 6px;
}

.container.bottom-half .footer-time {
    font-size: 11px;
}

.container.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Hidden state takes precedence over visible/bottom-half */
.container.visible.hidden,
.container.bottom-half.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Header */
.terminal-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 16px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.connected {
    background: var(--neon);
    animation: none;
}

.status-text {
    color: var(--neon-dim);
}

.status-text.connected {
    color: var(--neon);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Main terminal container */
.terminal-container {
    flex: 1;
    position: relative;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

#terminal-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: text;
}

/* Input overlay - hidden input field */
.input-overlay {
    position: absolute;
    top: -1000px;
    left: -1000px;
    opacity: 0;
    pointer-events: none;
}

.terminal-input {
    width: 1px;
    height: 1px;
    background: transparent;
    border: none;
    outline: none;
    color: transparent;
    caret-color: transparent;
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    padding: 0;
    pointer-events: all;
}

/* Footer */
.terminal-footer {
    padding: 12px 16px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    justify-content: flex-end;
}

.footer-time {
    font-size: 13px;
    font-weight: 400;
    color: var(--neon-dim);
    opacity: 0.8;
    letter-spacing: 0.5px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: var(--neon-dim);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 8px;
        gap: 8px;
    }

    .terminal-title {
        font-size: 18px;
    }

    .terminal-subtitle {
        font-size: 10px;
    }

    .terminal-header,
    .terminal-footer {
        padding: 12px;
    }

    :root {
        --font-size-base: 12px;
    }
}

/* Selection color */
::selection {
    background: rgba(20, 255, 125, 0.3);
    color: var(--neon);
}

/* Focus styles */
.terminal-input:focus {
    outline: none;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
