:root {
  --bg: #07080d;
  --bg-soft: #0d111b;
  --surface: rgba(17, 22, 34, 0.78);
  --surface-strong: rgba(12, 16, 25, 0.92);
  --surface-muted: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f8fafc;
  --muted: #9aa4b2;
  --muted-strong: #cbd5e1;
  --primary: #8b5cf6;
  --primary-strong: #7c3aed;
  --secondary: #22d3ee;
  --accent: #fb3b64;
  --warning: #facc15;
  --success: #4ade80;
  --radius-xl: 8px;
  --radius-lg: 8px;
  --radius-md: 8px;
  --shadow-soft: 0 18px 60px rgba(0, 0, 0, 0.38);
  --shadow-ring: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.08), transparent 30%),
    linear-gradient(225deg, rgba(139, 92, 246, 0.12), transparent 36%),
    linear-gradient(180deg, #090b12 0%, #05060a 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
textarea,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

:where(button, textarea, input, [role="button"]):focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 3px;
}

.bg-noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.error-console {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  width: 100%;
  padding: 20px;
  background: rgba(220, 38, 38, 0.94);
  color: white;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  white-space: pre-wrap;
}

.hidden-canvas {
  display: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: clamp(18px, 4vw, 44px) 16px 84px;
}

.app-container {
  position: relative;
  z-index: 10;
  width: min(100%, 520px);
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-container--result {
  width: min(100%, 660px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar--centered {
  align-items: center;
}

.brand-title {
  margin: 0 0 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.6rem, 10vw, 4.35rem);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: 0;
}

.brand-dot {
  color: var(--primary);
}

.brand-kicker,
.eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  line-height: 1.5;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted-strong);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.mode-card {
  min-height: 94px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

.mode-card--active {
  border-color: rgba(139, 92, 246, 0.65);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.24), rgba(34, 211, 238, 0.07));
  color: var(--text);
  box-shadow: 0 14px 36px rgba(37, 22, 71, 0.34);
}

.mode-icon {
  color: var(--primary);
}

.mode-icon--inactive {
  color: var(--muted);
  opacity: 0.7;
}

.mode-label {
  max-width: 100%;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.glass-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-soft), var(--shadow-ring);
}

.panel {
  padding: 6px;
  margin-bottom: 18px;
}

.panel-inner {
  border-radius: var(--radius-md);
  background: rgba(4, 7, 13, 0.54);
  padding: clamp(18px, 4vw, 24px);
}

.mode-description {
  margin: 0 0 16px;
  color: var(--muted-strong);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.upload-zone {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.upload-zone:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.08);
}

.upload-zone--active {
  border-style: solid;
  border-color: rgba(139, 92, 246, 0.65);
  background: rgba(139, 92, 246, 0.08);
}

.upload-empty {
  padding: 18px;
  text-align: center;
}

.upload-action {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted-strong);
  transition: transform 180ms ease, color 180ms ease, background 180ms ease;
}

.upload-zone:hover .upload-action {
  transform: scale(1.05);
  background: rgba(139, 92, 246, 0.16);
  color: var(--text);
}

.upload-title {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-remove {
  position: absolute;
  top: 10px;
  right: 10px;
}

.context-wrap {
  position: relative;
  margin-top: 14px;
}

.context-icon {
  position: absolute;
  top: 15px;
  left: 14px;
  color: rgba(203, 213, 225, 0.45);
}

.context-input {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  padding: 14px 16px 14px 44px;
  font-size: 0.92rem;
  line-height: 1.45;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.context-input::placeholder {
  color: rgba(154, 164, 178, 0.64);
}

.context-input:focus {
  border-color: rgba(139, 92, 246, 0.7);
  background: rgba(0, 0, 0, 0.32);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
  outline: none;
}

.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(251, 59, 100, 0.28);
  border-radius: var(--radius-md);
  background: rgba(251, 59, 100, 0.1);
  color: #ff6f8e;
  font-size: 0.82rem;
  line-height: 1.4;
}

.primary-action,
.download-button {
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius-md);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

.primary-action {
  background: linear-gradient(135deg, var(--primary), #5b7cfa);
  color: var(--text);
  box-shadow: 0 18px 42px rgba(124, 58, 237, 0.35);
}

.primary-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 24px 54px rgba(124, 58, 237, 0.42);
}

.primary-action:active:not(:disabled),
.download-button:active {
  transform: translateY(0) scale(0.99);
}

.primary-action:disabled {
  cursor: wait;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  box-shadow: none;
}

.loading-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  animation: dotPulse 0.9s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.12s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.24s;
}

.result-card {
  position: relative;
  overflow: hidden;
  padding: 6px;
  margin-bottom: 18px;
  border-color: color-mix(in srgb, var(--score-color, var(--primary)) 34%, rgba(255, 255, 255, 0.1));
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--score-color, var(--primary)), transparent);
  opacity: 0.8;
}

.result-inner {
  position: relative;
  border-radius: var(--radius-md);
  background: rgba(4, 7, 13, 0.58);
  padding: clamp(22px, 5vw, 34px);
  text-align: center;
}

.score-number {
  margin: 0 0 4px;
  color: var(--score-color, var(--primary));
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(4.7rem, 18vw, 7rem);
  font-weight: 900;
  line-height: 0.88;
}

.score-label {
  margin: 0 0 22px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.verdict-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  margin-bottom: 22px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--score-color, var(--primary)) 70%, white);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--score-color, var(--primary)) 12%, transparent);
  color: var(--score-color, var(--primary));
}

.verdict-pill h3 {
  margin: 0;
  font-size: clamp(1rem, 5vw, 1.35rem);
  font-weight: 900;
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.headline {
  margin: 0 0 22px;
  color: var(--muted-strong);
  font-size: clamp(1rem, 4vw, 1.18rem);
  font-weight: 600;
  font-style: italic;
  line-height: 1.55;
}

.flag-list {
  display: grid;
  gap: 10px;
  margin-bottom: 4px;
  text-align: left;
}

.flag-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted-strong);
  transition: border-color 180ms ease, background 180ms ease;
}

.flag-item:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.075);
}

.flag-icon {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--score-color, var(--primary));
}

.flag-text {
  font-size: 0.92rem;
  line-height: 1.45;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.usage-grid > div {
  min-width: 0;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.usage-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.usage-value {
  margin: 0;
  color: var(--muted-strong);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.classified-card {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 5vw, 28px);
  margin-bottom: 18px;
  transition: border-color 220ms ease, transform 220ms ease;
}

.classified-card--locked {
  cursor: pointer;
}

.classified-card--locked:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, 0.34);
}

.classified-card--unlocked {
  border-color: rgba(139, 92, 246, 0.36);
}

.classified-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(5, 6, 10, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.classified-lock {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  box-shadow: 0 16px 40px rgba(124, 58, 237, 0.38);
}

.classified-copy {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.blur-secret {
  filter: blur(10px) grayscale(80%);
  user-select: none;
  transition: filter 0.6s ease;
  cursor: pointer;
}

.unlocked .blur-secret {
  filter: none;
  user-select: text;
  cursor: text;
}

.classified-section + .classified-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.section-label--success {
  color: var(--success);
}

.truth-text {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.94rem;
  line-height: 1.65;
}

.action-box {
  border: 1px solid rgba(74, 222, 128, 0.22);
  border-radius: var(--radius-md);
  background: rgba(74, 222, 128, 0.09);
  padding: 15px;
}

.action-box p {
  margin: 0;
  color: #91f7b2;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

.download-button {
  margin-bottom: 20px;
  background: var(--text);
  color: #05060a;
  box-shadow: 0 18px 42px rgba(248, 250, 252, 0.12);
}

.download-button:hover {
  transform: translateY(-2px);
  background: #e6edf6;
}

.footer-credit {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 14px;
  pointer-events: none;
  text-align: center;
}

.footer-credit p {
  margin: 0;
  color: rgba(154, 164, 178, 0.54);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#loading-screen {
  position: fixed;
  inset: 0;
  background: #050505;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--primary);
  font-family: "JetBrains Mono", monospace;
  transition: opacity 0.5s ease;
}

.loading-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.loading-subtitle {
  margin-top: 10px;
  font-size: 0.62rem;
  opacity: 0.5;
  letter-spacing: 0.08em;
}

.loading-bar {
  width: min(220px, 60vw);
  height: 2px;
  background: #222;
  margin-top: 20px;
  position: relative;
  overflow: hidden;
}

.loading-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50%;
  background: var(--primary);
  animation: loading 1s infinite linear;
}

@keyframes loading {
  0% {
    left: -50%;
  }

  100% {
    left: 100%;
  }
}

@keyframes dotPulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-inline: 12px;
  }

  .mode-grid {
    gap: 8px;
  }

  .mode-card {
    min-height: 88px;
    padding-inline: 6px;
  }

  .mode-label {
    font-size: 0.56rem;
  }

  .upload-zone {
    min-height: 190px;
  }

  .usage-grid {
    gap: 6px;
  }
}
