:root{
  --violet: 108 75 244;
  --violet-2: 139 107 255;
  --ink: #1c1a2b;
  --ink-soft: #6b6880;
  --line: #e9e5f7;
  --surface-2: #f4f2fd;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(58, 36, 140, 0.10);
}
*{ box-sizing: border-box; }
html, body { margin:0; padding:0; }
body{
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(60% 45% at 85% 0%, rgba(139,107,255,.22), transparent 70%),
    radial-gradient(55% 40% at 10% 8%, rgba(108,75,244,.16), transparent 70%),
    radial-gradient(70% 50% at 50% 100%, rgba(70,206,180,.12), transparent 70%),
    #f7f5ff;
  -webkit-tap-highlight-color: transparent;
}
.wrap{ max-width: 520px; margin: 0 auto; padding: 18px 16px calc(28px + env(safe-area-inset-bottom)); }
header{ display:flex; align-items:center; gap:12px; margin-bottom: 18px; }
.mark{ width:46px; height:46px; border-radius:16px; background:#fff; box-shadow: var(--shadow); display:flex; align-items:center; justify-content:center; overflow:hidden; flex:none; }
.mark img{ width:100%; height:100%; object-fit:contain; }
h1{ font-size: 1.22rem; margin:0; letter-spacing:-0.01em; }
.tag{ margin:2px 0 0; font-size:.78rem; color: var(--ink-soft); }
.card{
  background: rgba(255,255,255,.84);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.label{ display:block; font-size:.82rem; font-weight:700; margin-bottom:8px; }
textarea{
  width:100%; min-height: 92px; resize: vertical; padding: 12px 14px;
  border-radius: 16px; border: 1px solid var(--line); background:#fff;
  font: inherit; font-size: .95rem; line-height:1.6; color: var(--ink);
}
.hint{ font-size:.72rem; color: var(--ink-soft); margin:6px 2px 0; }
@keyframes spin{ to{ transform: rotate(360deg); } }
.chips{ display:flex; flex-wrap:wrap; gap:8px; padding: 10px 2px 2px; }
.chip{
  flex:none; border:1px solid var(--line); background:#fff; color: var(--ink);
  border-radius: 999px; padding: 8px 13px; font: inherit; font-size:.78rem; font-weight:600;
  white-space: nowrap; cursor: pointer;
}
.chip:active{ transform: scale(.97); }
.seg{ display:flex; gap:6px; background: var(--surface-2); padding:5px; border-radius: 999px; }
.seg button{
  flex:1; border:0; background:transparent; font: inherit; font-size:.8rem; font-weight:700;
  padding: 10px 6px; border-radius: 999px; color: var(--ink-soft); cursor:pointer;
}
.seg button.on{ background:#fff; color: rgb(var(--violet)); box-shadow: 0 4px 12px rgba(58,36,140,.10); }
.go{
  width:100%; border:0; border-radius: 18px; padding: 15px 18px; font: inherit; font-size:1rem; font-weight:800;
  color:#fff; background: linear-gradient(135deg, rgb(var(--violet)), rgb(var(--violet-2)));
  box-shadow: 0 12px 26px rgba(108,75,244,.30); cursor:pointer;
  display:flex; align-items:center; justify-content:center; gap:10px;
}
.go:disabled{ opacity:.7; }
.spin{ width:18px; height:18px; border-radius:50%; border:2px solid rgba(255,255,255,.45); border-top-color:#fff; animation: spin .8s linear infinite; }
.note{ font-size:.72rem; color: var(--ink-soft); text-align:center; margin: 10px 4px 18px; }
.sk{ height: 14px; border-radius: 8px; background: #ece8fb; margin-bottom: 10px; opacity:.8; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse{ 0%,100%{ opacity:.45; } 50%{ opacity:.9; } }
.out{ display:none; }
.out.on{ display:block; animation: rise .35s cubic-bezier(.22,1,.36,1) both; }
@keyframes rise{ from{ opacity:0; transform: translateY(10px); } to{ opacity:1; transform:none; } }
.block-head{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.block-head h2{ font-size:.86rem; margin:0; }
.copy{ border:1px solid var(--line); background:#fff; color: rgb(var(--violet)); font: inherit; font-size:.72rem; font-weight:800; padding:6px 10px; border-radius:999px; cursor:pointer; }
.copy.done{ background: rgba(108,75,244,.1); border-color: transparent; }
.hook{ font-size: 1.05rem; font-weight: 800; line-height:1.55; margin:0; }
.body-text{ font-size:.92rem; line-height:1.75; white-space: pre-wrap; margin:0; }
.tags{ display:flex; flex-wrap:wrap; gap:6px; }
.tag-item{ background: rgba(108,75,244,.09); color: rgb(var(--violet)); border-radius:999px; padding:6px 10px; font-size:.78rem; font-weight:700; }
.err{ border-color: #f3c9c9; background:#fff7f7; }
.err p{ margin:0; font-size:.85rem; color:#8a2b2b; line-height:1.6; }
.again{ width:100%; border:1px solid var(--line); background:#fff; color: var(--ink); font: inherit; font-weight:700; font-size:.86rem; padding: 12px; border-radius:16px; cursor:pointer; margin-bottom: 6px; }
footer{ text-align:center; font-size:.72rem; color: var(--ink-soft); margin-top: 18px; }
@media (prefers-reduced-motion: reduce){ .out.on, .sk, .spin{ animation: none; } }

.wait{margin:14px 0 0;font-size:13px;color:var(--muted,#7b7794);text-align:center}
