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

html {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #f8f9fa;
  min-height: 100%;
  padding: 20px;
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.subtitle {
  color: #666;
  font-size: 0.95rem;
}

.controls {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.control-row {
  display: flex;
  gap: 20px;
  align-items: end;
  flex-wrap: wrap;
}

.control-row .control-group:nth-child(1),
.control-row .control-group:nth-child(2) {
  flex: 1;
  min-width: 120px;
}

.control-group {
  min-width: 0;
}

.control-group.checkbox-wrapper {
  display: flex;
  align-items: center;
  height: 46px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #444;
  margin-bottom: 8px;
}

input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

input[type="number"]:focus {
  outline: none;
  border-color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

/* Custom Select Dropdown */
.custom-select {
  position: relative;
  width: 100%;
}

.select-trigger {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.select-trigger:hover {
  border-color: #1a1a1a;
  box-shadow: 0 4px 12px rgba(26, 26, 26, 0.1);
  transform: translateY(-1px);
}

.select-trigger.open {
  border-color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.select-trigger.open .select-arrow {
  transform: rotate(180deg);
}

.select-value {
  font-weight: 500;
  color: #1a1a1a;
}

.select-arrow {
  color: #666;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.select-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.select-option {
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #444;
}

.select-option:first-child {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.select-option:last-child {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.select-option:hover {
  background: #f5f5f5;
  color: #1a1a1a;
  transform: translateX(4px);
}

.select-option.active {
  background: #1a1a1a;
  color: #fff;
}

.select-option.active:hover {
  background: #333;
  transform: translateX(0);
}

.option-icon {
  font-size: 1rem;
  opacity: 0.7;
  width: 20px;
  text-align: center;
}

.select-option.active .option-icon {
  opacity: 1;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1a1a1a;
}

.checkbox-group label {
  margin-bottom: 0;
  cursor: pointer;
  font-size: 0.9rem;
}

.button-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #1a1a1a;
  color: #fff;
}

.btn-primary:hover {
  background: #333;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #e8e8e8;
  color: #1a1a1a;
}

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

/* Configuration Panel */
.config-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
  border-radius: 12px 12px 0 0;
}

.config-actions {
  display: flex;
  gap: 10px;
}

.config-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

.btn-reset {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset:hover {
  border-color: #ff4444;
  color: #ff4444;
  background: #fff5f5;
}

.btn-reset svg {
  width: 14px;
  height: 14px;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export:hover {
  border-color: #1a1a1a;
  color: #1a1a1a;
  background: #f5f5f5;
}

.btn-export svg {
  width: 14px;
  height: 14px;
}

.config-sections {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.config-section {
  padding: 20px 24px;
  border-right: 1px solid #eee;
}

.config-section:last-child {
  border-right: none;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-bottom: 16px;
}

.section-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-content .control-group {
  width: 100%;
}

.style-buttons {
  display: flex;
  gap: 8px;
}

.style-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 1rem;
  font-w ght: 600;
  color: #444;
  cursor: pointer;
  transition: all 0.2s;
}

.style-btn:hover {
  background: #e0e0e0;
  border-color: #ccc;
}

.style-btn.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

.style-btn svg {
  width: 16px;
  height: 16px;
}

/* Color Picker */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s;
}

.color-picker-wrapper:hover {
  border-color: #1a1a1a;
}

.color-picker-wrapper input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: none;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
  border: 2px solid #e0e0e0;
  border-radius: 6px;
}

.color-picker-wrapper input[type="color"]::-moz-color-swatch {
  border: 2px solid #e0e0e0;
  border-radius: 6px;
}

.color-value {
  font-family: monospace;
  font-size: 0.9rem;
  color: #666;
  text-transform: uppercase;
}

.output-section {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #eee;
}

.output-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.output-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
}

.output-stats {
  font-size: 0.85rem;
  color: #666;
}

.btn-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f0f0f0;
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy:hover {
  background: #e0e0e0;
}

.btn-copy svg {
  width: 14px;
  height: 14px;
}

.output-content {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  line-height: 1.7;
  color: #333;
}

.output-content p {
  margin-bottom: 16px;
}

.output-content p:last-child {
  margin-bottom: 0;
}

.copy-feedback {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1a1a1a;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.copy-feedback.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Custom scrollbar */
.output-content::-webkit-scrollbar {
  width: 8px;
}

.output-content::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.output-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.output-content::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .config-sections {
    grid-template-columns: 1fr;
  }

  .config-section {
    border-right: none;
    border-bottom: 1px solid #eee;
  }

  .config-section:last-child {
    border-bottom: none;
  }
}

@media (max-width: 768px) {

  .controls .control-row .control-group:nth-child(1),
  .controls .control-row .control-group:nth-child(2) {
    flex: 1 1 45%;
  }

  .controls .control-row .control-group.checkbox-wrapper,
  .controls .control-row .control-group.button-group {
    flex: 1 1 45%;
  }
}

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

  h1 {
    font-size: 1.5rem;
  }

  .controls {
    padding: 20px;
  }

  .config-header {
    padding: 14px 20px;
  }

  .config-section {
    padding: 16px 20px;
  }

  .control-row {
    flex-direction: column;
    gap: 16px;
  }

  .controls .control-row .control-group:nth-child(1),
  .controls .control-row .control-group:nth-child(2),
  .controls .control-row .control-group.checkbox-wrapper,
  .controls .control-row .control-group.button-group {
    flex: 1 1 100%;
    width: 100%;
  }

  .style-buttons {
    width: 100%;
    justify-content: flex-start;
  }

  .style-btn {
    flex: 1;
    max-width: 50px;
  }

  .control-group.checkbox-wrapper {
    height: auto;
    padding: 8px 0;
  }

  .button-group {
    width: 100%;
  }

  .button-group button {
    width: 100%;
  }

  .output-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .output-header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .btn-copy {
    width: 100%;
    justify-content: center;
  }

  .output-content {
    padding: 20px;
  }
}

/* Export Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #fff;
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
  transform: translateY(-20px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  line-height: 1;
  padding: 0;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 24px;
}

.export-option {
  padding: 16px;
  border: 1px solid #eee;
  border-radius: 10px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.export-option:hover {
  border-color: #1a1a1a;
  background: #fafafa;
}

.export-option.selected {
  border-color: #1a1a1a;
  background: #f5f5f5;
}

.export-option-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.export-option-desc {
  font-size: 0.85rem;
  color: #888;
}

.export-preview {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow: auto;
  display: none;
}

.export-preview.show {
  display: block;
}

.copy-export-btn {
  width: 100%;
  margin-top: 16px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  display: none;
}

.copy-export-btn.show {
  display: block;
}

.copy-export-btn:hover {
  background: #333;
}