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

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  overflow-y: auto;
}

.crt {
  position: relative;
  width: 100%;
  max-width: 800px;
  min-height: 100vh;
  padding: 2rem;
  padding-top: 3.5rem;
  background: #0a0a0a;
  border: 2px solid #333;
  box-shadow: 0 0 60px rgba(0, 255, 0, 0.1), inset 0 0 60px rgba(0, 0, 0, 0.5);
}

.crt::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, rgba(0,40,0,0.1) 0%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 10;
}

.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 11;
}

/* Toolbar */
.toolbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #111;
  border-bottom: 1px solid #333;
  z-index: 20;
}

.toolbar-btn {
  background: transparent;
  border: 1px solid #555;
  color: #888;
  font-family: inherit;
  font-size: 11px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.toolbar-btn:hover {
  color: #00ff41;
  border-color: #00ff41;
}

.toolbar-btn.active {
  color: #00ff41;
  border-color: #00ff41;
}

#screen {
  position: relative;
  z-index: 5;
  color: #00ff41;
  font-size: 14px;
  line-height: 1.6;
}

#output {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.text-green { color: #00ff41; }
.text-amber { color: #ffb000; }
.text-cyan { color: #00e5ff; }
.text-red { color: #ff4444; }
.text-white { color: #ffffff; }
.text-dim { color: #555555; }
.text-magenta { color: #ff44ff; }
.text-bold { font-weight: 700; }

.title-block {
  color: #ffb000;
  font-weight: 700;
  text-align: center;
  margin: 1rem 0;
}

.border-top, .border-bottom {
  color: #ffb000;
  text-align: center;
}

#input-line {
  display: flex;
  align-items: center;
  margin-top: 1rem;
}

#input-line.hidden {
  display: none;
}

.prompt {
  color: #00ff41;
  font-weight: 700;
  margin-right: 0.5rem;
}

#input {
  background: transparent;
  border: none;
  color: #00ff41;
  font-family: inherit;
  font-size: inherit;
  outline: none;
  flex: 1;
  caret-color: #00ff41;
}

#input::selection {
  background: #00ff41;
  color: #000;
}

/* Blinking cursor — positioned after the input text */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Flicker effect */
@keyframes flicker {
  0% { opacity: 0.97; }
  5% { opacity: 0.95; }
  10% { opacity: 0.97; }
  15% { opacity: 0.94; }
  20% { opacity: 0.98; }
  100% { opacity: 0.97; }
}

.crt {
  animation: flicker 4s infinite;
}

/* Responsive */
@media (max-width: 600px) {
  .crt {
    padding: 1rem;
    padding-top: 3.5rem;
  }
  #screen {
    font-size: 12px;
  }
}

/* Tooltip */
.tooltip-trigger {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted #00e5ff;
}

.tooltip-trigger:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #1a1a1a;
  color: #00ff41;
  border: 1px solid #00e5ff;
  padding: 0.5rem 0.75rem;
  font-size: 12px;
  line-height: 1.4;
  max-width: 350px;
  width: max-content;
  white-space: normal;
  z-index: 100;
  margin-bottom: 4px;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.tooltip-trigger[data-url]:hover::before {
  content: '[click to read more]';
  position: absolute;
  bottom: calc(100% + 1.8rem);
  left: 0;
  color: #ffb000;
  font-size: 10px;
  white-space: nowrap;
  z-index: 101;
}

.tooltip-trigger[data-url] {
  cursor: pointer;
}
