:root {
  --paper: #f8f7fb;
  --ink: #291c3a;
  --ink-soft: #72677e;
  --lotus: #ad1766;
  --lotus-pale: #ff78bc;
  --line: rgba(41, 28, 58, .09);
  --shadow: 0 12px 38px rgba(41, 28, 58, .08);
  --font: 'Manrope', 'Noto Sans Thai', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-x: none;
}

button, a {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  width: min(100% - 1.5rem, 72rem);
  min-height: 4.75rem;
  margin: 0 auto;
  padding-top: max(.8rem, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .58rem;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 1rem;
  color: var(--paper);
  background: var(--ink);
  font: 1.3rem/1 Georgia, serif;
}

.brand-name {
  display: block;
  margin-bottom: .15rem;
  color: var(--ink);
  font: 800 1.65rem/1 var(--font);
  letter-spacing: -.065em;
}

.brand-label {
  display: block;
  color: var(--ink-soft);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .015em;
}

.hashtag {
  padding: .6rem .75rem;
  border-radius: 999px;
  background: #f2e8f0;
  color: #8b2057;
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
}

main {
  width: min(100% - 1.5rem, 72rem);
  margin: .5rem auto 0;
}

.prompt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

.prompt-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.45rem;
  background: #fff;
  box-shadow: var(--shadow);
}

.cover-wrap {
  position: relative;
  aspect-ratio: 4 / 5;
  min-height: 25rem;
  overflow: hidden;
  background: #e8dee0;
  isolation: isolate;
}

.cover-wrap::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 40% 0 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(10, 17, 32, .18) 28%, rgba(10, 17, 32, .84));
}

.cover-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.prompt-no {
  position: absolute;
  z-index: 2;
  top: .9rem;
  left: .9rem;
  min-width: 3.15rem;
  padding: .44rem .7rem;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  color: #fff;
  background: rgba(41,28,58,.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-align: center;
}

.image-overlay {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 1.1rem;
  padding-bottom: max(1.1rem, env(safe-area-inset-bottom));
  color: #fff;
}

.image-copy { margin-bottom: .9rem; }

.card-title {
  max-width: 28ch;
  margin: .12rem 0 0;
  font-size: 1.3rem;
  line-height: 1.55;
  text-wrap: balance;
  text-shadow: 0 2px 14px rgba(0,0,0,.28);
}

.personal-note {
  margin: 0;
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
  opacity: .86;
}

.primary-action {
  width: 100%;
  min-height: 3.4rem;
  padding: .75rem 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .72rem;
  border: 1px solid #ffb2d7;
  border-radius: 1.1rem;
  color: var(--ink);
  background: #ff91c6;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0,0,0,.2);
  font: 800 .95rem/1.4 var(--font);
  letter-spacing: .025em;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}

.primary-action:active { transform: scale(.985); }
.primary-action.is-copied { color: #fff; background: var(--lotus); }
.copy-icon { font-size: 1.16rem; line-height: 1; }

.prompt-panel { background: #fff; }

.expand-button {
  width: 100%;
  min-height: 4rem;
  padding: .8rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .7rem;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: 600 .9rem/1.5 var(--font);
  text-align: left;
  cursor: pointer;
}

.copy-count {
  color: var(--ink-soft);
  font-size: .75rem;
  font-weight: 500;
  text-align: right;
}

.chevron {
  display: inline-grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  border-radius: 50%;
  background: #fff1f4;
  color: var(--lotus);
  font-size: 1.12rem;
  transition: transform .2s ease;
}

.expand-button[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.prompt-content {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}

.prompt-content[hidden] { display: none; }

.prompt-content pre {
  max-height: min(62vh, 34rem);
  margin: 1rem 0 0;
  padding: 1rem;
  overflow: auto;
  border-radius: 1rem;
  color: #24334c;
  background: #f8f4f3;
  font: .82rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}

footer {
  width: min(100% - 1.5rem, 72rem);
  margin: 0 auto;
  padding: 1.5rem 0 max(2rem, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  color: var(--ink-soft);
  font-size: .76rem;
}

.botan-signature { color: var(--lotus); font: 800 1.1rem var(--font); letter-spacing: -.04em; }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 1.5rem);
  padding: .85rem 1.1rem;
  border-radius: 999px;
  color: #fff;
  background: rgba(41,28,58,.97);
  box-shadow: 0 14px 35px rgba(29,49,81,.25);
  font-size: .86rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 1rem);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

:focus-visible { outline: 3px solid var(--lotus-pale); outline-offset: 3px; }

@media (min-width: 40rem) {
  .site-header { width: min(100% - 2.5rem, 72rem); min-height: 5.5rem; }
  main, footer { width: min(100% - 2.5rem, 72rem); }
  main { margin-top: 1rem; }
  .prompt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; align-items: start; }
  .prompt-grid > :only-child { width: min(100%, 34rem); grid-column: 1 / -1; justify-self: center; }
  .cover-wrap { min-height: 37rem; }
  .image-overlay { padding: 1.35rem; }
  .card-title { font-size: 1.5rem; }
}

@media (hover: hover) {
  .primary-action:hover { color: #fff; background: var(--lotus); }
  .expand-button:hover { background: #fffafb; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Poster covers (poster: true in prompts.js) already carry their own text,
   so show the whole image uncropped and move the title + COPY button below it. */
.is-poster .cover-wrap { aspect-ratio: auto; min-height: 0; background: #fff; }
.is-poster .cover-wrap::after,
.is-poster .prompt-no { display: none; }
.is-poster .cover-wrap img { height: auto; }
.is-poster .image-overlay { position: static; color: var(--ink); }
.is-poster .personal-note { color: var(--ink); }
.is-poster .card-title { text-shadow: none; }
