:root {
  --paper: #fffaf2;
  --dot: rgba(255, 150, 195, 0.30);
  --ink: #5b4a55;
  --ink-soft: #a895a2;
  --pink: #ff7fb6;
  --pink-deep: #ff5fa2;
  --pink-soft: #ffd9ec;
  --mint: #8fe3c6;
  --lav: #cabaff;
  --lemon: #ffe27a;
  --sky: #aed8ff;
  --line: #ffb8d6;
  --radius: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: "Zen Maru Gothic", system-ui, -apple-system, "Hiragino Maru Gothic ProN", sans-serif;
  color: var(--ink);
  /* ドット方眼ノート */
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 2.1px, transparent 2.1px);
  background-size: 22px 22px;
  background-position: -11px -11px;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 28px 18px 52px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ふわふわ飾り */
.deco {
  position: fixed;
  font-size: 30px;
  z-index: 0;
  opacity: 0.85;
  animation: bob 5s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}
.deco--1 { top: 8%; left: 7%; transform: rotate(-12deg); }
.deco--2 { top: 16%; right: 8%; animation-delay: -1.2s; }
.deco--3 { bottom: 22%; left: 6%; animation-delay: -2.4s; font-size: 26px; }
.deco--4 { bottom: 12%; right: 9%; animation-delay: -3.1s; }
.deco--5 { top: 46%; right: 5%; animation-delay: -1.8s; font-size: 24px; transform: rotate(15deg); }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-10px) rotate(6deg); }
}
@media (max-width: 520px) {
  .deco--3, .deco--5 { display: none; }
  .deco { font-size: 24px; }
}

/* レイアウト */
.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: rise 0.5s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== hero ===== */
.hero { text-align: center; padding-top: 8px; }
.kicker {
  display: inline-block;
  background: #fff;
  border: 2px dashed var(--line);
  color: var(--pink-deep);
  font-weight: 700;
  font-size: 13px;
  padding: 5px 16px;
  border-radius: 999px;
  margin-bottom: 14px;
  transform: rotate(-2deg);
}
.title {
  font-family: "Mochiy Pop One", sans-serif;
  line-height: 1.18;
  font-weight: 400;
}
.title span { display: block; }
.title__a {
  font-size: clamp(34px, 10vw, 48px);
  color: var(--pink-deep);
  transform: rotate(-2deg);
  text-shadow: 3px 3px 0 #fff, 5px 5px 0 var(--pink-soft);
}
.title__b {
  font-size: clamp(30px, 8.6vw, 42px);
  color: #7d6bff;
  transform: rotate(1.5deg);
  margin-top: 4px;
  text-shadow: 3px 3px 0 #fff, 5px 5px 0 #e3dbff;
}
.speech {
  position: relative;
  display: inline-block;
  margin-top: 22px;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(91, 74, 85, 0.15);
}
.speech b { color: var(--pink-deep); }
.speech::after {
  content: "";
  position: absolute;
  bottom: -11px; left: 50%;
  width: 16px; height: 16px;
  background: #fff;
  border-right: 2.5px solid var(--ink);
  border-bottom: 2.5px solid var(--ink);
  transform: translateX(-50%) rotate(45deg);
}

/* ===== カード（付箋・ノート風） ===== */
.panel {
  position: relative;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 26px 18px 20px;
  box-shadow: 5px 6px 0 rgba(91, 74, 85, 0.16);
}
/* マスキングテープ */
.panel::before {
  content: "";
  position: absolute;
  top: -13px; left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 110px; height: 26px;
  background: repeating-linear-gradient(45deg, var(--mint) 0 7px, #b5efdb 7px 14px);
  opacity: 0.9;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.panel__label {
  font-family: "Yomogi", sans-serif;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
}

/* tones */
.tones {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  margin-bottom: 18px;
}
.tone {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--pink-deep);
  padding: 8px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.tone:hover { transform: translateY(-2px) rotate(-2deg); }
.tone:active { transform: scale(0.95); }
.tone.is-active {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
  box-shadow: 2px 2px 0 var(--pink-deep);
}

/* generate（キャンディボタン） */
.generate {
  width: 100%;
  font-family: "Mochiy Pop One", sans-serif;
  font-size: 19px;
  color: #fff;
  background: linear-gradient(135deg, #ff9ecb, #ff7eb8 60%, #ff9ad0);
  border: 3px solid #fff;
  border-radius: 18px;
  padding: 17px;
  cursor: pointer;
  outline: 3px solid var(--pink);
  box-shadow: 0 6px 0 var(--pink-deep);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.generate:hover { transform: translateY(-2px); }
.generate:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--pink-deep); }

/* AIでひねる（シール風サブボタン） */
.ai-btn {
  width: 100%;
  margin-top: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #2e9b78;
  background: #e7fbf3;
  border: 2.5px dashed var(--mint);
  border-radius: 16px;
  padding: 13px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.ai-btn:hover { background: #d6f7ea; transform: rotate(-1deg); }
.ai-btn:active { transform: scale(0.97); }
.ai-btn:disabled { cursor: progress; opacity: 0.8; }
.ai-btn__loading { display: inline-block; animation: blink 1s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.45;} }
.ai-note {
  margin-top: 9px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-soft);
}

/* ===== result（付箋メモ風） ===== */
.result { display: flex; flex-direction: column; gap: 14px; }
.result__card {
  position: relative;
  background: #fffceb;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 30px 22px 26px;
  box-shadow: 5px 6px 0 rgba(91, 74, 85, 0.16);
  text-align: center;
  transform: rotate(-1deg);
}
.result__card::before {
  content: "";
  position: absolute;
  top: -13px; left: 50%;
  transform: translateX(-50%) rotate(3deg);
  width: 100px; height: 26px;
  background: repeating-linear-gradient(45deg, var(--sky) 0 7px, #c9e7ff 7px 14px);
  opacity: 0.9;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.badge {
  display: inline-block;
  background: var(--lemon);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-weight: 700;
  font-size: 12.5px;
  padding: 4px 13px;
  border-radius: 999px;
  margin-bottom: 16px;
  transform: rotate(-2deg);
  box-shadow: 2px 2px 0 rgba(91,74,85,0.15);
}
.badge:empty { display: none; }
.line {
  font-family: "Yomogi", sans-serif;
  font-size: clamp(19px, 5.6vw, 24px);
  font-weight: 700;
  line-height: 1.7;
  color: var(--ink);
}

.result__actions { display: flex; gap: 10px; }
.action {
  flex: 1;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 14px;
  border-radius: 16px;
  border: 2.5px solid var(--ink);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.action:active { transform: translateY(3px); }
.action--copy {
  background: var(--pink);
  color: #fff;
  box-shadow: 0 4px 0 var(--pink-deep);
}
.action--copy:active { box-shadow: 0 1px 0 var(--pink-deep); }
.action--copy.is-copied { background: var(--mint); box-shadow: 0 4px 0 #38b48e; }
.action--again {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(91,74,85,0.25);
}
.action--again:active { box-shadow: 0 1px 0 rgba(91,74,85,0.25); }

/* animation */
.pop { animation: pop 0.34s cubic-bezier(0.18, 0.9, 0.3, 1.4); }
@keyframes pop {
  0% { opacity: 0; transform: rotate(-1deg) translateY(12px) scale(0.94); }
  100% { opacity: 1; transform: rotate(-1deg) translateY(0) scale(1); }
}

/* footer */
.foot {
  text-align: center;
  color: var(--ink-soft);
  font-size: 12.5px;
}
.foot__sub { margin-top: 6px; font-size: 11px; opacity: 0.85; }

@media (prefers-reduced-motion: reduce) {
  .deco, .wrap { animation: none; }
}
