
:root {
  --bg: #0f172a;
  --bg-soft: #131d35;
  --surface: rgba(21, 31, 56, 0.9);
  --surface-2: rgba(31, 45, 79, 0.9);
  --text: #e5eefc;
  --muted: #9db1d3;
  --border: rgba(148, 163, 184, 0.16);
  --brand: #7c3aed;
  --brand-2: #9333ea;
  --good: #22c55e;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-soft: #eef2ff;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-2: rgba(255, 255, 255, 0.98);
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15, 23, 42, 0.09);
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(6, 182, 212, 0.18), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: var(--text);
  min-height: 100vh;
}

body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, textarea { font: inherit; }

.container { width: min(1240px, calc(100% - 2rem)); margin: 0 auto; }
.narrow { width: min(820px, calc(100% - 2rem)); }
.section { padding: 56px 0; }
.muted-section { background: linear-gradient(180deg, transparent, rgba(255,255,255,0.02), transparent); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(12, 19, 36, 0.52);
  border-bottom: 1px solid var(--border);
}
:root[data-theme="light"] .site-header { background: rgba(248,250,252,0.72); }
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 74px;
}
.brand-logo { height: 38px; }
.nav-links { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; justify-content: flex-end; }
.nav-links a { color: var(--muted); font-size: .98rem; }
.nav-links a:hover { color: var(--text); }
.theme-toggle, .icon-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

.hero { padding-top: 28px; }
.hero-grid { display: grid; gap: 1.2rem; grid-template-columns: minmax(320px, 430px) minmax(0, 1fr); align-items: start; }
.hero-copy { max-width: none; position: sticky; top: 96px; }
.hero-copy h1 { max-width: 16ch; }
.eyebrow {
  display: inline-block;
  padding: .45rem .8rem;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.18);
  color: #d8c6ff;
  font-size: .94rem;
}
:root[data-theme="light"] .eyebrow { color: #5b21b6; }
h1 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 1.04;
  margin: 1rem 0 .9rem;
}
.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 1000px;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.25rem;
}
.hero-badges span {
  padding: .55rem .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

.tool-shell {
  margin-top: 0;
  display: grid;
  gap: 1.2rem;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  align-items: start;
}
.panel-card,
.wheel-card,
.info-card,
.faq-list details,
.support-card,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.panel-card,
.wheel-card { padding: 1.15rem; position: relative; }
.panel-header,
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}
.section-head { margin-bottom: 1.35rem; }
.section-head h2,
.panel-header h2,
.info-card h3,
.site-footer h3,
.site-footer h4,
.modal-card h2 { margin: 0; }
.section-head p,
.info-card p,
.site-footer p,
.faq-list p,
.support-card p,
.helper-text,
.modal-note { color: var(--muted); }
.helper-text { margin: .4rem 0 0; font-size: .95rem; }
textarea {
  width: 100%;
  margin-top: .95rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 1rem;
  resize: vertical;
  min-height: 190px;
}

.option-list {
  display: grid;
  gap: .85rem;
  margin-top: 1rem;
  color: var(--muted);
}
.option-list label {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.panel-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.compact-actions { justify-content: space-between; }
.center-actions { justify-content: center; }
.btn {
  border: 0;
  border-radius: 14px;
  padding: .9rem 1.1rem;
  cursor: pointer;
  transition: transform .15s ease, opacity .2s ease, background .2s ease;
}
.btn:hover,
.theme-toggle:hover,
.icon-toggle:hover { transform: translateY(-1px); }
.spin-button:hover { transform: translate(-50%, calc(-50% - 1px)); }
.btn-primary,
.btn-secondary,
.btn-ghost { color: white; }
.btn-primary,
.spin-button {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.btn-secondary {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
}
.btn-ghost {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border);
}

.history-card { margin-top: 1rem; max-height: min(30vh, 270px); overflow: auto; }
.howto-card { margin-top: 1rem; }
.history-list {
  margin: .9rem 0 0;
  padding-left: 1.35rem;
  display: grid;
  gap: .45rem;
}
.history-list li { line-height: 1.4; }

.wheel-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .2rem;
}
.wheel-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0 .25rem .25rem;
  min-height: clamp(360px, calc(100vh - 335px), 500px);
}
#wheelCanvas {
  width: min(100%, 56vh);
  max-width: 600px;
  min-width: 320px;
  height: auto;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.32));
}
.pointer {
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 34px solid #f8fafc;
  z-index: 2;
}
:root[data-theme="light"] .pointer { border-top-color: #0f172a; }
.spin-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 112px;
  height: 112px;
  padding: 0 0 0 .05em;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
  font-size: 1rem;
  border-radius: 999px;
  border: 8px solid rgba(255,255,255,.18);
  color: white;
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(124,58,237,.35);
}
.spin-button:disabled,
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn:disabled { transform: none; }
.spin-button:disabled { transform: translate(-50%, -50%); }
.result-card { text-align: center; padding-top: 0; margin-top: .35rem; }
.result-label {
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--muted);
  font-size: .8rem;
  margin: 0;
}
.result-value {
  font-size: clamp(1.35rem, 3vw, 2.15rem);
  margin: .55rem 0 0;
  font-weight: 800;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.info-card {
  padding: 1.15rem;
  transition: transform .15s ease, border-color .2s ease;
}
.info-card:hover { transform: translateY(-3px); border-color: rgba(124, 58, 237, 0.45); }
.info-card p { margin-bottom: 0; }
.center-head { justify-content: center; }
.faq-list { display: grid; gap: 1rem; }
.faq-list details { padding: 1rem 1.1rem; }
.faq-list summary { cursor: pointer; font-weight: 700; }
.faq-list p { margin: .8rem 0 0; }

.site-footer { padding: 2rem 0 3rem; border-top: 1px solid var(--border); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.25rem;
}
.site-footer ul {
  list-style: none;
  padding: 0;
  margin: .8rem 0 0;
  display: grid;
  gap: .65rem;
}

.footer-links-list {
  columns: 2;
  column-gap: 1.5rem;
}
.footer-links-list li { break-inside: avoid; }
@media (max-width: 700px) {
  .footer-links-list { columns: 1; }
}

.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

.compact-actions-3 .btn { flex: 1 1 0; }
.pill { display:inline-flex; align-items:center; padding:.35rem .65rem; border-radius:999px; font-size:.78rem; background:rgba(124,58,237,.18); color:#d8c6ff; margin-bottom:.75rem; }
:root[data-theme="light"] .pill { color:#5b21b6; }
.coming-soon { opacity:.92; }
.support-section { padding-top: 0; }
.support-card { padding:1.6rem; }
.support-card h2 { margin-top:0; margin-bottom:.8rem; }
.support-card p { max-width: 780px; margin-top:0; margin-bottom:1.2rem; }

.modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0;
  z-index: 30;
  pointer-events: none;
}
.modal.hidden { display: none; }
.modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(15,23,42,0.04), rgba(15,23,42,0.32));
  border-radius: 26px;
}
.modal-card { pointer-events: auto; position: relative; }
.modal-card {
  width: min(420px, calc(100% - 2rem));
  padding: 1.35rem;
  text-align: center;
  margin-top: 28px;
}
.modal-kicker {
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--muted);
  font-size: .8rem;
  margin: 0 0 .65rem;
}
.modal-card h2 { font-size: clamp(2rem, 5vw, 3rem); }
.modal-note { margin: .7rem auto 0; max-width: 32ch; }

@media (max-width: 1120px) {
  .hero-grid { display:block; }
  .hero-copy { max-width:none; }
}

@media (max-width: 980px) {
  .tool-shell { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wheel-stage { min-height: auto; }
}

@media (max-width: 720px) {
  .section { padding: 58px 0; }
  .nav-wrap { min-height: 68px; }
  .nav-links { gap: .75rem; font-size: .95rem; }
  .panel-actions { flex-direction: column; }
  .panel-actions .btn { width: 100%; }
  .card-grid, .footer-grid { grid-template-columns: 1fr; }
  .spin-button { width: 92px; height: 92px; font-size: .92rem; }
  .hero-copy h1 { max-width: 10ch; }
}


.page-main .panel-card { max-width: 820px; margin: 0 auto; text-align: left; }
.page-main h1 { font-size: clamp(2.2rem, 7vw, 3.8rem); line-height: 1.05; max-width: none; }
.page-main .lead { max-width: none; }

.history-intro { margin-top: .85rem; font-weight: 600; }
.hidden { display: none !important; }


.tool-section { padding-top: 10px; padding-bottom: 28px; }
.tool-section .tool-shell { align-items: start; }
.tool-section .wheel-stage { min-height: clamp(360px, calc(100vh - 335px), 500px); }


@media (min-height: 900px) {
  .tool-section .wheel-stage { min-height: clamp(420px, calc(100vh - 360px), 560px); }
  #wheelCanvas { width: min(100%, 60vh); max-width: 640px; }
}

@media (max-width: 1200px) {
  #wheelCanvas { width: min(100%, 52vh); max-width: 560px; }
}

@media (max-width: 980px) {
  #wheelCanvas { width: min(100%, 82vw); min-width: 0; }
  .tool-section .wheel-stage { min-height: auto; }
  .history-card { max-height: none; }
}


@media (max-height: 820px) {
  .tool-shell { gap: 1rem; }
  .panel-card, .wheel-card { padding: 1rem; }
  textarea { min-height: 160px; }
  .result-value { margin-top: .35rem; }
}


/* V2_4 light theme button and control contrast fixes */
:root[data-theme="light"] .btn-primary {
  color: #ffffff;
}
:root[data-theme="light"] .btn-secondary {
  color: #ffffff;
}
:root[data-theme="light"] .btn-ghost {
  background: #f1f5f9;
  color: #111827;
  border: 1px solid #cbd5e1;
}
:root[data-theme="light"] .btn-ghost:hover,
:root[data-theme="light"] .theme-toggle:hover,
:root[data-theme="light"] .icon-toggle:hover {
  background: #e2e8f0;
}
:root[data-theme="light"] .btn:disabled,
:root[data-theme="light"] .spin-button:disabled {
  opacity: .68;
}
:root[data-theme="light"] textarea:disabled,
:root[data-theme="light"] input:disabled,
:root[data-theme="light"] button:disabled {
  color: #94a3b8;
}
:root[data-theme="light"] .option-list,
:root[data-theme="light"] .helper-text,
:root[data-theme="light"] .modal-note,
:root[data-theme="light"] .faq-list p,
:root[data-theme="light"] .support-card p,
:root[data-theme="light"] .site-footer a,
:root[data-theme="light"] .site-footer p,
:root[data-theme="light"] .history-intro,
:root[data-theme="light"] .result-label,
:root[data-theme="light"] .nav-links a {
  color: #475569;
}
:root[data-theme="light"] .nav-links a:hover,
:root[data-theme="light"] .site-footer a:hover {
  color: #0f172a;
}
:root[data-theme="light"] .theme-toggle,
:root[data-theme="light"] .icon-toggle {
  background: rgba(255,255,255,.98);
  color: #111827;
  border-color: #cbd5e1;
}
:root[data-theme="light"] .panel-card,
:root[data-theme="light"] .wheel-card,
:root[data-theme="light"] .info-card,
:root[data-theme="light"] .faq-list details,
:root[data-theme="light"] .support-card,
:root[data-theme="light"] .modal-card {
  background: rgba(255,255,255,.96);
}

/* V2_5 Coin Flip */
.coin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 390px);
  gap: 1.2rem;
  align-items: start;
}
.coin-panel { padding: 1.2rem; }
.coin-stage {
  min-height: 360px;
  display: grid;
  place-items: center;
  perspective: 1200px;
}
.coin-disc {
  position: relative;
  width: min(280px, 70vw);
  aspect-ratio: 1;
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(.18,.85,.24,1);
}
.coin-face {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  backface-visibility: hidden;
  border: 8px solid rgba(255,255,255,.12);
  box-shadow: 0 20px 50px rgba(0,0,0,.2), inset 0 6px 20px rgba(255,255,255,.18);
}
.coin-front {
  background: linear-gradient(135deg, #f59e0b, #fcd34d);
  color: #1f2937;
}
.coin-back {
  background: linear-gradient(135deg, #60a5fa, #06b6d4);
  color: white;
  transform: rotateY(180deg);
}
.coin-result { margin-top: 0; }
.coin-history-card { max-height: none; }
.coin-head { align-items: start; }
:root[data-theme="light"] .coin-face { border-color: rgba(15,23,42,.08); }

@media (max-width: 980px) {
  .coin-grid { grid-template-columns: 1fr; }
  .coin-stage { min-height: 300px; }
}


/* V2_6 Random Name Picker */
.picker-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  align-items: start;
}
.picker-stage {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
}
.picker-result-box {
  width: min(100%, 560px);
  padding: 2rem 1.25rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(124,58,237,.14), rgba(6,182,212,.08));
}
.picker-result-box .result-value {
  font-size: clamp(2rem, 5vw, 3.3rem);
  word-break: break-word;
}
.picker-empty { color: var(--muted); font-size: 1rem; margin-top: .8rem; }
.picker-actions { margin-top: 1rem; }
.picker-history { margin-top: 1.35rem; max-height: min(30vh, 270px); overflow: auto; }
.picker-history .panel-header { align-items: start; gap: .8rem; }
.picker-history .panel-header .btn { flex-shrink: 0; }
:root[data-theme="light"] .picker-grid .btn-primary { color: #ffffff; box-shadow: 0 8px 20px rgba(109,74,255,.18); }
:root[data-theme="light"] .picker-grid .btn-secondary { color: #ffffff; box-shadow: 0 8px 20px rgba(59,130,246,.14); }
:root[data-theme="light"] .picker-grid .btn-primary:disabled,
:root[data-theme="light"] .picker-grid .btn-secondary:disabled { color: rgba(255,255,255,.85); opacity: .55; }
@media (max-width: 980px) { .picker-grid { grid-template-columns: 1fr; } .picker-stage{min-height:auto;} .picker-history{max-height:none;} }


/* V2_8 Random Name Picker spacing fix */
.picker-grid .compact-actions-3 { margin-bottom: 1.15rem; }
.picker-history { margin-top: 1.2rem !important; }

/* V2_8 Raffle Picker */
.upload-row { margin-top: 1rem; }
.file-help { margin: .45rem 0 0; color: var(--muted); font-size: .92rem; }
.file-input { display:block; width:100%; padding:.9rem 1rem; border-radius:16px; border:1px solid var(--border); background: var(--surface-2); color: var(--text); }
.file-input::file-selector-button { margin-right:.9rem; border:0; border-radius:10px; padding:.65rem .9rem; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color:#fff; cursor:pointer; }
.raffle-note { margin-top:.8rem; color: var(--muted); font-size:.95rem; }
:root[data-theme="light"] .file-input { background:#fff; }
:root[data-theme="light"] .file-input::file-selector-button { color:#fff; }

.picker-status { color: var(--muted); font-size: .92rem; margin-top: .65rem; }
.name-reveal { animation: nameReveal .32s ease; }
@keyframes nameReveal { 0% { opacity: .2; transform: scale(.96); } 100% { opacity: 1; transform: scale(1); } }
.history-flash { animation: historyFlash .55s ease; }
@keyframes historyFlash { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.0); } 35% { box-shadow: 0 0 0 4px rgba(34,197,94,.18); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
:root[data-theme="light"] .history-flash { animation-name: historyFlashLight; }
@keyframes historyFlashLight { 0% { box-shadow: 0 0 0 0 rgba(59,130,246,0); } 35% { box-shadow: 0 0 0 4px rgba(59,130,246,.16); } 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); } }


/* V3_0 tool-page and blog polish */
.tool-page-intro { padding: 18px 0 10px; }
.tool-page-intro .section-head { margin-bottom: 0; }
.tool-page-intro h1 { font-size: clamp(2rem, 5vw, 3.25rem); margin: 0 0 .35rem; }
.tool-page-intro .lead { max-width: 820px; }
.picker-history { margin-top: 1rem; }
.blog-cta { margin-top: 1.15rem; display: flex; gap: .75rem; flex-wrap: wrap; }
.blog-cta .btn { display: inline-flex; align-items: center; }
.tool-faq-section { padding-top: 10px; }
.raffle-note, .picker-empty, .picker-status { color: var(--muted); }


.tool-page-intro { padding: 22px 0 8px; }
.tool-page-intro .lead { max-width: 900px; }
.usecase-grid .info-card { display:block; }
.share-row {
  display:flex; flex-wrap:wrap; gap:.65rem; justify-content:center; margin-top: .9rem;
}
.share-btn {
  display:inline-flex; align-items:center; justify-content:center;
  min-width: 110px; padding:.7rem 1rem; border-radius: 12px; border:1px solid var(--border);
  background: rgba(148,163,184,.12); color: var(--text); cursor:pointer;
}
.share-btn:hover { transform: translateY(-1px); background: rgba(148,163,184,.18); }
.share-row.hidden { display:none; }
.mini-confetti { position: absolute; inset: 0; pointer-events:none; overflow:hidden; }
.mini-confetti i { position:absolute; width:8px; height:12px; opacity:0; animation: miniBurst 1s ease-out forwards; }
@keyframes miniBurst { 0% { transform: translate(var(--x0), var(--y0)) rotate(0deg); opacity:1; } 100% { transform: translate(var(--x1), var(--y1)) rotate(420deg); opacity:0; } }
.history-flash { box-shadow: 0 0 0 1px rgba(124,58,237,.3), 0 0 0 8px rgba(124,58,237,.08), var(--shadow); }
.picker-status { margin: .5rem 0 0; color: var(--muted); }
.tool-page-links { display:flex; flex-wrap:wrap; gap:.7rem; margin-top:.95rem; }
.blog-grid { display:grid; gap:1rem; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); }
.blog-card { display:block; }
.blog-cta { display:flex; flex-wrap:wrap; gap:.8rem; margin-top: 1.35rem; }
:root[data-theme="light"] .share-btn { background:#f8fafc; color:#0f172a; border-color: rgba(15,23,42,.14); }
:root[data-theme="light"] .share-btn:hover { background:#e2e8f0; }


/* V2_16 homepage quick tools + blog related tools */
.quick-tools-wrap { margin: 0 0 14px; }
.quick-tools-kicker { color: var(--muted); margin: 0 0 8px; font-size: .95rem; }
.quick-tools{ display:flex; gap:12px; flex-wrap:wrap; }
.quick-tool{ padding:10px 16px; border-radius:12px; background:#6c4cff; color:#fff; text-decoration:none; font-weight:600; }
.quick-tool:hover{ transform: translateY(-1px); }
.related-tools { margin-top: 1.35rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.related-tools h3 { margin: 0 0 .7rem; font-size: 1rem; }
.related-tools ul { display:flex; flex-wrap:wrap; gap:.7rem 1.25rem; padding:0; margin:0; list-style:none; }
.related-tools a { color: var(--text); text-decoration:none; }
.related-tools a:hover { text-decoration:underline; }
.blog-cta { margin-top: 1.35rem; display:flex; gap:.8rem; flex-wrap:wrap; }
