:root {
  --bg-deep: #0a0a0b;
  --bg-surface: #141416;
  --bg-elevated: #1c1c1f;
  --bg-card: #222226;
  --border-subtle: #2a2a2f;
  --border-accent: #3d3d44;
  --text-primary: #f0f0f2;
  --text-secondary: #9a9aa0;
  --text-muted: #606066;
  --accent-gold: #d4a853;
  --accent-gold-dim: #a68942;
  --accent-red: #c44;
  --accent-cyan: #4ecdc4;
  --grid-color: #1a1a1d;
}

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

body {
  font-family: "Source Serif 4", Georgia, serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* Grid border decoration */
.grid-border {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 32px;
  background: var(--grid-color);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 20px 0;
}

.grid-border.left {
  left: 0;
}

.grid-border.right {
  right: 0;
}

.grid-dot {
  width: 8px;
  height: 8px;
  background: var(--border-subtle);
  border-radius: 50%;
  margin: 0 auto;
}

/* Film perforations decoration (for scene) */
.film-border {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 32px;
  background: var(--grid-color);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 20px 0;
}

.film-border.left {
  left: 0;
}

.film-border.right {
  right: 0;
}

.perf {
  width: 16px;
  height: 10px;
  background: var(--bg-deep);
  border-radius: 2px;
  margin: 0 auto;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 60px;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(
    135deg,
    var(--accent-gold) 0%,
    var(--accent-gold-dim) 100%
  );
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 28px;
  color: var(--bg-deep);
  letter-spacing: -1px;
}

.logo-text h1 {
  font-family: "Bebas Neue", sans-serif;
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--text-primary);
  font-weight: 400;
}

.logo-text span {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
}

.scene-counter {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.scene-counter strong {
  color: var(--accent-gold);
  font-weight: 500;
}

/* Main Grid */
.config-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

/* Section Cards */
.section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.section:hover {
  border-color: var(--border-accent);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.section-number {
  font-family: "Bebas Neue", sans-serif;
  font-size: 14px;
  color: var(--accent-gold);
  background: var(--bg-deep);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.section-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: 18px;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  font-weight: 400;
}

.section-content {
  padding: 20px;
}

/* Selection Grid */
.selection-grid {
  display: grid;
  gap: 12px;
}

.selection-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.selection-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Selection Card */
.selection-card {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: 6px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.selection-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.selection-card.selected {
  border-color: var(--accent-gold);
  background: linear-gradient(
    135deg,
    rgba(212, 168, 83, 0.08) 0%,
    transparent 100%
  );
}

.selection-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.card-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-accent);
  border-radius: 50%;
  transition: all 0.2s ease;
}

.selection-card.selected .card-indicator {
  border-color: var(--accent-gold);
  background: var(--accent-gold);
}

.selection-card.selected .card-indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: var(--bg-deep);
  border-radius: 50%;
}

/* Checkbox variant */
.selection-card.checkbox .card-indicator {
  border-radius: 4px;
}

.selection-card.checkbox.selected .card-indicator::after {
  width: 10px;
  height: 6px;
  background: transparent;
  border-left: 2px solid var(--bg-deep);
  border-bottom: 2px solid var(--bg-deep);
  border-radius: 0;
  transform: translate(-50%, -60%) rotate(-45deg);
}

.card-emoji {
  font-size: 28px;
  margin-bottom: 10px;
  filter: grayscale(20%);
}

.card-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.card-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

/* Full-width section */
.section.full-width {
  grid-column: 1 / -1;
}

/* Accessory Grid - denser */
.accessory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.accessory-card {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.accessory-card:hover {
  border-color: var(--border-accent);
}

.accessory-card.selected {
  border-color: var(--accent-cyan);
  background: linear-gradient(
    135deg,
    rgba(78, 205, 196, 0.08) 0%,
    transparent 100%
  );
}

.accessory-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.accessory-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-accent);
  border-radius: 3px;
  transition: all 0.2s ease;
}

.accessory-card.selected .accessory-indicator {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan);
}

.accessory-card.selected .accessory-indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 4px;
  background: transparent;
  border-left: 2px solid var(--bg-deep);
  border-bottom: 2px solid var(--bg-deep);
  transform: translate(-50%, -60%) rotate(-45deg);
}

.accessory-emoji {
  font-size: 24px;
  margin-bottom: 6px;
}

.accessory-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Output Section */
.output-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

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

.output-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: 18px;
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

.output-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--accent-gold);
  background: rgba(212, 168, 83, 0.15);
  padding: 4px 8px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.copy-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.copy-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-accent);
  color: var(--text-primary);
}

.copy-btn.copied {
  background: rgba(78, 205, 196, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.output-content {
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.output-content pre {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.output-content pre .key {
  color: var(--accent-gold);
}

.output-content pre .string {
  color: var(--accent-cyan);
}

.output-content pre .number {
  color: #b794f6;
}

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

.output-content::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

.output-content::-webkit-scrollbar-thumb {
  background: var(--border-accent);
  border-radius: 4px;
}

/* Output tabs */
.output-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.output-tab {
  font-family: "Bebas Neue", sans-serif;
  font-size: 15px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 12px 24px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.output-tab:hover {
  color: var(--text-secondary);
}

.output-tab.active {
  color: var(--text-primary);
}

.output-tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gold);
}

/* Tab panels */
.output-panel {
  display: none;
}

.output-panel.active {
  display: block;
}

/* Parameter grid */
.param-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.param-field label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.param-field input,
.param-field select {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--text-primary);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px 12px;
  transition: border-color 0.2s ease;
  width: 100%;
}

.param-field input:focus,
.param-field select:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.param-field select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a9aa0' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* Responsive */
@media (max-width: 900px) {
  .grid-border,
  .film-border {
    display: none;
  }

  .container {
    padding: 24px 20px;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }

  .accessory-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .param-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section {
  animation: fadeIn 0.4s ease backwards;
}

.section:nth-child(1) {
  animation-delay: 0.1s;
}

.section:nth-child(2) {
  animation-delay: 0.15s;
}

.section:nth-child(3) {
  animation-delay: 0.2s;
}

.section:nth-child(4) {
  animation-delay: 0.25s;
}

.output-section {
  animation: fadeIn 0.4s ease backwards;
  animation-delay: 0.3s;
}

/* Footer */
.site-footer {
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--text-primary);
}
.site-footer ak-theme-toggle {
  margin-top: 16px;
}

/* Light Mode — param inputs */
[data-theme="light"] .param-field input,
[data-theme="light"] .param-field select {
  background-color: #fafafa;
  border-color: #d0d0d0;
}

[data-theme="light"] .param-field input:focus,
[data-theme="light"] .param-field select:focus {
  border-color: var(--accent-gold);
}

[data-theme="light"] .param-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555555' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
}

/* Light Mode */
[data-theme="light"] {
  --bg-deep: #f5f5f5;
  --bg-surface: #ffffff;
  --bg-elevated: #fafafa;
  --bg-card: #ffffff;
  --border-subtle: #e0e0e0;
  --border-accent: #cccccc;
  --text-primary: #111111;
  --text-secondary: #555555;
  --text-muted: #888888;
  --accent-gold: #b8860b;
  --accent-gold-dim: #996515;
  --grid-color: #e8e8e8;
}
