/* Design System & Custom Properties */
:root {
  --bg-color: #08090f;
  --card-bg: rgba(17, 18, 30, 0.45);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --accent-color: #ff4757;
  --accent-hover: #ff6b81;
  --accent-glow: rgba(255, 71, 87, 0.4);
  --secondary-color: #2ed573;
  --secondary-glow: rgba(46, 213, 115, 0.3);
  --purple-color: #a55eea;
  --purple-glow: rgba(165, 94, 234, 0.3);
  --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  perspective: 1000px;
}

/* Background Gradients & Effects */
.bg-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: 
    radial-gradient(circle at 10% 20%, rgba(255, 71, 87, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(165, 94, 234, 0.08) 0%, transparent 40%);
  z-index: 1;
}

/* Custom Interactive Cursor Glow */
.cursor-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 71, 87, 0.05) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
  transition: width 0.3s ease, height 0.3s ease;
}

/* Main Container Card */
.error-container {
  position: relative;
  width: 90%;
  max-width: 650px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 48px 32px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  z-index: 10;
  transform-style: preserve-3d;
  transition: transform 0.1s ease, box-shadow 0.3s ease;
}

.error-container::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 71, 87, 0.2), transparent, rgba(165, 94, 234, 0.2));
  z-index: -1;
  pointer-events: none;
}

/* Shocked Photo Styling */
.image-wrapper {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 32px;
  border-radius: 50%;
  padding: 8px;
  background: linear-gradient(135deg, var(--accent-color), var(--purple-color));
  box-shadow: 0 0 30px var(--accent-glow);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.5s ease;
}

.image-wrapper:hover {
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 0 45px rgba(255, 71, 87, 0.6);
}

.shocked-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #0d0e15;
  display: block;
}

/* Speech Bubble */
.speech-bubble {
  position: absolute;
  top: -20px;
  right: -80px;
  background: #ffffff;
  color: #08090f;
  padding: 12px 20px;
  border-radius: 18px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  transform: rotate(10deg);
  animation: floatBubble 3s ease-in-out infinite alternate;
  max-width: 180px;
  word-wrap: break-word;
  z-index: 15;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 30px;
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: #ffffff transparent;
  display: block;
  width: 0;
}

@keyframes floatBubble {
  0% { transform: translateY(0) rotate(10deg); }
  100% { transform: translateY(-8px) rotate(8deg); }
}

/* Typography */
h1 {
  font-family: var(--font-heading);
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ff4757, #ff6b81, #a55eea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -2px;
}

.error-subtitle {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.error-description {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto 32px;
}

/* Excuses Generator Box */
.excuse-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 32px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.excuse-box:hover {
  background: rgba(255, 255, 255, 0.05);
}

.excuse-text {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: opacity 0.2s ease;
}

/* Buttons / Actions Grid */
.actions-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 480px) {
  .actions-container {
    grid-template-columns: 1fr 1fr;
  }
}

.btn {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px 28px;
  border-radius: 12px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-decoration: none;
  outline: none;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 71, 87, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* Panic Button Styling */
.panic-wrapper {
  margin-top: 16px;
}

.btn-panic {
  background: linear-gradient(135deg, #d32f2f, #f44336);
  color: white;
  width: 100%;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 6px 20px rgba(211, 47, 47, 0.4);
  position: relative;
  overflow: hidden;
}

.btn-panic:hover {
  background: linear-gradient(135deg, #f44336, #ff5722);
  box-shadow: 0 8px 25px rgba(244, 67, 54, 0.6);
  transform: scale(1.02);
}

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

.btn-panic::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: rotate(45deg);
  transition: 0.5s;
  pointer-events: none;
}

.btn-panic:hover::after {
  left: 120%;
}

/* Shake Animation (for container on Panic) */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
  20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.shake-animation {
  animation: shake 0.6s ease-in-out;
}

/* Extreme Panic Mode (Screen Alarm Flash) */
.alarm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 0, 0, 0.15);
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.alarm-active {
  animation: alarmFlash 0.5s infinite alternate;
}

@keyframes alarmFlash {
  0% { opacity: 0; }
  100% { opacity: 0.35; }
}

/* Footer / Backlink */
.footer-text {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.25);
  margin-top: 24px;
}

.footer-text a {
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-text a:hover {
  color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 580px) {
  .error-container {
    padding: 32px 20px;
  }
  h1 {
    font-size: 3rem;
  }
  .error-subtitle {
    font-size: 1.25rem;
  }
  .image-wrapper {
    width: 160px;
    height: 160px;
  }
  .speech-bubble {
    right: -40px;
    top: -30px;
    font-size: 0.8rem;
    padding: 8px 12px;
  }
}
