/* ============================================================
   HTerm — shared simulated hacker terminal for Hackbydoing
   Public free pages (Nmap command lab, Linux "Terminal Bandit").

   Theme: deep dark #0B0B1A family, purple #7B2FFF, cyan #00E5FF,
   neon green (#39ff6a) terminal accents. Deep black screen,
   glowing neon mono text, subtle scanlines, custom scrollbar,
   blinking block cursor. Mobile-first: the input is 16px (no
   iOS zoom-on-focus), touch targets are generous, and the
   screen scrolls internally inside a capped height.
   ============================================================ */

.ht-root {
  --ht-bg: #0b0b1a;
  --ht-bg-deep: #05050d;
  --ht-screen: #020208;
  --ht-panel: #12122b;
  --ht-panel-2: #181838;
  --ht-border: #2a2a55;
  --ht-purple: #7b2fff;
  --ht-purple-soft: #b78bff;
  --ht-cyan: #00e5ff;
  --ht-green: #39ff6a;
  --ht-green-dim: #1fae4e;
  --ht-text: #d8ffe2;
  --ht-red: #ff6b7a;
  --ht-amber: #ffc857;
  --ht-grey: #8b8bb3;
  --ht-gold: #ffd94d;
  --ht-pink: #ff5fd2;
  --ht-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--ht-panel-2), var(--ht-bg) 42%);
  border: 1px solid var(--ht-border);
  border-radius: 14px;
  overflow: hidden;
  color: var(--ht-text);
  font-family: var(--ht-mono);
  box-shadow:
    0 0 0 1px rgba(123, 47, 255, 0.22),
    0 18px 50px rgba(0, 0, 0, 0.55),
    0 0 42px rgba(123, 47, 255, 0.14);
  -webkit-tap-highlight-color: transparent;
}

.ht-root *,
.ht-root *::before,
.ht-root *::after {
  box-sizing: border-box;
}

/* ---------- Chrome / title bar ---------- */

.ht-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 14px;
  background: linear-gradient(90deg, rgba(123, 47, 255, 0.28), rgba(0, 229, 255, 0.10) 55%, rgba(123, 47, 255, 0.16));
  border-bottom: 1px solid var(--ht-border);
  user-select: none;
}

.ht-dots {
  display: inline-flex;
  gap: 8px;
  flex: 0 0 auto;
}

.ht-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.45), 0 0 6px rgba(0, 0, 0, 0.35);
}

.ht-dot-r { background: #ff5f57; }
.ht-dot-y { background: #febc2e; }
.ht-dot-g { background: #28c840; }

.ht-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #cfc6ff;
  text-shadow: 0 0 8px rgba(123, 47, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ht-chrome-badge {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ht-green);
  border: 1px solid rgba(57, 255, 106, 0.45);
  border-radius: 999px;
  padding: 3px 8px;
  text-shadow: 0 0 6px rgba(57, 255, 106, 0.6);
}

/* ---------- Screen ---------- */

.ht-screen {
  position: relative;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(123, 47, 255, 0.10), transparent 55%),
    var(--ht-screen);
  padding: 14px 14px 10px;
}

/* Subtle, performance-safe scanlines: a static repeating gradient
   overlay. No animation, no blur filters, pointer-transparent. */
.ht-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
}

.ht-output {
  position: relative;
  z-index: 1;
  max-height: min(430px, 52vh);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 2px 6px;
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: var(--ht-purple) var(--ht-bg-deep);
  -webkit-overflow-scrolling: touch;
}

.ht-output::-webkit-scrollbar { width: 10px; }
.ht-output::-webkit-scrollbar-track { background: var(--ht-bg-deep); }
.ht-output::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--ht-purple), var(--ht-green-dim));
  border-radius: 8px;
  border: 2px solid var(--ht-bg-deep);
}

/* ---------- Output lines ---------- */

.ht-line {
  white-space: pre-wrap;
  min-height: 1.55em;
  color: var(--ht-text);
  text-shadow: 0 0 5px rgba(57, 255, 106, 0.16);
}

.ht-line:empty::before { content: "\00a0"; }

.ht-l-cmd  { color: var(--ht-cyan); font-weight: 700; text-shadow: 0 0 7px rgba(0, 229, 255, 0.45); }
.ht-l-ok   { color: var(--ht-green); text-shadow: 0 0 7px rgba(57, 255, 106, 0.45); }
.ht-l-err  { color: var(--ht-red); }
.ht-l-warn { color: var(--ht-amber); }
.ht-l-dim  { color: var(--ht-grey); text-shadow: none; }
.ht-l-sys  { color: var(--ht-purple-soft); text-shadow: 0 0 7px rgba(123, 47, 255, 0.4); }
.ht-l-flag { color: var(--ht-gold); font-weight: 700; text-shadow: 0 0 9px rgba(255, 217, 77, 0.55); }
.ht-l-vex  { color: var(--ht-pink); text-shadow: 0 0 7px rgba(255, 95, 210, 0.4); }

.ht-line a {
  color: var(--ht-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Input line ---------- */

.ht-input-line {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 48px; /* touch-friendly */
  padding: 6px 2px 2px;
  border-top: 1px dashed rgba(123, 47, 255, 0.35);
  cursor: text;
}

.ht-prompt {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ht-green);
  text-shadow: 0 0 8px rgba(57, 255, 106, 0.65);
  white-space: pre;
}

.ht-input-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

.ht-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  /* 16px minimum: prevents iOS Safari zoom-on-focus. Do not lower. */
  font-size: 16px;
  line-height: 1.4;
  font-family: inherit;
  font-weight: 600;
  color: #eaffef;
  background: transparent;
  border: 0;
  outline: none;
  padding: 8px 2px;
  margin: 0;
  caret-color: transparent; /* the block cursor below is the caret */
  text-shadow: 0 0 6px rgba(57, 255, 106, 0.3);
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
}

.ht-input::placeholder { color: rgba(139, 139, 179, 0.75); text-shadow: none; }
.ht-input:disabled { opacity: 0.45; }

/* Blinking block cursor, positioned by hterm.js over the text. */
.ht-cursor {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 9px;
  height: 1.25em;
  transform: translateY(-50%);
  background: var(--ht-green);
  box-shadow: 0 0 10px rgba(57, 255, 106, 0.85);
  pointer-events: none;
  opacity: 0;
}

.ht-root.ht-focused .ht-cursor {
  opacity: 1;
  animation: ht-blink 1.06s steps(1) infinite;
}

.ht-root.ht-locked .ht-cursor { animation: none; opacity: 0.35; }

@keyframes ht-blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

/* Hidden text measurer used to place the block cursor. */
.ht-measure {
  position: absolute;
  visibility: hidden;
  white-space: pre;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  pointer-events: none;
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  .ht-root { border-radius: 10px; }
  .ht-screen { padding: 10px 10px 8px; }
  .ht-output { font-size: 14px; max-height: min(380px, 50vh); }
  .ht-title { font-size: 11px; letter-spacing: 0.16em; text-align: left; }
  .ht-chrome-badge { display: none; }
  .ht-prompt { font-size: 16px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .ht-root.ht-focused .ht-cursor { animation: none; }
  .ht-screen::after { display: none; }
}
