:root {
  color-scheme: dark;
  --bg: #111111;
  --panel: #191919;
  --panel-2: #222222;
  --ink: #fff7e9;
  --muted: rgba(255, 247, 233, 0.68);
  --line: rgba(255, 247, 233, 0.16);
  --accent: #ffcf53;
  --accent-dark: #1b1400;
  --danger: #ff8f70;
  --ok: #7ee0b6;
  font-family: system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 48px);
  background: rgba(17, 17, 17, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 22px;
  font-weight: 700;
}

.brand-logotype {
  font-family: "Finesse", system-ui, sans-serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--accent-dark);
  background: var(--accent);
  border: 1px solid rgba(255, 247, 233, 0.24);
  border-radius: 16px;
}

.brand-mark svg {
  width: 30px;
  height: 30px;
}

.brand-mark path {
  fill: currentColor;
  opacity: 0.26;
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.top-agent-link {
  min-height: 42px;
  border: 1px solid rgba(255, 207, 83, 0.52);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--accent-dark);
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  overflow-x: auto;
}

.nav-button,
.secondary-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.nav-button.is-active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent);
}

main {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 48px) 56px;
}

.control-band {
  padding: clamp(58px, 10vw, 132px) 0 clamp(34px, 6vw, 76px);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: none;
  margin-bottom: 0;
  font-size: clamp(72px, 13vw, 220px);
  line-height: 0.86;
  letter-spacing: 0;
}

.controls {
  display: grid;
  gap: 14px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.collection-controls {
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  align-items: start;
  margin-bottom: 18px;
}

.preview-controls {
  display: grid;
  gap: 14px;
}

.input-label,
.range-label,
.eyebrow,
.filter-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

#preview-input,
#search-input,
#license-select,
#agent-prompt-text,
#agent-dialog-prompt {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--ink);
  background: #0d0d0d;
  outline: none;
}

#preview-input {
  font-size: 28px;
}

#preview-input:focus,
#search-input:focus,
#license-select:focus,
#agent-prompt-text:focus,
#agent-dialog-prompt:focus {
  border-color: var(--accent);
}

.control-row,
.toolbar,
.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 62px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.agent-helper {
  min-width: 0;
}

.agent-helper summary {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 14px 16px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #0d0d0d;
  cursor: pointer;
}

.agent-helper summary::-webkit-details-marker {
  display: none;
}

.agent-helper summary::after {
  content: "+";
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--accent-dark);
  background: var(--accent);
  border-radius: 999px;
  font-weight: 700;
}

.agent-helper[open] summary::after {
  content: "-";
}

.agent-helper-body {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.agent-helper-header {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.agent-helper-header p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
}

.agent-title {
  display: block;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.compact-action {
  min-height: 36px;
  padding: 8px 12px;
}

#agent-prompt-text {
  height: 260px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

.agent-dialog {
  width: min(880px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.agent-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
}

.agent-dialog-panel {
  display: grid;
  gap: 16px;
  max-height: min(820px, calc(100vh - 32px));
  padding: clamp(18px, 3vw, 28px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.48);
}

.agent-dialog-header,
.agent-dialog-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.agent-dialog-header h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.icon-button svg,
.icon-action svg {
  width: 18px;
  height: 18px;
}

.icon-button path,
.icon-action path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-action {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.icon-action.is-copied {
  border-color: rgba(126, 224, 182, 0.5);
  color: var(--ok);
}

.copy-state-check,
.icon-action.is-copied .copy-state-copy {
  display: none;
}

.icon-action.is-copied .copy-state-check {
  display: block;
}

#agent-dialog-prompt {
  height: min(54vh, 460px);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
}

.toolbar {
  justify-content: space-between;
  padding: 26px 0;
  border-top: 1px solid var(--line);
}

.toolbar-fields {
  display: grid;
  grid-template-columns: minmax(220px, 420px) minmax(220px, 320px);
  gap: 12px;
  width: min(760px, 56vw);
  align-items: end;
}

.category-switcher {
  justify-content: flex-start;
  margin: 0 0 18px;
  padding: 0 0 4px;
}

.toolbar h2 {
  margin: 0 0 4px;
  font-size: clamp(28px, 4vw, 48px);
}

#result-count {
  margin: 0;
  color: var(--muted);
}

.filter-field {
  display: grid;
  gap: 8px;
}

#license-select {
  cursor: pointer;
}

.typeface-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.type-card {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.specimen {
  position: relative;
  display: block;
  min-height: 0;
  padding: clamp(18px, 3vw, 36px) clamp(18px, 4vw, 44px) clamp(24px, 4vw, 52px);
  overflow: hidden;
  background: var(--panel-2);
  background-position: center;
  background-size: cover;
  isolation: isolate;
}

.specimen.is-barber-specimen {
  background-color: #1241ad;
}

.specimen.is-blackout-specimen {
  background-color: #151715;
}

.specimen::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.5));
}

.specimen.is-barber-specimen::after {
  display: none;
}

.specimen.is-blackout-specimen::after {
  display: none;
}

.specimen-mark {
  display: none;
}

.preview {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: white;
  font-size: var(--preview-size, 64px);
  line-height: 0.88;
}

.barber-preview {
  display: grid;
  width: max-content;
  max-width: 100%;
  color: transparent;
  font-family: "Barber", system-ui, sans-serif;
  text-transform: uppercase;
}

.barber-layer {
  grid-area: 1 / 1;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: "Barber", system-ui, sans-serif;
  line-height: 0.88;
}

.barber-layer-shadow {
  z-index: 1;
  color: #e89e0b;
}

.barber-layer-right {
  z-index: 2;
  color: #ffd243;
}

.barber-layer-outline {
  z-index: 3;
  color: #ffffff;
}

.barber-layer-fill {
  z-index: 4;
  color: #e20d0f;
}

.barber-layer-complete {
  z-index: 5;
  color: #ffffff;
}

.blackout-preview {
  color: #ffffff;
  font-family: "Blackout", system-ui, sans-serif;
  text-transform: uppercase;
}

.card-body {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: clamp(12px, 1.4vw, 18px) clamp(18px, 2vw, 28px);
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.card-body h3 {
  margin-bottom: 4px;
  font-size: 24px;
}

.meta,
.description {
  color: var(--muted);
  line-height: 1.45;
}

.meta,
.description {
  margin-bottom: 0;
}

.description {
  display: none;
}

.license-pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.license-pill {
  color: var(--muted);
}

.license-pill.restricted {
  color: var(--muted);
  background: transparent;
}

.license-pill.open {
  color: var(--muted);
  background: transparent;
}

.card-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.card-actions a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 860px) {
  .site-header,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .site-header {
    position: static;
  }

  .header-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .nav {
    justify-content: flex-start;
  }

  .toolbar {
    display: grid;
  }

  .collection-controls {
    grid-template-columns: 1fr;
  }

  .search-field {
    width: 100%;
  }

  .toolbar-fields {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .type-card {
    grid-template-columns: 1fr;
  }

  .card-body {
    display: grid;
    justify-content: stretch;
  }

  .agent-helper-header {
    align-items: flex-start;
  }

  .specimen {
    min-height: 0;
  }
}

@media (max-width: 520px) {
  .typeface-grid {
    grid-template-columns: 1fr;
  }

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

  .agent-helper-header {
    display: grid;
  }

  .agent-dialog-actions,
  .agent-dialog-header {
    align-items: flex-start;
  }

  h1 {
    font-size: clamp(46px, 14vw, 68px);
    line-height: 0.9;
  }
}
