/* Decision Lab — clean, cheerful, fast. No framework. */

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1d2333;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #6d28d9;
  --brand-2: #c026d3;
  --brand-grad: linear-gradient(135deg, #6d28d9, #c026d3);
  --accent: #f59e0b;
  --ok: #16a34a;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px -12px rgba(16, 24, 40, 0.18);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: #eef0f6;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.9em;
}

/* ---------- header ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.7rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { color: var(--muted); font-size: 0.8rem; }
.site-nav { display: flex; gap: 18px; font-size: 0.95rem; }

/* ---------- hero ---------- */
.hero-title { font-size: 2.1rem; margin: 34px 0 6px; letter-spacing: -0.02em; }
.accent { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--muted); max-width: 60ch; margin: 0 0 22px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { border-color: var(--brand); color: var(--brand); }
.tab.is-active { background: var(--brand-grad); border-color: transparent; color: #fff; }

/* ---------- panels ---------- */
.panel { display: none; }
.panel.is-active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card h2 { margin: 0 0 6px; font-size: 1.15rem; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }

.editor-card { display: flex; flex-direction: column; gap: 12px; }

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfbfe;
  color: var(--ink);
}
textarea:focus, input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }

.saved-row { display: flex; gap: 8px; }
.saved-row input { flex: 1; }
.saved-row select { flex: 1.4; }

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--brand-grad); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: #fff; border-color: var(--line); color: var(--danger); }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); }
.btn-lg { padding: 13px 20px; font-size: 1.05rem; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; }
.btn-ko-fi { color: #fff; background: #c2410c; }  /* contrast fix 2026-11-09 */
.btn-paypal { color: #fff; background: #003087; }

/* ---------- pressed + flash feedback (Round 5) ---------- */
/* :active must come AFTER the :hover rules so it wins the specificity tie. */
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:active:not(:disabled) { filter: brightness(0.9); }
.btn-ghost:active:not(:disabled) { background: var(--brand); border-color: transparent; color: #fff; }
.btn-danger:active:not(:disabled) { background: var(--danger); border-color: transparent; color: #fff; }
.tab:active { transform: translateY(1px); background: #eef0f6; }
@keyframes click-flash {
  0% { box-shadow: 0 0 0 0 rgba(109, 40, 217, 0.45); }
  100% { box-shadow: 0 0 0 7px rgba(109, 40, 217, 0); }
}
.clicked { animation: click-flash 0.35s ease-out; }

/* ---------- result reveal feedback (Round 5) ---------- */
@keyframes result-pop {
  0% { opacity: 0; transform: scale(0.6); }
  60% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
.pop { animation: result-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
#wheel-result.win { color: var(--brand); font-weight: 800; font-size: 1.3rem; }

/* ---------- wheel ---------- */
.wheel-stage { position: relative; margin: 0 auto; max-width: 420px; }
.wheel-stage canvas { display: block; width: 100%; height: auto; }
.pointer {
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid var(--ink);
  z-index: 2;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}

.result-card { display: flex; flex-direction: column; gap: 14px; }
.result-text { font-size: 1.15rem; min-height: 2.2em; display: flex; align-items: center; justify-content: center; text-align: center; }
.result-big {
  font-size: 3.4rem; font-weight: 800; text-align: center;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  min-height: 1.4em; display: flex; align-items: center; justify-content: center;
}
.result-actions { display: flex; justify-content: center; gap: 8px; }
.fineprint { color: var(--muted); font-size: 0.82rem; }

/* ---------- coin ---------- */
.center-card { max-width: 460px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
/* Perspective must live on the PARENT so the coin's own rotateY is a real 3D
   flip (the old rotateX with no perspective read as a flat vertical wobble). */
.coin-stage { perspective: 700px; display: grid; place-items: center; }
.coin {
  width: 130px; height: 130px;
  border-radius: 50%;
  border: 3px solid #d4a017;
  background: radial-gradient(circle at 35% 30%, #fff7cf, #f6c945 60%, #d4a017);
  font-size: 3rem;
  cursor: pointer;
  box-shadow: 0 10px 24px -8px rgba(0,0,0,0.35);
  display: grid; place-items: center;
  transform-style: preserve-3d;
  /* Final resting rotation is set inline from the resolved side (0deg heads /
     180deg tails). Whole turns are added by the keyframes during the spin. */
  transform: rotateY(var(--coin-landing, 0deg));
  transition: transform 0.12s ease;
}
.coin:hover { transform: rotateY(var(--coin-landing, 0deg)) translateY(-3px) scale(1.03); }
.coin:active { transform: rotateY(var(--coin-landing, 0deg)) scale(0.96); }

/* Two physical faces. Each is opaque and backface-hidden, so as the coin
   revolves the visible label actually CHANGES from 🪙/HEADS to TAILS. */
.coin-face {
  grid-area: 1 / 1;
  width: 100%; height: 100%;
  border-radius: 50%;
  display: grid; place-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-size: 2.6rem;
  line-height: 1;
  user-select: none;
}
.coin-face--heads {
  background: radial-gradient(circle at 35% 30%, #fff7cf, #f6c945 60%, #d4a017);
  color: #7a5200;
}
.coin-face--tails {
  background: radial-gradient(circle at 35% 30%, #f3f4f6, #cbd5e1 60%, #94a3b8);
  color: #334155;
  transform: rotateY(180deg);
}
.coin-face__label { display: block; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; margin-top: 4px; }

/* Visible multi-turn flip with a vertical toss arc. The animation overrides
   the inline resting transform while running and hands back to it on landing. */
.coin.spinning {
  animation: coin-spin var(--coin-spin-ms, 1100ms) cubic-bezier(0.25, 0.1, 0.25, 1) both;
}
@keyframes coin-spin {
  0%   { transform: rotateY(0deg) translateY(0) scale(1); }
  15%  { transform: rotateY(180deg) translateY(-26px) scale(1.06); }
  35%  { transform: rotateY(540deg) translateY(-42px) scale(1.1); }
  55%  { transform: rotateY(900deg) translateY(-44px) scale(1.1); }
  75%  { transform: rotateY(calc(var(--coin-landing, 1080deg) - 180deg)) translateY(-20px) scale(1.04); }
  100% { transform: rotateY(var(--coin-landing, 1080deg)) translateY(0) scale(1); }
}

/* Reduced motion: never animate. A static landed face + a visible badge in the
   result area still tells the user exactly what the coin decided. */
@media (prefers-reduced-motion: reduce) {
  .coin.spinning { animation: none !important; transform: rotateY(var(--coin-landing, 0deg)) !important; }
}
.coin.reduced-motion-result { outline: 3px solid var(--accent); outline-offset: 3px; }
.coin-result-note { display: block; margin-top: 4px; font-size: 0.8rem; color: var(--muted); font-style: italic; }

/* ---------- draw ---------- */
.inline-form { display: flex; gap: 10px; justify-content: center; align-items: flex-end; flex-wrap: wrap; }
.inline-form input { max-width: 240px; text-align: center; font-size: 1.1rem; }
.error { color: var(--danger); min-height: 1.2em; font-size: 0.9rem; margin: 0; }

/* ---------- steppers (lucky draw, Round 5) ---------- */
.stepper-group { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stepper-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper input { width: 108px; font-size: 1.1rem; text-align: center; }
.step-btn { width: 44px; flex: none; padding: 8px 0; font-size: 1.2rem; line-height: 1; }
.stepper-join { align-self: center; color: var(--muted); font-weight: 600; padding-bottom: 13px; }
.draw-live { margin: 10px 0 0; color: var(--muted); font-size: 0.9rem; }
.draw-live.invalid strong { color: var(--danger); }

/* ---------- raffle ---------- */
.count-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 0.9rem; }
.count-row input { width: 80px; }
#raffle-results { flex-direction: column; gap: 6px; }
#raffle-results .winner {
  font-size: 1.3rem; font-weight: 700;
  background: #f3f0ff; border: 1px solid #ddd6fe; border-radius: 999px;
  padding: 6px 14px; text-align: center;
  animation: result-pop 0.35s ease both;
}

/* ---------- quick-pick presets (Round 5) ---------- */
.preset-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.preset-group legend { font-size: 0.8rem; color: var(--muted); padding: 0 4px; }
.preset-options { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-option {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; color: var(--ink); transition: all 0.15s ease;
}
.preset-option:hover { border-color: var(--brand); color: var(--brand); }
.preset-option:active { background: #f0ecff; }
.preset-option.selected { background: var(--brand-grad); border-color: transparent; color: #fff; }
.preset-option.selected:hover { color: #fff; }
.preset-option input { accent-color: var(--brand); }

/* ---------- ad + cta ---------- */
.adsbygoogle { display: block; margin: 26px 0; min-height: 90px; background: #eef0f6; border-radius: var(--radius); }
.cta-card { text-align: center; margin: 20px 0 30px; }
.cta-card p { color: var(--muted); max-width: 54ch; margin: 8px auto 16px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: #fff; margin-top: 20px; padding: 26px 0 18px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; align-items: start; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-donate { display: flex; flex-direction: column; gap: 8px; }
.copyright { margin: 18px 0 0; text-align: center; }

/* ---------- confetti + toast ---------- */
#confetti-canvas {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9999;
}
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 0.9rem; box-shadow: var(--shadow);
  z-index: 10000;
}

@media (max-width: 760px) {
  .tool-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.6rem; }
  .site-header .wrap { flex-direction: column; gap: 10px; }
  .footer-grid { grid-template-columns: 1fr; }
}


/* Hub rail — internal links across the tool network */
.hub { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; justify-content: center; }
.hub a {
  color: inherit; opacity: 0.92; text-decoration: none; font-size: 0.9em;
  font-size: 0.8em; padding: 2px 8px; border: 1px solid currentColor; border-radius: 999px;
}
.hub a:hover { opacity: 1; }

/* >>> theme-by-name (2026-11-02) >>> */
/* Theme derived from the site's MEANING, not a random variant.
 * Chance and play = plum and violet. It should feel like a game, not a form.
 * Ad layout is deliberately NOT set here — container width and rail geometry are
 * measured and verified separately by check-ad-layout.mjs.
 */
:root {
  --bg: #faf6fd;
  --card: #ffffff;
  --ink: #241a2c;
  --muted: #6d5f78;
  --line: #ece2f4;
  --brand: #7e22ce;
  --brand-strong: #7e22ce;
  --accent: #c026d3;
  --radius: 20px;
  --font-sans: 'DM Sans', 'Avenir', 'Segoe UI', sans-serif;
}
body { font-family: var(--font-sans); background: var(--bg); color: var(--ink); }
h1, h2, h3 { font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.015em; }
.card, .panel, section[class*="card"] { border-radius: var(--radius); }
/* <<< theme-by-name <<< */

/* Privacy architecture section (2026-11-08) — the selling point of every site. */
.privacy-section{margin-top:34px;padding-top:24px;border-top:2px solid #e2e8f0}
.privacy-section h2{font-size:1.35em;margin-bottom:10px}
.privacy-section h3{font-size:1.05em;margin:20px 0 8px}
.privacy-steps{margin:10px 0 14px;padding-left:22px}
.privacy-steps li{margin-bottom:8px;line-height:1.6}
.privacy-section kbd{background:#f1f5f9;border:1px solid #cbd5e1;border-bottom-width:2px;
  border-radius:4px;padding:1px 5px;font-size:.85em;font-family:ui-monospace,Menlo,monospace}
