/* ==========================================================================
   Terminal hacker del Cripto-Casino: fondo negro, fósforo verde/cian, cursor parpadeante y
   scanlines propias. Se abre con la tecla ~ o con el botón >_ del HUD.
   ========================================================================== */

.terminal {
  width: min(96vw, 860px);
  max-width: none;
  height: min(78vh, 620px);
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--cy-accent, #3fd98a);
  border-radius: 0;
  background: #010302;
  color: #b8ffd6;
  font: 0.86rem/1.5 var(--font-mono, ui-monospace, Consolas, monospace);
  box-shadow: 0 0 0 2px #000, 0 30px 0 rgba(0, 0, 0, 0.85);
}

.terminal[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  animation: term-in 0.28s var(--ease-out, ease-out);
}

.terminal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(63, 217, 138, 0.25);
  background: #07120b;
}

.term-dots {
  display: inline-flex;
  gap: 6px;
}

.term-dots i {
  width: 11px;
  height: 11px;
  border-radius: 0;
  background: #ff5f57;
}

.term-dots i:nth-child(2) {
  background: #febc2e;
}

.term-dots i:nth-child(3) {
  background: #28c840;
}

.term-title {
  flex: 1;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #7fbf98;
  text-align: center;
}

.term-close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(63, 217, 138, 0.3);
  border-radius: 0;
  background: transparent;
  color: #b8ffd6;
  cursor: pointer;
}

.term-close:hover {
  background: rgba(63, 217, 138, 0.12);
}

.term-screen {
  position: relative;
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: 0;
  padding: 12px 14px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: radial-gradient(ellipse at 50% 0%, rgba(63, 217, 138, 0.06) 0% 17.5%, color-mix(in srgb, transparent 33%, rgba(63, 217, 138, 0.06)) 17.5% 35%, color-mix(in srgb, transparent 67%, rgba(63, 217, 138, 0.06)) 35% 52.5%, transparent 52.5% 70%, transparent 70%),
    #010302;
  text-shadow: none;
}

/* Scanlines del monitor, fijas (en la terminal solo se anima el cursor). */
html.has-crt .term-screen {
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 0%, rgba(63, 217, 138, 0.06) 0% 17.5%, color-mix(in srgb, transparent 33%, rgba(63, 217, 138, 0.06)) 17.5% 35%, color-mix(in srgb, transparent 67%, rgba(63, 217, 138, 0.06)) 35% 52.5%, transparent 52.5% 70%, transparent 70%),
    #010302;
}

.term-output {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.term-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.term-line.is-accent {
  color: #4cc4dc;
  text-shadow: none;
}

.term-line.is-ok {
  color: #3dff9a;
}

.term-line.is-warn {
  color: #ffd23f;
}

.term-line.is-error {
  color: #ff5c7a;
  text-shadow: none;
}

.term-line.is-dim {
  color: #5f9a76;
}

.term-line.is-prompt {
  margin-top: 6px;
  color: #3fd98a;
}

.term-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.term-prompt {
  flex: none;
  color: #3fd98a;
  font-weight: 700;
}

.term-input {
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #e6fff0;
  font: inherit;
  caret-color: #3fd98a;
  text-shadow: inherit;
}

.term-input:focus {
  outline: none;
}

.term-input-row::after {
  content: "";
  width: 9px;
  height: 1.1em;
  background: #3fd98a;
  box-shadow: none;
  animation: cursor-blink 1s steps(1) infinite;
}

/* Con el campo enfocado se ve el cursor real; el bloque parpadeante es para cuando no lo está. */
.term-input-row:focus-within::after {
  opacity: 0;
  animation: none;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

@keyframes term-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

@media (max-width: 600px) {
  .terminal {
    width: 100vw;
    height: 86vh;
    margin: auto 0 0;
    border-radius: 0;
    font-size: 0.78rem;
  }
}
