@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&display=swap');

:root {
  --bg-color: #111;
  --text-color: var(--main-color, #33ff00);
  --prompt-color: var(--main-color, #33ff00);
  --error-color: #ff3333;
  --art-color: var(--main-color, #33ff00);
  --font-stack: 'VT323', monospace;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-stack);
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.monitor {
  width: 80vw;
  height: 70vh;
  background: #050505;
  border-radius: 2rem;
  padding: 2rem;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  position: relative;
  transform: translateY(-5vh);
}

.screen {
  width: 100%;
  height: 100%;
  background-color: #001100;
  background-image: radial-gradient(circle at center, #002200 0%, #000000 100%);
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.9);
}

#terminal {
  width: 100%;
  height: 100%;
  padding: 2rem;
  padding-bottom: 3rem;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: var(--terminal-font-size, 2rem);
  text-shadow: 0 0 3px var(--glow-color, #138a03), 0 0 8px var(--main-color, #33ff00);
  position: relative;
  z-index: 1;
  animation: flicker 0.15s infinite;
  scrollbar-width: thin;
  scrollbar-color: var(--text-color) rgba(0, 0, 0, 0.2);
}

/* Custom Scrollbar for WebKit */
#terminal::-webkit-scrollbar {
  width: 8px;
}
#terminal::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
#terminal::-webkit-scrollbar-thumb {
  background: var(--text-color);
  border-radius: 4px;
  box-shadow: inset 0 0 5px var(--glow-color);
}
#terminal::-webkit-scrollbar-thumb:hover {
  background: var(--glow-color);
}

.output-line {
  margin-bottom: 5px;
  white-space: pre-wrap;
  line-height: 1.4;
}

.command-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.prompt {
  color: var(--prompt-color);
  margin-right: 10px;
  font-weight: bold;
  flex-shrink: 0;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

/* The real input is hidden but keeps focus */
#hidden-input {
  position: absolute;
  opacity: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: default;
}

/* The visible text mirroring the input */
#typer {
  outline: none;
  border: none;
  white-space: pre;
}

/* The Block Cursor */
.cursor {
  display: inline-block;
  width: 12px;
  height: 1.2em;
  background-color: var(--text-color);
  vertical-align: middle;
  margin-left: 1px;
  box-shadow: 0 0 5px var(--main-color, #33ff00), 0 0 15px var(--main-color, #33ff00);
  animation: blink 1s step-end infinite;
}

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

.error-text {
  color: var(--error-color);
}

.analytics-header {
  color: var(--art-color);
  font-weight: bold;
}

.analytics-value {
  color: #fff;
}

a {
  color: inherit;
  text-decoration: underline;
}

a:hover {
  background-color: var(--text-color);
  color: var(--bg-color);
  text-decoration: none;
}

.iconify {
  width: 18px;
  height: 18px;
  vertical-align: -0.2em;
  /* Aligns icon with text baseline */
  margin-right: 8px;
  display: inline-block;
}

/* --- SCANLINES & CRT EFFECTS --- */

.screen::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
              linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(var(--main-color-rgb, 51, 255, 0), 0.02), rgba(0, 0, 255, 0.06));
  z-index: 2;
  background-size: 100% var(--scanline-height, 4px), var(--scanline-width, 6px) 100%;
  pointer-events: none;
}

.screen::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: rgba(18, 16, 16, 0.1);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  animation: scroll-line 8s linear infinite;
}

@keyframes flicker {
  0% { opacity: 0.98; }
  50% { opacity: 0.95; text-shadow: 0 0 2px var(--glow-color, #138a03), 0 0 5px var(--main-color, #33ff00); }
  100% { opacity: 1; }
}

@keyframes scroll-line {
  0% { transform: translateY(-100%); background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(var(--main-color-rgb, 51, 255, 0), 0.05) 50%, rgba(0,0,0,0) 100%); opacity: 1; }
  10% { opacity: 0.3; }
  100% { transform: translateY(100%); background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(var(--main-color-rgb, 51, 255, 0), 0.05) 50%, rgba(0,0,0,0) 100%); opacity: 0; }
}

/* --- UPDATED STATUS BAR --- */
#status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--status-bar-height, 100px);
  /* Increased height */

  /* Dark gray background to make the white robot pop */
  background-color: var(--bg-color);
  border-top: 2px solid var(--prompt-color);

  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  box-sizing: border-box;
  z-index: 1000;
}

.status-left,
.status-right {
  color: var(--text-color);
  font-family: var(--font-stack);
  font-size: var(--status-bar-font-size, 12px);
  opacity: 0.8;
}

.status-right {
  display: flex;
  gap: 15px;
  align-items: center;
}

.status-right a {
  text-decoration: none;
  font-size: 18px;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.status-right a:hover {
  background-color: transparent;
  color: #fff;
}

/* --- PDF PREVIEW OVERLAY --- */
.pdf-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pdf-overlay-content {
  width: 85vw;
  height: 85vh;
  background: #001100;
  border: 2px solid var(--main-color, #33ff00);
  border-radius: 0.5rem;
  box-shadow: 0 0 15px var(--glow-color, #138a03), 0 0 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pdf-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 2px solid var(--main-color, #33ff00);
  color: var(--text-color);
  font-family: var(--font-stack);
  text-shadow: 0 0 3px var(--glow-color, #138a03), 0 0 8px var(--main-color, #33ff00);
  flex-shrink: 0;
}

.pdf-overlay-title {
  font-size: 1.25rem;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-overlay-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  margin-left: 1rem;
}

.pdf-overlay-actions a {
  font-size: 1.1rem;
  text-decoration: none;
}

.pdf-close-button {
  background: none;
  border: none;
  color: var(--text-color);
  font-family: var(--font-stack);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.pdf-close-button:hover,
.pdf-overlay-actions a:hover {
  background-color: var(--text-color);
  color: var(--bg-color);
}

.pdf-overlay-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

.pdf-overlay-body {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-color);
  font-family: var(--font-stack);
  font-size: 1.5rem;
  text-shadow: 0 0 3px var(--glow-color, #138a03), 0 0 8px var(--main-color, #33ff00);
}

@media (hover: none) and (pointer: coarse) {
  .pdf-overlay-content {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}

/* Terminal scrolling is handled inside the .screen block */

@media (hover: none) and (pointer: coarse) {
  body {
    align-items: flex-start;
  }
  .monitor {
    width: 100vw;
    height: calc(100vh - var(--status-bar-height, 75px));
    height: calc(100dvh - var(--status-bar-height, 75px));
    padding: 0;
    border-radius: 0;
    transform: none;
    box-sizing: border-box;
  }
  .screen {
    border-radius: 0;
  }
  #terminal {
    padding: 1rem;
    padding-bottom: 4rem;
  }
}
