/* ── Reset & Base ─────────────────────────────────────── */

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

body {
  background: #0a0a0a;
  color: #33ff33;
  font-family: 'Fira Mono', 'Courier New', monospace;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* ── Scanline overlay ────────────────────────────────── */

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
}

/* ── Terminal container ──────────────────────────────── */

.terminal {
  width: 100%;
  max-width: 620px;
  padding: 2.5rem 2rem;
  border: 1px solid #1a3a1a;
  border-radius: 4px;
  background: rgba(5, 15, 5, 0.85);
  box-shadow:
    0 0 30px rgba(51, 255, 51, 0.05),
    inset 0 0 60px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 1;
}

/* ── Header ──────────────────────────────────────────── */

.terminal-header {
  text-align: center;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid #1a3a1a;
  padding-bottom: 1.5rem;
}

.classification {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: #557755;
  margin-bottom: 0.75rem;
}

.restricted-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #33ff33;
  letter-spacing: 0.08em;
  text-shadow: 0 0 20px rgba(51, 255, 51, 0.4);
  animation: pulse-glow 3s ease-in-out infinite;
}

.security-level {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: #557755;
  letter-spacing: 0.15em;
}

.level-iubire {
  color: #ff6b9d;
  text-shadow: 0 0 8px rgba(255, 107, 157, 0.4);
}

/* ── Riddle ───────────────────────────────────────────── */

.riddle-container {
  margin-bottom: 2rem;
}

.riddle-label {
  font-size: 0.75rem;
  color: #448844;
  margin-bottom: 1.2rem;
  animation: blink-underscore 1s step-end infinite;
}

.riddle-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: #ccddcc;
  border-left: 3px solid #33ff33;
  padding: 0.8rem 1rem;
  margin-bottom: 2rem;
  background: rgba(51, 255, 51, 0.03);
  line-height: 1.6;
}

/* ── Form ─────────────────────────────────────────────── */

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #225522;
  border-radius: 3px;
  padding: 0.6rem 0.8rem;
  background: rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-row:focus-within {
  border-color: #33ff33;
  box-shadow: 0 0 12px rgba(51, 255, 51, 0.15);
}

.prompt {
  color: #33ff33;
  font-weight: 700;
  flex-shrink: 0;
}

#answer-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #33ff33;
  font-family: 'Fira Mono', monospace;
  font-size: 1rem;
  caret-color: #33ff33;
}

#answer-input::placeholder {
  color: #2a5a2a;
}

#submit-btn {
  background: transparent;
  border: 1px solid #33ff33;
  color: #33ff33;
  font-family: 'Fira Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 0.75rem 1.5rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.25s, box-shadow 0.25s, color 0.25s;
}

#submit-btn:hover {
  background: rgba(51, 255, 51, 0.1);
  box-shadow: 0 0 18px rgba(51, 255, 51, 0.2);
}

#submit-btn:active {
  background: rgba(51, 255, 51, 0.2);
}

#submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Status message ──────────────────────────────────── */

.status-message {
  min-height: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  margin-top: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: color 0.3s;
}

.status-message.granted {
  color: #33ff33;
  text-shadow: 0 0 15px rgba(51, 255, 51, 0.5);
  animation: glow-in 0.6s ease-out;
}

.status-message.denied {
  color: #ff3333;
  text-shadow: 0 0 10px rgba(255, 51, 51, 0.4);
  animation: shake 0.5s ease-in-out;
}

/* ── Footer ──────────────────────────────────────────── */

.terminal-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #1a3a1a;
}

.terminal-footer p {
  font-size: 0.65rem;
  color: #334433;
  letter-spacing: 0.1em;
}

/* ── Animations ──────────────────────────────────────── */

@keyframes pulse-glow {
  0%, 100% {
    text-shadow: 0 0 20px rgba(51, 255, 51, 0.4);
  }
  50% {
    text-shadow: 0 0 35px rgba(51, 255, 51, 0.7), 0 0 60px rgba(51, 255, 51, 0.2);
  }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
  20%, 40%, 60%, 80% { transform: translateX(6px); }
}

@keyframes glow-in {
  0% {
    opacity: 0;
    text-shadow: 0 0 0 transparent;
  }
  100% {
    opacity: 1;
    text-shadow: 0 0 15px rgba(51, 255, 51, 0.5);
  }
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 640px) {
  .terminal {
    margin: 1rem;
    padding: 1.5rem 1.2rem;
  }

  .restricted-title {
    font-size: 1.3rem;
  }

  .riddle-text {
    font-size: 1rem;
  }
}
