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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a1a;
  color: #e0d6c8;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.container {
  max-width: 720px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #3d3428;
}

h1 {
  font-size: 2rem;
  color: #d4a845;
  letter-spacing: 0.05em;
}

.subtitle {
  color: #8a7e6e;
  margin-top: 0.5rem;
}

h2 {
  color: #c9953a;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.hint {
  color: #7a7060;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #222222;
  border-radius: 8px;
  border: 1px solid #3d3428;
}

/* Positions */
.positions-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.position-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.position-row label {
  width: 70px;
  font-weight: 600;
  color: #b8a88a;
}

.position-row select {
  width: 50px;
}

.pos-visual {
  display: flex;
  gap: 3px;
  flex: 1;
}

/* Slider cells (shared) */
.slider-cell {
  width: 28px;
  height: 20px;
  border-radius: 3px;
  background: #2e2e2e;
  border: 1px solid #444;
  transition: background 0.2s;
}

.slider-cell.goal-cell {
  border-color: #7a6530;
}

.slider-cell.active-cell {
  background: #d4a845;
  border-color: #d4a845;
  box-shadow: 0 0 6px rgba(212, 168, 69, 0.4);
}

.slider-cell.goal-cell.active-cell {
  background: #4caf50;
  border-color: #4caf50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.4);
}

/* Dependencies */
.dependencies-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dep-group {
  padding: 0.75rem;
  background: #2a2a2a;
  border-radius: 6px;
  border: 1px solid #333;
}

.dep-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dep-header span {
  font-weight: 600;
  color: #b8a88a;
}

.dep-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.dep-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
}

/* Form elements */
select {
  background: #2e2e2e;
  color: #e0d6c8;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

select:hover {
  border-color: #d4a845;
}

select:focus {
  outline: none;
  border-color: #d4a845;
  box-shadow: 0 0 0 2px rgba(212, 168, 69, 0.2);
}

/* Buttons */
.btn-add {
  background: transparent;
  color: #d4a845;
  border: 1px solid #d4a845;
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add:hover {
  background: rgba(212, 168, 69, 0.1);
}

.btn-remove {
  background: transparent;
  color: #e05555;
  border: 1px solid #e05555;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-remove:hover {
  background: rgba(224, 85, 85, 0.15);
}

.actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.btn-solve {
  background: #d4a845;
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  padding: 0.75rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-solve:hover {
  background: #e0b84f;
}

.btn-solve:active {
  transform: scale(0.97);
}

.btn-reset {
  background: transparent;
  color: #8a7e6e;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.btn-reset:hover {
  border-color: #8a7e6e;
}

/* Results */
#results h3 {
  color: #4caf50;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.no-solution h3 {
  color: #e05555 !important;
}

.no-solution p,
.already-solved p {
  color: #8a7e6e;
}

.already-solved h3 {
  color: #4caf50 !important;
}

.solution-step {
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: #2a2a2a;
  border-radius: 6px;
  border-left: 3px solid #d4a845;
}

.step-label {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.step-number {
  color: #d4a845;
  font-weight: 700;
  margin-right: 0.5rem;
}

.step-visual {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-visual-row {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.slider-visual-row.changed {
  opacity: 1;
}

.slider-visual-row .slider-label {
  width: 18px;
  font-size: 0.75rem;
  color: #8a7e6e;
  text-align: center;
}

.slider-visual-row.changed .slider-label {
  color: #d4a845;
  font-weight: 700;
}
