:root {
  /* Light theme colors */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f9fafb;
  --bg-quaternary: #f3f4f6;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-primary: #e5e7eb;
  --border-secondary: #d1d5db;
  --accent-primary: #15aae7;
  --accent-secondary: #2563eb;
  --accent-hover: #1d4ed8;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --focus-ring: rgba(21, 170, 231, 0.1);
  --success-color: #4caf50;
  --card-hover: rgba(255, 255, 255, 0.5);
  --card-active: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] {
  /* Dark theme colors */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-quaternary: #475569;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-primary: #475569;
  --border-secondary: #64748b;
  --accent-primary: #0ea5e9;
  --accent-secondary: #3b82f6;
  --accent-hover: #2563eb;
  --shadow-light: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.5);
  --focus-ring: rgba(14, 165, 233, 0.2);
  --success-color: #22c55e;
  --card-hover: rgba(51, 65, 85, 0.5);
  --card-active: rgba(51, 65, 85, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Header */
.header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.title {
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.badge {
  background: var(--bg-secondary);
  color: var(--accent-secondary);
  border: 1px solid var(--border-primary);
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
}

.community-link {
  color: var(--accent-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.community-link:hover {
  color: var(--accent-hover);
}

.inline-icon {
  width: 12px;
  height: 12px;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 1000;
  font-size: 1.25rem;
  box-shadow: 0 2px 4px var(--shadow-light);
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  transform: scale(1.05);
}

/* Main Layout */
.main-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

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

.sidebar {
  width: 280px;
  flex-shrink: 0;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px var(--shadow-light);
  overflow: hidden;
  border: 1px solid var(--border-primary);
  transition: all 0.3s ease;
}

.scene-card {
  background: var(--bg-tertiary);
}

.scene-card .card-header {
  background: var(--bg-quaternary);
  border-bottom: 1px solid var(--border-primary);
}

.prompt-card {
  border: 1px solid var(--accent-primary);
  border-opacity: 0.3;
}

.prompt-card .card-header {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--accent-primary);
  border-bottom-opacity: 0.3;
}

.info-card .card-header {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-primary);
}

.sidebar-card {
  background: var(--bg-tertiary);
  height: 100%;
}

.sidebar-card .card-header {
  background: var(--bg-quaternary);
  border-bottom: 1px solid var(--border-primary);
}

.card-header {
  padding: 1rem;
}

.card-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.card-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.card-content {
  padding: 1rem;
}

/* Form Elements */
input[type="text"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-secondary);
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.2s;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

textarea {
  min-height: 300px;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.875rem;
  resize: none;
}

select {
  cursor: pointer;
}

select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-secondary);
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--bg-secondary);
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.copy-button {
  background: var(--accent-secondary);
  color: white;
  border: none;
  padding: 0.5rem 0.875rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-button:hover {
  background: var(--accent-hover);
}

.copy-button.copied {
  background: var(--success-color);
}

.reset-button {
  background: var(--text-muted);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.reset-button:hover {
  background: var(--text-secondary);
}

.button-icon {
  width: 16px;
  height: 16px;
}

/* Tip Box */
.tip-box {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--accent-primary);
}

/* Info Section */
.info-placeholder {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

.help-icon {
  margin-bottom: 1rem;
  font-size: 3rem;
  opacity: 0.3;
}

.info-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.info-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border-secondary);
}

.info-table th,
.info-table td {
  border: 1px solid var(--border-secondary);
  padding: 0.75rem;
  text-align: left;
}

.info-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

.info-table td {
  color: var(--text-primary);
}

/* Sidebar */
.sidebar-controls {
  display: flex;
  gap: 0.5rem;
}

.icon-button {
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.icon-button:hover {
  background: var(--bg-quaternary);
}

/* Parameter Groups */
.parameter-group {
  margin-bottom: 0.75rem;
}

.group-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--card-active);
  border: 1px solid var(--border-primary);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
}

.group-header:hover {
  background: var(--card-hover);
}

.group-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.group-icon {
  width: 2rem;
  height: 2rem;
  background: var(--bg-secondary);
  color: var(--accent-primary);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.chevron {
  transition: transform 0.2s;
  font-size: 1rem;
  color: var(--text-secondary);
}

.group-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.group-content {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--card-hover);
  border-radius: 0.5rem;
  display: block;
}

.group-content.collapsed {
  display: none;
}

/* Parameters */
.parameter {
  margin-bottom: 0.75rem;
}

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

.parameter-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.help-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  font-size: 0.75rem;
}

.help-btn:hover {
  color: var(--accent-primary);
}

.custom-input {
  margin-top: 0.5rem;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 3rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer p {
  margin-bottom: 0.25rem;
}

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

  .sidebar {
    width: 100%;
  }

  .header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .controls {
    justify-content: center;
  }

  .theme-toggle {
    position: relative;
    top: auto;
    right: auto;
    margin: 0 auto 1rem;
    display: block;
    width: fit-content;
  }
}

/* Smooth transitions for theme switching */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Focus states */
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
