:root {
  --primary-color: #000000;
  --secondary-color: #646cff;
  --bg-color: #f8f9fc;
  --card-bg: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --radius-md: 12px;
  --radius-sm: 8px;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  background-color: var(--bg-color);
  color: var(--text-primary);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: var(--bg-color);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  box-sizing: border-box;
}

@media (max-width: 1200px) {
  .container {
    padding: 1rem;
  }
}

h1 {
  font-size: 1.875rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--text-primary);
  text-align: center;
}

.input-section {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  overflow: hidden;
}

.button-group {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

@media (max-width: 640px) {
  .button-group {
    flex-direction: column;
  }
}

.button-group button {
  flex: 1;
  min-width: 120px;
  white-space: nowrap;
}

textarea {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  background: var(--card-bg);
  color: var(--text-primary);
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

textarea:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(100, 108, 255, 0.1);
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.output-section {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.custom-class-input {
  background: var(--bg-color);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.custom-class-input label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.custom-class-input .legend {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.custom-class-field {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  transition: all 0.2s;
  box-sizing: border-box;
}

.custom-class-field:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(100, 108, 255, 0.1);
}

.url-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.url-table th,
.url-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  box-sizing: border-box;
}

.url-table th {
  background: var(--bg-color);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.url-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .url-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.anchor-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  transition: all 0.2s;
  box-sizing: border-box;
}

.anchor-input:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(100, 108, 255, 0.1);
}

.url-group {
  background: var(--bg-color);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.url-group h3 {
  margin-top: 0;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.url-list {
  margin: 0;
  padding-left: 1.5rem;
  list-style-position: inside;
}

.url-list li {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.url-list a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color 0.2s;
}

.url-list a:hover {
  color: var(--primary-color);
}

#generateLinks {
  display: none;
  margin-top: 1.5rem;
  width: 100%;
}

.buttons-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toggle-btn,
.export-btn {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  background-color: var(--bg-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  min-width: auto;
}

.export-all-btn {
  margin: 1rem 0 1.5rem 0;
  width: 100%;
}

.code-view {
  background: var(--bg-color);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  font-size: 0.875rem;
  overflow-x: auto;
}

.code-view pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.code-view code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
}

.custom-template-section {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.custom-template-section h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.template-input {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.875rem;
  background: var(--bg-color);
  color: var(--text-primary);
  resize: vertical;
}

.template-input:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(100, 108, 255, 0.1);
}

.template-preview {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.template-preview pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: monospace;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.template-help {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.image-options {
  padding: 0.5rem 0;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.checkbox-label {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.image-url-container {
  margin-top: 0.5rem;
}

.image-url-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #1a1a1a;
    --card-bg: #242424;
    --text-primary: rgba(255, 255, 255, 0.87);
    --text-secondary: rgba(255, 255, 255, 0.6);
    --border-color: #333333;
  }
  
  .toggle-btn,
  .export-btn {
    background-color: var(--card-bg);
    color: var(--text-primary);
  }
  
  .code-view {
    background: var(--card-bg);
  }
}