body {
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #e3f2fd, #fce4ec);
  color: #2c3e50;
  animation: fadeIn 0.6s ease-in;
  transition: background 0.3s ease, color 0.3s ease;
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 40px auto;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.navbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  background-color: #4a148c;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  transition: background 0.3s;
}

.navbar a:hover {
  background-color: #6a1b9a;
}

h1, h2, h3 {
  text-align: center;
  color: #4a148c;
  margin-bottom: 1rem;
}

label {
  font-weight: bold;
  display: block;
  margin: 1rem 0 0.5rem;
}

textarea, input#patternInput {
  width: 100%;
  padding: 1rem;
  border-radius: 10px;
  border: 2px solid #6a1b9a;
  font-size: 1rem;
  resize: vertical;
  background-color: #fdfdfd;
  font-family: monospace;
  margin-bottom: 1rem;
}

button, .start-btn, .info-btn {
  padding: 0.75rem 1.5rem;
  margin: 0.5rem 0.25rem;
  font-size: 1rem;
  color: white;
  background: linear-gradient(to right, #4a148c, #0d47a1);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s;
  text-decoration: none;
  display: inline-block;
}

button:hover, .start-btn:hover, .info-btn:hover {
  transform: scale(1.05);
  background-color: #0d47a1;
}

.analysis-output, #result, .disorder-result {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 12px;
  font-size: 1rem;
  animation: fadeInResult 0.6s ease;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-family: 'Courier New', monospace;
}

.analysis-output {
  background: #fffde7;
  border-left: 6px solid #fbc02d;
}

#result {
  background: #e8f5e9;
  border-left: 6px solid #1b5e20;
}

.disorder-result {
  background: #ffffff;
  border-left: 4px solid #6a1b9a;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 1.5rem;
}

#validationMsg {
  font-size: 0.95rem;
  color: #d32f2f;
  margin-top: 0.5rem;
}

.progress-bar {
  display: none;
  height: 5px;
  width: 100%;
  background: #d1c4e9;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 1rem;
}

.progress-bar.loading::before {
  content: "";
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4a148c, #0d47a1);
  animation: load 2s linear infinite;
}

@keyframes load {
  0% { width: 0%; }
  50% { width: 100%; }
  100% { width: 0%; }
}

.dna-animation {
  width: 200px;
  height: auto;
  display: block;
  margin: 2rem auto;
  animation: rotateDNA 10s linear infinite;
}

@keyframes rotateDNA {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.modal {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.3s ease-in-out;
  color: #2c3e50;
}

.modal-content h2 {
  margin-top: 0;
  color: #4a148c;
  font-size: 1.5rem;
}

.modal-content button {
  margin-top: 1.5rem;
  background: #4a148c;
  color: white;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

.modal-content button:hover {
  background: #6a1b9a;
}

@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

canvas#chartCanvas {
  margin: 2rem auto;
  display: block;
  max-width: 100%;
  background: #ffffff;
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInResult {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 0.5rem;
  }
  button, .start-btn {
    width: 100%;
  }
  .container {
    padding: 1rem;
  }
}

body.dark-mode {
  background: #121212;
  color: #f5f5f5;
}

body.dark-mode .container {
  background: #1e1e1e;
}

body.dark-mode textarea,
body.dark-mode input#patternInput {
  background: #2a2a2a;
  color: #eee;
  border-color: #666;
}

body.dark-mode .navbar {
  background: #333;
}

body.dark-mode .navbar a:hover {
  background: #555;
}

body.dark-mode .analysis-output {
  background: #3a3a28;
  border-left-color: #ffeb3b;
}

body.dark-mode #result {
  background: #1b2f20;
  border-left-color: #00e676;
}

body.dark-mode .disorder-result {
  background: #2b2b2b;
  border-left-color: #ab47bc;
}

body.dark-mode .modal-content {
  background: #2b2b2b;
  color: #f5f5f5;
}

body.dark-mode .modal-content button {
  background: #333;
  color: #fff;
}

body.dark-mode .modal-content button:hover {
  background: #555;
}

body.dark-mode canvas#chartCanvas {
  background: #1e1e1e;
  box-shadow: 0 0 8px rgba(255,255,255,0.1);
}
