/* ============================================
   ROYAL APPS — 404 PAGE (LIGHT THEME)
   Palette: Crisp White + Emerald Green
   Fonts: Bricolage Grotesque + Cormorant Garamond
   ============================================ */

:root {
  --green-bright:   #00A651;
  --green-mid:      #00C853;
  --green-deep:     #1B5E20;
  --green-light:    #E8F5E9;
  --green-pale:     #F1FAF4;
  --green-glow:     rgba(0, 166, 81, 0.15);
  --green-glow-lg:  rgba(0, 166, 81, 0.07);
  --white:          #FFFFFF;
  --bg:             #F7FBF8;
  --bg-2:           #EDF7F1;
  --surface:        #FFFFFF;
  --surface-2:      #F0F9F3;
  --border:         #C8E6C9;
  --border-light:   #E8F5E9;
  --text-primary:   #1A2E1A;
  --text-secondary: #2E5E2E;
  --text-muted:     #5A8A5A;
  --text-dim:       #9DC09D;
  --shadow-sm:      0 2px 12px rgba(0, 166, 81, 0.10);
  --shadow-md:      0 8px 32px rgba(0, 166, 81, 0.14);
  --shadow-lg:      0 20px 60px rgba(0, 166, 81, 0.18);
  --font-display:   'Bricolage Grotesque', sans-serif;
  --font-serif:     'Cormorant Garamond', serif;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  cursor: none;
  position: relative;
}

/* ---- CANVAS BACKGROUND ---- */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---- SUBTLE GRID PATTERN ---- */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 166, 81, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 166, 81, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridDrift 20s linear infinite;
}

@keyframes gridDrift {
  0%   { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}

/* ---- NOISE (very subtle on light) ---- */
.noise {
  position: fixed;
  inset: -50%;
  z-index: 2;
  pointer-events: none;
  width: 200%; height: 200%;
  opacity: 0.012;
  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");
  animation: noiseAnim 0.15s steps(2) infinite;
}

@keyframes noiseAnim {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2%, -1%); }
  50%  { transform: translate(1%, 2%); }
  75%  { transform: translate(-1%, 1%); }
  100% { transform: translate(2%, -2%); }
}

/* ---- CURSOR TRAIL ---- */
#cursor-trail {
  position: fixed;
  top: 0; left: 0;
  width: 20px; height: 20px;
  border: 2px solid var(--green-bright);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 0 10px var(--green-glow), 0 0 20px var(--green-glow-lg);
  background: rgba(0, 166, 81, 0.06);
}

#cursor-trail::after {
  content: '';
  position: absolute;
  inset: 5px;
  background: var(--green-bright);
  border-radius: 50%;
  opacity: 0.5;
}

/* ---- CARD WRAPPER ---- */
.container {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 3.5rem;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(0, 166, 81, 0.06),
    inset 0 1px 0 rgba(255,255,255,0.9);
  max-width: 560px;
  width: calc(100% - 2rem);
  animation: cardReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
  backdrop-filter: blur(2px);
}

/* Decorative top border accent */
.container::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--green-bright), var(--green-mid), var(--green-bright), transparent);
  border-radius: 0 0 4px 4px;
}

/* Subtle corner decorations */
.container::after {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 16px;
  border: 1px solid var(--border-light);
  pointer-events: none;
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- CROWN ---- */
.crown-wrapper {
  margin-bottom: 1rem;
  animation: crownFloat 3.5s ease-in-out infinite, cardReveal 0.9s 0.1s cubic-bezier(0.16,1,0.3,1) both;
}

.crown-svg {
  width: 90px;
  height: auto;
  filter: drop-shadow(0 4px 16px rgba(0, 166, 81, 0.3)) drop-shadow(0 2px 6px rgba(0, 166, 81, 0.2));
}

.crown-shape {
  fill: var(--green-pale);
  stroke: var(--green-bright);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.jewel {
  fill: var(--green-bright);
  filter: drop-shadow(0 0 3px rgba(0, 166, 81, 0.6));
  animation: jewelPulse 2s ease-in-out infinite;
}
.jewel-1 { animation-delay: 0s; }
.jewel-2 { animation-delay: 0.4s; fill: #00C853; }
.jewel-3 { animation-delay: 0.8s; }
.jewel-4 { animation-delay: 0.2s; fill: #43A047; }
.jewel-5 { animation-delay: 0.6s; fill: #43A047; }

.crown-base {
  stroke: var(--green-deep);
}

@keyframes crownFloat {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50%       { transform: translateY(-8px) rotate(1deg); }
}

@keyframes jewelPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* ---- 404 GLITCH ---- */
.error-code-wrapper {
  position: relative;
  margin-bottom: 0.4rem;
  animation: fadeInUp 0.9s 0.2s cubic-bezier(0.16,1,0.3,1) both;
}

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

.error-code {
  font-family: var(--font-display);
  font-size: clamp(5.5rem, 18vw, 10rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 2.5px var(--green-bright);
  text-stroke: 2.5px var(--green-bright);
  position: relative;
  display: inline-block;
  text-shadow:
    0 4px 20px rgba(0, 166, 81, 0.2),
    0 8px 40px rgba(0, 166, 81, 0.1);
  animation: glitch 5s infinite;
}

/* Glitch pseudo-layers */
.error-code::before,
.error-code::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

.error-code::before {
  color: rgba(0, 200, 83, 0.25);
  -webkit-text-stroke: 0;
  animation: glitchTop 5s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.error-code::after {
  color: rgba(0, 166, 81, 0.2);
  -webkit-text-stroke: 0;
  animation: glitchBottom 5s infinite;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch {
  0%, 88%, 100% { transform: translate(0); }
  89%  { transform: translate(-3px, 1px); }
  90%  { transform: translate(3px, -1px); }
  91%  { transform: translate(-2px, 2px); }
  92%  { transform: translate(2px, -2px); }
  93%  { transform: translate(0); }
}

@keyframes glitchTop {
  0%, 88%, 100% { transform: translate(0); opacity: 0; }
  89%  { transform: translate(-5px, -2px); opacity: 1; }
  90%  { transform: translate(5px, 2px); opacity: 1; }
  91%  { transform: translate(-3px, 0); opacity: 0.7; }
  92%  { transform: translate(0); opacity: 0; }
}

@keyframes glitchBottom {
  0%, 88%, 100% { transform: translate(0); opacity: 0; }
  89%  { transform: translate(5px, 2px); opacity: 1; }
  90%  { transform: translate(-5px, -2px); opacity: 1; }
  91%  { transform: translate(3px, 0); opacity: 0.7; }
  92%  { transform: translate(0); opacity: 0; }
}

/* ---- DIVIDER ---- */
.divider {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  max-width: 320px;
  margin: 0.5rem 0 1.2rem;
  animation: fadeInUp 0.9s 0.35s cubic-bezier(0.16,1,0.3,1) both;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.divider-icon {
  color: var(--green-bright);
  font-size: 0.7rem;
  animation: spinStar 6s linear infinite;
}

@keyframes spinStar {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---- TEXT ---- */
.tagline {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.1em;
  color: var(--green-deep);
  text-transform: uppercase;
  margin-bottom: 0.7rem;
  animation: fadeInUp 0.9s 0.4s cubic-bezier(0.16,1,0.3,1) both;
}

.subtitle {
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 1.4vw, 0.88rem);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.85;
  max-width: 360px;
  margin-bottom: 2rem;
  animation: fadeInUp 0.9s 0.5s cubic-bezier(0.16,1,0.3,1) both;
}

/* ---- CTA BUTTONS ---- */
.cta-group {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 2rem;
  animation: fadeInUp 0.9s 0.6s cubic-bezier(0.16,1,0.3,1) both;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.6rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: none;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn:hover::before { opacity: 1; }
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: linear-gradient(135deg, var(--green-bright), var(--green-mid));
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(0, 166, 81, 0.35), 0 1px 3px rgba(0,0,0,0.1);
}

.btn-primary:hover {
  box-shadow: 0 8px 28px rgba(0, 166, 81, 0.45), 0 2px 6px rgba(0,0,0,0.12);
}

.btn-ghost {
  background: var(--green-pale);
  color: var(--green-deep);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-ghost:hover {
  background: var(--green-light);
  border-color: var(--green-bright);
  box-shadow: 0 4px 16px rgba(0, 166, 81, 0.15);
}

.btn-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ---- BRAND FOOTER ---- */
.brand-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: fadeInUp 0.9s 0.75s cubic-bezier(0.16,1,0.3,1) both;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.brand-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--border);
  animation: dotPulse 2s ease-in-out infinite;
}

.brand-dot:last-child { animation-delay: 0.5s; }

@keyframes dotPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1; transform: scale(1.5); background: var(--green-bright); }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 520px) {
  body { overflow-y: auto; align-items: flex-start; padding: 2rem 0; }
  .container { padding: 2rem 1.5rem; border-radius: 16px; }
  .cta-group { flex-direction: column; align-items: center; }
  .btn { width: 200px; justify-content: center; }
  .crown-svg { width: 70px; }
}