.prompt-page {
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 12%, rgba(245, 158, 11, 0.12), transparent 28%),
    radial-gradient(circle at 88% 0%, rgba(37, 99, 235, 0.15), transparent 34%),
    linear-gradient(180deg, #f8fbff 0%, #eef3fb 100%);
}

.prompt-brand-link {
  color: inherit;
  text-decoration: none;
}

.prompt-topbar .brand {
  max-width: 520px;
}

.prompt-actions {
  margin-left: auto;
}

.prompt-create-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.prompt-shell {
  width: min(100% - 40px, 1220px);
  margin: 0 auto;
  padding: 30px 0 48px;
}

.prompt-card {
  border: 1px solid rgba(214, 224, 241, 0.92);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 50px rgba(31, 41, 55, 0.08);
  backdrop-filter: blur(12px);
}

.prompt-kicker {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 28px;
  margin: 0;
  padding: 0 12px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eaf1ff;
  font-size: 13px;
  font-weight: 900;
}

.prompt-filter-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 0 16px;
  scrollbar-width: thin;
}

.prompt-filter {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #d6e0f1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
  font-size: 14px;
  font-weight: 850;
}

.prompt-filter.active {
  border-color: rgba(37, 99, 235, 0.35);
  color: #1d4ed8;
  background: #eaf1ff;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.prompt-market,
.prompt-detail {
  display: grid;
  gap: 18px;
}

.market-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 0;
}

.market-heading h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.035em;
}

.market-heading p {
  margin: 6px 0 0;
  color: #64748b;
  line-height: 1.6;
}

.upload-template-toggle {
  flex: 0 0 auto;
}

.template-upload-open {
  overflow: hidden;
}

.template-upload-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.template-upload-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background:
    radial-gradient(circle at 72% 18%, rgba(37, 99, 235, 0.2), transparent 34%),
    rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(10px);
}

.template-upload-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(214, 224, 241, 0.95);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(239, 246, 255, 0.9)),
    radial-gradient(circle at 96% 0%, rgba(245, 158, 11, 0.13), transparent 32%);
  box-shadow: 0 18px 50px rgba(31, 41, 55, 0.08);
}

.template-upload-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #334155;
  font-size: 24px;
  line-height: 1;
}

.template-upload-close:hover,
.template-upload-close:focus-visible {
  border-color: rgba(37, 99, 235, 0.42);
  color: #1d4ed8;
  outline: none;
}

.template-upload-heading h3 {
  margin: 0;
  padding-right: 42px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.template-upload-heading p {
  margin: 7px 0 0;
  color: #64748b;
  line-height: 1.62;
}

.template-upload-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.template-upload-wide,
.template-upload-submit {
  grid-column: 1 / -1;
}

.template-upload-prompt {
  min-height: 142px;
}

.template-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.template-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(214, 224, 241, 0.92);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 50px rgba(31, 41, 55, 0.08);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.template-card:hover,
.template-card:focus-visible {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 22px 60px rgba(37, 99, 235, 0.14);
  outline: none;
  transform: translateY(-3px);
}

.template-card-body {
  display: grid;
  gap: 8px;
  padding: 16px 16px 18px;
}

.template-card-body h3 {
  margin: 0;
  color: #111827;
  font-size: 19px;
  letter-spacing: -0.025em;
}

.template-card-body p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.62;
}

.template-thumb {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}

.template-thumb-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 44%;
  filter: saturate(1.02) contrast(1.02);
}

.template-thumb.has-template-image::before {
  inset: 0;
  z-index: 1;
  width: auto;
  height: auto;
  border-radius: 0;
  filter: none;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.58));
}

.template-thumb.has-template-image::after {
  display: none;
}

.template-thumb::before,
.template-thumb::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  z-index: -1;
}

.template-thumb::before {
  width: 170px;
  height: 170px;
  right: -44px;
  top: -34px;
  background: rgba(255, 255, 255, 0.24);
}

.template-thumb::after {
  width: 150px;
  height: 150px;
  left: -56px;
  bottom: -52px;
  background: rgba(15, 23, 42, 0.22);
}

.template-thumb-copy {
  position: absolute;
  inset: auto 16px 16px;
  z-index: 3;
}

.template-thumb-copy span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 900;
  backdrop-filter: blur(8px);
}

.template-thumb-copy strong {
  display: block;
  width: min(280px, 100%);
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.template-thumb-art {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.template-thumb-graduation {
  background:
    radial-gradient(circle at 74% 24%, rgba(251, 191, 36, 0.36), transparent 28%),
    linear-gradient(135deg, #0f172a 0%, #1d4ed8 55%, #dbeafe 100%);
}

.template-thumb-graduation .template-thumb-art::before {
  content: "";
  position: absolute;
  right: 24px;
  bottom: -28px;
  width: 152px;
  height: 190px;
  border-radius: 54% 42% 38% 48% / 28% 34% 58% 60%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(219, 234, 254, 0.78)),
    repeating-linear-gradient(120deg, rgba(37, 99, 235, 0.18) 0 2px, transparent 2px 12px);
  box-shadow: inset 22px 0 54px rgba(15, 23, 42, 0.22);
}

.template-thumb-graduation.has-template-image .template-thumb-art {
  display: none;
}

.template-thumb-portrait {
  background: linear-gradient(135deg, #111827, #2563eb 58%, #f59e0b);
}

.template-thumb-portrait .template-thumb-art::before {
  content: "";
  position: absolute;
  right: 38px;
  bottom: 28px;
  width: 110px;
  height: 144px;
  border-radius: 999px 999px 28px 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.35);
}

.template-thumb-product {
  background: linear-gradient(135deg, #0f172a, #0891b2 58%, #eab308);
}

.template-thumb-product .template-thumb-art::before {
  content: "";
  position: absolute;
  right: 42px;
  bottom: 42px;
  width: 138px;
  height: 82px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(207, 250, 254, 0.8));
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.28);
  transform: rotate(-8deg);
}

.template-thumb-space {
  color: #172033;
  background: linear-gradient(135deg, #f8fafc, #dbeafe 52%, #fb923c);
}

.template-thumb-space .template-thumb-art::before {
  content: "";
  position: absolute;
  right: 34px;
  bottom: 34px;
  width: 172px;
  height: 112px;
  border: 8px solid rgba(255, 255, 255, 0.74);
  border-radius: 26px;
  background: repeating-linear-gradient(90deg, rgba(37, 99, 235, 0.18) 0 18px, rgba(255, 255, 255, 0.24) 18px 32px);
}

.template-thumb-diagram {
  background: linear-gradient(135deg, #18212f, #4f46e5 52%, #22c55e);
}

.template-thumb-diagram .template-thumb-art::before {
  content: "";
  position: absolute;
  right: 32px;
  bottom: 34px;
  width: 176px;
  height: 112px;
  border-radius: 20px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.84) 0 38px, transparent 38px 50px, rgba(255, 255, 255, 0.7) 50px 96px, transparent 96px 108px, rgba(255, 255, 255, 0.58) 108px 176px);
  opacity: 0.86;
}

.template-thumb-food {
  background: linear-gradient(135deg, #431407, #ea580c 58%, #fde68a);
}

.template-thumb-food .template-thumb-art::before {
  content: "";
  position: absolute;
  right: 30px;
  bottom: 34px;
  width: 168px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 44%, rgba(255, 247, 237, 0.9), rgba(251, 146, 60, 0.72) 45%, rgba(124, 45, 18, 0.6) 72%);
  box-shadow: 0 24px 52px rgba(67, 20, 7, 0.32);
}

.back-to-market {
  justify-self: start;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #d6e0f1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #24324a;
  font-size: 14px;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.06);
}

.template-detail-card {
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(214, 224, 241, 0.92);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 22px 60px rgba(31, 41, 55, 0.1);
}

.template-detail-visual .template-thumb {
  height: 100%;
  min-height: 540px;
}

.template-detail-body {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px;
}

.template-detail-head {
  display: grid;
  gap: 14px;
}

.template-detail-head h2 {
  margin: 8px 0 10px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
  letter-spacing: -0.055em;
}

.template-detail-head p {
  margin: 0;
  color: #64748b;
  line-height: 1.7;
}

.template-requirements {
  display: grid;
  gap: 12px;
}

.template-requirements h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.prompt-grid.single-template {
  grid-template-columns: minmax(0, 860px);
  justify-content: center;
}

.prompt-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: 26px;
}

.prompt-visual {
  position: relative;
  min-height: 190px;
  padding: 18px;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}

.prompt-visual::before,
.prompt-visual::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.82;
  z-index: -1;
}

.prompt-visual::before {
  width: 170px;
  height: 170px;
  right: -34px;
  top: -28px;
  background: rgba(255, 255, 255, 0.22);
}

.prompt-visual::after {
  width: 120px;
  height: 120px;
  left: -34px;
  bottom: -34px;
  background: rgba(15, 23, 42, 0.22);
}

.prompt-visual[data-tone="portrait"] {
  background: linear-gradient(135deg, #111827, #2563eb 62%, #f59e0b);
}

.prompt-visual[data-tone="product"] {
  background: linear-gradient(135deg, #0f172a, #0891b2 58%, #eab308);
}

.prompt-visual[data-tone="space"] {
  background: linear-gradient(135deg, #f8fafc, #dbeafe 52%, #fb923c);
  color: #172033;
}

.prompt-visual[data-tone="diagram"] {
  background: linear-gradient(135deg, #18212f, #4f46e5 52%, #22c55e);
}

.prompt-visual[data-tone="food"] {
  background: linear-gradient(135deg, #431407, #ea580c 58%, #fde68a);
}

.prompt-visual[data-tone="graduation"] {
  min-height: 260px;
  background:
    radial-gradient(circle at 72% 18%, rgba(251, 191, 36, 0.42), transparent 28%),
    radial-gradient(circle at 18% 84%, rgba(191, 219, 254, 0.34), transparent 34%),
    linear-gradient(135deg, #0f172a 0%, #1d4ed8 52%, #f8fafc 100%);
}

.graduation-template-card {
  max-width: 860px;
}

.graduation-visual {
  position: relative;
}

.graduation-silhouette {
  position: absolute;
  right: 42px;
  bottom: -20px;
  width: 210px;
  height: 250px;
  border-radius: 54% 42% 38% 48% / 28% 34% 58% 60%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(219, 234, 254, 0.78)),
    repeating-linear-gradient(120deg, rgba(37, 99, 235, 0.18) 0 2px, transparent 2px 12px);
  box-shadow: inset 24px 0 60px rgba(15, 23, 42, 0.22), 0 24px 64px rgba(15, 23, 42, 0.24);
  opacity: 0.9;
}

.graduation-silhouette::before,
.graduation-silhouette::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.18);
}

.graduation-silhouette::before {
  width: 84px;
  height: 18px;
  left: 62px;
  top: 90px;
  transform: rotate(-8deg);
}

.graduation-silhouette::after {
  width: 128px;
  height: 58px;
  left: 44px;
  bottom: 54px;
  border-radius: 22px;
}

.prompt-scene-title {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: end;
  min-height: 154px;
  z-index: 1;
}

.prompt-scene-title span {
  width: max-content;
  max-width: 100%;
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 900;
  backdrop-filter: blur(8px);
}

.prompt-scene-title strong {
  width: min(260px, 100%);
  font-size: 26px;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.prompt-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.prompt-card h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}

.prompt-card p {
  margin: 0;
  color: #617087;
  line-height: 1.65;
}

.prompt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-meta span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #f1f5fb;
  color: #45556d;
  font-size: 12px;
  font-weight: 820;
}

.prompt-sample {
  padding: 12px;
  border: 1px dashed #cbd7ea;
  border-radius: 16px;
  background: #f8fbff;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}

.template-prompt-editor {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #d6e0f1;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(245, 158, 11, 0.05)),
    rgba(248, 251, 255, 0.92);
}

.template-prompt-head h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.template-prompt-head p {
  margin: 6px 0 0;
  color: #64748b;
  line-height: 1.6;
}

.template-prompt-input {
  min-height: 168px;
  padding: 14px;
  resize: vertical;
  line-height: 1.62;
  font-weight: 650;
}

.template-prompt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.template-prompt-actions .secondary {
  min-height: 40px;
  padding: 0 14px;
}

.prompt-form {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.prompt-field {
  display: grid;
  gap: 6px;
}

.prompt-field label {
  color: #25324a;
  font-size: 13px;
  font-weight: 850;
}

.prompt-field small {
  color: #748095;
  line-height: 1.5;
}

.prompt-field textarea {
  min-height: 84px;
  resize: vertical;
}

.prompt-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #d4dfef;
  border-radius: 14px;
  background: #fff;
}

.prompt-upload input {
  width: 100%;
  font-size: 13px;
}

.prompt-file-name {
  color: #64748b;
  font-size: 12px;
}

.prompt-apply {
  width: 100%;
  margin-top: 2px;
  min-height: 46px;
}

.prompt-toast {
  right: 24px;
  left: auto;
  bottom: 24px;
}

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

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

  .template-upload-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .template-detail-visual .template-thumb {
    min-height: 320px;
  }
}

@media (max-width: 760px) {
  .prompt-shell {
    width: min(100% - 22px, 1220px);
    padding: 16px 0 32px;
  }

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

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

  .market-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-template-toggle {
    width: 100%;
  }

  .template-upload-modal {
    align-items: end;
    padding: 12px;
  }

  .template-upload-panel {
    max-height: calc(100vh - 24px);
    border-radius: 22px;
  }

  .template-upload-form {
    grid-template-columns: 1fr;
  }

  .template-thumb {
    min-height: 190px;
  }

  .template-detail-body {
    padding: 20px;
  }

  .prompt-topbar .nav-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .prompt-actions {
    width: 100%;
  }

  .prompt-create-link {
    width: 100%;
  }
}
