:root {
  --bg-page: #071b2f;
  --bg-card: rgba(15, 23, 42, 0.92);
  --bg-panel: rgba(15, 23, 42, 0.78);
  --border: rgba(255, 255, 255, 0.12);
  --text-base: #e2e8f0;
  --text-muted: #94a3b8;
  --text-strong: #ffffff;
  --accent: #38bdf8;
  --accent-dark: #2563eb;
  --success: #22c55e;
  --surface: rgba(255, 255, 255, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 28%),
    linear-gradient(135deg, #0d1f35 0%, #122b43 50%, #0f172a 100%);
  color: var(--text-base);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.12), transparent 22%);
  pointer-events: none;
}

.container {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 100vh;
}

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.18);
}

header h1 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: clamp(1.75rem, 2.2vw, 2.4rem);
  color: var(--text-strong);
}

.page-subtitle {
  margin-top: 0.85rem;
  max-width: 44rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.method-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.method-btn {
  padding: 0.85rem 1.15rem;
  min-width: 8rem;
  border-radius: 0.85rem;
  font-weight: 700;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-base);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.method-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.method-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 20px 45px rgba(37, 99, 235, 0.2);
}

.main-content {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

aside {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.control-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.btn {
  border: none;
  border-radius: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.15rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.15);
  color: #ffffff;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-play {
  background: linear-gradient(135deg, #22c55e, #14b8a6);
}

.btn-reset {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-base);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  color: var(--text-strong);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
}

.space-y-4 {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.space-y-1 {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input[type='range'],
select {
  width: 100%;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-strong);
  padding: 0.9rem 1rem;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

input[type='range'] {
  padding: 0.35rem 0;
}

input[type='range']:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #ffffff;
}

main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.22);
}

.card h2 {
  font-size: 1.15rem;
  color: #ffffff;
  margin-bottom: 0.75rem;
}

.diagram-container {
  min-height: 320px;
  border-radius: 1rem;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.15), rgba(15, 23, 42, 0.95));
  border: 2px dashed rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
}

.chart-container {
  min-height: 320px;
  position: relative;
}

canvas {
  width: 100% !important;
  height: 100% !important;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.18);
}

.stat-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  padding: 1.2rem;
  text-align: center;
}

.stat-box h4 {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.stat-value {
  color: var(--text-strong);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-box.blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(15, 23, 42, 0.75));
}

.stat-box.blue h4 {
  color: #93c5fd;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button,
select,
input {
  font: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.75);
  outline-offset: 3px;
}

aside::-webkit-scrollbar {
  width: 8px;
}

aside::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

aside::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

aside::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 1100px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .container {
    padding: 1rem;
  }

  header {
    padding: 1.25rem;
    align-items: stretch;
  }

  .control-buttons {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
