/* Code rain */
#rain {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: 0.12;
}

/* Scan lines */
.scan-overlay {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 1px, transparent 1px, transparent 3px);
  pointer-events: none;
  z-index: 10;
}

/* Scene */
.scene {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.4s;
}
.scene.on { opacity: 1; }

/* Computer (desktop) */
.computer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.monitor-body {
  background: linear-gradient(170deg, #2e2e2e, #1a1a1a);
  border-radius: 16px 16px 8px 8px;
  padding: 18px 20px 26px;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 80px rgba(0,255,0,0.03);
}

.screen {
  width: 92vw;
  max-width: 820px;
  height: 80vh;
  max-height: 600px;
  background: #0a0a0a;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.6), inset 0 0 4px rgba(0,255,0,0.04);
}

.screen-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
}

.screen-glare {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 40%, transparent 60%, rgba(255,255,255,0.01) 100%);
  pointer-events: none;
  z-index: 20;
}

.screen-content {
  position: absolute;
  inset: 0;
  padding: 16px 20px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s;
  overflow: hidden;
}
.screen-content.on { opacity: 1; }

/* Terminal output */
.terminal-output {
  flex: 1;
  overflow-y: auto;
  font-size: 0.75rem;
  line-height: 1.7;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.terminal-output::-webkit-scrollbar { width: 4px; }
.terminal-output::-webkit-scrollbar-thumb { background: #333; }

/* Message types */
.msg { margin-bottom: 8px; word-wrap: break-word; white-space: pre-wrap; }
.msg-system { color: #0a0; opacity: 0.5; font-size: 0.6rem; }
.msg-bot { color: #0F0; }
.msg-user { color: #fff; opacity: 0.7; }
.msg-user::before { content: "> "; color: #555; }
.msg-dim { color: #0F0; opacity: 0.4; font-size: 0.62rem; font-style: italic; }

/* Clickable options */
.msg-options { margin: 8px 0 12px; display: flex; flex-wrap: wrap; gap: 4px; }
.msg-option {
  display: inline-block;
  border: 1px solid #0F0;
  color: #0F0;
  padding: 4px 14px;
  font-family: inherit;
  font-size: 0.68rem;
  cursor: pointer;
  background: none;
  transition: all 0.15s;
}
.msg-option:hover {
  background: #0F0;
  color: #000;
  box-shadow: 0 0 12px rgba(0,255,0,0.3);
}

/* Inline images - BIGGER */
.msg-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 4px;
  margin: 8px 0 14px;
  max-width: 100%;
}
.msg-images img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid #222;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.msg-images img:hover {
  transform: scale(1.05);
  border-color: #0F0;
  box-shadow: 0 0 10px rgba(0,255,0,0.2);
}

/* Single large image */
.msg-image-large {
  margin: 8px 0 14px;
}
.msg-image-large img {
  max-width: 100%;
  max-height: 200px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid #222;
  transition: transform 0.2s, border-color 0.2s;
}
.msg-image-large img:hover {
  border-color: #0F0;
}

/* Inline links */
.msg-link {
  color: #0F0;
  text-decoration: underline;
  cursor: pointer;
}
.msg-link:hover { opacity: 0.7; }

/* Typing indicator */
.msg-typing { color: #0F0; opacity: 0.4; }
.msg-typing::after {
  content: '...';
  animation: dots 1.5s steps(4) infinite;
}
@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Input */
.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}
.prompt { color: #0F0; font-size: 0.75rem; }
.terminal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.75rem;
  caret-color: transparent;
}
.cursor-blink {
  animation: blink 1s step-end infinite;
  font-size: 0.72rem;
  color: #0F0;
}
@keyframes blink { 50% { opacity: 0; } }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.96);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border: 1px solid #333;
  animation: lbIn 0.2s ease;
}
@keyframes lbIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.lightbox-close {
  position: absolute;
  top: 12px; right: 16px;
  color: #555;
  font-size: 0.65rem;
  font-family: inherit;
  border: 1px solid #333;
  background: none;
  padding: 3px 10px;
  cursor: pointer;
}
.lightbox-close:hover { color: #0F0; border-color: #0F0; }

/* Power LED */
.power-led {
  position: absolute;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #333;
  transition: all 0.5s;
}
.power-led.on {
  background: #0F0;
  box-shadow: 0 0 6px #0F0;
}

.monitor-brand {
  position: absolute;
  bottom: 8px; right: 20px;
  font-size: 7px;
  color: #444;
  letter-spacing: 3px;
}

/* Stand */
.stand-neck {
  width: 44px; height: 32px;
  background: linear-gradient(90deg, #1a1a1a, #252525, #1a1a1a);
}
.stand-base {
  width: 140px; height: 9px;
  background: linear-gradient(180deg, #222, #1a1a1a);
  border-radius: 0 0 5px 5px;
}
.desk {
  width: 90vw; max-width: 680px;
  height: 5px;
  background: linear-gradient(180deg, #1a1714, #0f0d0b);
  border-radius: 2px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
}

/* Keyboard */
.keyboard {
  width: 70vw; max-width: 400px;
  height: 24px;
  background: linear-gradient(180deg, #2a2a2a, #1e1e1e);
  border-radius: 3px;
  margin-top: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  padding: 3px 8px;
}
.key-row { display: flex; gap: 2px; width: 100%; }
.key {
  flex: 1;
  height: 7px;
  background: #333;
  border-radius: 1px;
  border: 1px solid #3a3a3a;
}
.key.spacebar { flex: 6; }

/* ============ MOBILE: Phone device ============ */
@media (max-width: 600px) {
  /* Hide desktop computer parts */
  .stand-neck, .stand-base, .desk, .keyboard { display: none; }

  /* Scene fills viewport, no scroll */
  .scene {
    position: fixed;
    inset: 0;
    padding: 8px;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .computer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .monitor-body {
    border-radius: 28px;
    padding: 10px 5px;
    background: linear-gradient(170deg, #1a1a1a, #111);
    box-shadow: 0 4px 30px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.06);
    width: calc(100vw - 16px);
    max-width: 400px;
    height: calc(100dvh - 16px);
    max-height: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  /* Notch */
  .monitor-body::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 4px;
    background: #333;
    border-radius: 4px;
    z-index: 30;
  }

  .screen {
    width: calc(100% - 10px);
    height: calc(100% - 20px);
    max-width: none;
    max-height: none;
    border-radius: 20px;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
  }

  .screen-glare { border-radius: 20px; }

  .screen-content {
    padding: 18px 12px 10px;
    border-radius: 20px;
  }

  .terminal-output { font-size: 0.68rem; }

  /* Prevent iOS zoom on input - must be 16px+ */
  .terminal-input {
    font-size: 16px;
  }

  .msg-images {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
  .msg-images img { height: 70px; }

  .msg-option {
    font-size: 0.62rem;
    padding: 5px 12px;
  }

  .power-led { display: none; }
  .monitor-brand { display: none; }

  /* Home bar */
  .monitor-body::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 3px;
    background: #444;
    border-radius: 3px;
  }

  /* Code rain behind phone */
  #rain { opacity: 0.06; }
}
