@import url('css');

/* =========================================
   Cutorline14 - Terminal Hacker (v4)
   Negro + rojo, detalles verde.
   Fondo: CRT + grid sutil (sin bailes raros)
   ========================================= */

:root{
  --bg: #040405;
  --panel: rgba(0,0,0,0.72);
  --panel2: rgba(0,0,0,0.86);

  --green: #39ff14;
  --green-dim: rgba(57,255,20,0.55);

  --red: #ff0033;
  --red-dim: rgba(255,0,51,0.32);
  --red-dark: #86070d;

  --text: rgba(230,255,235,0.92);
  --muted: rgba(230,255,235,0.70);

  --border: rgba(255,0,51,0.32);
  --border2: rgba(57,255,20,0.16);

  --glow-red: 0 0 18px rgba(255,0,51,0.22), 0 0 46px rgba(255,0,51,0.10);
  --glow-green: 0 0 16px rgba(57,255,20,0.16), 0 0 40px rgba(57,255,20,0.06);

  --radius: 18px;
  --radius-sm: 12px;

  --shadow: 0 18px 60px rgba(0,0,0,0.70);
  --mono: 'Fira Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*{ box-sizing: border-box; }
html, #viewport{ position: fixed; inset: 0; overflow: hidden; }

/* All UI is inside a fixed viewport so the browser can't scroll the document
   while dragging a text selection. Keep things centered on any screen size. */
#viewport{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px 14px;
}

/* Pages with long content (cmds/status): keep header visible and scroll inside panels */
body.page--doc #viewport{ justify-content: flex-start; }
body.page--doc .term-wrap{ flex: 1 1 auto; display:flex; align-items: stretch; }
body.page--doc .term{ display:flex; flex-direction: column; max-height: calc(100svh - 170px); max-height: calc(100dvh - 170px); }
body.page--doc .panel{ flex: 1 1 auto; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

body{ height: 100%; overflow: hidden; }

html{
  overflow: hidden;
  overscroll-behavior: none;
  scroll-behavior: auto;
}


body{
  margin: 0;
  font-family: var(--mono);
  color: var(--text);
  background: #000;
  overflow: hidden;
  /* Evita "saltos" por scroll anchoring cuando hay selección */
  overflow-anchor: none;
}

::selection{ background: rgba(255,0,51,0.32); color: rgba(255,255,255,0.92); }

/* ===== Fondo hacker (Cyber grid + network canvas) ===== */
.bg-canvas{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  pointer-events: none;
  opacity: 0.88;
}

/* Scanlines + vignette + grid */
body::before{
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;

  /* CRT scanlines + vignette */
  background:
    radial-gradient(circle at 50% 40%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.38) 62%, rgba(0,0,0,0.92) 100%),
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.035) 0px,
      rgba(255,255,255,0.03) 1px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0) 4px
    );
  opacity: 0.85;
}

/* Glow HUD (sutil) */
body::after{
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(900px 700px at 16% 24%, rgba(255,0,51,0.16), transparent 62%),
    radial-gradient(1000px 800px at 86% 28%, rgba(57,255,20,0.12), transparent 64%),
    radial-gradient(1100px 900px at 50% 110%, rgba(255,0,51,0.08), transparent 66%);
  opacity: 0.78;
}

/* Si el usuario está seleccionando/arrastrando: congelamos TODO lo animado */
body.is-freeze::before,
body.is-freeze::after{ animation-play-state: paused; }

/* Y evitamos "botes" por hover/transitions mientras seleccionas */
body.is-freeze .logo,
body.is-freeze .chip,
body.is-freeze .btn{ transition: none !important; }

body.is-freeze .logo:hover,
body.is-freeze .chip:hover,
body.is-freeze .btn:hover{ transform: none !important; }

@media (prefers-reduced-motion: reduce){
  *{ animation: none !important; transition: none !important; }
}

/* Layout */
.page{
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 22px 14px;
}

.topbar{
  width: min(980px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px 0;
}

.logo{
  width: 86px;
  height: 86px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(255,0,51,0.35));
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}

.logo:hover{
  transform: translateY(-1px) scale(1.02);
  filter: drop-shadow(0 0 18px rgba(57,255,20,0.20)) drop-shadow(0 0 18px rgba(255,0,51,0.35));
}

.badges{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.badge{
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.45);
  box-shadow: var(--glow-red);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .2px;
}

.term-wrap{ width: min(980px, 100%); }

.term{
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0,0,0,0.90), rgba(0,0,0,0.62));
  box-shadow: var(--shadow), var(--glow-red), var(--glow-green);
  overflow: hidden;
}

.term__bar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.76);
  border-bottom: 1px solid rgba(255,0,51,0.22);
}

.dots{ display:flex; gap: 8px; align-items:center; }
.dot{ width: 11px; height: 11px; border-radius: 999px; box-shadow: 0 0 10px rgba(255,255,255,0.06); }
.dot.red{ background: var(--red); box-shadow: 0 0 18px rgba(255,0,51,0.35); }
.dot.green{ background: var(--green); box-shadow: 0 0 18px rgba(57,255,20,0.25); }
.dot.dark{ background: rgba(255,255,255,0.14); }

.term__title{
  flex: 1;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: rgba(230,255,235,0.78);
  text-transform: uppercase;
}

.term__hint{
  font-size: 12px;
  color: rgba(230,255,235,0.60);
  white-space: nowrap;
}

.kbd{
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(57,255,20,0.25);
  background: rgba(0,0,0,0.35);
  color: var(--green);
}

.term__screen{
  padding: 16px 16px 14px;
  min-height: 320px;
  max-height: min(70svh, 720px);
  overflow-y: scroll;
  overflow-x: hidden;
  line-height: 1.55;
  font-size: clamp(13px, 1.9vw, 14px);
  color: rgba(230,255,235,0.88);
  text-shadow: 0 0 12px rgba(57,255,20,0.06);
  -webkit-overflow-scrolling: touch;
  overflow-anchor: none; /* evita saltos raros */
  scrollbar-gutter: stable both-edges; /* evita cambios de ancho al aparecer scrollbar */
  overscroll-behavior: contain;
}

/*
  Al arrastrar selección dentro de un contenedor con scroll,
  algunos navegadores pueden auto-desplazar el contenedor unos px.
  Activamos esta clase SOLO durante el drag para evitar ese movimiento,
  sin romper el scroll normal con rueda/scrollbar.
*/
/* Nota: no tocamos overflow durante selección.
   Algunos navegadores (Chrome) resetean/clampan scrollTop al cambiar overflow
   y eso provoca el “salto hacia arriba”. Mantener overflow estable evita el bug.
*/

.term__screen::-webkit-scrollbar{ width: 10px; }
.term__screen::-webkit-scrollbar-thumb{
  background: rgba(255,0,51,0.25);
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.6);
}

.line{
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 6px 0;
}

.hr{
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,0,51,0.35), transparent);
  margin: 10px 0;
}

.prompt-line{ display:flex; align-items: baseline; gap: 8px; padding-top: 6px; border-top: 1px dashed rgba(255,0,51,0.22); }
.prompt{ color: var(--green); }
.path{ color: rgba(230,255,235,0.78); }
.prompt-end{ color: var(--red); }

.cmd-form{ display:flex; align-items: baseline; gap: 8px; width: 100%; }

.cmd-input{
  flex: 1;
  min-width: 40px;
  border: none;
  outline: none;
  background: transparent;
  color: rgba(230,255,235,0.95);
  font: inherit;
  caret-color: var(--red);
  padding: 0;
  /* iOS: evita el zoom al enfocar */
  font-size: 16px;
}

@media (min-width: 520px){
  .cmd-input{ font-size: inherit; }
}

.blink{ animation: blink 1s steps(1,end) infinite; }
body.is-freeze .blink{ animation-play-state: paused; }

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

/* Chips */
.chips{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px 14px;
  background: rgba(0,0,0,0.52);
  border-top: 1px solid rgba(57,255,20,0.12);
}

.chip{
  border: 1px solid rgba(57,255,20,0.22);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(0,0,0,0.35);
  color: rgba(230,255,235,0.84);
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  user-select: none;
  font-size: 12px;
}

.chip:hover{
  transform: translateY(-1px);
  border-color: rgba(255,0,51,0.35);
  box-shadow: var(--glow-red);
}

.chip strong{ color: var(--green); font-weight: 700; }

/* Program outputs */
.program{
  border: 1px solid rgba(57,255,20,0.12);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.28);
  box-shadow: 0 0 22px rgba(0,0,0,0.35);
}

.program pre{
  margin: 0;
  font: inherit;
  white-space: pre;
  line-height: 1.25;
}

.program .hint{
  margin: 0 0 8px 0;
  font-size: 12px;
  color: rgba(230,255,235,0.70);
}

/* Links/buttons */
a{ color: inherit; }
a.link{ color: var(--green); text-decoration: none; border-bottom: none; }
a.link:hover{ color: rgba(57,255,20,0.92); }

.btn{
  border: 1px solid rgba(57,255,20,0.22);
  border-radius: 12px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.35);
  color: rgba(230,255,235,0.86);
  cursor: pointer;
  font: inherit;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.btn:hover{ transform: translateY(-1px); border-color: rgba(255,0,51,0.35); box-shadow: var(--glow-red); }

/* Tables for commands/status */
.panel{ padding: 12px 14px 14px; }

.search{
  width: 100%;
  border: 1px solid rgba(255,0,51,0.25);
  border-radius: 12px;
  background: rgba(0,0,0,0.40);
  color: rgba(230,255,235,0.92);
  padding: 10px 12px;
  font: inherit;
  outline: none;
  margin: 12px 0 14px;
}
.search:focus{ border-color: rgba(57,255,20,0.25); box-shadow: var(--glow-green); }

.section-title{
  color: rgba(230,255,235,0.82);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 14px 0 10px;
}

.cmd-grid{ display:grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 760px){ .cmd-grid{ grid-template-columns: 1fr 1fr; } }

.card{
  border: 1px solid rgba(57,255,20,0.14);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.35);
  padding: 12px 12px;
  box-shadow: 0 0 18px rgba(0,0,0,0.35);
}

.card .label{ color: rgba(230,255,235,0.80); font-size: 12px; margin-bottom: 8px; }
.code{ display:flex; align-items:center; justify-content: space-between; gap: 10px; }
.code code{ color: var(--green); font-size: 12px; }
code{ font-family: var(--mono); background: rgba(0,0,0,0.25); border: 1px solid rgba(255,0,51,0.18); border-radius: 10px; padding: 8px 10px; }

/* Status */
.status-grid{ display:grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 760px){ .status-grid{ grid-template-columns: 1fr 1fr; } }

.status-item{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,0,51,0.18);
  background: rgba(0,0,0,0.35);
}

.status-item .name{ color: rgba(230,255,235,0.80); }

.pill{ padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(57,255,20,0.18); background: rgba(0,0,0,0.25); font-size: 12px; }
.pill.ok{ color: var(--green); border-color: rgba(57,255,20,0.28); }
.pill.bad{ color: var(--red); border-color: rgba(255,0,51,0.32); }

.meters{ display:grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 760px){ .meters{ grid-template-columns: 1fr 1fr 1fr; } }

.meter{ padding: 12px; border-radius: 14px; border: 1px solid rgba(57,255,20,0.14); background: rgba(0,0,0,0.35); }
.meter .t{ font-size: 12px; color: rgba(230,255,235,0.75); margin-bottom: 6px; }
.meter .v{ font-size: 18px; color: rgba(230,255,235,0.92); margin-bottom: 8px; }

.bar{ height: 10px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; border: 1px solid rgba(255,0,51,0.18); }
.bar > span{ display:block; height:100%; width:0%; background: linear-gradient(90deg, rgba(57,255,20,0.85), rgba(255,0,51,0.75)); box-shadow: 0 0 18px rgba(255,0,51,0.18); transition: width .35s ease; }

/* Tiny toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.78);
  border: 1px solid rgba(57,255,20,0.22);
  border-radius: 999px;
  padding: 10px 14px;
  color: rgba(230,255,235,0.90);
  box-shadow: var(--shadow), var(--glow-green);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show{ opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ===== Programas (cmatrix / sl) ===== */
.prog{
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(57,255,20,0.12);
  border-radius: 14px;
  background: rgba(0,0,0,0.30);
  white-space: pre;
  overflow: hidden;
  user-select: none; /* evita bugs al seleccionar un elemento que cambia */
}

.matrix-cv{
  display: block;
  width: 100%;
  height: clamp(220px, 44svh, 520px);
  border-radius: 12px;
  background: rgba(0,0,0,0.85);
}

.prog--matrix{
  color: rgba(57,255,20,0.88);
  text-shadow: 0 0 14px rgba(57,255,20,0.12);
}

.prog--sl{
  color: rgba(230,255,235,0.92);
  text-shadow: 0 0 12px rgba(255,0,51,0.10);
}


/* Lock page while dragging selection (prevents Chrome auto-scroll micro jumps) */
body.scroll-lock{ position: fixed; left:0; right:0; width:100%; overflow:hidden; }
html, body{ overscroll-behavior: none; }
.term__screen{ overscroll-behavior: contain; }


.badge .ok { color: var(--green); text-shadow: 0 0 6px rgba(0,255,120,.35); }

.badge .kbd{
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,255,120,.45);
  background: rgba(0,255,120,.08);
}




/* --- Fix: no shrink on long text / zoom --- */
.term, .terminal, .window, .panel { min-width: 0; }
.term__screen, .term__body, .term__content { min-width: 0; }

/* Search/input should never change terminal width */
input, textarea {
  max-width: 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Keep long text inside the search box */
.search input, .searchbox input, .cmds-search input, .filter input, input[type="text"] {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Terminal window sizing: responsive and stable */
.term, .terminal, .window {
  width: min(980px, 92vw);
  max-width: 92vw;
}

/* Prevent browser font autoscaling */
html { text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }


/* ===== Volume UI ===== */
:root{ --vol: 50%; }

.brand{ display:flex; align-items:center; gap:14px; }
.vol{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-left: 14px; /* separación del logo */
  padding:10px 12px;
  border-radius: 16px;
  border:1px solid rgba(255,40,40,.55);
  background: rgba(0,0,0,.55);
  box-shadow: 0 0 0 1px rgba(255,0,0,.12), 0 10px 30px rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  transform: translateY(-6px) scale(.98);
  filter: blur(.2px);
  opacity:0;
  pointer-events:none;
  transition: opacity .22s ease, transform .22s ease, filter .22s ease;
}
.vol--show{
  opacity:1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  pointer-events:auto;
}
.vol__label{
  display:flex; align-items:center; justify-content:space-between;
  font-size: 12px;
  letter-spacing: .06em;
  opacity:.9;
}
.vol__slider{
  -webkit-appearance:none;
  appearance:none;
  width: 170px;
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(0,255,120,.85) 0%, rgba(0,255,120,.85) var(--vol),
                    rgba(0,255,120,.12) var(--vol), rgba(0,255,120,.12) 100%);
  outline:none;
  border:1px solid rgba(255,40,40,.45);
  box-shadow: inset 0 0 10px rgba(0,255,120,.08);
}
.vol__slider::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0,255,120,.95);
  border: 1px solid rgba(0,0,0,.6);
  box-shadow: 0 0 10px rgba(0,255,120,.35);
  cursor: pointer;
}
.vol__slider::-moz-range-thumb{
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0,255,120,.95);
  border: 1px solid rgba(0,0,0,.6);
  box-shadow: 0 0 10px rgba(0,255,120,.35);
  cursor: pointer;
}
@media (max-width: 520px){
  .vol__slider{ width: 140px; }
  .brand{ gap:10px; }
}



/* --- Mobile: keep tip badges visible (no cut) --- */
@media (max-width: 520px){
  .topbar{
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }
  .badges{
    width: 100%;
    justify-content: center;
  }
  .badge{
    max-width: 92vw;
  }
  .logo{
    width: 72px;
    height: 72px;
  }
}

/* --- DOOM (js-dos iframe) --- */
.doom-wrap{
  border: 1px solid rgba(255,42,42,.55);
  border-radius: 14px;
  padding: 10px;
  margin: 12px 0;
  background: rgba(0,0,0,.55);
  box-shadow: 0 0 24px rgba(255,0,0,.08);
}
.doom-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:8px;
  gap:10px;
}
.doom-title{
  color: var(--green);
  font-family: var(--mono);
  letter-spacing: .12em;
}
.doom-fs{
  border: 1px solid rgba(255,42,42,.65);
  background: rgba(0,0,0,.35);
  color: var(--green);
  padding: 4px 10px;
  border-radius: 999px;
  cursor:pointer;
}
.doom-frame{
  width: 100%;
  height: min(62vh, 520px);
  border: 1px solid rgba(0,255,100,.18);
  border-radius: 12px;
  background: #000;
}
.doom-hint{
  margin-top: 8px;
  opacity: .7;
  font-size: 12px;
  text-align: center;
  color: rgba(210,210,210,.8);
}
@media (max-width: 680px){
  .doom-frame{ height: 52vh; }
}
