/* ===== RESET ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== THEME VARIABLES ===== */
:root {
  --bg-card: #1e293b;
  --bg-input: #020617;

  --text-main: #e5e7eb;
  --text-muted: #94a3b8;

  --accent: #22d3ee;
  --accent-hover: #67e8f9;

  --border-radius: 10px;
}

/* ===== PAGE ===== */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(
    135deg,
    #020617,
    #0f172a,
    #1e3a8a,
    #0f172a,
    #020617
  );
  background-size: 400% 400%;
  animation: gradientShift 40s ease-in-out infinite;

  color: var(--text-main);
  min-height: 100vh;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 40px;
}

/* ===== BACKGROUND NOISE TEXTURE ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;

  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");

  opacity: 0.15;
  z-index: -1;
  mix-blend-mode: overlay;
}

/* ===== GRADIENT MOTION ===== */

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== APP WRAPPER ===== */
.container {
  width: 100%;
  max-width: 700px;
}

/* ===== HEADER ===== */
.header {
  margin-bottom: 30px;
}

.header h1 {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.header p {
  color: var(--text-muted);
}

/* ===== CARD ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.card h2 {
  margin-bottom: 10px;
  font-size: 1.3rem;
}

/* ===== INPUT ===== */
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-muted);
}

select,
textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid #334155;
  border-radius: var(--border-radius);
  font-size: 15px;
  resize: vertical;
  margin-bottom: 15px;
}

textarea {
  height: 120px;
}

select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== BUTTON ===== */
button {
  background: var(--accent);
  color: #020617;
  border: none;
  padding: 12px 20px;
  border-radius: var(--border-radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ===== OUTPUT ===== */
pre.output {
  background: var(--bg-input);
  border-radius: var(--border-radius);
  padding: 15px;
  min-height: 50px;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ===== RESULT REVEAL ANIMATION ===== */

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

.card-animation.animate {
  animation: revealResult 1s ease;
}

/* ===== ALGORITHM CHANGE FEEDBACK ===== */
.context-change {
  animation: contextFade 1s ease;
}

@keyframes contextFade {
  0%   { opacity: 1; transform: translateY(0); }
  40%  { opacity: 1; transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== PARAGRAPH ===== */
.info-p {
  white-space: pre-line;
  
  position: relative;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.65);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.history-subheading {
  font-weight: 700;
  color: var(--accent);
}

#dot-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}