/* ─── Reset & Variables ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:       #00ff41;
  --green-dim:   #00b32d;
  --green-dark:  #004d14;
  --green-faint: #002a0a;
  --bg:          #0d0d0d;
  --bezel:       #1a1a1a;
  --bezel-inner: #111;
  --font:        'Courier New', Courier, monospace;
  --fs:          14px;
  --lh:          1.5;
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--green);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  overflow: hidden;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; color: #fff; }

/* ─── App Shell ───────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 12px 8px 8px;
  gap: 0;
}

/* ─── Monitor ─────────────────────────────────────────────── */
#monitor {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 620px;
  flex-shrink: 1;
  min-height: 0;
}

/* Outer bezel — the chunky CRT surround */
#bezel {
  width: 100%;
  background: var(--bezel);
  border-radius: 12px 12px 6px 6px;
  padding: 14px 14px 18px;
  box-shadow:
    0 0 0 2px #333,
    0 0 0 4px #222,
    0 4px 24px rgba(0,0,0,0.8),
    inset 0 0 12px rgba(0,0,0,0.6);
  position: relative;
  flex-shrink: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Bezel power LED */
#bezel::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: 18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-dim);
  box-shadow: 0 0 6px var(--green-dim);
  animation: led-pulse 3s ease-in-out infinite;
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* The actual screen surface */
#screen {
  background: #000;
  border-radius: 4px;
  border: 2px solid #000;
  box-shadow:
    inset 0 0 30px rgba(0,255,65,0.04),
    inset 0 0 2px rgba(0,255,65,0.15),
    0 0 20px rgba(0,255,65,0.08);
  display: flex;
  flex-direction: column;
  height: clamp(240px, 40vh, 420px);
  overflow: hidden;
  position: relative;
}

/* CRT scanline overlay */
#screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.12) 2px,
    rgba(0,0,0,0.12) 4px
  );
  pointer-events: none;
  z-index: 10;
  border-radius: 4px;
}

/* CRT vignette */
#screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
    transparent 60%,
    rgba(0,0,0,0.35) 100%
  );
  pointer-events: none;
  z-index: 11;
  border-radius: 4px;
}

/* ─── Screen Header ───────────────────────────────────────── */
#screen-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 10px 5px;
  border-bottom: 1px solid var(--green-dark);
  font-family: var(--font);
  font-size: var(--fs);
}

.header-name {
  color: #fff;
  letter-spacing: 0.15em;
  font-size: 0.9em;
}

.header-loc {
  color: var(--green-dark);
  font-size: 0.8em;
}

/* ─── Output Area ─────────────────────────────────────────── */
#output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 4px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dark) transparent;
}

#output::-webkit-scrollbar       { width: 4px; }
#output::-webkit-scrollbar-track { background: transparent; }
#output::-webkit-scrollbar-thumb { background: var(--green-dark); border-radius: 2px; }

.cmd-output {
  margin-bottom: 0.3em;
  color: var(--green-dim);
  word-break: break-word;
  white-space: pre-wrap;
}

/* ─── Prompt Line ─────────────────────────────────────────── */
#prompt-line {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 5px 10px 6px;
  border-top: 1px solid var(--green-dark);
  gap: 0;
}

.ps1 {
  color: var(--green-dim);
  white-space: nowrap;
  user-select: none;
}

#cmd-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  font-family: var(--font);
  font-size: var(--fs);
  flex: 1;
  caret-color: var(--green);
  padding: 0;
}

#cmd-input::placeholder {
  color: var(--green-dark);
  opacity: 1;
}

/* ─── Monitor Stand ───────────────────────────────────────── */
#stand {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#stand-neck {
  width: 60px;
  height: 14px;
  background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
  border-left: 1px solid #333;
  border-right: 1px solid #333;
}

#stand-base {
  width: 180px;
  height: 10px;
  background: linear-gradient(to bottom, #222, #181818);
  border-radius: 0 0 8px 8px;
  border: 1px solid #333;
  border-top: none;
  box-shadow: 0 3px 8px rgba(0,0,0,0.5);
}

/* ─── Keyboard ────────────────────────────────────────────── */
#keyboard-wrap {
  margin-top: 4px;
  flex-shrink: 0;
}

#keyboard {
  display: block;
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  white-space: pre;
  color: var(--green-dark);
  user-select: none;
}

.kb-border { color: var(--green-dark); }

.key {
  cursor: pointer;
  display: inline;
  color: var(--green-dark);
}
.key:hover  { color: var(--green-dim); }
.key:active { color: var(--green); }

/* ─── ls clickable files ──────────────────────────────────── */
.ls-file {
  cursor: pointer;
  color: var(--green);
}
.ls-file:hover { color: #fff; text-decoration: underline; }

.ls-dir {
  cursor: pointer;
  color: var(--green-dim);
}
.ls-dir:hover { color: #fff; text-decoration: underline; }

/* ─── Content Pages ───────────────────────────────────────── */
.page { animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.page h2 {
  color: #fff;
  margin-bottom: 0.4em;
  letter-spacing: 0.1em;
  font-size: 1em;
}
.page h3 {
  color: var(--green);
  margin: 0.6em 0 0.2em;
  font-size: 0.95em;
}
.page p, .page li {
  color: var(--green-dim);
  line-height: 1.5;
  margin-bottom: 0.3em;
  font-size: 0.9em;
}
.page ul { list-style: none; padding-left: 1em; }
.page ul li::before { content: '> '; color: var(--green-dark); }
.page .section-divider { color: var(--green-dark); margin: 0.4em 0; font-size: 0.9em; }

.project-card {
  border: 1px solid var(--green-dark);
  padding: 0.4em 0.6em;
  margin-bottom: 0.5em;
  border-radius: 2px;
}
.project-card h3 { margin: 0 0 0.15em; color: var(--green); font-size: 0.9em; }
.project-card p  { margin: 0; color: var(--green-dim); font-size: 0.85em; }
.project-card a  { color: var(--green); }
.project-card a:hover { color: #fff; }

/* ─── Pong ────────────────────────────────────────────────── */
#pong-canvas {
  display: block;
  background: transparent;
  border: 1px solid var(--green-dark);
  cursor: none;
  max-width: 100%;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 500px) {
  :root { --fs: 12px; }

  #bezel {
    border-radius: 8px 8px 4px 4px;
    padding: 10px 10px 14px;
  }

  #screen {
    height: clamp(200px, 45vh, 320px);
  }

  /* Hide keyboard on mobile — too wide */
  #keyboard-wrap { display: none; }

  #stand-neck { width: 40px; height: 10px; }
  #stand-base { width: 120px; height: 8px; }
}

@media (max-height: 600px) {
  #screen {
    height: clamp(180px, 38vh, 300px);
  }
  #keyboard-wrap { display: none; }
}
