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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f8fafc;
  min-height: 100vh;
  padding: 2rem;
  color: #1a202c;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border: 1px solid #e2e8f0;
  padding: 2rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

h1 {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.subtitle {
  text-align: center;
  font-size: 1.2rem;
  color: #4a5568;
  margin-bottom: 2rem;
  font-weight: 400;
  line-height: 1.4;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.controls-section {
  background: white;
  padding: 2rem;
  border: 1px solid #e2e8f0;
  margin-bottom: 2rem;
  border-left: 4px solid #3182ce;
}

.controls-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.controls-title::before {
  content: "⚙";
  font-size: 1.2rem;
  color: #3182ce;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

label {
  font-weight: 600;
  color: #2d3748;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: "?";
  display: inline-block;
  width: 18px;
  height: 18px;
  background: #3182ce;
  color: white;
  font-size: 11px;
  text-align: center;
  line-height: 18px;
  font-weight: bold;
  margin-left: 6px;
  transition: all 0.2s ease;
}

.tooltip:hover::after {
  background: #2c5282;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: white;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  white-space: normal;
  z-index: 1000;
  max-width:  320px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border: 1px solid #2d3748;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

input[type="number"], input[type="text"], input[type="range"], select {
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
  font-weight: 500;
  font-family: inherit;
}

input[type="range"] {
  padding: 0.5rem;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-track {
  background: #e2e8f0;
  height: 6px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  width: 18px;
  background: #3182ce;
  cursor: pointer;
  margin-top: -6px;
}

input[type="number"]:focus, input[type="text"]:focus, input[type="range"]:focus, select:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233182ce' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  padding-right: 3rem;
}

select:hover {
  border-color: #3182ce;
}

select option {
  padding: 0.5rem;
  font-weight: 500;
  background: white;
  color: #1a202c;
}

.preset-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 0.5rem 1rem;
  border: 2px solid #e2e8f0;
  background: white;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preset-btn:hover {
  border-color: #3182ce;
  background: #f7fafc;
}

.preset-btn.active {
  border-color: #3182ce;
  background: #3182ce;
  color: white;
}

.buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

button {
  padding: 0.875rem 2rem;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: #3182ce;
  color: white;
  box-shadow: 0 2px 8px rgba(49, 130, 206, 0.25);
}

.btn-primary:hover {
  background: #2c5282;
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.35);
}

.btn-secondary {
  background: #38a169;
  color: white;
  box-shadow: 0 2px 8px rgba(56, 161, 105, 0.25);
}

.btn-secondary:hover {
  background: #2f855a;
  box-shadow: 0 4px 12px rgba(56, 161, 105, 0.35);
}

.btn-danger {
  background: #e53e3e;
  color: white;
  box-shadow: 0 2px 8px rgba(229, 62, 62, 0.25);
}

.btn-danger:hover {
  background: #c53030;
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.35);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (max-width: 1200px) {
  .charts-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  }
}

.chart-container {
  background: white;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.chart-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #3182ce;
}

.chart-container:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.chart-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 1rem;
}

.chart-title.data::before { content: "■"; color: #3182ce; }
.chart-title.prediction::before { content: "▲"; color: #38a169; }
.chart-title.training::before { content: "●"; color: #d69e2e; }
.chart-title.boundary::before { content: "◆"; color: #805ad5; }
.chart-title.network::before { content: "▼"; color: #e53e3e; }
.chart-title.activation::before { content: "⬢"; color: #00b5d8; }
.chart-title.training-data::before { content: "♦"; color: #dd6b20; }
.chart-title.validation-data::before { content: "♠"; color: #0bc5ea; }
.chart-title.legend::before { content: "■"; color: #718096; }

canvas {
  width: 100% !important;
  height: 300px !important;
}

.results-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.metrics-container, .confusion-container {
  background: white;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.metrics-container::before, .confusion-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #38a169;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 1rem;
}

.section-title.metrics::before { content: "■"; color: #38a169; }
.section-title.confusion::before { content: "▲"; color: #3182ce; }

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

th, td {
  padding: 1rem;
  text-align: center;
  border: 1px solid #e2e8f0;
  font-weight: 500;
}

th {
  background: #f7fafc;
  color: #1a202c;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.85rem;
  border-bottom: 2px solid #3182ce;
}

td.correct {
  background: #f0fff4;
  color: #22543d;
  font-weight: 600;
}

td.incorrect {
  background: #fff5f5;
  color: #742a2a;
  font-weight: 600;
}

#metricsList {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

#metricsList li {
  background: #f7fafc;
  padding: 1rem;
  border-left: 4px solid #3182ce;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

#metricsList li:hover {
  background: #edf2f7;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#metricsList li strong {
  color: #3182ce;
  font-weight: 700;
}

.loading {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #3182ce;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

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

.early-stopping-indicator {
  background: #fed7e2;
  color: #702459;
  padding: 0.5rem 1rem;
  margin-top: 1rem;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 0.5rem;
  border-left: 4px solid #d53f8c;
}

.early-stopping-indicator::before {
  content: "■";
  color: #d53f8c;
}

.range-value {
  font-weight: 700;
  color: #3182ce;
  font-size: 0.85rem;
}


.footer {
 margin-top: 1rem;
 background: transparent;
 color: #4a5568;
 padding: 1.5rem 0;
 text-align: center;
}

.footer-content {
 max-width: 800px;
 margin: 0 auto;
 padding: 0 1rem;
}

.footer-main {
 font-size: 1rem;
 margin-bottom: 0.75rem;
 font-weight: 500;
}

.footer-main strong:first-of-type {
 color: #3182ce;
 font-weight: 700;
}

.footer-main strong:last-of-type {
 color: #38a169;
 font-weight: 700;
}

.footer-info {
 border-top: 1px solid #e2e8f0;
 padding-top: 0.75rem;
 font-size: 0.85rem;
 color: #718096;
 line-height: 1.4;
}

@media (max-width: 768px) {
 .footer {
   padding: 1rem 0;
 }
 
 .footer-main {
   font-size: 0.9rem;
 }
 
 .footer-info {
   font-size: 0.8rem;
 }
}