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

:root {
  --bg-base: #070b14;
  --bg-surface: rgba(255, 255, 255, .04);
  --bg-card: rgba(255, 255, 255, .055);
  --bg-card-hover: rgba(255, 255, 255, .08);
  --bg-input: rgba(255, 255, 255, .06);
  --bg-input-focus: rgba(255, 255, 255, .09);
  --border: rgba(255, 255, 255, .10);
  --border-focus: rgba(99, 179, 237, .6);

  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-green: #22c55e;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --grad-brand: linear-gradient(135deg, #3b82f6 0%, #06b6d4 50%, #22c55e 100%);
  --grad-btn: linear-gradient(135deg, #3b82f6, #06b6d4);
  --grad-btn-h: linear-gradient(135deg, #60a5fa, #22d3ee);

  --glow-blue: 0 0 24px rgba(59, 130, 246, .35);
  --glow-cyan: 0 0 24px rgba(6, 182, 212, .35);
  --glow-green: 0 0 16px rgba(34, 197, 94, .4);

  --text-primary: #f0f6ff;
  --text-secondary: #a8bbd4;
  --text-tertiary: #64788e;
  --text-muted: #3d5166;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-lift: 0 16px 48px rgba(0, 0, 0, .55), 0 4px 12px rgba(0, 0, 0, .35);

  --font-display: 'Orbitron', monospace;
  --font-body: 'Poppins', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: .22s cubic-bezier(.4, 0, .2, 1);
  --transition-slow: .4s cubic-bezier(.4, 0, .2, 1);
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(99, 179, 237, .3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-blue);
}

html {
  scroll-behavior: smooth;
  height: 100vh;
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  font-family: var(--font-body);
  background-color: var(--bg-base);
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, .018) 1px, transparent 1px),
    radial-gradient(ellipse 80% 50% at 15% 20%, rgba(59, 130, 246, .13) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 75%, rgba(168, 85, 247, .11) 0%, transparent 55%),
    radial-gradient(ellipse 50% 35% at 50% 50%, rgba(6, 182, 212, .07) 0%, transparent 60%);
  background-size: 32px 32px, 100% 100%, 100% 100%, 100% 100%;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.65;
  overflow-x: hidden;
}

.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--border);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 11, 20, .75);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  padding: 0 2rem;
}

.header-inner {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: auto;
  gap: 1.5rem;
  padding: 0.8rem 0;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0 0 auto;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  margin-left: auto;
}

.logo-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, .25), rgba(6, 182, 212, .25));
  border: 1px solid rgba(99, 179, 237, .35);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  box-shadow: 0 0 18px rgba(6, 182, 212, .25);
  transition: box-shadow var(--transition), transform var(--transition);
}

.logo-icon:hover {
  transform: rotate(-6deg) scale(1.08);
  box-shadow: 0 0 30px rgba(6, 182, 212, .45);
}

.logo-icon svg {
  width: 22px;
  height: 22px;
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .12em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.logo-text span {
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .35rem .6rem .35rem 1rem;
  letter-spacing: .05em;
  margin-left: 2rem;
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  opacity: 0.6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin-left: 8px;
  border-left: 1px solid var(--border);
  padding-left: 12px;
  transition: opacity var(--transition), transform var(--transition);
}

.theme-toggle-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.theme-toggle-btn svg {
  width: 16px;
  height: 16px;
}

[data-theme="light"] .theme-moon {
  display: block;
}

[data-theme="light"] .theme-sun {
  display: none;
}

[data-theme="dark"] .theme-moon {
  display: none;
}

[data-theme="dark"] .theme-sun {
  display: block;
}

[data-theme="dark"]:root .theme-moon {
  display: none;
}

[data-theme="dark"]:root .theme-sun {
  display: block;
}

:root:not([data-theme="light"]) .theme-moon {
  display: none;
}

:root:not([data-theme="light"]) .theme-sun {
  display: block;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .5;
    transform: scale(.8);
  }
}

.app-main {
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem 2.5rem 0.5rem;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
  flex: 1;
  min-height: calc(100vh - 84px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.content-area {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  min-width: 0;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(59, 130, 246, .5) 30%,
      rgba(6, 182, 212, .5) 60%,
      transparent 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: rgba(255, 255, 255, .16);
}

.card-header {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: 1.05rem 1.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  background: rgba(255, 255, 255, .02);
}

.card-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: .01em;
  flex: 1;
}

.card-icon {
  font-size: 1rem;
  opacity: .55;
  flex-shrink: 0;
  color: var(--accent-cyan);
}

.header-note {
  font-size: .67rem;
  color: var(--text-tertiary);
  margin-left: auto;
}

.card-body {
  padding: 1.6rem;
}

.form-group {
  margin-bottom: 1.25rem;
  transition: opacity var(--transition), max-height .35s var(--transition);
}

.form-group.hidden {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  pointer-events: none;
}

.form-group label {
  display: block;
  font-size: 0.9rem; /* slightly smaller */
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: .5rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
[data-theme="dark"] .form-group label {
  color: var(--text-primary);
}

input[type="text"],
input[type="number"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 400;
  padding: .72rem 1.1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18), 0 0 14px rgba(59, 130, 246, .1);
}

input::placeholder {
  color: var(--text-muted);
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}

.hint {
  display: block;
  font-size: 1rem;
  color: var(--text-tertiary);
  margin-top: .35rem;
  line-height: 1.5;
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background: rgba(15, 23, 42, .88);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 400;
  padding: .65rem 2.4rem .65rem 1rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  color-scheme: dark;
  accent-color: #3b82f6;
}

.select-wrapper select::-ms-expand {
  display: none;
}

.select-wrapper select:focus {
  border-color: var(--border-focus);
  background: rgba(15, 23, 42, .96);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

[data-theme="light"] .select-wrapper select {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, .12);
  color: #0f172a;
  color-scheme: light;
}

[data-theme="light"] .select-wrapper select:focus {
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .14);
}

[data-theme="dark"] .select-wrapper select {
  color-scheme: dark;
}

.select-wrapper select option {
  font-family: var(--font-body);
}

[data-theme="light"] .select-wrapper .select-arrow {
  color: rgba(15, 23, 42, .65);
}


.select-arrow {
  position: absolute;
  right: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: .8rem;
  transition: color var(--transition);
}

.viz-body {
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  background: rgba(15, 23, 42, .52);
  border: 1px solid rgba(59, 130, 246, .14);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04), 0 24px 90px rgba(6, 182, 212, .11);
}

#disk-canvas {
  width: 100%;
  display: block;
  min-height: 520px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 0 28px rgba(59, 130, 246, .18), inset 0 0 0 1px rgba(255, 255, 255, .08);
  background: rgba(7, 11, 20, .72);
}

#highlight-canvas {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
}


.select-wrapper:focus-within .select-arrow {
  color: var(--accent-blue);
}

/* Radio */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: .7rem;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-secondary);
  padding: .5rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.radio-label:hover {
  background: var(--bg-input-focus);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, .18);
}

.radio-label input[type="radio"] {
  display: none;
}

.radio-custom {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, .2);
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.radio-label input[type="radio"]:checked~.radio-custom {
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, .5);
}

.radio-label input[type="radio"]:checked~.radio-custom::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent-blue);
}

.radio-label input[type="radio"]:checked~span:last-child {
  color: var(--text-primary);
}

/* Slider */
.slider-row {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.slider-label {
  font-size: 1rem;
  color: var(--text-muted);
  white-space: nowrap;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, var(--accent-blue) 50%, rgba(255, 255, 255, .1) 50%);
  transition: box-shadow var(--transition);
}

input[type="range"]:focus {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .25);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  box-shadow: 0 0 10px rgba(59, 130, 246, .5);
  border: 2px solid rgba(7, 11, 20, .8);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px rgba(59, 130, 246, .7);
}

/* Error */
.error-box {
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .35);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  font-size: 1.15rem;
  color: #fca5a5;
  margin-bottom: .9rem;
  backdrop-filter: blur(4px);
}

.btn-row {
  display: flex;
  gap: .75rem;
  margin-top: .25rem;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 600;
  padding: .82rem 1.25rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  letter-spacing: .025em;
}

.btn-primary {
  flex: 2;
}

.btn-primary {
  background: var(--grad-btn);
  color: #fff;
  box-shadow: 0 4px 18px rgba(59, 130, 246, .35);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .15), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn-primary:hover {
  background: var(--grad-btn-h);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 28px rgba(59, 130, 246, .5), 0 0 0 1px rgba(255, 255, 255, .12);
}

.btn-primary:hover::after {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0) scale(.99);
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-input-focus);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, .2);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}

.btn-ghost:active {
  transform: translateY(0);
}

.info-placeholder {
  color: var(--text-tertiary);
  font-size: 1.15rem;
  text-align: center;
  padding: 1.5rem 0;
  line-height: 1.75;
}

.algo-info-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .08em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .35rem;
}

.algo-info-subtitle {
  font-size: 1.1rem;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
  font-style: italic;
  font-weight: 300;
  padding-bottom: .85rem;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.algo-info-desc {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
  line-height: 1.75;
  font-weight: 400;
}

.info-section {
  margin-bottom: 1rem;
}

.info-section-title {
  font-size: .95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-tertiary);
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.info-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, rgba(255, 255, 255, .07), transparent);
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.info-list li {
  font-size: 1.15rem;
  color: var(--text-secondary);
  padding: .45rem .8rem;
  border-radius: var(--radius-sm);
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  line-height: 1.55;
}

.info-list li::before {
  flex-shrink: 0;
  font-size: .8rem;
  margin-top: .05rem;
  font-weight: 700;
}

.advantages li {
  background: rgba(34, 197, 94, .07);
  border: 1px solid rgba(34, 197, 94, .14);
  color: rgba(187, 247, 208, .85);
}

.advantages li::before {
  content: '+';
  color: var(--accent-green);
}

.limitations li {
  background: rgba(245, 158, 11, .07);
  border: 1px solid rgba(245, 158, 11, .14);
  color: rgba(253, 230, 138, .8);
}

.limitations li::before {
  content: '–';
  color: var(--accent-amber);
}

.status-badge {
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .24rem .8rem;
  border-radius: 20px;
  margin-left: auto;
  background: rgba(255, 255, 255, .05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, .08);
  transition: all var(--transition);
}

.status-badge.running {
  background: rgba(59, 130, 246, .15);
  color: var(--accent-blue);
  border-color: rgba(59, 130, 246, .35);
  box-shadow: 0 0 12px rgba(59, 130, 246, .2);
  animation: blink .9s ease-in-out infinite;
}

.status-badge.done {
  background: rgba(34, 197, 94, .12);
  color: var(--accent-green);
  border-color: rgba(34, 197, 94, .3);
  box-shadow: 0 0 12px rgba(34, 197, 94, .2);
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .6;
  }
}

.canvas-hit-area {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 3;
  cursor: crosshair;
}

.graph-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
  padding: .55rem .85rem;
  background: rgba(7, 11, 20, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(59, 130, 246, .35);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5), 0 0 0 1px rgba(59, 130, 246, .1);
  min-width: 148px;
}

.graph-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .15rem 0;
}

.tooltip-row:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  padding-bottom: .25rem;
  margin-bottom: .25rem;
}

.tooltip-label {
  font-size: .95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-tertiary);
}

.tooltip-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.tooltip-value.accent {
  color: var(--accent-cyan);
}

.canvas-overlay {
  position: absolute;
  inset: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  background: rgba(7, 11, 20, .75);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, .15);
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 2;
}

.canvas-overlay.hidden {
  display: none;
}

.placeholder-icon {
  font-size: 4rem;
  opacity: .55;
  color: var(--accent-cyan);
}

.canvas-overlay p {
  font-size: 1.2rem;
  color: var(--text-primary);
  max-width: 280px;
  line-height: 1.75;
  font-weight: 400;
}

.canvas-overlay strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* Movement Ticker */
.movement-ticker {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .95rem 1.4rem;
  margin-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, .06);
  background: rgba(255, 255, 255, .02);
}

.ticker-label {
  font-size: .95rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
  white-space: nowrap;
}

.ticker-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--accent-cyan);
  font-weight: 500;
  flex: 1;
}


.seek-live {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .22rem .7rem;
  white-space: nowrap;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.3rem;
}

.result-stat {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  align-items: center;
  text-align: center;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.result-stat:hover {
  transform: translateY(-2px);
}

.result-stat.highlight {
  border-color: rgba(59, 130, 246, .4);
  box-shadow: 0 0 20px rgba(59, 130, 246, .15), inset 0 1px 0 rgba(255, 255, 255, .06);
  background: rgba(59, 130, 246, .08);
}

.stat-label {
  font-size: .95rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
}

.stat-value {
  font-size: 2.4rem;
  line-height: 1.1;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: -.02em;
}

.result-stat.highlight .stat-value {
  background: var(--grad-btn);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Execution order */
.execution-order {
  margin-top: .9rem;
}

.exec-label {
  font-size: .95rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
  display: block;
  margin-bottom: .7rem;
}

.exec-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}

.exec-seq-item {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 500;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: var(--radius-sm);
  padding: .28rem .65rem;
  color: var(--text-primary);
  animation: fadeUp .3s ease forwards;
  opacity: 0;
  transition: background var(--transition);
}

.exec-seq-item:hover {
  background: rgba(255, 255, 255, .09);
}

.exec-seq-item.start-item {
  border-color: rgba(59, 130, 246, .4);
  color: var(--accent-blue);
  background: rgba(59, 130, 246, .1);
  box-shadow: 0 0 10px rgba(59, 130, 246, .15);
}

.exec-seq-arrow {
  color: var(--text-muted);
  font-size: .78rem;
  animation: fadeUp .3s ease forwards;
  opacity: 0;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.table-wrapper {
  overflow-x: auto;
  padding: .7rem 0 1rem;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 1.2rem;
}

thead tr {
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

thead th {
  padding: .75rem 1.1rem;
  text-align: left;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, .04);
  transition: background var(--transition);
}

tbody tr:hover {
  background: rgba(255, 255, 255, .035);
}

tbody td {
  padding: .8rem 1.1rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

tbody td:first-child {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-primary);
}

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-body);
  padding: 1.5rem;
}

.best-row {
  background: rgba(34, 197, 94, .05) !important;
}

.best-row td {
  color: var(--accent-green) !important;
}

.best-row td:first-child {
  color: var(--text-primary) !important;
}

.best-badge {
  display: inline-flex;
  align-items: center;
  font-size: .66rem;
  font-weight: 700;
  background: rgba(34, 197, 94, .15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, .3);
  border-radius: 20px;
  padding: .14rem .65rem;
  margin-left: .5rem;
  font-family: var(--font-body);
  letter-spacing: .05em;
  box-shadow: 0 0 8px rgba(34, 197, 94, .2);
}

td .algo-chip {
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: .5rem;
  vertical-align: middle;
}

.status-dot.done {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

@media (max-width: 1100px) {
  .app-main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 0 1rem;
  }

  .header-badge {
    display: none;
  }

  .implementers-badge {
    display: none;
  }

  .app-main {
    padding: 1rem;
    gap: 1rem;
  }

  .card-body {
    padding: 1rem;
  }

  .results-grid {
    grid-template-columns: 1fr 1fr;
  }

  .results-grid .result-stat:last-child {
    grid-column: span 2;
  }

  .logo-text h1 {
    font-size: 1rem;
    letter-spacing: .06em;
  }
}

.canvas-hit-area {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 20;
  opacity: 0;
}

[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: rgba(0, 0, 0, .03);
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: rgba(0, 0, 0, .04);
  --bg-input-focus: rgba(0, 0, 0, .07);
  --border: rgba(0, 0, 0, .12);
  --border-focus: rgba(37, 99, 235, .5);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #475569;
  --text-muted: #94a3b8;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, .08);
}

[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: rgba(15, 23, 42, 0.08);
  color: var(--text-primary);
}

[data-theme="light"] .app-header .header-badge {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.10);
  color: var(--text-secondary);
}

[data-theme="light"] .theme-toggle-btn {
  color: var(--text-primary);
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .logo-text span {
  color: var(--text-secondary);
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  opacity: 0.7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin-left: 10px;
  border-left: 1px solid var(--border);
  padding-left: 14px;
  transition: opacity var(--transition), transform var(--transition);
}

.theme-toggle-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.theme-toggle-btn svg {
  width: 15px;
  height: 15px;
}

[data-theme="light"] .theme-moon {
  display: block;
}

[data-theme="light"] .theme-sun {
  display: none;
}

[data-theme="dark"] .theme-moon {
  display: none;
}

[data-theme="dark"] .theme-sun {
  display: block;
}

.canvas-hit-area {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 10;
  cursor: crosshair;
}

.graph-tooltip {
  position: fixed;
  background: rgba(7, 11, 20, 0.95);
  backdrop-filter: blur(12px) saturate(1.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  border: 1px solid var(--border);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.75rem;
  line-height: 1.5;
  width: 172px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.15s ease, transform 0.15s ease, top 0.1s ease, left 0.1s ease;
  border-left: 3px solid var(--accent-blue);
}


.graph-tooltip.visible {
  opacity: 1;
  transform: scale(1);
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.tooltip-row:last-child {
  margin-bottom: 0;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tooltip-label {
  color: var(--text-muted);
}

.tooltip-value {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.tooltip-value.accent {
  color: var(--accent-blue);
  font-weight: 600;
}

[data-theme="light"] .graph-tooltip {
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .tooltip-label {
  color: #64748b;
}

[data-theme="light"] .tooltip-value {
  color: #334155;
}

[data-theme="light"] .tooltip-row:last-child {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .algo-info-title {
  color: #0f172a;
  font-weight: 700;
}

[data-theme="light"] .algo-info-subtitle {
  color: #64748b;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .algo-info-desc {
  color: #334155;
}

[data-theme="light"] .card-header {
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}


[data-theme="light"] .movement-ticker {
  background: rgba(0, 0, 0, 0.02);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .ticker-value {
  color: var(--accent-blue);
  text-shadow: none;
}

[data-theme="light"] .viz-body {
  background: transparent;
}

[data-theme="light"] .canvas-overlay {
  background: rgba(255, 255, 255, .88);
  border-color: rgba(15, 23, 42, .12);
}

[data-theme="dark"] .canvas-overlay {
  background: rgba(7, 11, 20, .75);
  border-color: rgba(255, 255, 255, .15);
}

[data-theme="dark"] .viz-body {
  background: transparent;
}



[data-theme="light"] .info-section-title {
  color: #0f172a;
}

[data-theme="light"] .info-list li {
  color: #334155;
}

[data-theme="light"] .info-list.advantages li::before {
  color: #16a34a;
}

[data-theme="light"] .info-list.limitations li::before {
  color: #dc2626;
}

/* Implementers Badge in Header */
.implementers-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0.3rem 0.6rem;
  flex: 0 1 auto;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  line-height: 1.2;
  margin-left: 3rem;
}

.implementers-badge strong {
  color: var(--accent-blue);
  font-weight: 800;
  display: inline;
  font-size: 0.95rem;
}

[data-theme="light"] .implementers-badge {
  color: #0f172a;
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.4);
}

[data-theme="light"] .implementers-badge strong {
  color: #3b82f6;
}