:root{
  /* Navy */
  --navy-900: #000040;
  --navy-800: #000055;
  --navy-700: #000066;
  --navy-600: #0A1280;
  --navy-500: #1A25A0;
  --navy-100: #E5E9FF;
  --navy-50:  #F0F3FF;

  /* Gold */
  --gold-800: #7A5000;
  --gold-700: #9A6A00;
  --gold-600: #B8871E;
  --gold-500: #CC9933;
  --gold-400: #E0B045;
  --gold-300: #ECC870;
  --gold-100: rgba(200,150,40,.10);
  --gold-50:  rgba(200,150,40,.05);

  /* SYSTEM MAPPING (IMPORTANT) */
  --bg: #06070D;                 /* deep neutral, not pure navy */
  --surface: #0D0F1A;            /* slightly lifted */
  --surface-2: #121528;

  --border: rgba(255,255,255,.08);
  --border-soft: rgba(255,255,255,.05);

  --text-1: #F5F7FF;
  --text-2: #B8C0E0;
  --text-3: #7C86B0;

  --accent: var(--gold-500);
  --accent-hover: var(--gold-400);

  --danger: #FF5D5D;
  --success: #22C55E;

  --r-lg: 12px;
  --r-sm: 10px;
}

/* =========================
   BASE
========================= */
body{
  padding: 40px 0;
  margin:0;
  background: var(--bg);
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* =========================
   WRAPPER
========================= */
.auth-wrap{
  width:100%;
  max-width:420px;
  padding:20px;
  margin: auto 0;
}

/* =========================
   BRAND
========================= */
.auth-brand{
  text-align:center;
  margin-bottom:28px;
}

.auth-brand-name{
  font-size:22px;
  font-weight:600;
  color:var(--text-1);
  letter-spacing:-0.2px;
}

.auth-brand-name span{
  color:var(--accent); /* gold used ONLY here */
}

.auth-brand-sub{
  font-size:11px;
  color:var(--text-3);
  margin-top:6px;
  letter-spacing:.12em;
}

/* =========================
   CARD
========================= */
.auth-card{
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 32px;

  box-shadow:
    0 1px 0 rgba(255,255,255,.03),
    0 12px 28px rgba(0,0,0,.45);
}

.plan-teaser {
  display: flex;
  align-items: center;

  padding: 12px 14px;
  margin: 14px 0;

  background: rgba(255,255,255,.02);
  border: 1px solid var(--color-border-soft);
  border-radius: 10;

  transition: border-color 150ms ease, background 150ms ease;
}

/* subtle hover (feels like SaaS UI, not marketing card) */
.plan-teaser:hover {
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.03);
}

.plan-teaser-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-teaser-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-500);
  line-height: 1.3;
}

.plan-teaser-sub {
  font-size: 12px;
  color: wheat;
  line-height: 1.4;
  letter-spacing: 0.1px;
}

/* =========================
   HEADINGS
========================= */
.auth-card h1{
  font-size:22px;
  font-weight:600;
  color:var(--text-1);
  margin:0 0 6px;
}

.auth-card .sub{
  font-size:14px;
  color:var(--text-2);
  margin:0 0 24px;
}

/* =========================
   INPUTS
========================= */
label.lbl{
  display:block;
  font-size:10px;
  font-weight:600;
  color:var(--text-3);
  text-transform:uppercase;
  letter-spacing:.08em;
  margin-bottom:6px;
}

input.fi{
  width:100%;
  padding:12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-size:14px;
  outline:none;
  transition: .15s ease;
  margin-bottom:16px;
}

input.fi::placeholder{
  color:var(--text-3);
}

input.fi:hover{
  border-color: rgba(255,255,255,.18);
}

/* GOLD used ONLY on focus */
input.fi:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--gold-100);
}

/* =========================
   PASSWORD
========================= */
/* =========================
PASSWORD FIELD
========================= */
.pw-wrap{
position:relative;
margin-bottom:16px;
}

/* ensure input has space for the icon */
.pw-wrap .fi{
padding-right:42px;
}

/* =========================
TOGGLE BUTTON
========================= */
.pw-toggle{
position:absolute;
top:50%;
right:8px;
transform:translateY(-50%);

/* Use grid for flawless, shift-free centering */
display:grid;
place-items:center;

width:32px;
height:32px;

background:none;
border:none;
border-radius:6px;

color:var(--text-3);
cursor:pointer;

transition: 
 color .15s ease,
 background .15s ease,
 transform .1s ease;
}

/* hover = subtle, not loud */
.pw-toggle:hover{
color:var(--text-2);
background: rgba(255,255,255,.04);
}

/* active click feedback */
.pw-toggle:active{
transform:translateY(-50%) scale(.92);
}

/* keyboard accessibility */
.pw-toggle:focus-visible{
outline: 2px solid var(--accent);
outline-offset: 2px;
}

/* icon sizing consistency - bulletproof alignment */
.pw-toggle i,
.pw-toggle svg{
display:inline-flex;
align-items:center;
justify-content:center;

/* Force a perfect square box to prevent font/icon bounding box shifts */
width:16px;
height:16px;

font-size:16px;
line-height:1;
text-align:center;
}

input.fi{
box-sizing: border-box;
}
/* =========================
   BUTTON
========================= */
.btn-submit{
  width:100%;
  padding:12px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color:#000;
  font-weight:600;
  font-size:14px;
  border:none;
  cursor:pointer;
  transition:.15s ease;
}

/* subtle hover only */
.btn-submit:hover{
  background: var(--accent-hover);
}

/* =========================
 LINK RESET (GLOBAL)
========================= */
a{
color: var(--text-1);          /* default = white */
text-decoration: none;
transition: color .15s ease;
}

/* hover = gold (controlled, not loud) */
a:hover{
color: var(--accent);
}

/* remove ugly browser focus outline, replace properly */
a:focus{
outline: none;
}

/* =========================
 SSO GROUP
========================= */
.sso-group{
display:flex;
flex-direction:column;
gap:10px;
margin-bottom:18px;
}

/* =========================
 BUTTON
========================= */
.sso-btn{
position:relative;
display:flex;
align-items:center;
justify-content:center;

height:44px;
padding:0 14px;

border-radius: var(--r-sm);
border:1px solid var(--border);
background: var(--surface-2);

color: var(--text-1);
font-size:14px;
font-weight:500;
text-decoration:none;

transition:.15s ease;
}

/* =========================
 ICON (LOCKED LEFT)
========================= */
.sso-icon{
position:absolute;
left:14px;
display:flex;
align-items:center;
justify-content:center;
}

/* normalize svg */
.sso-icon svg{
width:18px;
height:18px;
display:block;
}

/* 🔑 CRITICAL: tone down Google colors */
.sso-btn:first-child svg{
filter: grayscale(1) brightness(1.4);
opacity:.9;
}

/* GitHub stays clean */
.sso-btn:last-child svg{
fill: currentColor;
opacity:.9;
}

/* =========================
 TEXT (TRUE CENTER)
========================= */
.sso-text{
text-align:center;
width:100%;
}

/* =========================
 HOVER
========================= */
.sso-btn:hover{
border-color: var(--accent);
background: rgba(255,255,255,.02);
}

/* =========================
 ACTIVE
========================= */
.sso-btn:active{
transform: scale(.98);
}

/* =========================
   ALERTS
========================= */
.alert-msg{
  border-radius:8px;
  padding:10px 12px;
  font-size:13px;
  margin-bottom:16px;
}

.alert-msg.err{
  background: rgba(255,93,93,.08);
  border:1px solid rgba(255,93,93,.25);
  color: var(--danger);
}

.alert-msg.ok{
  background: rgba(34,197,94,.08);
  border:1px solid rgba(34,197,94,.25);
  color: var(--success);
}

/* =========================
 DIVIDER
========================= */
.divider{
display:flex;
align-items:center;
gap:12px;
margin:20px 0;
color:var(--text-3);
font-size:12px;
}

/* left + right lines */
.divider::before,
.divider::after{
content:"";
flex:1;
height:1px;
background:var(--border-soft);
}

/* =========================
   FOOTER
========================= */
.auth-footer{
  text-align:center;
  font-size:13px;
  color:var(--text-2);
  margin-top:18px;
}

.auth-footer a{
  color:var(--accent);
  text-decoration:none;
}

.auth-footer a:hover{
  text-decoration:underline;
}

/* =========================
   LEGAL
========================= */
.legal-note{
  font-size:11px;
  color:var(--text-3);
  text-align:center;
  margin-top:14px;
}

.legal-note a{
  color:var(--text-2);
}

/* =========================
 PERKS (ICON LIST)
========================= */
.perks{
display:flex;
flex-direction:column;
gap:10px;
margin-bottom:20px;
}

.perk{
display:flex;
align-items:center;
gap:10px;
font-size:13px;
color:var(--text-2);
line-height:1.5;
}

/* icon styling = subtle, premium */
.perk i{
font-size:16px;
color:var(--accent);
opacity:.85;
}

/* subtle variation */
.perk:nth-child(2) i,
.perk:nth-child(4) i{
color:var(--text-3);
opacity:.9;
}

/* Forget Password */
.forgot {
display: block;
text-align: right;
font-size: 12px;
color: var(--text-3);
margin: -8px 0 14px;
text-decoration: none;
transition: color .15s ease;
}

.forgot:hover {
color: var(--accent);
}

.forgot-wrap {
display: flex;
justify-content: flex-end;
margin: -8px 0 14px;
}


/* ==========================================================
   ERROR PAGES — PERSISTENT WARNING + INTERACTIVE DESIGN
   ========================================================== */

/* --- Base Layout: Side-by-side (desktop), Stacked (mobile) --- */
.error-wrap {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary, #0f0f1a); 
}

/* --- Persistent Anime Scene (NO fade out) --- */
.error-wrap .intro-scene {
    position: relative !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    z-index: 10;
    transform: none !important;
}

/* Character container — interactive */
.error-wrap .anime-character {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
    opacity: 0;
}

.error-wrap .anime-character:hover {
    transform: scale(1.08) rotate(-3deg);
}

.error-wrap .anime-character.clicked {
    animation: characterJump 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.error-wrap .anime-img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 10px 25px rgba(0,0,0,0.4));
    transition: filter 0.3s ease;
}

.error-wrap .anime-character:hover .anime-img {
    filter: drop-shadow(0 15px 35px rgba(0,0,0,0.5)) brightness(1.05);
}

/* --- Character Aura (varies by error type) --- */
.error-wrap .anime-character::after {
    content: "";
    position: absolute;
    inset: -15px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.error-wrap .anime-character:hover::after {
    opacity: 1;
}

.error-wrap[data-error="400"] .anime-character::after {
    background: radial-gradient(circle, rgba(230, 160, 50, 0.18) 0%, transparent 70%);
}
.error-wrap[data-error="404"] .anime-character::after {
    background: radial-gradient(circle, rgba(204, 153, 51, 0.18) 0%, transparent 70%);
}
.error-wrap[data-error="403"] .anime-character::after,
.error-wrap[data-error="500"] .anime-character::after {
    background: radial-gradient(circle, rgba(255, 93, 93, 0.18) 0%, transparent 70%);
}

/* 500: Shake effect */
.error-wrap[data-error="500"] .anime-character {
    animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards,
               panicShake 0.5s ease-in-out 1.5s infinite;
}

/* ==========================================================
   ANIME EFFECTS
   ========================================================== */
.error-wrap .sweat-drop {
    position: absolute; top: 15px; right: 25px;
    width: 10px; height: 18px; background: #88C0D0;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transform: rotate(15deg); opacity: 0;
    animation: sweatDrop 2s infinite 1.2s;
}

.error-wrap .anger-mark {
    position: absolute; top: 6px; right: 14px;
    font-size: 26px; line-height: 1; opacity: 0;
    animation: angerPop 1.8s infinite 1.2s; cursor: default;
}

.error-wrap .smoke-puff {
    position: absolute; top: 40%; left: 20%;
    font-size: 20px; line-height: 1; opacity: 0;
    animation: smokeRise 2.2s infinite 1s; pointer-events: none;
}
.error-wrap .smoke-puff.p2 { left: 55%; animation-delay: 1.7s; }
.error-wrap .smoke-puff.p3 { left: 35%; top: 30%; animation-delay: 2.3s; }

.error-wrap .dizzy-stars {
    position: absolute; top: -5px; left: 50%;
    transform: translateX(-50%); font-size: 20px; line-height: 1;
    opacity: 0; animation: dizzySpin 2.5s infinite 1s;
    pointer-events: none; white-space: nowrap;
}
.error-wrap .dizzy-stars span { display: inline-block; margin: 0 4px; }
.error-wrap .dizzy-stars .star-1 { animation: starOrbit1 2.5s infinite 1s; }
.error-wrap .dizzy-stars .star-2 { animation: starOrbit2 2.5s infinite 1.3s; }
.error-wrap .dizzy-stars .star-3 { animation: starOrbit3 2.5s infinite 1.6s; }

.error-wrap .question-float {
    position: absolute; top: 20px; left: 10px;
    font-size: 22px; font-weight: bold; color: #e6a032;
    opacity: 0; animation: questionRise 2.8s infinite 1.4s; pointer-events: none;
}
.error-wrap .question-float.q2 { left: auto; right: 15px; top: 30px; animation-delay: 2.1s; font-size: 18px; }

/* ==========================================================
   SPEECH BUBBLE
   ========================================================== */
.error-wrap .speech-bubble {
    position: relative;
    background: var(--surface-2, #1e1e2e);
    border: 2px solid var(--accent, #cc9933);
    border-radius: 20px; padding: 14px 26px; margin-top: -8px;
    box-shadow: 0 8px 24px rgba(204, 153, 51, 0.15);
    animation: bubblePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s forwards;
    opacity: 0; transform-origin: top center; cursor: default;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-width: 240px; text-align: center;
}
.error-wrap .speech-bubble:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(204, 153, 51, 0.25);
}

.error-wrap .speech-bubble.bubble-red { border-color: var(--danger, #ff5d5d); box-shadow: 0 8px 24px rgba(255, 93, 93, 0.15); }
.error-wrap .speech-bubble.bubble-red:hover { box-shadow: 0 12px 32px rgba(255, 93, 93, 0.25); }
.error-wrap .speech-bubble.bubble-amber { border-color: #e6a032; box-shadow: 0 8px 24px rgba(230, 160, 50, 0.18); }
.error-wrap .speech-bubble.bubble-amber:hover { box-shadow: 0 12px 32px rgba(230, 160, 50, 0.28); }

.error-wrap .bubble-text, .error-wrap .bubble-text-alt {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
    font-size: 16px; font-weight: bold; color: var(--text-1, #e0e0e0);
    letter-spacing: 0.5px; display: block;
}
.error-wrap .bubble-text-alt { display: none; }
.error-wrap .speech-bubble:hover .bubble-text { display: none; }
.error-wrap .speech-bubble:hover .bubble-text-alt { display: block; }

.error-wrap .bubble-tail {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 12px solid transparent; border-right: 12px solid transparent;
    border-bottom: 12px solid var(--accent, #cc9933);
}
.error-wrap .bubble-tail::after {
    content: ""; position: absolute; top: 3px; left: -9px;
    width: 0; height: 0;
    border-left: 9px solid transparent; border-right: 9px solid transparent;
    border-bottom: 9px solid var(--surface-2, #1e1e2e);
}
.error-wrap .speech-bubble.bubble-red .bubble-tail { border-bottom-color: var(--danger, #ff5d5d); }
.error-wrap .speech-bubble.bubble-amber .bubble-tail { border-bottom-color: #e6a032; }

/* ==========================================================
   ERROR CARD & TYPOGRAPHY
   ========================================================== */
.error-wrap .error-content {
    opacity: 0;
    animation: fadeInMain 0.8s ease-out 1.2s forwards;
    max-width: 440px; width: 100%;
}

/* Brand Header */
.error-wrap .error-brand { text-align: center; margin-bottom: 1.5rem; }
.error-wrap .error-brand-name {
    font-size: 1.5rem; font-weight: 800; color: var(--text-1, #ffffff);
}
.error-wrap .error-brand-name span { color: var(--accent, #cc9933); }
.error-wrap .error-brand-sub {
    font-size: 0.85rem; color: var(--text-2, #a0a0b0); margin-top: -4px;
}

/* Main Error Card Container */
.error-wrap .error-card {
    background: var(--surface-1, #161625);
    border: 1px solid var(--border, #2d2d44);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    color: var(--text-1, #ffffff);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.error-wrap .error-card:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4); 
}

/* Error Badge */
.error-wrap .error-badge {
    display: inline-block;
    background: rgba(230, 160, 50, 0.15);
    color: #e6a032;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; padding: 6px 16px; border-radius: 100px;
    margin-bottom: 1rem; border: 1px solid rgba(230, 160, 50, 0.3);
}

/* Error Code (e.g., 400, 404) */
.error-wrap .error-code {
    font-size: 5rem; font-weight: 900; line-height: 1; margin: 0.5rem 0;
    color: var(--text-1, #ffffff);
    cursor: default; transition: transform 0.2s ease;
}
.error-wrap .error-code:hover { transform: scale(1.05); }
.error-wrap .error-code.gold-glow { animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 1.65s forwards, pulseGold 4s infinite 2s; opacity: 0; }
.error-wrap .error-code.red-glow { animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 1.65s forwards, pulseRed 3s infinite 2s; opacity: 0; }
.error-wrap .error-code.amber-glow { animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 1.65s forwards, pulseAmber 3.5s infinite 2s; opacity: 0; }

/* Error Title & Description */
.error-wrap .error-title {
    font-size: 1.5rem; font-weight: 700; color: var(--text-1, #ffffff);
    margin-bottom: 0.75rem;
}
.error-wrap .error-sub {
    font-size: 0.95rem; color: var(--text-2, #b0b0c0);
    line-height: 1.6; margin-bottom: 1.5rem;
}

/* Footer Warning Text */
.error-wrap .error-footer {
    font-size: 0.75rem; color: var(--text-3, #707080);
    margin-top: 1.5rem; padding-top: 1rem;
    border-top: 1px solid var(--border, #2d2d44);
}

/* Animation delays for card elements */
.error-wrap .error-content .error-brand { animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 1.3s forwards; opacity: 0; }
.error-wrap .error-content .error-card { animation: fadeInUp 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 1.4s forwards; opacity: 0; }
.error-wrap .error-content .error-badge { animation: fadeInUp 0.5s ease-out 1.55s forwards, badgeRing 3s infinite 2.5s; opacity: 0; }
.error-wrap .error-content .error-title { animation: fadeInUp 0.5s ease-out 1.75s forwards; opacity: 0; }
.error-wrap .error-content .error-sub { animation: fadeInUp 0.5s ease-out 1.85s forwards; opacity: 0; }
.error-wrap .error-content .error-actions { animation: fadeInUp 0.5s ease-out 1.95s forwards; opacity: 0; }
.error-wrap .error-content .error-footer { animation: fadeInUp 0.5s ease-out 2.05s forwards; opacity: 0; }

/* ==========================================================
   BUTTONS
   ========================================================== */
.error-wrap .error-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }

.error-wrap .error-btn {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.75rem 1.5rem; font-size: 0.9rem; font-weight: 600;
    color: #ffffff !important;
    background: var(--accent, #cc9933);
    border: 1px solid var(--accent, #cc9933);
    border-radius: 8px; cursor: pointer; text-decoration: none;
    transition: all 0.3s ease;
}
.error-wrap .error-btn::before {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 0; height: 0; background: rgba(255,255,255,0.2); border-radius: 50%;
    transform: translate(-50%, -50%); transition: width 0.5s ease, height 0.5s ease;
}
.error-wrap .error-btn:hover::before { width: 300px; height: 300px; }
.error-wrap .error-btn:active { transform: scale(0.96); }

.error-wrap .error-btn-fix {
    background: transparent;
    border: 1px solid var(--border, #2d2d44);
    color: var(--text-1, #ffffff) !important;
}
.error-wrap .error-btn-fix:hover { 
    background: rgba(255, 255, 255, 0.05); 
    border-color: var(--accent, #cc9933);
    transform: translateY(-2px); 
    box-shadow: 0 6px 20px rgba(230, 160, 50, 0.15); 
}
.error-wrap .error-btn-fix .fix-icon { display: inline-block; transition: transform 0.4s ease; }
.error-wrap .error-btn-fix:hover .fix-icon { transform: rotate(90deg) scale(1.1); }

.error-wrap .error-btn-retry:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 93, 93, 0.3); }
.error-wrap .error-btn-retry .retry-icon { display: inline-block; transition: transform 0.4s ease; }
.error-wrap .error-btn-retry:hover .retry-icon { transform: rotate(180deg); }

/* ==========================================================
   KEYFRAMES
   ========================================================== */
@keyframes popIn { 0% { transform: scale(0.5) translateY(20px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes bubblePop { 0% { transform: scale(0); opacity: 0; } 80% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeInMain { 0% { opacity: 0; transform: translateX(30px); } 100% { opacity: 1; transform: translateX(0); } }
@keyframes fadeInUp { 0% { opacity: 0; transform: translateY(15px); } 100% { opacity: 1; transform: translateY(0); } }

@keyframes sweatDrop { 0% { opacity: 0; transform: translateY(-10px) scale(0.5); } 20% { opacity: 1; transform: translateY(0) scale(1); } 80% { opacity: 1; transform: translateY(15px) scale(1); } 100% { opacity: 0; transform: translateY(25px) scale(0.5); } }
@keyframes angerPop { 0% { opacity: 0; transform: scale(0.3) rotate(-15deg); } 25% { opacity: 1; transform: scale(1.2) rotate(5deg); } 60% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.85) translateY(-8px); } }
@keyframes smokeRise { 0% { opacity: 0; transform: translateY(6px) scale(0.6); } 30% { opacity: 0.85; } 100% { opacity: 0; transform: translateY(-28px) scale(1.25); } }

@keyframes dizzySpin { 0%, 100% { opacity: 0; } 15%, 85% { opacity: 1; } }
@keyframes starOrbit1 { 0% { transform: translate(0, 0) scale(0.8); } 50% { transform: translate(0, -8px) scale(0.9); } 100% { transform: translate(0, 0) scale(0.8); } }
@keyframes starOrbit2 { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(0, -10px) scale(1.1); } 100% { transform: translate(0, 0) scale(1); } }
@keyframes starOrbit3 { 0% { transform: translate(0, 0) scale(0.9); } 50% { transform: translate(-4px, -12px) scale(0.8); } 100% { transform: translate(0, 0) scale(0.9); } }
@keyframes questionRise { 0% { opacity: 0; transform: translateY(8px) scale(0.6); } 20% { opacity: 1; transform: translateY(0) scale(1); } 70% { opacity: 1; transform: translateY(-12px) scale(1); } 100% { opacity: 0; transform: translateY(-22px) scale(0.8); } }

@keyframes characterJump { 0% { transform: translateY(0) scaleY(1); } 30% { transform: translateY(5px) scaleY(0.9) scaleX(1.1); } 60% { transform: translateY(-30px) scaleY(1.1) scaleX(0.95); } 100% { transform: translateY(0) scaleY(1) scaleX(1); } }
@keyframes panicShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); } }

@keyframes badgeRing { 0%, 100% { box-shadow: 0 0 0 0 rgba(204, 153, 51, 0.4); } 50% { box-shadow: 0 0 0 8px rgba(204, 153, 51, 0); } }
@keyframes pulseGold { 0%, 100% { text-shadow: 0 0 20px rgba(204, 153, 51, 0.5); } 50% { text-shadow: 0 0 40px rgba(204, 153, 51, 0.8); } }
@keyframes pulseRed { 0%, 100% { text-shadow: 0 0 20px rgba(255, 93, 93, 0.5); } 50% { text-shadow: 0 0 40px rgba(255, 93, 93, 0.8); } }
@keyframes pulseAmber { 0%, 100% { text-shadow: 0 0 20px rgba(230, 160, 50, 0.5); } 50% { text-shadow: 0 0 40px rgba(230, 160, 50, 0.8); } }

/* ==========================================================
   RESPONSIVE & LARGE SCREEN ENHANCEMENTS (TOP NOTCH)
   ========================================================== */

/* --- Mobile Adjustments --- */
@media (max-width: 768px) {
    .error-wrap { flex-direction: column; gap: 1.5rem; padding: 1.5rem; }
    .error-wrap .anime-img { width: 140px; height: 140px; }
    .error-wrap .speech-bubble { max-width: 200px; padding: 10px 18px; }
    .error-wrap .bubble-text, .error-wrap .bubble-text-alt { font-size: 15px; }
    .error-wrap .error-content { max-width: 100%; }
    .error-wrap .error-content .error-card:hover { transform: none; }
    .error-wrap .error-actions { flex-direction: column; align-items: stretch; }
    .error-wrap .error-code { font-size: 4rem; }
}

/* --- Desktop & Large Screens (1200px+) --- */
@media (min-width: 1200px) {
    .error-wrap {
        gap: 5rem;
        padding: 4rem;
        /* Premium cinematic background for large displays */
        background: 
            radial-gradient(circle at 15% 50%, rgba(204, 153, 51, 0.04) 0%, transparent 40%),
            radial-gradient(circle at 85% 50%, rgba(255, 93, 93, 0.04) 0%, transparent 40%),
            var(--bg-primary, #0f0f1a);
    }

    /* Subtle premium grid overlay (masked to fade elegantly at edges) */
    .error-wrap::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image: 
            linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
        background-size: 48px 48px;
        mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
        -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
        pointer-events: none;
        z-index: 0;
    }

    /* Ensure interactive elements sit cleanly above the background grid */
    .error-wrap .intro-scene,
    .error-wrap .error-content {
        position: relative;
        z-index: 2;
    }

    /* Gentle floating animation for the character scene on large screens */
    .error-wrap .intro-scene {
        animation: floatScene 6s ease-in-out infinite;
    }

    .error-wrap .anime-img {
        width: 300px;
        height: 300px;
    }

    .error-wrap .speech-bubble {
        max-width: 340px;
        padding: 18px 32px;
        border-radius: 24px;
    }

    .error-wrap .bubble-text, 
    .error-wrap .bubble-text-alt {
        font-size: 17px;
    }

    /* Scale up the speech bubble tail proportionally */
    .error-wrap .bubble-tail {
        top: -14px;
        border-left-width: 14px;
        border-right-width: 14px;
        border-bottom-width: 14px;
    }
    .error-wrap .bubble-tail::after {
        top: 3px;
        left: -10px;
        border-left-width: 10px;
        border-right-width: 10px;
        border-bottom-width: 10px;
    }

    .error-wrap .error-content {
        max-width: 580px;
    }

    .error-wrap .error-code {
        font-size: 7rem;
        letter-spacing: -0.04em; /* Tighter, more modern look for huge text */
    }

    .error-wrap .error-title {
        font-size: 1.75rem;
    }

    .error-wrap .error-sub {
        font-size: 1.05rem;
        line-height: 1.7;
    }

    .error-wrap .error-card:hover { 
        transform: translateY(-6px); 
        box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05); 
    }
}

/* --- Ultrawide Monitors (1600px+) --- */
@media (min-width: 1600px) {
    .error-wrap {
        gap: 6rem;
        /* Constrain max width on massive screens to maintain cinematic focus */
        max-width: 1600px;
        margin: 0 auto;
    }

    .error-wrap .anime-img {
        width: 360px;
        height: 360px;
    }

    .error-wrap .speech-bubble {
        max-width: 380px;
        padding: 22px 36px;
    }

    .error-wrap .bubble-text, 
    .error-wrap .bubble-text-alt {
        font-size: 18px;
    }

    .error-wrap .error-content {
        max-width: 640px;
    }

    .error-wrap .error-code {
        font-size: 8.5rem;
    }
}

/* Gentle float animation keyframe */
@keyframes floatScene {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {
    .error-wrap * { animation-duration: 0.01s !important; animation-delay: 0s !important; transition: none !important; }
    .error-wrap .anime-character:hover, .error-wrap .speech-bubble:hover, .error-wrap .error-card:hover { transform: none !important; }
}