* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f3f4f6;
  color: #111827;
}

header {
  background: linear-gradient(135deg, #111827, #2563eb);
  color: white;
  text-align: center;
  padding: 28px;
}

header h1 {
  margin: 0;
  font-size: 34px;
}

header p {
  margin: 8px 0 0;
  color: #dbeafe;
}

.top-controls {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: white;
  border-bottom: 1px solid #ddd;
}

#searchInput {
  flex: 1;
}

#searchInput,
#categoryFilter {
  padding: 12px;
  font-size: 15px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

main {
  display: flex;
  min-height: calc(100vh - 140px);
}

aside {
  width: 320px;
  background: white;
  padding: 18px;
  border-right: 1px solid #ddd;
  overflow-y: auto;
}

.formula-card {
  padding: 13px;
  margin-bottom: 10px;
  background: #eef2ff;
  border-left: 5px solid #2563eb;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

.formula-card:hover {
  background: #dbeafe;
  transform: translateX(4px);
}

.formula-card.active {
  background: #bfdbfe;
}

.formula-card strong {
  display: block;
  font-size: 15px;
}

.formula-card small {
  color: #475569;
}

.content {
  flex: 1;
  padding: 22px;
  overflow-y: auto;
}

.box {
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.category {
  display: inline-block;
  padding: 7px 13px;
  border-radius: 18px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: bold;
}

#formulaText {
  color: #2563eb;
  font-size: 32px;
}

.buttons button {
  padding: 10px 16px;
  margin: 6px;
  border: none;
  border-radius: 8px;
  color: white;
  background: #2563eb;
  cursor: pointer;
}

.buttons button:hover {
  background: #1d4ed8;
}

label {
  margin-left: 16px;
  font-weight: bold;
}

input[type="range"] {
  vertical-align: middle;
}

canvas {
  width: 100%;
  max-width: 850px;
  height: 460px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: white;
}

ol li {
  margin-bottom: 10px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  main {
    flex-direction: column;
  }

  aside {
    width: 100%;
    max-height: 300px;
  }

  .top-controls {
    flex-direction: column;
  }
}
.visual-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.canvas-panel {
  flex: 2;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}

.canvas-panel canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 460px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.visual-notes-panel {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;
  min-height: 460px;
}

.visual-notes-panel h3 {
  margin-top: 0;
  margin-bottom: 14px;
  color: #1d4ed8;
}

#visualNotes {
  line-height: 1.7;
  color: #334155;
  font-size: 15px;
}

#visualNotes ul {
  padding-left: 20px;
  margin: 0;
}

#visualNotes li {
  margin-bottom: 10px;
}

@media (max-width: 1000px) {
  .visual-layout {
    flex-direction: column;
  }

  .visual-notes-panel {
    min-height: auto;
    width: 100%;
  }
}
