:root {
  --ph-bg: #f7f9ff;
  --ph-surface: #ffffff;
  --ph-surface-soft: #f2f5ff;
  --ph-ink: #111827;
  --ph-muted: #687386;
  --ph-primary: #2f6df6;
  --ph-primary-dark: #174bd1;
  --ph-accent: #9b4dff;
  --ph-pink: #ff4fac;
  --ph-warm: #ff4fac;
  --ph-card-radius: 8px;
  --ph-soft-border: rgba(42, 79, 185, 0.12);
  --ph-shadow-sm: 0 8px 24px rgba(29, 50, 107, 0.07);
  --ph-shadow-md: 0 18px 46px rgba(29, 50, 107, 0.12);
}

html {
  min-height: 100%;
  background: var(--ph-bg);
}

body {
  min-height: 100%;
  background:
    radial-gradient(circle at 14% 0%, rgba(47, 109, 246, 0.1), transparent 320px),
    radial-gradient(circle at 86% 4%, rgba(255, 79, 172, 0.1), transparent 320px),
    linear-gradient(180deg, #ffffff 0%, #f5f7ff 390px, var(--ph-bg) 780px);
  color: var(--ph-ink);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  letter-spacing: 0;
}

a {
  color: var(--ph-primary-dark);
}

a:hover {
  color: #6d35d8;
}

.container {
  max-width: 1160px;
}

.btn {
  border-radius: 8px;
  text-transform: none;
  font-weight: 650;
}

.btn-primary {
  --bs-btn-bg: var(--ph-primary);
  --bs-btn-border-color: var(--ph-primary);
  --bs-btn-hover-bg: #6d35d8;
  --bs-btn-hover-border-color: #6d35d8;
  --bs-btn-active-bg: #174bd1;
  --bs-btn-active-border-color: #174bd1;
  background-image: linear-gradient(135deg, var(--ph-primary), var(--ph-accent) 58%, var(--ph-pink));
  box-shadow: 0 10px 22px rgba(47, 109, 246, 0.24);
}

.btn-outline-primary {
  --bs-btn-color: var(--ph-primary-dark);
  --bs-btn-border-color: rgba(47, 109, 246, 0.42);
  --bs-btn-hover-bg: var(--ph-primary);
  --bs-btn-hover-border-color: var(--ph-primary);
}

.form-control,
.form-select {
  border-radius: 8px;
  border-color: rgba(23, 33, 43, 0.14);
  min-height: 44px;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(155, 77, 255, 0.52);
  box-shadow: 0 0 0 0.2rem rgba(47, 109, 246, 0.13);
}

.card {
  border-radius: var(--ph-card-radius);
}

.badge {
  font-weight: 650;
}

.app-nav {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 26px rgba(20, 24, 31, 0.05);
}

.navbar-brand {
  font-weight: 750;
  min-width: 0;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.brand-logo {
  display: block;
  width: auto;
  height: 34px;
  max-width: 190px;
  object-fit: contain;
}

.footer-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex: 0 0 auto;
}

.navbar .nav-link {
  border-radius: 8px;
  color: #334155;
  font-weight: 620;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  background: rgba(47, 109, 246, 0.08);
  color: var(--ph-primary-dark);
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, var(--ph-primary), var(--ph-accent), var(--ph-pink));
  color: #fff;
  box-shadow: 0 10px 24px rgba(47, 109, 246, 0.24);
}

.hero-panel {
  border: 1px solid rgba(80, 105, 255, 0.16);
  border-radius: var(--ph-card-radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 255, 0.96)),
    linear-gradient(135deg, rgba(47, 109, 246, 0.08), rgba(255, 79, 172, 0.08));
  box-shadow: var(--ph-shadow-md);
}

.hero-panel .text-primary {
  color: var(--ph-primary-dark) !important;
}

.hero-panel .lead {
  max-width: 760px;
}

.guest-limit-card {
  border: 1px solid rgba(47, 109, 246, 0.14) !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 79, 172, 0.1), transparent 280px),
    linear-gradient(180deg, #ffffff, #f8faff);
}

.guest-limit-icon {
  width: 4rem;
  height: 4rem;
  margin-inline: auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--ph-primary), var(--ph-accent), var(--ph-pink));
  box-shadow: 0 18px 36px rgba(47, 109, 246, 0.2);
  font-size: 1.7rem;
}

.prompt-card {
  border: 1px solid rgba(23, 33, 43, 0.08) !important;
  border-radius: var(--ph-card-radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--ph-shadow-sm) !important;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.prompt-card:hover,
.prompt-card:focus-within {
  border-color: rgba(155, 77, 255, 0.28) !important;
  box-shadow: var(--ph-shadow-md) !important;
  transform: translateY(-2px);
}

.prompt-image-button {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  padding: 0;
  border: 0;
  background: #e9eef2;
  cursor: pointer;
  overflow: hidden;
}

.prompt-image-button::after {
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  content: "";
  background: linear-gradient(180deg, rgba(13, 18, 24, 0), rgba(13, 18, 24, 0.22));
  pointer-events: none;
}

.prompt-image-button img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 180ms ease, filter 180ms ease;
}

.prompt-image-button:hover img,
.prompt-image-button:focus-visible img {
  filter: saturate(1.06);
  transform: scale(1.035);
}

.prompt-image-placeholder {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  color: #758393;
  background: linear-gradient(135deg, #eaf1f4, #f8fafc);
  font-size: 2rem;
}

.prompt-title-link {
  color: var(--ph-ink);
  line-height: 1.22;
}

.prompt-title-link:hover {
  color: var(--ph-primary-dark);
}

.search-panel {
  border: 1px solid rgba(47, 109, 246, 0.12) !important;
  background: rgba(255, 255, 255, 0.96);
}

.tag-link {
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.tag-link:hover,
.tag-link:focus-visible {
  border-color: rgba(255, 79, 172, 0.45) !important;
  background: rgba(255, 79, 172, 0.08) !important;
  color: var(--ph-primary-dark);
}

.ai-tool-badge {
  border: 1px solid rgba(47, 109, 246, 0.16);
  background: linear-gradient(135deg, rgba(47, 109, 246, 0.1), rgba(255, 79, 172, 0.12));
  color: #2343a6;
  font-weight: 760;
}

.ai-tool-badge:hover,
.ai-tool-badge:focus-visible {
  color: #6d35d8;
  border-color: rgba(155, 77, 255, 0.26);
}

.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  object-fit: cover;
  background: #eef3ff;
  color: var(--ph-primary-dark);
  font-weight: 750;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(47, 109, 246, 0.18);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
}

.avatar-md {
  width: 52px;
  height: 52px;
  font-size: 1.15rem;
}

.avatar-lg {
  width: 94px;
  height: 94px;
  font-size: 2rem;
}

.avatar-fallback {
  border: 1px solid rgba(155, 77, 255, 0.18);
}

.prompt-detail-card,
.comments-card {
  border: 1px solid rgba(23, 33, 43, 0.08) !important;
  box-shadow: var(--ph-shadow-md) !important;
  background: rgba(255, 255, 255, 0.98);
}

.detail-image-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(23, 33, 43, 0.1);
  border-radius: var(--ph-card-radius);
  overflow: hidden;
  background: #eef2f5;
  cursor: zoom-in;
  box-shadow: var(--ph-shadow-sm);
}

.detail-image-button::after {
  position: absolute;
  inset: auto 0 0 0;
  height: 44%;
  content: "";
  background: linear-gradient(180deg, rgba(9, 13, 18, 0), rgba(9, 13, 18, 0.5));
  pointer-events: none;
}

.detail-image-button .image-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1;
  padding: 0.36rem 0.58rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #17212b;
  font-size: 0.82rem;
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(9, 13, 18, 0.15);
}

.detail-image-button:hover .prompt-detail-image,
.detail-image-button:focus-visible .prompt-detail-image {
  transform: scale(1.025);
}

.prompt-detail-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  object-fit: cover;
  background: #eef2f5;
  transition: transform 180ms ease, filter 180ms ease;
}

.prompt-text-box,
.legal-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.66;
}

.prompt-text-box {
  border-color: rgba(23, 33, 43, 0.1) !important;
  background: #f8fafb !important;
  color: #22303d;
}

.copy-prompt-btn {
  min-width: 210px;
}

.comment-item {
  border: 1px solid rgba(23, 33, 43, 0.08);
  border-radius: var(--ph-card-radius);
  background: linear-gradient(180deg, #ffffff, #f8fafb);
  padding: 1rem;
}

.admin-user-form {
  min-width: min(100%, 420px);
}

.admin-sidebar {
  position: sticky;
  top: 88px;
}

.table {
  vertical-align: middle;
}

.table thead th {
  border-bottom-color: rgba(23, 33, 43, 0.1);
  color: #475569;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.image-lightbox .modal-dialog {
  max-width: min(1120px, calc(100vw - 32px));
}

.image-lightbox .modal-content {
  border-radius: 8px;
  overflow: hidden;
  background: #05070a !important;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.36);
}

.image-lightbox .modal-header {
  border-color: rgba(255, 255, 255, 0.12) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
}

.lightbox-body {
  position: relative;
  min-height: 68vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    #05070a;
  background-size: 18px 18px;
  padding: 18px;
}

.lightbox-body img {
  max-width: 100%;
  max-height: calc(100vh - 154px);
  display: block;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.42);
}

.stretched-link-safe {
  position: relative;
  z-index: 1;
}

@media (max-width: 991.98px) {
  .navbar-collapse {
    padding-top: 0.75rem;
  }

  .navbar-nav {
    align-items: stretch !important;
  }

  .navbar-nav .btn,
  .navbar-nav form,
  .navbar-nav form .btn {
    width: 100%;
  }

  .admin-sidebar {
    position: static;
  }
}

@media (max-width: 767.98px) {
  main {
    padding-top: 1rem !important;
  }

  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-panel {
    box-shadow: var(--ph-shadow-sm);
  }

  .hero-panel .display-6,
  .prompt-detail-page .display-6 {
    font-size: 2rem;
    line-height: 1.12;
  }

  .prompt-card {
    box-shadow: var(--ph-shadow-sm) !important;
  }

  .copy-prompt-btn {
    width: 100%;
  }

  .table-responsive {
    border-radius: var(--ph-card-radius);
  }
}

@media (max-width: 575.98px) {
  .brand-logo {
    height: 28px;
    max-width: 150px;
  }

  .footer-icon {
    width: 24px;
    height: 24px;
  }

  .hero-panel {
    padding: 1.25rem !important;
  }

  .hero-panel .display-6,
  .prompt-detail-page .display-6 {
    font-size: 1.7rem;
  }

  .prompt-detail-card .btn,
  .comments-card .btn,
  .hero-panel .btn {
    width: 100%;
  }

  .prompt-detail-card form {
    width: 100%;
  }

  .detail-image-button .image-label {
    left: 10px;
    bottom: 10px;
  }

  .image-lightbox .modal-content {
    min-height: 100svh;
    border-radius: 0;
  }

  .lightbox-body {
    min-height: calc(100svh - 58px);
    padding: 10px;
  }

  .lightbox-body img {
    max-height: calc(100svh - 76px);
  }
}
