/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #fff8f2;
  --bg-alt: #fdeee0;
  --card: #ffffff;
  --text: #2b201a;
  --text-soft: #7a685d;
  --border: #f0e0d0;

  --accent: #ff7a45;
  --accent-dark: #e35d2b;
  --accent-bg: #ffe9dc;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --sans: "Inter", system-ui, sans-serif;
  --display: "Baloo 2", var(--sans);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #201712;
    --bg-alt: #291d16;
    --card: #2c2019;
    --text: #f7ece3;
    --text-soft: #cbb4a4;
    --border: #3c2c22;
    --accent-bg: #3a281c;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; text-wrap: balance; line-height: 1.15; color: var(--text); }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--card); color: var(--text);
  z-index: 9999; border-radius: 8px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 1.25rem; }

/* =============================================================
   4. Header (ToolSprout site-wide green — not this tool's palette)
   ============================================================= */
.site-header { position: sticky; top: 0; z-index: 50; padding: .85rem 0; border-bottom: 1px solid var(--border); background: var(--card); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.header-inner { gap: 1rem; flex-wrap: wrap; }
.header-left { display: flex; align-items: center; gap: 1.1rem; }
.logo { font-family: var(--display); font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .55rem; color: #142420; }
.logo-mark {
  display: inline-grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);
  gap: 3px; width: 26px; height: 26px; padding: 5px; border-radius: 8px;
  background: #0b5347; flex-shrink: 0;
}
.logo-mark span { background: #14b892; border-radius: 2px; }

.header-nav { position: relative; }
.dropdown-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .8rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .92rem;
  color: var(--text); transition: background .15s var(--ease-out);
}
.dropdown-toggle:hover { background: var(--bg-alt); }
.dropdown-caret { transition: transform .18s var(--ease-out); }
.dropdown-toggle[aria-expanded="true"] .dropdown-caret { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: calc(100% + .5rem); left: 0; min-width: 190px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px -16px rgba(30, 20, 10, .25);
  padding: .4rem; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s var(--ease-out), transform .16s var(--ease-out), visibility .16s;
}
.dropdown-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu li a { display: block; padding: .55rem .7rem; border-radius: 8px; font-size: .92rem; font-weight: 500; color: var(--text); }
.dropdown-menu li a:hover { background: var(--bg-alt); text-decoration: none; }

.header-search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
  padding: .5rem .9rem; flex: 1; max-width: 260px; min-width: 140px;
}
.search-icon { color: var(--text-soft); flex-shrink: 0; }
.header-search input { border: 0; background: none; outline: none; color: var(--text); font: inherit; font-size: .92rem; width: 100%; }
.header-search input::placeholder { color: var(--text-soft); }
.search-kbd {
  font-family: var(--sans); font-size: .72rem; color: var(--text-soft);
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: .1rem .4rem; flex-shrink: 0; display: none;
}
@media (min-width: 540px) { .search-kbd { display: inline-block; } }

.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding-block: .9rem; font-size: .85rem; color: var(--text-soft); }
.breadcrumb a { color: var(--text-soft); font-weight: 600; }
.breadcrumb a:hover { color: #0b5347; }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 2rem 0 1rem; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); margin-bottom: .6rem; }
.hero .subtitle { color: var(--text-soft); max-width: 46ch; margin-inline: auto; font-size: 1.02rem; }

/* =============================================================
   6. Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.2rem; border-radius: 999px; font-weight: 700; font-size: .92rem;
  transition: transform .15s var(--ease-bounce), box-shadow .2s var(--ease-out), opacity .2s;
}
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { transform: translateY(-2px); text-decoration: none; }
.btn-sm { padding: .55rem .9rem; font-size: .85rem; }

/* =============================================================
   7. Tool card layout
   ============================================================= */
.tool-section { padding-block: 1.25rem 1rem; }
.wheel-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; box-shadow: 0 12px 40px -20px rgba(200, 100, 40, .3);
  display: grid; gap: 1.5rem; grid-template-columns: 1fr;
}
@media (min-width: 860px) { .wheel-card { grid-template-columns: 1fr 1fr; padding: 1.75rem; } }

/* --- Wheel panel --- */
.wheel-panel { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.wheel-stage { position: relative; width: 100%; max-width: 460px; aspect-ratio: 1; }
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; z-index: 5;
  border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-top: 22px solid var(--accent-dark);
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.25));
}
#wheel-canvas { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 10px 30px -10px rgba(200,100,40,.4); }
#confetti-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.spin-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 20%; height: 20%; min-width: 64px; min-height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff;
  font-family: var(--display); font-weight: 800; font-size: clamp(.75rem, 2.2vw, 1rem); letter-spacing: .02em;
  box-shadow: 0 10px 20px -8px rgba(200,80,30,.6), inset 0 0 0 4px #fff;
  z-index: 7; transition: transform .15s var(--ease-bounce), opacity .2s;
}
.spin-btn:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.05); }
.spin-btn:disabled { opacity: .55; cursor: not-allowed; }

.wheel-controls-row { display: flex; align-items: center; gap: .75rem; width: 100%; justify-content: center; text-align: center; }
.icon-toggle {
  width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--bg-alt); border: 1.5px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text);
}
.icon-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.winner-banner { font-family: var(--display); font-weight: 800; font-size: clamp(1.1rem, 3vw, 1.5rem); color: var(--accent-dark); min-height: 1.6em; }

/* --- Options panel --- */
.options-panel { display: flex; flex-direction: column; gap: 1rem; }
.form-row label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .4rem; }
#options-input {
  width: 100%; padding: .8rem 1rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg); font-size: .95rem; color: var(--text);
  font-family: var(--sans); resize: vertical; line-height: 1.5;
}
#options-input:focus { border-color: var(--accent-dark); outline: none; }
.hint { color: var(--text-soft); font-size: .82rem; margin-top: .35rem; }

.option-toggles { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; }
.check-row { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; }
.check-row input { width: 17px; height: 17px; accent-color: var(--accent-dark); }

.custom-colors-list { display: grid; gap: .5rem; max-height: 220px; overflow-y: auto; padding-right: .25rem; }
.custom-color-row { display: flex; align-items: center; gap: .6rem; font-size: .88rem; }
.custom-color-row input[type="color"] { width: 30px; height: 30px; border: 1.5px solid var(--border); border-radius: 8px; padding: 0; background: none; flex-shrink: 0; }

.list-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.list-name-input {
  padding: .55rem .8rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); font-size: .88rem; color: var(--text); min-width: 140px; flex: 1;
}
.select-inline { padding: .55rem .7rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--bg); font-size: .85rem; color: var(--text); }

/* =============================================================
   8. History
   ============================================================= */
.history-section { margin-top: 1.5rem; padding: 1.25rem; background: var(--card); border: 1.5px dashed var(--border); border-radius: var(--radius-lg); }
.history-title { font-size: 1.1rem; margin-bottom: .75rem; }
.history-empty { color: var(--text-soft); font-size: .9rem; }
#history-list { display: flex; flex-direction: column; gap: .4rem; max-height: 260px; overflow-y: auto; }
.history-item {
  display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem;
  background: var(--bg-alt); border-radius: var(--radius-sm); font-size: .9rem;
}
.history-index { font-weight: 800; color: var(--accent-dark); font-size: .8rem; flex-shrink: 0; }
.history-name { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.history-time { color: var(--text-soft); font-size: .78rem; flex-shrink: 0; }


/* =============================================================
   9. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  border: 2px dashed #e8c4a8; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-weight: 700; letter-spacing: .06em; font-size: .85rem;
  background: repeating-linear-gradient(45deg, var(--bg-alt), var(--bg-alt) 10px, var(--bg) 10px, var(--bg) 20px);
}
.ad-slot--leaderboard { min-height: 90px; margin: 2rem auto; max-width: 960px; }
.ad-slot--incontent { min-height: 250px; margin: 2rem auto; max-width: 728px; }

.ad-popup { border: none; border-radius: var(--radius-lg); padding: 0; max-width: 380px; width: 90vw; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); }
.ad-popup::backdrop { background: rgba(40, 20, 10, .45); backdrop-filter: blur(2px); }
.ad-popup-inner { padding: 1.5rem; text-align: center; position: relative; }
.ad-popup-close { position: absolute; top: .6rem; right: .6rem; width: 32px; height: 32px; border-radius: 50%; background: var(--bg-alt); font-size: 1.1rem; line-height: 1; }
.ad-popup .ad-slot { min-height: 220px; margin: 1rem 0 0; }

.corner-ad {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 40;
  background: var(--card); border: 2px dashed #e8c4a8; border-radius: var(--radius);
  padding: .7rem 2.2rem .7rem 1rem; max-width: 240px; font-size: .8rem; color: var(--text-soft);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.corner-ad.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.corner-ad strong { display: block; font-weight: 800; color: var(--text); margin-bottom: .15rem; }
.corner-ad-close { position: absolute; top: .4rem; right: .4rem; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-alt); font-size: .85rem; line-height: 1; }

/* =============================================================
   10. Content sections
   ============================================================= */
.content-section { padding-block: 2rem; }
.content-section h2 { font-size: clamp(1.3rem, 3.5vw, 1.8rem); margin-bottom: 1rem; }
.content-section > p { color: var(--text-soft); max-width: 68ch; margin-bottom: 1rem; }
.content-section > p.center-text { max-width: none; margin-inline: 0; text-align: justify; text-align-last: left; }

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.step .step-num {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; font-weight: 800; margin-bottom: .75rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.step p { color: var(--text-soft); font-size: .92rem; }

.usecases { display: grid; gap: .8rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .usecases { grid-template-columns: repeat(5, 1fr); } }
.usecase { background: var(--bg-alt); border-radius: var(--radius); padding: 1rem .75rem; text-align: center; border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; }
.usecase-icon { display: block; margin-bottom: .4rem; color: var(--text); }
.usecase-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.usecase h3 { font-size: .92rem; margin-top: auto; }

.faq { max-width: 68ch; }
.faq details { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: .6rem; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { color: var(--text-soft); margin-top: .6rem; font-size: .94rem; }

/* =============================================================
   11. Related tools (interlinking)
   ============================================================= */
.related-tools-title { font-size: 1rem; margin-bottom: .75rem; color: var(--text-soft); }
.related-tools-list { display: flex; flex-wrap: wrap; gap: .6rem; }
.related-tools-list a {
  display: inline-flex; padding: .5rem 1rem; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 600; font-size: .88rem;
}
.related-tools-list a:hover { border-color: var(--accent); color: var(--accent-dark); text-decoration: none; }

/* =============================================================
   12. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; margin-top: 1rem; color: var(--text-soft); font-size: .85rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; justify-content: space-between; align-items: center; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* =============================================================
   12. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dropdown-menu, .dropdown-caret, .spin-btn, .corner-ad { transition: none; }
}
