/* =========================================================
   RETRO CRT TERMINAL — OUR_NEXT_DATE  (sleek edition)
   ========================================================= */

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

html, body {
  height: 100%;
  width: 100%;
  background:
    radial-gradient(circle at 50% 25%, #181a26 0%, #0a0c14 55%, #03040a 100%);
  font-family: 'JetBrains Mono', 'Menlo', 'Courier New', Courier, monospace;
  overflow: hidden;
  color: #00ff9c;
}

/* ---------- MONITOR HOUSING ---------- */
.monitor-housing {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.monitor-bezel {
  width: min(94vw, 1180px);
  height: min(86vh, 760px);
  background:
    linear-gradient(160deg, #1c1d24 0%, #111218 45%, #0a0b10 100%);
  border-radius: 14px;
  padding: 18px 18px 28px 18px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.04),
    inset 0 0 25px rgba(0,0,0,0.6),
    0 24px 60px rgba(0,0,0,0.85),
    0 0 0 1px #000;
  position: relative;
}

/* ---------- THE SCREEN ---------- */
.screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #03060a;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    inset 0 0 80px rgba(0, 30, 20, 0.85),
    inset 0 0 160px rgba(0, 0, 0, 0.95);
  transform: perspective(1400px) rotateX(0.3deg);
}

.scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 255, 156, 0.035) 0px,
    rgba(0, 255, 156, 0.035) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none; z-index: 5;
  mix-blend-mode: screen;
}

.glow {
  position: absolute; inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 255, 156, 0.08) 0%,
    rgba(0, 0, 0, 0.0) 60%,
    rgba(0, 0, 0, 0.6) 100%
  );
  pointer-events: none; z-index: 4;
}

.flicker {
  position: absolute; inset: 0;
  background: rgba(0,255,156,0.015);
  animation: flicker 0.18s infinite;
  pointer-events: none; z-index: 6;
}
@keyframes flicker {
  0%, 100% { opacity: 0.96; }
  50%      { opacity: 1; }
}

/* ---------- CRT POWER-ON ---------- */
.power-on {
  position: absolute; inset: 0;
  z-index: 30;
  pointer-events: none;
  background: #000;
  display: block;
}
.power-on.animate {
  animation: powerOn 1.3s cubic-bezier(.2,.6,.2,1) forwards;
}
@keyframes powerOn {
  0%   { background: #000; transform: scaleY(0.001) scaleX(1); opacity: 1; }
  10%  { background: #fff; transform: scaleY(0.005) scaleX(1.001); opacity: 1; }
  18%  { background: #d8ffe9; transform: scaleY(0.02) scaleX(1.005); opacity: 1; }
  28%  { background: #aaffce; transform: scaleY(0.7) scaleX(1.01);  opacity: 0.85; }
  45%  { background: rgba(170,255,206,0.45); transform: scaleY(1.02) scaleX(1.005); opacity: 0.6; }
  65%  { background: rgba(0,255,156,0.18); transform: scaleY(1) scaleX(1); opacity: 0.35; }
  85%  { background: rgba(0,255,156,0.08); opacity: 0.18; }
  100% { background: rgba(0,0,0,0); opacity: 0; }
}

/* ---------- TERMINAL CONTENT ---------- */
.terminal {
  position: relative; z-index: 2;
  width: 100%; height: 100%;
  padding: 24px 32px 80px 32px;
  color: #00ff9c;
  text-shadow:
    0 0 3px rgba(0, 255, 156, 0.55),
    0 0 12px rgba(0, 255, 156, 0.25);
  font-size: 15px;
  line-height: 1.55;
  overflow-y: auto;
  overflow-x: hidden;
  letter-spacing: 0.2px;
}
.terminal.hidden-init { display: none; }

.terminal::-webkit-scrollbar { width: 6px; }
.terminal::-webkit-scrollbar-track { background: rgba(0, 80, 60, 0.1); }
.terminal::-webkit-scrollbar-thumb { background: rgba(0, 255, 156, 0.35); border-radius: 3px; }

.terminal-header {
  border-bottom: 1px solid rgba(0, 255, 156, 0.18);
  padding-bottom: 8px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.75;
  text-transform: uppercase;
}
.header-status { animation: blink-soft 1.4s infinite; }
@keyframes blink-soft {
  0%, 49%   { opacity: 0.4; }
  50%, 100% { opacity: 1; }
}

.terminal-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
}

.terminal-body .heart { color: #ff5b88; text-shadow: 0 0 5px #ff2244, 0 0 12px rgba(255, 50, 80, 0.6); }
.terminal-body .label { color: #6affc4; text-shadow: 0 0 3px rgba(106, 255, 196, 0.5); }
.terminal-body .value { color: #ffffff; text-shadow: 0 0 2px rgba(255, 255, 255, 0.5); }
.terminal-body .prompt-line { color: #66ffaa; }

.terminal-body .ascii {
  display: inline-block;
  color: #ff5b88;
  font-size: 11px;
  line-height: 1;
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  white-space: pre;
  text-shadow: 0 0 5px rgba(255, 80, 110, 0.55);
}

/* Live countdown */
.terminal-body .countdown {
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 0 0 4px rgba(0, 255, 156, 0.55), 0 0 12px rgba(0, 255, 156, 0.3);
}
.terminal-body .countdown.go {
  color: #ff5b88;
  text-shadow: 0 0 6px #ff2244, 0 0 14px rgba(255, 50, 80, 0.6);
  animation: blink-soft 0.8s infinite;
}

/* ----- Message banner (full width) ----- */
.terminal-body .msg-banner {
  display: block;
  width: 100%;
  border: 1px solid rgba(0, 255, 156, 0.6);
  padding: 14px 18px;
  margin: 6px 0 22px 0;
  text-align: center;
  letter-spacing: 1px;
  background: rgba(0, 255, 156, 0.04);
  box-shadow:
    0 0 0 1px rgba(0, 255, 156, 0.12),
    inset 0 0 18px rgba(0, 255, 156, 0.06);
}
.terminal-body .msg-banner-line1 {
  font-size: 14px;
  color: #ffffff;
  text-shadow: 0 0 4px rgba(0, 255, 156, 0.55);
  text-transform: uppercase;
}
.terminal-body .msg-banner-line2 {
  font-size: 11px;
  color: #6affc4;
  margin-top: 6px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ----- Photo strip ----- */
.terminal-body .photo-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 22px 0;
  max-width: 720px;
}
.terminal-body .photo-item {
  display: flex; flex-direction: column; gap: 6px;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  filter: blur(2px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(.34,1.4,.6,1), filter 0.45s ease;
}
.terminal-body .photo-item.shown {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}
.terminal-body .photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(0, 255, 156, 0.55);
  background: #000;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 255, 156, 0.12),
    0 0 18px rgba(0, 255, 156, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.terminal-body .photo-frame:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 0 0 1px rgba(0, 255, 156, 0.3),
    0 0 24px rgba(0, 255, 156, 0.35);
}
.terminal-body .photo-frame img {
  width: 100%; height: 100%; object-fit: cover;
}
.terminal-body .ph-fallback {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #00ff9c; font-size: 10px; text-align: center;
  text-shadow: 0 0 5px rgba(0,255,156,0.6);
  line-height: 1.6; letter-spacing: 1px;
}
.terminal-body .photo-caption {
  font-size: 9px;
  color: #6affc4;
  text-align: left;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Cursor */
.cursor {
  display: inline-block;
  width: 8px; height: 16px;
  background: #00ff9c;
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1s step-end infinite;
  box-shadow: 0 0 6px rgba(0, 255, 156, 0.8);
}
@keyframes blink {
  0%, 50%    { opacity: 1; }
  51%, 100%  { opacity: 0; }
}

/* ---------- BUTTONS ---------- */
.cancel-btn,
.confirm-btn {
  font-family: inherit;
  font-size: 13px;
  padding: 10px 18px;
  background: rgba(5, 10, 8, 0.85);
  color: #ff4477;
  border: 1px solid rgba(255, 68, 119, 0.7);
  cursor: pointer;
  text-shadow: 0 0 5px rgba(255, 70, 119, 0.7);
  box-shadow:
    0 0 10px rgba(255, 70, 119, 0.25),
    inset 0 0 6px rgba(255, 70, 119, 0.1);
  letter-spacing: 2px;
  z-index: 10;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1),
              left 0.18s cubic-bezier(.34,1.56,.64,1),
              top 0.18s cubic-bezier(.34,1.56,.64,1);
  user-select: none;
  text-transform: uppercase;
  backdrop-filter: blur(2px);
}
/* CANCEL: starts inline below confirm, then runaway logic switches it to absolute */
.cancel-btn {
  display: block;
  margin: 14px auto 0;
}
.cancel-btn.runaway {
  position: absolute;
  margin: 0;
}
/* CONFIRM lives in the document flow at the end of the typed content */
.confirm-btn {
  position: static;
  display: block;
  margin: 8px auto 6px;
  bottom: auto; right: auto; left: auto; top: auto;
  color: #00ff9c;
  border-color: rgba(0, 255, 156, 0.7);
  text-shadow: 0 0 6px rgba(0, 255, 156, 0.8);
  box-shadow:
    0 0 12px rgba(0, 255, 156, 0.35),
    inset 0 0 6px rgba(0, 255, 156, 0.15);
  font-size: 16px;
  padding: 14px 28px;
  letter-spacing: 3px;
}
.confirm-btn:hover { background: #00ff9c; color: #000; transform: scale(1.04); }
.cancel-btn.hidden, .confirm-btn.hidden { display: none; }
.confirm-slot {
  display: block;
  text-align: center;
  margin: 18px 0 10px;
}

/* ---------- CONFIRM OVERLAY ---------- */
.confirm-overlay {
  position: absolute; inset: 0;
  background: rgba(3, 6, 10, 0.97);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  z-index: 20;
  padding: 30px;
}
.confirm-overlay.active { display: flex; }
.confirm-overlay pre {
  color: #ff5b88;
  text-shadow: 0 0 6px #ff2244, 0 0 16px rgba(255, 50, 80, 0.55);
  font-size: 14px; line-height: 1.2;
  text-align: center;
  font-family: inherit; white-space: pre;
}
.overlay-back {
  background: transparent;
  color: #6affc4;
  border: 1px solid rgba(106, 255, 196, 0.6);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  text-shadow: 0 0 4px rgba(106, 255, 196, 0.5);
  text-transform: uppercase;
}
.overlay-back:hover { background: rgba(106, 255, 196, 0.15); }

/* ---------- PASSWORD GATE ---------- */
.gate {
  position: absolute; inset: 0;
  z-index: 18;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  color: #00ff9c;
  text-shadow:
    0 0 3px rgba(0, 255, 156, 0.55),
    0 0 12px rgba(0, 255, 156, 0.25);
  font-size: 15px;
  letter-spacing: 0.2px;
  background: transparent;
  transition: opacity 0.4s ease;
}
.gate.fade-out { opacity: 0; }
.gate.shake { animation: shake 0.5s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.gate-body {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.gate-line {
  color: #66ffaa;
  margin-bottom: 6px;
  opacity: 0;
  animation: gateFadeIn 0.4s forwards;
}
.gate-line:nth-child(1) { animation-delay: 0.8s; }
.gate-line:nth-child(2) { animation-delay: 1.3s; }
.gate-spacer { height: 22px; }
.gate-prompt {
  display: flex; flex-direction: column;
  margin-bottom: 14px;
  opacity: 0;
  animation: gateFadeIn 0.4s 1.8s forwards;
}
.gate-q { color: #ffffff; font-size: 16px; }
.gate-format { color: #6affc4; font-size: 11px; letter-spacing: 1.5px; margin-top: 4px; opacity: 0.85; }
.gate-form {
  display: flex; gap: 10px; align-items: center;
  border: 1px dashed rgba(0, 255, 156, 0.4);
  padding: 12px 14px;
  opacity: 0;
  animation: gateFadeIn 0.4s 2.1s forwards;
}
.gate-caret { color: #66ffaa; }
#gateInput {
  flex: 1;
  background: transparent;
  border: none; outline: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 2px;
  caret-color: #00ff9c;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.5);
}
#gateInput::placeholder { color: rgba(106, 255, 196, 0.45); letter-spacing: 4px; }
/* Suppress browser autofill yellow background */
#gateInput:-webkit-autofill,
#gateInput:-webkit-autofill:focus,
#gateInput:-webkit-autofill:hover {
  -webkit-box-shadow: 0 0 0 30px transparent inset !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #00ff9c !important;
  transition: background-color 9999s ease-in-out 0s;
}
.gate-submit {
  background: transparent;
  color: #00ff9c;
  border: 1px solid rgba(0, 255, 156, 0.6);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  text-shadow: 0 0 4px rgba(0, 255, 156, 0.6);
  text-transform: uppercase;
}
.gate-submit:hover { background: rgba(0, 255, 156, 0.15); }
.gate-msg {
  margin-top: 12px;
  font-size: 13px;
  letter-spacing: 1px;
  min-height: 18px;
}
.gate-msg.ok  { color: #00ff9c; text-shadow: 0 0 5px rgba(0, 255, 156, 0.6); }
.gate-msg.err { color: #ff4477; text-shadow: 0 0 5px rgba(255, 70, 119, 0.6); animation: blink-soft 0.6s infinite; }

@keyframes gateFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- PHOTO VIEWER ---------- */
.photo-viewer {
  position: absolute; inset: 0;
  background: rgba(3, 6, 10, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 25;
  padding: 28px;
  cursor: zoom-out;
}
.photo-viewer.active { display: flex; }
.viewer-frame {
  position: relative;
  max-width: 96%;
  max-height: 92%;
  border: 1px solid rgba(0, 255, 156, 0.6);
  background: #000;
  box-shadow: 0 0 40px rgba(0, 255, 156, 0.35);
  display: flex; flex-direction: column;
  cursor: default;
}
.viewer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 255, 156, 0.35);
  font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase;
  background: rgba(0, 255, 156, 0.05);
}
.viewer-name { color: #6affc4; }
.viewer-close {
  background: transparent;
  color: #ff4477;
  border: 1px solid rgba(255, 68, 119, 0.6);
  padding: 4px 10px;
  font-family: inherit; font-size: 11px;
  cursor: pointer;
  text-shadow: 0 0 4px rgba(255, 70, 119, 0.6);
  letter-spacing: 1px;
}
.viewer-close:hover { background: rgba(255, 70, 119, 0.15); }
.viewer-frame img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 80px);
  object-fit: contain;
}

/* ---------- POWER LED ---------- */
.brand {
  position: absolute;
  bottom: 8px; right: 14px;
  display: flex; align-items: center; gap: 8px;
}
.brand-led {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4dff8a;
  box-shadow: 0 0 6px #4dff8a, 0 0 12px rgba(77, 255, 138, 0.6);
  animation: led-pulse 2.5s infinite;
}
@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* ---------- MONITOR STAND ---------- */
.monitor-neck {
  width: 60px; height: 18px;
  background: linear-gradient(180deg, #1c1d24, #0a0b10);
  margin-top: -1px;
  border-radius: 0 0 6px 6px;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.5);
}
.monitor-base {
  width: 180px; height: 8px;
  background: linear-gradient(180deg, #1c1d24, #0a0b10);
  border-radius: 50%/100% 100% 0 0;
  margin-top: -1px;
  box-shadow:
    inset 0 -2px 4px rgba(0,0,0,0.5),
    0 14px 30px rgba(0,0,0,0.7);
}

/* ============================================================
   RESPONSIVE — TABLET
   ============================================================ */
@media (max-width: 900px) {
  .monitor-bezel { padding: 14px 14px 24px 14px; height: 90vh; }
  .terminal { padding: 20px 22px 80px 22px; font-size: 14px; }
  .terminal-body { font-size: 14px; }
  .terminal-body .ascii { font-size: 10px; }
  .gate { padding: 20px 22px; font-size: 14px; }
}

/* ============================================================
   RESPONSIVE — MOBILE (the important one)
   ============================================================ */
@media (max-width: 560px) {
  .monitor-housing { width: 100%; }
  .monitor-bezel {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    padding: 10px 8px 18px 8px;
  }
  .monitor-neck, .monitor-base { display: none; }

  .screen { border-radius: 4px; }

  .terminal { padding: 14px 10px 90px 10px; font-size: 11px; }
  .terminal-body { font-size: 11px; }
  .terminal-body .ascii { font-size: 9px; }

  .terminal-header { font-size: 9px; letter-spacing: 1.5px; }

  /* Photos: keep 3-up but tighter, OR stack on very narrow screens */
  .terminal-body .photo-strip { gap: 6px; max-width: 100%; }
  .terminal-body .photo-caption { font-size: 8px; letter-spacing: 0.5px; }

  /* Buttons */
  .cancel-btn, .confirm-btn {
    font-size: 11px; padding: 8px 12px;
    bottom: 14px; letter-spacing: 1.5px;
  }
  .cancel-btn { left: 14px; }
  .confirm-btn { right: 14px; }

  /* Gate */
  .gate { padding: 14px 14px; font-size: 13px; }
  .gate-q { font-size: 14px; }
  #gateInput { font-size: 14px; letter-spacing: 1.5px; }
  .gate-submit { font-size: 10px; padding: 6px 10px; }
  .gate-form { padding: 10px 12px; gap: 8px; }

  /* Banner */
  .terminal-body .msg-banner { padding: 10px 12px; margin-bottom: 16px; }
  .terminal-body .msg-banner-line1 { font-size: 11px; letter-spacing: 0.5px; }
  .terminal-body .msg-banner-line2 { font-size: 9px; letter-spacing: 1px; }

  /* Confirm overlay */
  .confirm-overlay pre { font-size: 11px; }
  .confirm-btn { font-size: 14px; padding: 12px 22px; letter-spacing: 2px; }

  /* Photo viewer */
  .photo-viewer { padding: 12px; }
  .viewer-header { padding: 6px 10px; font-size: 10px; }
}

/* Stack photos to 1 col on very narrow screens */
@media (max-width: 420px) {
  .terminal-body .photo-strip {
    grid-template-columns: 1fr;
    max-width: 260px;
    margin-left: auto;
    margin-right: auto;
    gap: 10px;
  }
  .terminal-body .photo-caption { font-size: 9px; text-align: center; }
}
