:root {
  color-scheme: light;
  --bg: #f8f7ff;
  --panel: #ffffff;
  --panel-2: #fdf8ff;
  --text: #3d3659;
  --muted: #7b7397;
  --primary: #8f87ff;
  --primary-2: #cfd7ff;
  --accent: #ffd8e2;
  --accent-2: #ffe8c2;
  --border: #e7e0f2;
  --shadow: 0 18px 45px rgba(98, 86, 154, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg), #fefcfb 70%);
  color: var(--text);
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 32px;
  margin-bottom: 24px;
  background: linear-gradient(90deg, #fef7ff 0%, #fefdf8 100%);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 700;
}

.hero-card h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.builder-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

.panel {
  padding: 24px;
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 18px;
}

.field-group {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

select,
input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--panel-2);
  color: var(--text);
}

.filter-row,
.limit-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.limit-row {
  grid-template-columns: 100px auto;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.small-btn {
  padding: 7px 10px;
  font-size: 0.9rem;
}

.assignment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.assignment-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.assignment-row input {
  min-width: 0;
}

.assignment-remove {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: var(--primary);
  color: white;
  width: 100%;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(143, 135, 255, 0.24);
}

.secondary-btn {
  background: var(--accent);
  color: #6f4960;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.hidden {
  display: none;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--primary-2);
  color: #4b4680;
  border-radius: 999px;
  font-size: 0.95rem;
}

.chip button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.output-note {
  color: var(--muted);
  margin-top: -6px;
}

pre {
  background: #fcfbff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  white-space: pre-wrap;
  line-height: 1.6;
}

.summary-card {
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(90deg, var(--accent-2), #fdf7ff);
  border-radius: 16px;
}

.summary-card h3 {
  margin-top: 0;
  margin-bottom: 6px;
}

.section-header-row,
.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.example-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--panel-2);
}

.example-hint {
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 16px;
  }

  .builder-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hero-card,
  .panel {
    border-radius: 18px;
    padding: 18px;
  }

  .hero-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .section-header-row,
  .output-header,
  .example-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-actions {
    width: 100%;
  }

  .section-actions button {
    flex: 1;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-card h1 {
    font-size: 1.5rem;
  }

  .section-actions {
    flex-direction: column;
  }

  .section-actions button,
  .secondary-btn,
  .ghost-btn,
  .primary-btn {
    width: 100%;
  }

  .panel {
    padding: 16px;
  }
}
