* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Yu Gothic UI', sans-serif;
  background: #111827;
  color: #f3f4f6;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  line-height: 1.5;
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.page-header-row h2 {
  margin: 0;
  color: #00d9ff;
  text-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
  font-size: 28px;
}

.home-link-btn {
  padding: 8px 12px;
  font-size: 13px;
  background: #111827;
  border: 1px solid #4b5563;
  border-radius: 6px;
  color: #f3f4f6;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.home-link-btn:hover {
  background: #1f2937;
  border-color: #6b7280;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toolbar {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

button {
  padding: 8px 14px;
  cursor: pointer;
  border: 1px solid #4b5563;
  background: #111827;
  color: #f3f4f6;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

button:hover {
  background: #1f2937;
  border-color: #6b7280;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

button.primary {
  background: #1d4ed8;
  border-color: #3b82f6;
  color: #fff;
}

button.primary:hover {
  background: #2563eb;
  border-color: #60a5fa;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.side-column,
.main-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 16px;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: #f3f4f6;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header h3 {
  margin: 0;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.preset-btn.active {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #fff;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #9ca3af;
  font-size: 13px;
}

.field-label span {
  color: #e5e7eb;
  font-family: Consolas, 'Courier New', monospace;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="color"] {
  width: 52px;
  height: 36px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid #4b5563;
  background: #111827;
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  accent-color: #3b82f6;
}

.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  margin-bottom: 0;
}

.check-row label {
  color: #9ca3af;
  font-size: 13px;
  cursor: pointer;
}

.hint {
  margin: 12px 0 0;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

#svgContainer {
  width: min(320px, 100%);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

#svgContainer svg {
  width: 100%;
  height: 100%;
}

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #4b5563;
  background: #111827;
  color: #e5e7eb;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
}

textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #1f2937;
  border: 1px solid #3b82f6;
  color: #f3f4f6;
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .page-header-row h2 {
    font-size: 22px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 16px;
  }
}
