:root {
  color-scheme: dark;
  --background: #0c0c0d;
  --surface: #151517;
  --surface-raised: #1b1b1e;
  --line: #2b2b30;
  --line-strong: #44444c;
  --text: #f3f1ee;
  --muted: #a6a3a0;
  --soft: #ccc7c1;
  --accent: #ff6b8a;
  --accent-soft: #ffb3c3;
  --focus: #bca6ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 300px;
  background:
    radial-gradient(circle at 10% -5%, rgba(108, 78, 154, 0.18), transparent 34rem),
    radial-gradient(circle at 95% 0%, rgba(131, 69, 84, 0.12), transparent 32rem),
    var(--background);
  color: var(--text);
  font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.shell {
  width: min(1760px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(68, 68, 76, 0.78);
  background: rgba(12, 12, 13, 0.91);
  backdrop-filter: blur(18px);
}

.masthead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 0 8px;
}

.brand {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  color: var(--accent-soft);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 2.05rem);
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.header-options {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mobile-menu-toggle {
  display: none;
}

.header-options .toggle {
  min-height: 34px;
  padding-inline: 8px;
  font-size: 0.82rem;
  line-height: 1.2;
}

.header-options .range-control {
  display: flex;
  min-width: 210px;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding-block: 3px;
}

.header-options .range-control span {
  flex: 0 0 auto;
  gap: 7px;
}

.header-options .range-control input {
  min-width: 64px;
  flex: 1;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(320px, 2fr) minmax(290px, 1.35fr) minmax(180px, 0.8fr) minmax(160px, 0.7fr);
  align-items: end;
  gap: 8px;
  padding-bottom: 8px;
}

.control-group {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.control-group > span,
.control-group > label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
}

.base-prompt-controls {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.prompt-action {
  white-space: nowrap;
}

.control,
.toggle,
.range-control,
.action {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(24, 24, 27, 0.92);
  color: var(--text);
}

.control {
  width: 100%;
  padding: 6px 10px;
}

.control:hover,
.toggle:hover,
.range-control:hover,
.action:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.control:disabled {
  cursor: not-allowed;
  color: #77747a;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  white-space: nowrap;
}

.toggle input {
  accent-color: var(--accent);
}

.range-control {
  display: grid;
  min-width: 170px;
  align-content: center;
  gap: 2px;
  padding: 3px 10px;
  white-space: nowrap;
}

.range-control span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--soft);
  font-size: 0.76rem;
}

.range-control output {
  color: var(--accent-soft);
  font-weight: 800;
}

.range-control input {
  width: 100%;
  accent-color: var(--accent);
}

.export-menu {
  position: relative;
}

.export-menu > summary {
  display: flex;
  align-items: center;
  list-style: none;
  white-space: nowrap;
}

.header-options .export-menu > summary {
  min-height: 34px;
}

.export-menu > summary::-webkit-details-marker {
  display: none;
}

.export-menu > summary::after {
  content: "▾";
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.7rem;
}

.export-menu[open] > summary::after {
  transform: rotate(180deg);
}

.export-menu-panel {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 40;
  display: grid;
  min-width: 245px;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

.export-menu-panel .action {
  width: 100%;
  text-align: left;
}

.action {
  padding: 5px 11px;
  color: var(--soft);
}

.action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.catalog-status {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  min-height: 54px;
  padding: 17px 1px 11px;
  color: var(--muted);
  font-size: 0.87rem;
}

#notice {
  color: var(--accent-soft);
  text-align: right;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(var(--columns, 5), minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 48px;
}

.style-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(21, 21, 23, 0.95);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.19);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.style-card:hover {
  transform: translateY(-2px);
  border-color: #414148;
  box-shadow: 0 19px 40px rgba(0, 0, 0, 0.27);
}

.base-image-card {
  border-color: rgba(255, 107, 138, 0.42);
}

.base-image-card .style-name {
  color: var(--accent-soft);
}

.card-heading {
  display: flex;
  min-height: 61px;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 10px 11px 16px;
}

.style-name {
  flex: 1;
  margin: 0;
  padding: 3px 0 0;
  font-size: 1.06rem;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.copy-style-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 8px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8f8a93;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.copy-style-button:hover {
  background: #232126;
  color: var(--text);
}

.copy-style-button:active {
  transform: scale(0.94);
}

.copy-style-button.copied {
  color: #8ed19a;
}

.copy-style-button svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.image-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: #080809;
}

.image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.image-wrap img:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -4px;
}

.image-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(145deg, rgba(69, 57, 79, 0.27), transparent 46%),
    linear-gradient(25deg, #111113, #18171a);
  color: #77737b;
  text-align: center;
}

.favorite-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 7px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: white;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
  transition: opacity 150ms ease, transform 150ms ease, color 150ms ease;
}

.favorite-button svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: rgba(0, 0, 0, 0.12);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.style-card:hover .favorite-button,
.favorite-button:focus-visible,
.favorite-button[aria-pressed="true"] {
  opacity: 1;
}

.favorite-button:hover {
  transform: scale(1.08);
}

.favorite-button[aria-pressed="true"] {
  color: var(--accent);
}

.favorite-button[aria-pressed="true"] svg {
  fill: currentColor;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  padding: 15px 16px 16px;
}

.catalog-grid.details-hidden .card-body {
  display: none;
}

.descriptor {
  margin: 0;
  color: #c5c1bd;
  font-size: 0.84rem;
  line-height: 1.58;
}

.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.categories span {
  padding: 3px 8px;
  border: 1px solid #3a3740;
  border-radius: 999px;
  background: #18171a;
  color: #aaa4af;
  font-size: 0.71rem;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 64px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.prompt-dialog {
  width: min(760px, calc(100% - 30px));
  max-height: min(78vh, 760px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #151517;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.prompt-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.image-viewer {
  width: fit-content;
  max-width: 96vw;
  max-height: 96vh;
  padding: 64px 12px 10px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(10, 10, 11, 0.97);
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.72);
}

.image-viewer::backdrop {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(5px);
}

.image-viewer-stage {
  position: relative;
  touch-action: pan-y;
}

.image-viewer figure {
  display: grid;
  margin: 0;
  place-items: center;
}

.image-viewer img {
  display: block;
  width: auto;
  max-width: calc(96vw - 24px);
  height: auto;
  max-height: calc(96vh - 78px);
  max-height: calc(96dvh - 78px);
  border-radius: 8px;
  object-fit: contain;
}

.image-viewer-info {
  position: absolute;
  top: 10px;
  right: 54px;
  left: 16px;
  min-width: 0;
}

.image-viewer-info h2,
.image-viewer-info p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-viewer-info h2 {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.3;
}

.image-viewer-info p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.image-viewer-position::before {
  content: "·";
  padding-inline: 7px;
  color: var(--line-strong);
}

.image-viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  width: 42px;
  height: 58px;
  padding: 0 0 4px;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  background: rgba(8, 8, 9, 0.62);
  color: rgba(255, 255, 255, 0.86);
  font-size: 2rem;
  line-height: 1;
  opacity: 0;
  backdrop-filter: blur(6px);
  transition: opacity 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.image-viewer-stage.touch-navigation-visible .image-viewer-nav {
  opacity: 0.56;
}

.image-viewer-nav:hover,
.image-viewer-nav:focus-visible {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(12, 12, 13, 0.88);
  opacity: 1;
}

.image-viewer-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.image-viewer-nav[hidden] {
  display: none;
}

.image-viewer-previous {
  left: 18px;
}

.image-viewer-next {
  right: 18px;
}

@media (hover: hover) and (pointer: fine) {
  .image-viewer-stage:hover .image-viewer-nav {
    opacity: 0.56;
  }
}

.image-viewer-close {
  position: absolute;
  top: 5px;
  right: 6px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.dialog-close {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 1.65rem;
  line-height: 1;
}

.dialog-close:hover {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--text);
}

.prompt-text {
  max-height: calc(78vh - 94px);
  margin: 0;
  padding: 20px;
  overflow: auto;
  color: #d2cdc7;
  font: 0.92rem/1.65 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (hover: none) {
  .favorite-button {
    opacity: 0.88;
  }
}

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

@media (max-width: 1150px) {
  .masthead {
    grid-template-columns: auto 1fr;
  }

  .header-options {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .summary {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 22px, 1760px);
  }

  .site-header.mobile-menu-open {
    max-height: 100svh;
    overflow-y: auto;
  }

  .masthead {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px 12px;
    padding-top: 10px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .summary {
    grid-column: 2;
    grid-row: 1;
    align-items: flex-end;
    font-size: 0.76rem;
  }

  .header-options {
    display: none;
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding-top: 2px;
  }

  .toolbar {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-menu-open .header-options,
  .mobile-menu-open .toolbar {
    display: grid;
  }

  .mobile-menu-toggle {
    display: flex;
    min-height: 36px;
    grid-column: 1 / -1;
    grid-row: 2;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(24, 24, 27, 0.92);
    color: var(--soft);
    font-weight: 700;
  }

  .mobile-menu-toggle::after {
    content: "▾";
    color: var(--muted);
    font-size: 0.72rem;
    transition: transform 150ms ease;
  }

  .mobile-menu-toggle:hover {
    border-color: var(--line-strong);
    background: var(--surface-raised);
  }

  .mobile-menu-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
  }

  .header-options > .toggle {
    min-width: 0;
    white-space: normal;
  }

  .header-options > .details-toggle,
  .header-options > .density-control,
  .header-options > .export-menu {
    grid-column: 1 / -1;
  }

  .header-options .range-control {
    min-width: 0;
  }

  .header-options .export-menu > summary {
    justify-content: space-between;
  }

  .export-menu-panel {
    right: 0;
    left: 0;
    min-width: 0;
  }

  .search-control,
  .base-prompt-group {
    grid-column: 1 / -1;
  }

  .catalog-grid {
    gap: 13px;
  }

  .card-heading {
    min-height: 54px;
    gap: 4px;
    padding: 10px 5px 8px 10px;
  }

  .style-name {
    padding-top: 4px;
    font-size: 0.92rem;
    line-height: 1.2;
  }

  .copy-style-button {
    width: 34px;
    height: 34px;
    padding: 8px;
  }

  .card-body {
    gap: 10px;
    padding: 11px;
  }

  .catalog-status {
    min-height: 46px;
    padding-block: 13px 9px;
  }
}
