:root {
  --bg-primary: #f7df1e; /* JS Yellow */
  --bg-secondary: #ffe566;
  --bg-card: #f9e13d;
  --accent-primary: #000;
  --accent-hover: #333;
  --accent-dim: #555;
  --text-primary: #000;
  --text-secondary: #111;
  --text-muted: #444;
  --error-red: #d32f2f;
  --success: #000;
  --border: rgba(0, 0, 0, 0.15);
  --max-width: 720px;
  --pad: 16px;
  --gap: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Subtle dark noise texture on yellow bg */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  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.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  filter: brightness(0) invert(0);
}

#root {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  z-index: 2;
}

.app {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.terminal {
  background: #fff; /* White terminal card on yellow bg */
  border: 1px solid var(--border);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.12),
    0 0 20px rgba(0, 0, 0, 0.05);
  padding: 24px;
  border-radius: 12px;
  position: relative;
}

.header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.brand {
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Buttons */
button {
  font-family: inherit;
}

.analyze-btn {
  background: #000;
  color: #f7df1e;
  border: 2px solid #000;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  transition: all 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.analyze-btn:hover:not(:disabled) {
  background: transparent;
  color: #000;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.analyze-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.analyze-btn.disabled,
button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: #888;
  border-color: #888;
  color: #fff;
}

/* InputScreen */
.input-screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.editor {
  width: 100%;
  background: #fdfdfd;
  border: 1px solid #ddd;
  color: #000;
  padding: 16px;
  border-radius: 8px;
  line-height: 1.6;
  min-height: 200px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  outline: none;
  caret-color: #000;
  transition: border-color 200ms ease;
}

.editor:focus {
  border-color: #000;
}

.editor::placeholder {
  color: #bbb;
  opacity: 0.8;
}

/* AnalyzingScreen */
.analyzing-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.analyzing-screen .title {
  color: #000;
  font-weight: 700;
  font-size: 1.1rem;
}

.progress {
  background: #eee;
  border: 1px solid #ddd;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.progress-inner {
  height: 100%;
  background: #000;
  width: 0%;
  transition: width 100ms linear;
}

.progress-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-weight: 700;
  z-index: 5;
  mix-blend-mode: difference;
}

.log-container {
  background: #f9f9f9;
  border: 1px solid #eee;
  padding: 16px;
  border-radius: 8px;
  color: #333;
  max-height: 240px;
  overflow: auto;
  font-size: 0.9rem;
}

.log-line {
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
}

.cursor {
  color: #000;
  animation: blink 1s steps(2, start) infinite;
}

/* SuccessScreen */
.success-card {
  text-align: center;
  padding: 30px;
  border: 3px solid #000;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.success-200 {
  font-family: "Fira Code", sans-serif;
  font-size: 4rem;
  color: #000;
  line-height: 1;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.success-title {
  color: #000;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.success-sub {
  color: #666;
}

/* ErrorScreen */
.error-screen {
  padding: 30px;
  border: 1px solid #eee;
  border-radius: 16px;
  background: #fff;
}

.error-heading {
  font-family: "Fira Code", sans-serif;
  font-size: 2rem;
  color: var(--error-red);
  margin-bottom: 5px;
}

.error-sub {
  color: #000;
  font-weight: 700;
  margin-bottom: 20px;
}

.json-block {
  background: #f8f8f8;
  border: 1px solid #000;
  padding: 16px;
  border-radius: 8px;
  color: #111;
  position: relative;
  margin-bottom: 20px;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  border: 1px solid #ddd;
  color: #666;
  padding: 4px 8px;
  font-size: 0.7rem;
  border-radius: 4px;
}

.confidence-label {
  color: #000;
  font-weight: 700;
  margin-bottom: 8px;
}

.confidence-bar {
  background: #eee;
  border: 1px solid #ddd;
  height: 14px;
  border-radius: 10px;
  overflow: hidden;
}

.confidence-inner {
  height: 100%;
  background: #000;
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.status-left {
  display: flex;
  align-items: center;
  color: #000;
  font-weight: 700;
}

.status-right {
  color: #666;
  font-size: 0.85rem;
}

/* Global Utilities */
.app-footer {
  margin-top: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0.6;
}

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

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

.enter {
  animation: fadeInUp 400ms ease both;
}

@media (max-width: 600px) {
  #root {
    padding: 20px;
  }
  .success-200 {
    font-size: 2.5rem;
  }
  .error-heading {
    font-size: 1.5rem;
  }
}
