*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black:   #111111;
  --offwhite: #f7f5f0;
  --gray:    #6b6b6b;
  --lgray:   #a0a0a0;
  --border:  #e0ddd6;
  --cream:   #ffffff;
  --accent:  #e91e8c;
  --accent2: #ff6b35;
  --cat:     #aaa899;
  --sidebar: 240px;
  --nav:     56px;
}

body {
  font-family: "DM Sans", sans-serif;
  background: var(--cream);
  color: var(--black);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Main Layout ── */
.main-wrap {
  margin-top: var(--nav);
  min-height: calc(100vh - var(--nav));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
}

/* ── Paper texture bg ── */
.main-wrap::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(233,30,140,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255,107,53,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── Card ── */
.error-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 700px;
  text-align: center;
}

/* ── The big scratch stage ── */
.scratch-stage {
  position: relative;
  height: 320px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

/* The 404 text — big, scratched look */
.num-404 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(120px, 22vw, 200px);
  line-height: 1;
  color: var(--offwhite);
  letter-spacing: 4px;
  position: relative;
  z-index: 2;
  user-select: none;
  -webkit-text-stroke: 3px #d8d4cc;
  text-shadow:
    4px 4px 0 #e0dcd4,
    8px 8px 0 rgba(0,0,0,0.04);
  animation: nudge 0.15s ease 0.6s both;
}

@keyframes nudge {
  0%   { transform: translate(0,0) rotate(0deg); }
  25%  { transform: translate(-4px,2px) rotate(-1deg); }
  50%  { transform: translate(3px,-2px) rotate(0.5deg); }
  75%  { transform: translate(-2px,1px) rotate(-0.3deg); }
  100% { transform: translate(0,0) rotate(0deg); }
}

/* Lottie paw — sits in front of the 404 */
#cat-lottie {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-40%);
  width: 320px;
  height: 320px;
  z-index: 5;
  pointer-events: none;
}

/* SVG scratch marks that appear ON the 404 */
.scratch-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 3;
  pointer-events: none;
}

.scratch-line {
  stroke: #c8c4bc;
  stroke-width: 2.5;
  stroke-linecap: round;
  fill: none;
  opacity: 0;
  animation: scratch-appear 0.4s ease forwards;
}
.scratch-line:nth-child(1) { animation-delay: 0.55s; }
.scratch-line:nth-child(2) { animation-delay: 0.65s; }
.scratch-line:nth-child(3) { animation-delay: 0.75s; }
.scratch-line:nth-child(4) { animation-delay: 0.85s; }
.scratch-line:nth-child(5) { animation-delay: 0.95s; }

@keyframes scratch-appear {
  0%   { opacity: 0; stroke-dashoffset: 300; stroke-dasharray: 300; }
  60%  { opacity: 1; }
  100% { opacity: 0.55; stroke-dashoffset: 0; stroke-dasharray: 300; }
}

/* Shaking scratch particles */
.fleck {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #d0ccc4;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
}
.fleck:nth-child(1) { top: 30%; left: 38%; animation: fleck-fly 0.5s ease 0.7s forwards; }
.fleck:nth-child(2) { top: 50%; left: 52%; animation: fleck-fly 0.5s ease 0.8s forwards; }
.fleck:nth-child(3) { top: 40%; left: 60%; animation: fleck-fly 0.45s ease 0.9s forwards; }
.fleck:nth-child(4) { top: 55%; left: 44%; animation: fleck-fly 0.4s ease 1.0s forwards; }

@keyframes fleck-fly {
  0%  { opacity: 1; transform: translate(0,0) scale(1); }
  100%{ opacity: 0; transform: translate(var(--dx, 20px), var(--dy, -30px)) scale(0.3); }
}
.fleck:nth-child(1) { --dx: -25px; --dy: -40px; }
.fleck:nth-child(2) { --dx:  20px; --dy: -50px; }
.fleck:nth-child(3) { --dx:  35px; --dy: -30px; }
.fleck:nth-child(4) { --dx: -10px; --dy: -45px; }

/* ── Copy ── */
.error-tagline {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  letter-spacing: 2px;
  color: var(--black);
  margin-top: 56px;
  margin-bottom: 8px;
  animation: fadeUp 0.6s ease 1.1s both;
}

.error-desc {
  font-size: .97rem;
  color: var(--gray);
  line-height: 1.7;
  max-width: 380px;
  margin: 0 auto 32px;
  animation: fadeUp 0.6s ease 1.2s both;
}

.error-desc em {
  font-style: normal;
  color: var(--accent);
  font-weight: 600;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Pill badge ── */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 5px 14px 5px 10px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 24px;
  letter-spacing: 0.03em;
  animation: fadeUp 0.5s ease 1.0s both;
}
.cat-badge span { font-size: .9rem; }

/* ── Buttons ── */
.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 36px;
  animation: fadeUp 0.6s ease 1.3s both;
}

.btn-home {
  background: var(--black);
  color: #fff;
  border: 2px solid var(--black);
  border-radius: 6px;
  padding: 13px 28px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.btn-home:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn-back {
  background: transparent;
  color: var(--gray);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 13px 28px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: border-color 0.15s, color 0.15s;
}
.btn-back:hover { border-color: var(--black); color: var(--black); }

/* ── Divider ── */
.error-divider {
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 99px;
  margin: 0 auto 20px;
  animation: fadeUp 0.5s ease 1.15s both;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .gc-nav-search { display: none; }
  #cat-lottie { width: 220px; height: 220px; bottom: -20px; }
  .num-404 { font-size: 120px; }
  .scratch-stage { height: 220px; }
}