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

body {
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
  padding: 20px;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 860px;
  width: 100%;
}

h1 {
  font-size: 1.8rem;
  color: #00d4aa;
  letter-spacing: 2px;
}

#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: #16213e;
  padding: 12px 20px;
  border-radius: 10px;
  width: 100%;
}

button {
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #00d4aa;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

button:hover {
  background: #00d4aa;
  color: #1a1a2e;
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

input[type="range"] {
  accent-color: #00d4aa;
}

input[type="checkbox"] {
  accent-color: #00d4aa;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

input[type="number"] {
  width: 60px;
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #00d4aa;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9rem;
}

input[type="number"]:disabled {
  border-color: #444;
  color: #555;
}

#generation {
  font-size: 0.9rem;
  color: #00d4aa;
  font-weight: bold;
}

#structures {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: #16213e;
  padding: 10px 20px;
  border-radius: 10px;
  width: 100%;
}

#structures-label {
  font-size: 0.9rem;
  color: #888;
}

#stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
  background: #0f1a2e;
  padding: 8px 20px;
  border-radius: 10px;
  width: 100%;
  font-size: 0.9rem;
  font-weight: bold;
}

#stats-label {
  color: #888;
  font-weight: normal;
}

.btn-structure {
  border-color: var(--sc, #00d4aa);
  color: var(--sc, #e0e0e0);
}

.btn-structure:hover {
  background: var(--sc, #00d4aa);
  color: #1a1a2e;
}

button.active {
  background: var(--sc, #00d4aa);
  color: #1a1a2e;
  font-weight: bold;
}

#btn-coloring {
  background: #00d4aa;
  color: #1a1a2e;
  font-weight: bold;
  border-color: #00d4aa;
}

#btn-coloring:not(.active) {
  background: #0f3460;
  color: #888;
  border-color: #888;
}

canvas {
  border: 2px solid #00d4aa;
  border-radius: 6px;
  cursor: crosshair;
  background: #0a0a1a;
}

#hint {
  font-size: 0.8rem;
  color: #888;
}

#btn-lang {
  background: #1a1a2e;
  color: #00d4aa;
  border-color: #00d4aa;
  font-weight: bold;
}

#btn-lang:hover {
  background: #00d4aa;
  color: #1a1a2e;
}

#btn-info {
  background: #00d4aa;
  color: #1a1a2e;
  font-weight: bold;
  border-color: #00d4aa;
}

#btn-info:hover {
  background: #00f0c0;
}

#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

#modal-overlay.visible {
  display: flex;
}

#modal {
  background: #16213e;
  border: 2px solid #00d4aa;
  border-radius: 12px;
  padding: 32px;
  max-width: 520px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#modal h2 {
  color: #00d4aa;
  font-size: 1.3rem;
}

#modal ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  line-height: 1.5;
}

#modal a {
  color: #00d4aa;
  text-decoration: none;
}

#modal a:hover {
  text-decoration: underline;
}

#modal-close {
  align-self: flex-end;
}
