:root {
    --primary-color: #00ff00;
    --secondary-color: #006400;
    --background-color: #0d1a0d;
    --terminal-body-bg: #0a110a;

    font-family: 'VT323', monospace;
    font-size: clamp(16px, 2.5vw, 24px);
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.terminal-wrapper {
    background-color: var(--terminal-body-bg);
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 10px;
    position: relative;
    overflow: hidden;
}

.terminal-header {
    display: grid;
    grid-auto-columns: auto;
    padding-bottom: 5px;
    border-bottom: 1px dashed var(--secondary-color);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.terminal-screen {
    flex-grow: 1;
    overflow-y: auto;
    padding: 5px 0;
    position: relative;
}

/* 
CRT effect
TODO: animation not displaying
*/
.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0,255,0,0.08) 0px,   /* lit line */
        rgba(0,255,0,0.08) 2px,
        rgba(0,0,0,0) 2px,        /* gap */
        rgba(0,0,0,0) 4px
    );
    opacity: .5;
    animation: crt-flicker 8s linear infinite;
    z-index: 100;
    pointer-events: none;
}

@keyframes crt-flicker {
  0%, 100% { opacity: .20; }
  50%      { opacity: .28; }
}

.terminal-screen::before{
  content:"";
  position:absolute; inset:0;
  pointer-events:none;
  background:
     radial-gradient(120% 80% at 50% -10% , rgba(0,255,0,0.12), transparent 60%),
     radial-gradient(120% 80% at 50% 110%, rgba(0,0,0,0.35), transparent 60%);
  z-index: 99;
}


/* scrollbar - webkit */
.terminal-screen::-webkit-scrollbar {
    width: 8px;
}

.terminal-screen::-webkit-scrollbar-track {
    background: var(--terminal-body-bg);
}

.terminal-screen::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

.terminal-screen::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

#terminalOutput {
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: 1.2;
    padding-right: 10px;
    margin: 0;
}

.terminal-input-line {
    display: flex;
    align-items: baseline;
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px dashed var(--secondary-color);
    position: relative;
    caret-color: currentColor;
}

.prompt {
    margin-right: 5px;
    white-space: pre;
    font-size: 1.2em;
}

#terminalInput {
    background: transparent;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: 1.2em;
    outline: none;
    caret-color: transparent;
    flex-grow: 1;
    text-shadow: 0 0 5px var(--primary-color);
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--primary-color);
    vertical-align: middle;
    animation: blink-cursor 1s steps(1) infinite;
    box-shadow: 0 0 5px var(--primary-color);
}

@keyframes blink-cursor {
    50% { opacity: 0; }
}

.terminal-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 5px;
    border-top: 1px dashed var(--secondary-color);
    margin-top: 10px;
    font-size: 0.9em;
}

.audio-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 101;
}

.audio-controls button {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8em;
    padding: 5px;
    text-shadow: 0 0 5px var(--primary-color);
    box-shadow: 0 0 5px var(--primary-color);
    outline: none;
    border-radius: 5px;
}

.audio-controls button:hover {
    box-shadow: 0 0 10px var(--primary-color);
}

a {
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--secondary-color);
    text-shadow: 0 0 5px var(--secondary-color);
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 1s ease-in-out;
}

.loading-text {
    font-size: 2em;
    margin-top: 20px;
}

.hidden {
    display: none;
}