* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  min-height: 100vh;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.header {
  margin-bottom: 1.5rem;
}

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

.main {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

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

.sidebar {
  flex: 0 0 320px;
}

.form {
  background: #252525;
  border-radius: 8px;
  padding: 1.25rem;
}

.template-choice {
  margin-top: 1rem;
  padding: 1.25rem;
  background: #252525;
  border-radius: 8px;
}

.template-choice-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0e0e0;
}

.template-choice .template-row {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  margin-bottom: 0.75rem;
}

.template-choice .template-row select {
  width: 100%;
  min-width: 0;
}

.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.template-actions .template-name-input {
  flex: 1;
  min-width: 100px;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  color: #aaa;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #404040;
  border-radius: 6px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 0.9rem;
  font-family: inherit;
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #F5B6C8;
}

.field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #404040;
  border-radius: 6px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}

.field select:focus {
  outline: none;
  border-color: #F5B6C8;
}

.model-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: #888;
  line-height: 1.4;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: #F5B6C8;
  color: #333;
  width: 100%;
}

.btn-primary:hover {
  background: #f0a5b5;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: #404040;
  color: #e0e0e0;
}

.btn-secondary:hover {
  background: #505050;
}

.preview-area {
  flex: 1;
  min-width: 0;
}

.preview {
  background: #252525;
  border-radius: 8px;
  aspect-ratio: 16 / 9;
  max-width: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview .placeholder {
  color: #666;
  text-align: center;
  padding: 2rem;
}

.preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.export-area {
  margin-top: 1rem;
}

.title-test {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #404040;
}

.title-test h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.title-test-desc {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: #888;
}

.title-test-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.title-test-form input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #404040;
  border-radius: 6px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 0.9rem;
}

.title-style {
  margin-top: 1.25rem;
  padding: 1rem;
  background: #1e1e1e;
  border-radius: 6px;
}

.title-style h4 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #aaa;
}

.style-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.style-row:last-child {
  margin-bottom: 0;
}

.style-row label {
  flex: 0 0 80px;
  font-size: 0.85rem;
  color: #888;
}

.style-row input[type="range"] {
  flex: 1;
  max-width: 120px;
}

.style-row input[type="color"] {
  width: 36px;
  height: 28px;
  padding: 2px;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #1a1a1a;
  cursor: pointer;
}

.style-row input[type="text"].color-hex {
  width: 80px;
  padding: 0.4rem 0.5rem;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 0.8rem;
}

.template-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #333;
  flex-wrap: wrap;
}

.template-row label {
  flex: 0 0 80px;
  font-size: 0.85rem;
  color: #888;
}

.template-row select {
  min-width: 140px;
  padding: 0.4rem 0.5rem;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 0.85rem;
}

.template-name-input {
  min-width: 120px;
  padding: 0.4rem 0.5rem;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 0.85rem;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}
