:root {
  --bg: #120d1f;
  --card: #1c1530;
  --card2: #261d40;
  --line: #3a2e5c;
  --text: #f6f2ff;
  --dim: #b4a8d6;
  --accent: #b79cff;
  --accent2: #ff7ab8;
  --in: #2c2445;
  --out: linear-gradient(135deg, #7c4dff, #b8327f); /* both stops pass 4.5:1 with white text */
  --ok: #6ee7b7;
  --warn: #ffd27a;
  --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  background-image: radial-gradient(circle at 85% -10%, rgba(183,156,255,.22), transparent 45%),
    radial-gradient(circle at -10% 110%, rgba(255,122,184,.14), transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 48px; }

header { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; }
.logo { font-weight: 900; font-size: 22px; letter-spacing: -.03em; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent2); }
header nav a { color: var(--dim); text-decoration: none; font-size: 14px; border: 1px solid var(--line); padding: 8px 12px; border-radius: 999px; }

h1 { font-size: clamp(34px, 10vw, 48px); line-height: 1.02; letter-spacing: -.04em; font-weight: 900; margin: 12px 0 10px; }
h1 em { font-style: normal; background: var(--out); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 22px; letter-spacing: -.02em; margin: 28px 0 10px; }
.sub { color: var(--dim); margin-bottom: 22px; }
.bm { color: var(--dim); font-size: 14px; font-style: italic; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
label, .label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--dim); letter-spacing: .02em; margin: 0 0 8px; }
textarea, input[type=text] {
  width: 100%; background: var(--in); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; font: 16px/1.45 var(--font); outline: none;
}
textarea { resize: vertical; min-height: 110px; }
textarea:focus, input[type=text]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(183,156,255,.18); }
.field { margin-bottom: 16px; }

.tones { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; border: 0; }
.tones input { position: absolute; opacity: 0; pointer-events: none; }
.tones label {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0;
  padding: 12px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card2);
  color: var(--text); font-size: 15px; font-weight: 700; cursor: pointer; min-height: 48px;
}
.tones input:checked + label { border-color: var(--accent2); background: rgba(255,122,184,.14); }
.tones input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: block; width: 100%; border: 0; border-radius: 999px; padding: 15px 18px; min-height: 52px;
  background: var(--out); color: #fff; font: 800 17px var(--font); cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: wait; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 700; }

.err { color: var(--warn); font-size: 14px; margin: 10px 0 0; min-height: 1em; }
.rules { color: var(--dim); font-size: 13px; margin-top: 12px; text-align: center; }

#out { margin-top: 22px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 18px; margin-bottom: 10px; word-wrap: break-word; overflow-wrap: anywhere; }
.bubble.in { background: var(--in); border-bottom-left-radius: 6px; color: var(--dim); white-space: pre-wrap; }
.reply { display: flex; align-items: flex-end; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.reply .bubble { background: var(--out); color: #fff; border-bottom-right-radius: 6px; margin: 0; }
.copy {
  flex: none; border: 1px solid var(--line); background: var(--card2); color: var(--text);
  border-radius: 999px; padding: 8px 12px; font: 700 13px var(--font); cursor: pointer; min-height: 40px;
}
.note { background: rgba(255,210,122,.1); border: 1px solid rgba(255,210,122,.35); color: var(--warn); border-radius: 14px; padding: 12px 14px; margin: 10px 0; font-size: 15px; }
.left { color: var(--dim); font-size: 13px; text-align: right; }

.steps { list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 12px 50px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 14px; top: 12px; width: 24px; height: 24px; border-radius: 50%; background: var(--out); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.prose p, .prose li { color: var(--dim); margin-bottom: 10px; }
.prose ul { padding-left: 20px; }
.prose strong { color: var(--text); }
table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text); width: 38%; }
td { color: var(--dim); }

footer { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }

.gate { position: fixed; inset: 0; z-index: 10; background: rgba(10,7,18,.92); display: grid; place-items: center; padding: 16px; }
.gate[hidden] { display: none; }
.gate .card { max-width: 420px; width: 100%; text-align: center; padding: 24px 18px; }
.gate h2 { margin-top: 0; }
.gate p { color: var(--dim); margin-bottom: 16px; }
.gate .btn + .btn { margin-top: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
fieldset{border:0;min-width:0}
