/* ── Geslar Hakiran — Dark-only theme ─────────────────────────────────────── */

:root {
  --bg: #0b1120;
  --bg-rgb: 11, 17, 32;
  --surface: #111827;
  --surface2: #1a2438;
  --border: #1e3048;
  --border-strong: #2d4a6a;
  --primary: #60a5fa;
  --primary-light: #93c5fd;
  --accent: #f87171;
  --accent-soft: #450a0a;
  --gold: #fbbf24;
  --text: #ffffff;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --green: #34d399;
  --radius-sm: 5px;
  --radius-md: 7px;
  --radius-lg: 10px;
  --mono: 'Fira Code', monospace;
  --body: 'Inter', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* ── Particle canvas background ───────────────────────────────────────────── */

#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.container, .footer { position: relative; z-index: 1; }

/* ── Layout ────────────────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Shield ────────────────────────────────────────────────────────────────── */

.shield-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.shield-svg {
  width: 80px;
  height: 93px;
  animation: shieldFloat 4s ease-in-out infinite;
  transition: filter 0.5s;
}

@keyframes shieldFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Shield pulse glow on idle */
.shield-svg #shieldPath {
  animation: shieldPulse 3s ease-in-out infinite;
}

@keyframes shieldPulse {
  0%, 100% { stroke-opacity: 0.7; }
  50% { stroke-opacity: 1; }
}

/* Crack lines — hidden by default */
.crack-lines { opacity: 0; transition: opacity 0.3s; }

/* Shield states */
.shield-wrap.breached .shield-svg {
  animation: shieldShake 0.5s ease-in-out;
  filter: drop-shadow(0 0 20px rgba(248, 113, 113, 0.5));
}

.shield-wrap.breached .shield-svg #shieldPath {
  stroke: var(--accent);
  animation: none;
}

.shield-wrap.breached .crack-lines {
  opacity: 1;
  animation: cracksAppear 0.6s ease-out 0.2s both;
}

.shield-wrap.safe .shield-svg {
  filter: drop-shadow(0 0 20px rgba(52, 211, 153, 0.4));
}

.shield-wrap.safe .shield-svg #shieldPath {
  stroke: var(--green);
  animation: none;
  stroke-opacity: 1;
}

@keyframes shieldShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  10% { transform: translateX(-4px) rotate(-2deg); }
  20% { transform: translateX(4px) rotate(2deg); }
  30% { transform: translateX(-3px) rotate(-1deg); }
  40% { transform: translateX(3px) rotate(1deg); }
  50% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
}

@keyframes cracksAppear {
  from { opacity: 0; stroke-dashoffset: 40; }
  to { opacity: 1; stroke-dashoffset: 0; }
}

.crack-lines line {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
}

.shield-wrap.breached .crack-lines line {
  animation: drawCrack 0.4s ease-out forwards;
}

.shield-wrap.breached .crack-lines line:nth-child(2) { animation-delay: 0.1s; }
.shield-wrap.breached .crack-lines line:nth-child(3) { animation-delay: 0.15s; }
.shield-wrap.breached .crack-lines line:nth-child(4) { animation-delay: 0.2s; }
.shield-wrap.breached .crack-lines line:nth-child(5) { animation-delay: 0.25s; }
.shield-wrap.breached .crack-lines line:nth-child(6) { animation-delay: 0.3s; }

@keyframes drawCrack {
  to { stroke-dashoffset: 0; }
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */

.hero {
  text-align: center;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Guerilla mode overrides ──────────────────────────────────────────────── */

body.guerilla .hero h1 {
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(248, 113, 113, 0.3);
  animation: glitch 4s infinite;
  position: relative;
}

/* CSS Glitch effect for guerilla headline */
@keyframes glitch {
  0%, 92%, 100% { transform: none; text-shadow: 0 0 40px rgba(248, 113, 113, 0.3); }
  93% { transform: translate(-2px, 1px) skewX(-0.5deg); text-shadow: 2px 0 #60a5fa, -2px 0 #f87171; }
  94% { transform: translate(2px, -1px) skewX(0.5deg); text-shadow: -2px 0 #60a5fa, 2px 0 #f87171; }
  95% { transform: translate(-1px, 0) skewX(-0.3deg); text-shadow: 1px 0 #f87171; }
  96% { transform: none; text-shadow: 0 0 40px rgba(248, 113, 113, 0.3); }
  97% { transform: translate(1px, 1px); text-shadow: -1px 0 #60a5fa; }
  98% { transform: none; text-shadow: 0 0 40px rgba(248, 113, 113, 0.3); }
}

body.guerilla .subtitle {
  color: var(--text-dim);
  font-style: italic;
}

/* Guerilla shield has red tint */
body.guerilla .shield-svg #shieldPath {
  stroke: var(--accent);
}
body.guerilla .shield-svg #lockBody,
body.guerilla .shield-svg #lockShackle {
  stroke: var(--accent);
}
body.guerilla .shield-svg #lockKeyhole,
body.guerilla .shield-svg #lockKeyhole + rect {
  fill: var(--accent);
}
body.guerilla .shield-svg {
  filter: drop-shadow(0 0 12px rgba(248, 113, 113, 0.3));
}

/* ── Checker card ─────────────────────────────────────────────────────────── */

.checker-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  background: rgba(17, 24, 39, 0.85);
}

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.18s;
}

.input-wrap:focus-within {
  border-color: var(--primary);
}

#passwordInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--text);
  min-width: 0;
}

#passwordInput::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

.eye-btn {
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  padding: 0 12px;
  height: 46px;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.eye-btn svg { width: 18px; height: 18px; }
.eye-btn:hover { color: var(--text); background: var(--border); }
.eye-btn.active { color: var(--primary); }

.check-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.check-btn:hover:not(:disabled) {
  background: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35);
}

.check-btn:active { transform: translateY(0); }
.check-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.privacy-note {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
}

/* ── Result states ────────────────────────────────────────────────────────── */

.result { min-height: 0; }

.result-found, .result-safe, .result-error, .result-loading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.5;
  animation: resultSlideIn 0.4s ease-out;
}

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

.result-found {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.result-safe {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.result-error {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.result-loading {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  justify-content: center;
}

.result-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.result-found .result-icon { color: var(--accent); }
.result-safe .result-icon { color: var(--green); }

.result-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-message {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Typing cursor for message */
.result-message .typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: currentColor;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Guerilla mode: bigger, bolder message */
body.guerilla .result-message {
  font-size: 1.4rem;
  font-weight: 700;
  font-style: italic;
}

body.guerilla .result-found {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.5);
  box-shadow: 0 0 30px rgba(220, 38, 38, 0.1);
}

/* Screen shake animation for breach */
body.shake {
  animation: screenShake 0.5s ease-in-out;
}

@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-3px); }
  20% { transform: translateX(3px); }
  30% { transform: translateX(-2px); }
  40% { transform: translateX(2px); }
  50% { transform: translateX(-1px); }
}

/* Red flash overlay on breach */
.breach-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(220, 38, 38, 0.15), transparent 70%);
  z-index: 100;
  pointer-events: none;
  animation: flashFade 0.8s ease-out forwards;
}

@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── CTA ──────────────────────────────────────────────────────────────────── */

.cta {
  text-align: center;
}

.cta.hidden { display: none; }

.cta-link {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.2s;
  animation: resultSlideIn 0.4s ease-out 0.3s both;
}

.cta-link:hover {
  background: var(--primary-light);
  color: var(--bg);
  transform: translateY(-1px);
}

/* ── Share button ────────────────────────────────────────────────────────── */

.share-wrap {
  text-align: center;
  animation: resultSlideIn 0.4s ease-out 0.5s both;
}

.share-wrap.hidden { display: none; }

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-family: var(--body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.share-btn:hover {
  background: var(--border);
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.share-btn.copied {
  background: rgba(52, 211, 153, 0.1);
  border-color: var(--green);
  color: var(--green);
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.footer {
  margin-top: 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.footer-logo:hover { color: var(--text); }
.footer-logo img { border-radius: 4px; }

.footer-text {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 520px) {
  .hero h1 { font-size: 1.6rem; }
  body.guerilla .hero h1 { font-size: 1.9rem; }
  .checker-card { padding: 16px; }
  body.guerilla .result-message { font-size: 1.2rem; }
  .shield-svg { width: 64px; height: 75px; }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  #particles { display: none; }
}
