:root {
  --bg0: #06060d;
  --bg1: #0f0f1a;
  --card-bg: rgba(18, 18, 42, 0.65);
  --accent: #7c5cff;
  --accent2: #00d4aa;
  --text: #eceaf5;
  --muted: #9b97b8;
  --border: rgba(255, 255, 255, 0.09);
  --radius: 16px;
  --font: "DM Sans", system-ui, sans-serif;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1000px 520px at 8% -5%, rgba(124, 92, 255, 0.28), transparent),
    radial-gradient(800px 480px at 92% 8%, rgba(0, 212, 170, 0.12), transparent),
    linear-gradient(180deg, #0a0a14 0%, #06060d 40%, #080812 100%);
}

code {
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

a {
  color: var(--accent2);
}

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.site-header {
  padding: 1.75rem 0 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 6, 13, 0.85);
  backdrop-filter: blur(12px);
}

.site-header-inner {
  max-width: 1320px;
}

.site-title-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 40px rgba(124, 92, 255, 0.35);
}

.site-title {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.site-tagline {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(124, 92, 255, 0.25);
  border: 1px solid rgba(124, 92, 255, 0.45);
  color: #dcd7ff;
  vertical-align: middle;
}

.site-lead {
  margin: 1rem 0 0;
  max-width: 72ch;
  line-height: 1.6;
  color: #c4c0dc;
  font-size: 0.95rem;
}

.site-lead-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.88rem;
}

/* Layout */
.layout {
  display: block;
  max-width: 920px;
  margin: 0 auto;
  padding-top: 1.75rem;
  padding-bottom: 4rem;
}

.main-col {
  min-width: 0;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.card-generate {
  margin-bottom: 1.25rem;
}

.card-paste {
  margin-bottom: 1.25rem;
}

.card-sub {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-hint {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.55;
}

.pick-field-inline {
  margin-bottom: 0.85rem;
  max-width: 320px;
}

.row-actions-tight {
  margin-top: 0.75rem;
}

button.secondary {
  border: 1px solid rgba(124, 92, 255, 0.45);
  border-radius: 999px;
  padding: 0.72rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  color: #e8e4ff;
  background: rgba(124, 92, 255, 0.15);
}

button.secondary:hover {
  background: rgba(124, 92, 255, 0.28);
  border-color: rgba(0, 212, 170, 0.45);
}

.meta-hint {
  margin-left: 0;
  flex: 1;
  min-width: 200px;
}

#paste-in {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.38);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 140px;
}

#paste-in:focus {
  outline: 2px solid rgba(124, 92, 255, 0.4);
  outline-offset: 2px;
}

.pick-field-inline select {
  background: #e8e6f2;
  color: #12121c;
  border: 1px solid #6e6a8a;
}

.intent-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

#intent {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  padding: 1rem;
  line-height: 1.55;
}

#intent:focus {
  outline: 2px solid rgba(124, 92, 255, 0.45);
  outline-offset: 2px;
}

.pickers-block {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.pickers-title {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.pickers-subtitle {
  margin: 0.85rem 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #b8b4d4;
}

.pick-grid-cheatsheet {
  margin-bottom: 0.25rem;
}

.pickers-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.65rem 1rem;
}

.pick-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.pick-field select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #6e6a8a;
  background: #e8e6f2;
  color: #12121c;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.52rem 0.6rem;
  cursor: pointer;
}

.pick-field select option {
  background: #f2f0fa;
  color: #12121c;
}

.pick-field select:focus {
  outline: 2px solid rgba(124, 92, 255, 0.55);
  outline-offset: 1px;
  border-color: var(--accent);
}

.duet-panel {
  margin-top: 1rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(124, 92, 255, 0.35);
  background: rgba(10, 10, 28, 0.55);
}

.duet-panel[hidden] {
  display: none !important;
}

.duet-panel-title {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #dcd7ff;
}

.duet-panel-hint {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.duet-names {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-bottom: 0.75rem;
}

.duet-name-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.74rem;
  color: var(--muted);
  flex: 1 1 160px;
}

.duet-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #6e6a8a;
  background: #e8e6f2;
  color: #12121c;
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.48rem 0.55rem;
}

.duet-input:focus {
  outline: 2px solid rgba(124, 92, 255, 0.55);
  outline-offset: 1px;
  border-color: var(--accent);
}

.duet-grid {
  margin-top: 0.15rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

button.primary {
  border: 0;
  border-radius: 999px;
  padding: 0.78rem 1.45rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  color: #06060d;
  background: linear-gradient(135deg, var(--accent2), #7cfadc);
  box-shadow: 0 8px 28px rgba(0, 212, 170, 0.22);
}

button.primary:hover {
  filter: brightness(1.06);
}

button.ghost {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font-size: 0.88rem;
}

button.ghost:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: auto;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
  min-height: 1.4rem;
}

.chip {
  font-size: 0.76rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.18);
  border: 1px solid rgba(124, 92, 255, 0.32);
  color: #dcd7ff;
}

.chip-muted {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--muted);
}

.output-section {
  margin-top: 0.25rem;
}

.tabs {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.tabs button {
  flex: 1;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  padding: 0.65rem 1rem;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.tabs button.is-active {
  color: var(--text);
  border-bottom-color: transparent;
  background: var(--card-bg);
}

.panels textarea {
  width: 100%;
  min-height: 260px;
  border-radius: 0 0 var(--radius) var(--radius);
  border: 1px solid var(--border);
  border-top: 0;
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.48;
  padding: 1rem;
  resize: vertical;
}

.panels textarea.flash {
  animation: flash 0.45s ease;
}

@keyframes flash {
  from {
    box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.55);
  }
  to {
    box-shadow: 0 0 0 14px transparent;
  }
}

.panel-head {
  display: flex;
  justify-content: flex-end;
  padding: 0.45rem 0.65rem 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}

.footnote {
  margin-top: 2rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
  max-width: 70ch;
}

/* Reference aside */
.ref-aside {
  position: relative;
}

.ref-sticky {
  position: sticky;
  top: 0.75rem;
  max-height: calc(100vh - 1rem);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ref-heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ref-intro {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.ref-search-label {
  display: block;
}

.ref-search {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.55rem 0.75rem;
}

.ref-search:focus {
  outline: 2px solid rgba(124, 92, 255, 0.4);
  outline-offset: 1px;
}

.ref-scroll {
  flex: 1;
  min-height: 200px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding-right: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8, 8, 18, 0.5);
  padding: 0.5rem 0.6rem;
}

.ref-details {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.35rem;
}

.ref-details:last-child {
  border-bottom: 0;
}

.ref-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.45rem 0.25rem;
  list-style: none;
  color: #d8d4f0;
}

.ref-details summary::-webkit-details-marker {
  display: none;
}

.ref-details summary::before {
  content: "▸ ";
  color: var(--accent2);
  font-size: 0.75rem;
}

.ref-details[open] summary::before {
  content: "▾ ";
}

.ref-body {
  padding: 0.35rem 0.25rem 0.65rem;
  font-size: 0.78rem;
  color: #b8b4d0;
  line-height: 1.45;
}

.ref-list {
  margin: 0;
  padding-left: 1.1rem;
}

.ref-list li {
  margin-bottom: 0.35rem;
}

.ref-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

button.ref-pill {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.68rem;
  padding: 0.28rem 0.45rem;
  border-radius: 8px;
  border: 1px solid rgba(124, 92, 255, 0.35);
  background: rgba(124, 92, 255, 0.12);
  color: #e2defa;
  cursor: pointer;
  line-height: 1.2;
  text-align: left;
}

button.ref-pill:hover {
  background: rgba(124, 92, 255, 0.28);
  border-color: rgba(0, 212, 170, 0.45);
}

.ref-pill.is-dim {
  opacity: 0.22;
  pointer-events: none;
}

.ref-table-wrap {
  overflow-x: auto;
  margin-top: 0.35rem;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.ref-table th,
.ref-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.4rem;
  text-align: left;
  vertical-align: top;
}

.ref-table th {
  background: rgba(124, 92, 255, 0.12);
  color: #dcd7ff;
}

.ref-muted {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 0.35rem;
}

.ref-block-title {
  font-size: 0.74rem;
  font-weight: 600;
  color: #cecae8;
  margin: 0.5rem 0 0.25rem;
}
