:root {
  --bg-main: #8A9BB0;
  --bg-dark: #1a1a2e;
  --bg-darker: #0f0f1e;
  --red-deep: #8B0000;
  --red-accent: #CC0000;
  --cream: #F5F0DC;
  --cream-dim: #9e9a8a;
  --gray-muted: #4a4a5e;
}

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

body {
  background-color: var(--bg-main);
  font-family: 'IBM Plex Mono', monospace;
  color: var(--cream);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Creep title styling */
.creep-title {
  font-family: 'Creepster', cursive;
  font-size: clamp(3rem, 8vw, 6rem);
  color: var(--cream);
  text-shadow:
    3px 3px 0px var(--red-deep),
    -1px -1px 0px var(--red-accent),
    2px -1px 0px var(--red-accent),
    -1px 2px 0px var(--red-accent),
    0 0 20px rgba(139, 0, 0, 0.5);
  letter-spacing: 0.05em;
  user-select: none;
}

/* Pixel font for creep responses */
.creep-response {
  font-family: 'VT323', monospace;
  font-size: clamp(48px, 10vw, 80px);
  color: var(--cream);
  text-shadow: 0 0 10px rgba(139, 0, 0, 0.4);
}

/* Trembling animation */
@keyframes tremble {
  0% { transform: translate(0, 0); }
  10% { transform: translate(-1px, 0); }
  20% { transform: translate(1px, -1px); }
  30% { transform: translate(0, 1px); }
  40% { transform: translate(-1px, -1px); }
  50% { transform: translate(1px, 0); }
  60% { transform: translate(-1px, 1px); }
  70% { transform: translate(0, -1px); }
  80% { transform: translate(1px, 1px); }
  90% { transform: translate(-1px, 0); }
  100% { transform: translate(0, 0); }
}

.tremble {
  animation: tremble 3s infinite;
}

/* Fade in from darkness */
@keyframes fadeFromDark {
  0% {
    opacity: 0;
    filter: brightness(0);
    transform: scale(0.95);
  }
  60% {
    opacity: 0.7;
    filter: brightness(0.5);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
    transform: scale(1);
  }
}

.fade-from-dark {
  animation: fadeFromDark 2s ease-out forwards;
}

/* Blinking cursor */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.blink-cursor::after {
  content: '▌';
  animation: blink 1s step-end infinite;
  color: var(--red-accent);
  font-size: 2rem;
}

/* Textarea worn look */
.worn-textarea {
  background: var(--bg-darker);
  border: 2px solid var(--gray-muted);
  border-image: repeating-linear-gradient(
    90deg,
    var(--gray-muted) 0px,
    var(--gray-muted) 4px,
    transparent 4px,
    transparent 8px
  ) 2;
  color: rgba(245, 240, 220, 0.8);
  font-family: 'IBM Plex Mono', monospace;
  resize: none;
  outline: none;
  transition: border-color 0.3s;
}

.worn-textarea:focus {
  border-color: var(--red-deep);
  border-image: none;
  border: 2px solid var(--red-deep);
}

.worn-textarea::placeholder {
  color: rgba(245, 240, 220, 0.25);
  font-style: italic;
}

/* Translate button */
.translate-btn {
  background: var(--bg-darker);
  border: 2px solid var(--gray-muted);
  color: var(--cream-dim);
  font-family: 'VT323', monospace;
  font-size: 1.5rem;
  padding: 12px 40px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s;
  letter-spacing: 0.3em;
}

.translate-btn:hover {
  border-color: var(--red-deep);
  color: var(--cream);
  background: rgba(139, 0, 0, 0.2);
}

.translate-btn:active {
  transform: scale(0.98);
}

.translate-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* History card */
.history-card {
  background: var(--bg-darker);
  border-left: 3px solid var(--red-deep);
  padding: 12px 16px;
  margin-bottom: 8px;
  transition: background 0.2s;
}

.history-card:hover {
  background: rgba(30, 30, 50, 0.9);
}

/* Creep character pixel art via CSS */
.creep-character {
  width: 80px;
  height: 100px;
  position: relative;
  image-rendering: pixelated;
}

/* Eye follow cursor */
.creep-eye {
  width: 10px;
  height: 10px;
  background: var(--cream);
  position: absolute;
  transition: transform 0.1s;
}

.creep-eye-pupil {
  width: 4px;
  height: 4px;
  background: var(--red-deep);
  position: absolute;
  transition: transform 0.15s ease-out;
}

/* Blink animation for character */
@keyframes creepBlink {
  0%, 95% { transform: scaleY(1); }
  97% { transform: scaleY(0.1); }
  100% { transform: scaleY(1); }
}

.creep-blinks {
  animation: creepBlink 4s infinite;
}

/* Copy toast */
@keyframes toastIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.toast {
  animation: toastIn 0.3s ease-out;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-muted);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--red-deep);
}

/* Subtle scan lines overlay */
.scanlines::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* Hover tooltip for button */
.translate-btn .hover-text {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--cream-dim);
  opacity: 0;
  transition: opacity 0.3s;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.translate-btn:hover .hover-text {
  opacity: 1;
}

/* Noise background */
.noise-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9998;
}