:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #6d28d9;
  --accent-ink: #ffffff;
  --pop: #0f172a;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 17px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 18px; }

/* header / footer / crumbs */
.site-head { border-bottom: 1px solid var(--line); background: var(--card); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { font-weight: 800; font-size: 19px; color: var(--pop); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.nav a { color: var(--muted); font-size: 15px; margin-left: 18px; }
.crumbs { font-size: 13px; color: var(--muted); margin: 18px 0 4px; }
.crumbs a { color: var(--muted); }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.02em; margin: 10px 0 14px; }
.lead { color: var(--muted); margin: 0 0 20px; }
h2 { font-size: 20px; margin: 30px 0 12px; letter-spacing: -.01em; }
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 50px; color: var(--muted); font-size: 14px; background: var(--card); }
.site-foot a { color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* controls */
.controls { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 8px 0 16px; }
.controls label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 5px; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 14px; }
.row + .row { margin-top: 14px; }
.row > div { flex: 1; min-width: 130px; }
.row > div.titlecell { flex: 2.5; min-width: 220px; }
input, select, textarea { width: 100%; padding: 10px 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-family: inherit; }
textarea { min-height: 132px; resize: vertical; line-height: 1.4; }
.ctl-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.gen-btn { font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 11px 22px; }
.gen-btn:hover { filter: brightness(1.08); }
.copy-btn { font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; }
.copy-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.copy-btn:disabled { opacity: .5; cursor: default; }
.hint { color: var(--muted); font-size: 13px; }

/* result area */
.result-area {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 22px; margin: 0 0 18px;
  min-height: 130px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  overflow-wrap: anywhere;
}
.result-empty { color: #94a3b8; font-size: 16px; }

/* numbers / letters */
.nums { display: flex; flex-wrap: wrap; gap: 10px 12px; justify-content: center; align-items: center; }
.rnum {
  font-weight: 800; font-size: clamp(28px, 7vw, 52px); line-height: 1;
  color: var(--pop); letter-spacing: -.02em;
}
.nums .rnum:not(:only-child) {
  font-size: clamp(20px, 4.5vw, 30px);
  background: #f1edfb; color: var(--accent); border-radius: 10px; padding: 8px 14px;
}

/* dice */
.dice { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.die {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; font-weight: 800; font-size: 24px;
  background: #f1edfb; color: var(--accent); border: 1px solid #ddd3f7; border-radius: 12px;
}
.sum { margin-top: 14px; font-size: 18px; color: var(--ink); }

/* coins */
.coins { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.coin {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 15px;
  border: 1px solid var(--line);
}
.coin.h { background: #f1edfb; color: var(--accent); border-color: #ddd3f7; }
.coin.t { background: #f8fafc; color: var(--muted); }
.tally { margin-top: 14px; font-size: 17px; }

/* teams / groups */
.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; width: 100%; text-align: left; }
.team-col { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fbfaff; }
.team-col h4 { margin: 0 0 8px; font-size: 15px; color: var(--accent); }
.team-col .cnt { color: var(--muted); font-weight: 500; }
.team-col ul { margin: 0; padding-left: 18px; }
.team-col li { font-size: 15px; margin: 2px 0; }

/* list picker */
.picks { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 460px; }
.pick { background: #f1edfb; color: var(--pop); border: 1px solid #ddd3f7; border-radius: 10px; padding: 12px 16px; font-weight: 700; font-size: 19px; }

/* colors */
.colors { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.swatch .chip { display: block; width: 76px; height: 76px; border-radius: 12px; border: 1px solid rgba(15,23,42,.12); }
.swatch code { font-size: 13px; color: var(--ink); }

/* yes / no */
.verdict { font-weight: 800; font-size: clamp(48px, 12vw, 84px); line-height: 1; letter-spacing: -.02em; }
.verdict.yes { color: #16a34a; }
.verdict.no { color: #dc2626; }
.q { color: var(--muted); font-size: 16px; margin-bottom: 10px; }

/* link grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 10px; }
.grid a { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; color: var(--ink); font-size: 15px; }
.grid a:hover { border-color: var(--accent); text-decoration: none; }
.chip-emoji { margin-right: 6px; }

/* prose + ads */
.prose { margin: 22px 0; }
.prose p { margin: 0 0 14px; }
.ad-slot {
  margin: 22px 0;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, #eef2f6, #eef2f6 10px, #f4f7fa 10px, #f4f7fa 20px);
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #94a3b8; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
}

@media (max-width: 620px) {
  h1 { font-size: 23px; }
  .result-area { padding: 22px 14px; }
}
