:root {
  --ink: #333044;
  --muted: #756f86;
  --paper: #eee6de;
  --line: #cfc4d1;
  --rose: #bba4ba;
  --rose-dark: #5d566d;
  --mint: #d7d1c7;
  --cyan: #8a95ad;
  --sun: #e8ddd4;
  --orange: #bba189;
  --night: #252239;
  --panel: #f7f1eb;
  --shadow: 0 22px 60px rgba(34, 31, 50, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.34) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 18%, rgba(255, 255, 255, 0.28) 0 1px, transparent 2px),
    linear-gradient(135deg, rgba(37, 34, 57, 0.92), rgba(93, 86, 109, 0.82)),
    var(--paper);
  background-size: 150px 150px, 210px 210px, auto, auto;
}

button {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(360px, 1fr);
  gap: 28px;
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.input-pane,
.preview-pane {
  min-width: 0;
}

.input-pane {
  display: grid;
  gap: 20px;
  align-content: start;
}

.brand-row,
.likes-form,
.share-card,
.actions {
  border: 3px solid var(--cyan);
  border-radius: 8px;
  background: rgba(246, 239, 255, 0.88);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 20px;
  transform: rotate(-0.7deg);
}

.mark {
  display: grid;
  place-items: center;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  border: 3px solid #fff;
  border-radius: 22px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--sun), var(--mint) 48%, var(--cyan));
  box-shadow: 4px 5px 0 var(--rose);
  transform: rotate(8deg);
}

.eyebrow,
.result-kicker {
  margin: 0 0 6px;
  color: var(--rose);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 1px 1px 0 #fff, 2px 2px 0 var(--cyan);
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.16;
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 rgba(24, 255, 103, 0.6);
}

.likes-form {
  padding: 18px;
}

.form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.form-head h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.prompt-card {
  margin-bottom: 14px;
  border: 2px dashed var(--rose);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.prompt-title {
  margin-bottom: 4px;
  color: var(--rose-dark);
  font-size: 13px;
  font-weight: 900;
}

.prompt-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.input-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.like-slot {
  min-height: 34px;
  border: 2px solid var(--rose);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--sun), var(--mint));
  font-size: 13px;
  font-weight: 900;
  box-shadow: 3px 4px 0 rgba(255, 37, 200, 0.48);
}

.like-slot:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(255, 37, 200, 0.2), 3px 4px 0 rgba(255, 37, 200, 0.48);
}

.slot-value {
  overflow-wrap: anywhere;
}

.selected-strip {
  display: none;
  margin-top: 14px;
  border: 2px dashed var(--cyan);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.48);
}

.selected-strip.has-items {
  display: block;
}

.form-note {
  min-height: 22px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button {
  min-height: 44px;
  border-radius: 8px;
  border: 0;
  padding: 0 16px;
  font-weight: 900;
}

.primary-button {
  width: 100%;
  color: var(--ink);
  border: 3px solid var(--ink);
  background: linear-gradient(135deg, var(--sun), var(--mint));
  box-shadow: 4px 5px 0 var(--rose);
}

.secondary-button {
  color: var(--ink);
  border: 3px solid var(--rose);
  background: #fff;
  box-shadow: 4px 5px 0 var(--cyan);
}

.ghost-button {
  color: var(--ink);
  border: 2px solid var(--cyan);
  background: linear-gradient(135deg, #fff, rgba(28, 232, 255, 0.36));
  box-shadow: 3px 4px 0 rgba(24, 255, 103, 0.6);
}

.text-button {
  min-height: auto;
  padding: 0;
  color: var(--rose-dark);
  background: transparent;
  font-size: 12px;
}

.suggestions {
  margin-top: 14px;
}

.suggestion-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-chip {
  min-height: 34px;
  border: 2px solid var(--cyan);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 2px 3px 0 rgba(53, 33, 111, 0.16);
}

.suggestion-chip.used {
  color: var(--ink);
  border-color: var(--rose);
  background: linear-gradient(135deg, var(--mint), var(--sun));
  text-decoration: none;
  box-shadow: 3px 4px 0 var(--rose);
}

.preview-pane {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
  align-self: start;
}

.share-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  background:
    radial-gradient(circle at 92% 10%, rgba(255, 37, 200, 0.36) 0 10px, transparent 11px),
    linear-gradient(rgba(28, 232, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 232, 255, 0.22) 1px, transparent 1px),
    rgba(252, 247, 255, 0.92);
  background-size: auto, 18px 18px, 18px 18px, auto;
}

.share-card::before,
.share-card::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: 92px;
  height: 42px;
  border: 4px solid currentColor;
  border-radius: 50%;
  pointer-events: none;
}

.share-card::before {
  top: 20px;
  right: 28px;
  color: var(--mint);
  transform: rotate(18deg);
}

.share-card::after {
  bottom: 18px;
  left: 26px;
  color: var(--rose);
  transform: rotate(-22deg);
}

.card-topline {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--rose-dark);
  font-size: 12px;
  font-weight: 800;
}

.hero-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(230px, 0.65fr);
  gap: 16px;
  align-items: center;
}

.share-badge {
  display: inline-block;
  margin-bottom: 12px;
  border: 3px solid var(--rose);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--ink);
  background: #fff;
  box-shadow: 4px 5px 0 var(--mint);
  font-size: 13px;
  font-weight: 900;
  transform: rotate(-1.5deg);
}

#result-title {
  margin-bottom: 12px;
  font-size: clamp(30px, 4.8vw, 56px);
  line-height: 1.04;
  color: var(--ink);
  text-shadow: 2px 2px 0 #fff, 5px 5px 0 rgba(255, 37, 200, 0.42);
}

.result-copy {
  max-width: 44em;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.share-caption {
  margin-top: 14px;
  border: 3px solid var(--cyan);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 4px 5px 0 rgba(255, 37, 200, 0.32);
}

.caption-label {
  display: block;
  margin-bottom: 5px;
  color: var(--rose-dark);
  font-size: 11px;
  font-weight: 900;
}

.share-caption p {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.hashtag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.hashtag-row span {
  border: 2px solid var(--mint);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--ink);
  background: rgba(255, 239, 41, 0.82);
  font-size: 12px;
  font-weight: 900;
}

#character-canvas {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: contain;
  filter: drop-shadow(7px 9px 0 rgba(255, 37, 200, 0.35)) drop-shadow(-5px 5px 0 rgba(24, 255, 103, 0.35));
}

.thumb-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.thumb {
  position: relative;
  min-height: 98px;
  overflow: hidden;
  border-radius: 8px;
  border: 3px solid #fff;
  box-shadow: 4px 5px 0 rgba(53, 33, 111, 0.22);
  background: var(--thumb-bg);
  transform: rotate(var(--tilt, -1deg));
}

.thumb:nth-child(2n) {
  --tilt: 1.2deg;
}

.thumb:nth-child(3n) {
  --tilt: -1.8deg;
}

.thumb:nth-child(5n) {
  --tilt: 2deg;
}

.thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--thumb-pattern);
  opacity: 0.95;
}

.thumb span {
  position: absolute;
  inset: auto 6px 6px;
  display: block;
  border-radius: 6px;
  padding: 5px 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  font-size: clamp(10px, 1.15vw, 12px);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.actions {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.share-action-copy {
  display: grid;
  gap: 3px;
  color: var(--ink);
}

.share-action-copy strong {
  font-size: 14px;
  font-weight: 900;
}

.share-action-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.brand-row,
.likes-form,
.share-card,
.actions,
.site-footer {
  border: 1px solid rgba(247, 241, 235, 0.42);
  background: rgba(247, 241, 235, 0.9);
  box-shadow: var(--shadow);
}

.brand-row {
  transform: none;
}

.mark {
  border-radius: 50%;
  color: var(--panel);
  background: linear-gradient(145deg, #2b2942, #716a82);
  box-shadow: none;
  transform: none;
}

.eyebrow,
.result-kicker {
  color: var(--rose-dark);
  text-shadow: none;
}

h1 {
  color: var(--panel);
  text-shadow: none;
}

.brand-row h1 {
  color: var(--ink);
}

.prompt-card,
.selected-strip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.48);
}

.prompt-title,
.text-button {
  color: var(--rose-dark);
}

.primary-button,
.secondary-button {
  border: 1px solid var(--rose-dark);
  color: var(--panel);
  background: linear-gradient(135deg, #3c394f, #6f677d);
  box-shadow: none;
}

.secondary-button {
  color: var(--rose-dark);
  background: var(--panel);
}

.suggestion-chip,
.like-slot {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: none;
}

.suggestion-chip.used,
.like-slot {
  border-color: var(--rose-dark);
  color: var(--panel);
  background: linear-gradient(135deg, #393649, #7a7289);
  box-shadow: none;
}

.share-card {
  border-radius: 28px;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(37, 34, 57, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(37, 34, 57, 0.04) 1px, transparent 1px),
    var(--panel);
  background-size: 24px 24px;
}

.share-card::before,
.share-card::after {
  display: none;
}

.card-topline {
  margin: 0 8px 12px;
  color: var(--rose-dark);
  letter-spacing: 0.04em;
}

.result-spread {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 0.85fr);
  gap: 18px;
  min-height: 650px;
}

.visual-panel,
.result-sheet {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(93, 86, 109, 0.28);
  border-radius: 22px;
}

.visual-panel {
  display: grid;
  place-items: center;
  min-height: 650px;
  color: #fff;
  background:
    radial-gradient(circle at 78% 22%, rgba(205, 197, 220, 0.32), transparent 24%),
    linear-gradient(160deg, #171827, #24334f 52%, #111622);
}

.visual-panel::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 18px;
  pointer-events: none;
}

#character-canvas {
  display: none;
}

#character-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 24% center;
  filter: saturate(0.95) contrast(1.04);
}

.visual-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 48%, rgba(10, 13, 24, 0.64)),
    radial-gradient(circle at 35% 24%, transparent 0 28%, rgba(18, 21, 34, 0.18) 70%);
  pointer-events: none;
}

.hero-quote {
  position: absolute;
  z-index: 2;
  left: 42px;
  bottom: 98px;
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1.9;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
  display: none;
}

.visual-tags {
  position: absolute;
  z-index: 2;
  left: 34px;
  right: 34px;
  bottom: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  display: none;
}

.visual-tags span {
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 4px;
  padding: 5px 9px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(17, 22, 34, 0.5);
  font-size: 13px;
  font-weight: 700;
}

.result-sheet {
  padding: clamp(24px, 3vw, 42px);
  background:
    radial-gradient(circle at 90% 16%, rgba(108, 119, 150, 0.14), transparent 18%),
    rgba(253, 248, 242, 0.96);
}

.share-badge,
.share-caption,
.hashtag-row {
  display: none;
}

#result-title {
  margin: 12px 0 4px;
  color: var(--ink);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.32;
  letter-spacing: 0.08em;
  text-shadow: none;
}

.result-script {
  margin: 0 0 26px;
  color: rgba(93, 86, 109, 0.56);
  font-family: "Snell Roundhand", "Brush Script MT", cursive;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: 0.08em;
}

.result-copy {
  color: var(--ink);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 17px;
  line-height: 2;
}

.mini-section {
  position: relative;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 16px 14px;
  background: rgba(255, 255, 255, 0.36);
}

.section-label {
  position: absolute;
  top: -14px;
  left: 22px;
  border-radius: 5px;
  padding: 5px 28px;
  color: var(--panel);
  background: #686174;
  font-size: 13px;
  font-weight: 700;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 0;
}

.thumb {
  min-height: 96px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  transform: none;
}

.thumb:nth-child(3n) {
  border-right: 0;
}

.thumb:nth-last-child(-n+3) {
  border-bottom: 0;
}

.thumb::before {
  opacity: 0.16;
}

.thumb span {
  inset: auto 8px 10px;
  color: var(--ink);
  background: transparent;
  text-align: center;
  font-size: 12px;
}

.keyword-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.keyword-grid span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.from-him {
  margin-top: 22px;
  border-radius: 12px;
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(224, 207, 218, 0.86), rgba(247, 241, 235, 0.72));
}

.from-him span {
  display: block;
  margin-bottom: 4px;
  color: rgba(93, 86, 109, 0.62);
  font-family: "Snell Roundhand", "Brush Script MT", cursive;
  font-size: 28px;
}

.from-him p {
  margin-bottom: 0;
  color: var(--ink);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  line-height: 1.8;
}

.actions {
  grid-template-columns: 1.15fr 1fr 1fr;
}

.site-footer {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto 24px;
  border: 1px solid rgba(247, 241, 235, 0.42);
  border-radius: 22px;
  padding: 16px 20px;
  color: var(--panel);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    rgba(37, 34, 57, 0.9);
  background-size: 24px 24px;
  box-shadow: 0 18px 42px rgba(17, 19, 30, 0.24);
  font-size: 13px;
  font-weight: 800;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer a {
  color: var(--panel);
  text-decoration: none;
  opacity: 0.82;
}

.site-footer a:hover {
  text-decoration: underline;
}

.legal-shell {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.legal-card {
  border: 3px solid var(--cyan);
  border-radius: 8px;
  padding: clamp(20px, 4vw, 34px);
  background:
    linear-gradient(rgba(28, 232, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 232, 255, 0.14) 1px, transparent 1px),
    rgba(252, 247, 255, 0.94);
  background-size: 18px 18px;
  box-shadow: var(--shadow);
}

.legal-card h1 {
  margin-bottom: 8px;
  color: var(--ink);
}

.legal-card h2 {
  margin: 28px 0 8px;
  font-size: 20px;
}

.legal-card p,
.legal-card li {
  color: var(--muted);
  line-height: 1.85;
}

.legal-card ul {
  padding-left: 1.2em;
}

.legal-meta {
  display: inline-block;
  margin-bottom: 18px;
  border: 2px solid var(--rose);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--ink);
  background: rgba(255, 239, 41, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--rose-dark);
  font-weight: 900;
  text-decoration: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .preview-pane {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 560px);
    padding: 10px 0 18px;
  }

  .brand-row {
    align-items: flex-start;
  }

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

  .hero-layout {
    grid-template-columns: 1fr;
  }

  .result-spread {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .visual-panel {
    min-height: 520px;
  }

  .result-sheet {
    padding: 22px;
  }

  #character-canvas {
    max-height: 360px;
  }

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

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

  .site-footer {
    flex-direction: column;
  }
}
