:root {
  color-scheme: light;
  --page-bg: #ffffff;
  --sidebar-bg: rgba(255, 255, 255, 0.96);
  --card-bg: #ffffff;
  --panel-soft: #f1f5f9;
  --text: #1e293b;
  --text-strong: #0f172a;
  --muted: #64748b;
  --muted-soft: #94a3b8;
  --line: #e2e8f0;
  --line-soft: rgba(226, 232, 240, 0.6);
  --primary: #38bdf8;
  --primary-deep: #0891b2;
  --cyan: #06b6d4;
  --blue: #3b82f6;
  --shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page-bg: #0a0e1a;
    --sidebar-bg: rgba(15, 23, 42, 0.82);
    --card-bg: #111827;
    --panel-soft: rgba(255, 255, 255, 0.05);
    --text: #e2e8f0;
    --text-strong: #ffffff;
    --muted: #94a3b8;
    --muted-soft: #64748b;
    --line: rgba(51, 65, 85, 0.8);
    --line-soft: rgba(255, 255, 255, 0.1);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.opennana-shell {
  min-height: 100vh;
}

.desktop-sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: 160px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  backdrop-filter: blur(18px);
}

.sidebar-brand {
  display: flex;
  min-height: 56px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
}

.sidebar-brand strong {
  overflow: visible;
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  white-space: normal;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.nav-group,
.sidebar-link {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #475569;
  padding: 10px 12px;
  text-align: left;
  transition:
    background 180ms ease,
    color 180ms ease;
}

.nav-group:hover,
.sidebar-link:hover,
.nav-group.is-active,
.sidebar-link.is-active {
  background: rgba(224, 242, 254, 0.8);
  color: var(--primary-deep);
}

.nav-group strong,
.sidebar-link span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-group em {
  color: var(--muted-soft);
  font-size: 13px;
  font-style: normal;
}

.nav-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 14px 16px;
  border-left: 2px solid var(--line);
  padding-left: 12px;
}

.sidebar-link {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--muted);
}

.nav-icon {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--muted-soft);
}

.image-icon {
  border: 1.7px solid currentColor;
  border-radius: 4px;
}

.image-icon::before {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.image-icon::after {
  position: absolute;
  right: 3px;
  bottom: 4px;
  left: 3px;
  height: 6px;
  border-radius: 1px;
  background: linear-gradient(135deg, transparent 45%, currentColor 46% 58%, transparent 59%),
    linear-gradient(45deg, transparent 43%, currentColor 44% 56%, transparent 57%);
  content: "";
}

.spark-icon,
.clock-icon,
.heart-icon {
  border: 1.7px solid currentColor;
  border-radius: 50%;
}

.spark-icon::after {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.clock-icon::before {
  position: absolute;
  top: 4px;
  left: 8px;
  width: 1.5px;
  height: 6px;
  background: currentColor;
  content: "";
}

.clock-icon::after {
  position: absolute;
  top: 9px;
  left: 8px;
  width: 5px;
  height: 1.5px;
  background: currentColor;
  content: "";
}

.heart-icon {
  border-radius: 6px;
  transform: rotate(45deg) scale(0.75);
}

.sidebar-footer {
  margin: 0 12px 12px;
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 12px;
  background: rgba(224, 242, 254, 0.78);
  color: var(--text-strong);
  padding: 12px;
  font-size: 12px;
}

.sidebar-footer span,
.sidebar-footer small {
  display: block;
}

.sidebar-footer span {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 700;
}

.sidebar-footer small {
  color: var(--muted);
  line-height: 17px;
}

.mobile-header {
  display: none;
}

.main-stage {
  min-height: 100vh;
  margin-left: 144px;
  padding: 20px 24px 48px;
}

.gallery-controls {
  position: relative;
  z-index: 20;
  margin: 0 0 13px;
  padding: 0;
  background: transparent;
}

.search-stack {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: 30px;
  font-weight: 800;
  line-height: 36px;
  letter-spacing: 0;
}

.subtitle {
  margin: 8px 0 0;
  max-width: 900px;
  color: var(--muted);
  font-size: 18px;
  line-height: 28px;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.board-tabs {
  display: inline-flex;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
  padding: 4px;
}

.board-tabs button {
  min-width: 96px;
  height: 34px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  white-space: nowrap;
}

.board-tabs button.is-active {
  background: var(--card-bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  color: var(--primary-deep);
}

.search-box {
  display: flex;
  width: 240px;
  height: 44px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
  padding: 10px 16px;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.search-box:focus-within {
  border-color: rgba(6, 182, 212, 0.6);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.search-emoji {
  width: 20px;
  color: var(--muted-soft);
  font-size: 17px;
  opacity: 0.75;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  outline: none;
  padding: 0;
  font-size: 14px;
  line-height: 20px;
}

.search-submit {
  min-width: 76px;
  height: 40px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  color: #ffffff;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  transition:
    filter 180ms ease,
    transform 180ms ease;
}

.search-submit:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.result-count {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}

.result-count strong {
  color: var(--primary-deep);
  font-weight: 600;
}

.filter-line,
.quick-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow: visible;
}

.quick-tabs {
  margin-top: 10px;
}

.quick-tabs {
  max-height: 42px;
  overflow: hidden;
}

.quick-tabs.is-expanded {
  max-height: none;
  flex-wrap: wrap;
  overflow: visible;
}

.filter-label {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.quick-tabs button,
.more-chip {
  min-height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.quick-tabs button:hover,
.more-chip:hover {
  background: #e2e8f0;
  color: var(--text-strong);
}

.quick-tabs button.is-active {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.2);
  color: var(--primary-deep);
}

.gallery-summary {
  display: none;
}

.masonry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.masonry.is-workflow-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.prompt-card {
  display: block;
  width: 100%;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition:
    transform 260ms ease,
    box-shadow 260ms ease,
    border-color 260ms ease;
}

.prompt-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.card-image-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: linear-gradient(110deg, #f8fafc 8%, #eef2f7 18%, #f8fafc 33%);
  background-size: 200% 100%;
}

.card-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms ease;
}

.prompt-card:hover img {
  transform: scale(1.035);
}

.workflow-card-face {
  position: relative;
  display: flex;
  min-height: 210px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: var(--panel-soft);
}

.workflow-card-face img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 700ms ease;
}

.workflow-card-overlay {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  min-height: 104px;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.86) 40%, rgba(15, 23, 42, 0.96));
  padding: 46px 16px 16px;
}

.workflow-eyebrow {
  margin: 0 0 8px;
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 900;
  line-height: 18px;
}

.workflow-preview {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  line-height: 21px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.workflow-copy {
  pointer-events: auto;
}

.prompt-card.is-workflow:hover .workflow-card-face img {
  transform: scale(1.035);
}

.floating-copy {
  position: absolute;
  right: 50%;
  bottom: 8px;
  opacity: 0;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  color: var(--primary);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  pointer-events: none;
  transform: translateX(50%);
  transition: opacity 160ms ease;
}

.card-image-wrap::after {
  position: absolute;
  inset: auto 0 0;
  height: 68px;
  opacity: 0;
  background: linear-gradient(to top, rgba(56, 189, 248, 0.7), rgba(56, 189, 248, 0.35), transparent);
  content: "";
  pointer-events: none;
  transition: opacity 160ms ease;
}

.prompt-card:hover .card-image-wrap::after,
.prompt-card:hover .floating-copy {
  opacity: 1;
}

.card-body {
  display: flex;
  min-height: 56px;
  flex-direction: column;
  justify-content: center;
  background: var(--card-bg);
  padding: 16px 16px 12px;
}

.card-body h3 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 19.25px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-body p {
  display: none;
}

.variables code {
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.12);
  color: var(--primary-deep);
  font-size: 12px;
  padding: 5px 8px;
}

.load-more-note {
  margin-top: 20px;
  min-height: 72px;
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.62);
  padding: 24px;
}

.prompt-modal {
  position: relative;
  display: block;
  width: min(920px, 100%);
  max-height: min(920px, 92vh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: white;
  font-size: 24px;
  line-height: 1;
}

.modal-media {
  min-height: 0;
  border-bottom: 1px solid var(--line);
  background: var(--card-bg);
}

.modal-media img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
}

.modal-content {
  padding: clamp(20px, 3vw, 34px);
}

.prompt-modal.is-text-only {
  width: min(820px, 100%);
}

.modal-content h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.2;
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.favorite-toggle {
  flex: 0 0 auto;
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.1);
  color: var(--primary-deep);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
}

.favorite-toggle.is-active {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(254, 226, 226, 0.75);
  color: #be123c;
}

.usage {
  color: var(--muted);
  line-height: 1.75;
}

.variables div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.variables {
  margin: 18px 0;
}

.variables strong,
.prompt-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 900;
}

textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  outline: none;
  padding: 14px;
  line-height: 1.7;
}

.copy-primary {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: white;
  padding: 14px;
  font-weight: 900;
}

.is-copied {
  background: linear-gradient(135deg, #10b981, var(--cyan)) !important;
}

.related {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.related h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

.related button {
  display: grid;
  width: 100%;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  padding: 8px;
  text-align: left;
}

.related button:hover {
  background: var(--panel-soft);
}

.related img {
  width: 54px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
}

.related-text-icon {
  display: grid;
  width: 54px;
  height: 68px;
  place-items: center;
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.14);
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 900;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.empty-state strong {
  color: var(--text-strong);
  font-size: 16px;
}

@media (max-width: 1320px) {
  .masonry {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .masonry.is-workflow-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .masonry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .masonry.is-workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .desktop-sidebar {
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .is-menu-open .desktop-sidebar {
    transform: translateX(0);
  }

  .mobile-header {
    position: fixed;
    z-index: 50;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    height: 56px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: var(--sidebar-bg);
    padding: 0 16px;
    backdrop-filter: blur(18px);
  }

  .mobile-header strong {
    max-width: calc(100% - 52px);
    overflow: visible;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
    line-height: 1.2;
    white-space: normal;
  }

  .icon-button {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted-soft);
  }

  .icon-button span {
    display: block;
    width: 26px;
    height: 2px;
    margin: 3px 0;
    border-radius: 999px;
    background: currentColor;
  }

  .main-stage {
    margin-left: 0;
    padding: 76px 16px 34px;
  }

  .gallery-controls {
    margin-bottom: 5px;
  }

  h1 {
    font-size: 24px;
    line-height: 32px;
  }

  .subtitle {
    margin-top: 10px;
    font-size: 18px;
    line-height: 28px;
  }

  .search-row {
    gap: 16px;
    row-gap: 10px;
    margin-top: 8px;
  }

  .board-tabs {
    display: flex;
    width: 100%;
  }

  .board-tabs button {
    flex: 1 1 0;
    min-width: 0;
  }

  .search-box {
    width: 100%;
    height: 46px;
  }

  .result-count,
  .filter-label,
  .quick-tabs button,
  .more-chip {
    font-size: 14px;
    line-height: 20px;
  }

  .quick-tabs {
    margin-top: 8px;
  }

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

  .masonry.is-workflow-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 12px;
  }

  .prompt-modal {
    max-height: 94vh;
    border-radius: 14px;
  }

  .modal-title-row {
    display: block;
  }

  .favorite-toggle {
    margin-top: 12px;
  }
}
