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

body {
  margin: 0;
  font-family: Georgia, "Songti SC", "SimSun", "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.6;
  color: #333;
  background: #fff;
}

.header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 1rem;
  text-align: center;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: start;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #555;
}

.panel textarea,
.panel input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}

.panel textarea:focus,
.panel input[type="text"]:focus {
  outline: none;
  border-color: #333;
}

.panel input[type="range"] {
  width: 100%;
  accent-color: #333;
}

.panel .optional {
  font-weight: 400;
  color: #999;
  font-size: 0.85em;
}

.panel .hint {
  margin: -0.5rem 0 0;
  font-size: 0.8rem;
  color: #888;
}

.panel .hint-block {
  margin-top: 0.25rem;
}

.panel .hint-block .hint {
  margin-top: 0.35rem;
}

.panel .hint-block .hint:first-child {
  margin-top: 0;
}

.panel .hint code {
  font-size: 0.9em;
  padding: 0.1em 0.3em;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 2px;
}

#customCss {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  font-size: 0.85rem;
}

.themes {
  border: none;
  padding: 0;
  margin: 0;
}

.themes legend {
  font-size: 0.9rem;
  font-weight: 500;
  color: #555;
  margin-bottom: 0.5rem;
}

.theme-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.theme-btn {
  padding: 0.4rem 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #333;
  cursor: pointer;
}

.theme-btn:hover {
  border-color: #999;
  background: #f9f9f9;
}

.theme-btn.active {
  border-color: #333;
  background: #333;
  color: #fff;
}

.download-btn {
  margin-top: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  background: #333;
  color: #fff;
  cursor: pointer;
}

.download-btn:hover {
  background: #555;
}

.preview-wrap {
  position: sticky;
  top: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  padding: 1rem;
  background: #f5f5f5;
  border-radius: 4px;
}

.preview-svg {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.preview-svg svg {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
  .main {
    grid-template-columns: 1fr;
    padding: 1rem 1rem 2rem;
  }

  .preview-wrap {
    position: static;
  }
}
