/* wordscramblepuzzles.com - design system ("playful-editorial")
   Palette: Cream #FBF5EC, Plum #3D2B56, Mustard #D9A441, Ink #241A33, Mist #EFE4D4
   Fonts: Fraunces (headings, display), Inter (body/UI) */

:root {
  --cream: #FBF5EC;
  --plum: #3D2B56;
  --plum-soft: #6A5088;
  --mustard: #D9A441;
  --mustard-soft: #F3DCA6;
  --ink: #241A33;
  --mist: #EFE4D4;
  --white: #FFFFFF;
  --grey: #8A7F93;
  --line: #E6D9C3;
  --good: #3F7D58;
  --radius: 16px;
  --max-w: 820px;
  --shadow: 0 2px 0 rgba(36,26,51,.06), 0 10px 24px -14px rgba(36,26,51,.28);
  --shadow-sm: 0 1px 0 rgba(36,26,51,.05), 0 4px 10px -6px rgba(36,26,51,.2);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3, .display { font-family: 'Fraunces', Georgia, serif; font-weight: 600; color: var(--plum); margin: 0 0 14px; line-height: 1.2; }
h1 { font-size: clamp(30px, 5.6vw, 46px); letter-spacing: -.01em; }
h2 { font-size: clamp(21px, 3.4vw, 27px); margin-top: 8px; }
h3 { font-size: 18px; }

p { margin: 0 0 14px; }
.lede { font-size: 17px; color: var(--grey); max-width: 680px; }

a { color: var(--plum); text-decoration: underline; text-decoration-color: var(--mustard); text-decoration-thickness: 2px; text-underline-offset: 2px; }
a:hover { color: var(--mustard); }
.tool-card, .letter-tile, .nav-pills a, .logo, .theme-toggle, .pill-row a { text-decoration: none; }
img, svg { max-width: 100%; display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
main { padding-bottom: 70px; }

/* ---------- Header ---------- */
.site-header { border-bottom: 2px solid var(--line); padding: 18px 0; background: var(--cream); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.header-row { display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; color: var(--plum); font-family: 'Fraunces', serif; }
.logo-tiles { display: flex; gap: 2px; }
.logo-tiles .lt {
  width: 22px; height: 22px; border-radius: 5px; background: var(--plum); color: var(--mustard-soft);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
  box-shadow: 0 2px 0 rgba(0,0,0,.18);
  transform: rotate(var(--r, 0deg));
}
.logo-tiles .lt:nth-child(1) { --r: -6deg; }
.logo-tiles .lt:nth-child(2) { --r: 4deg; background: var(--mustard); color: var(--plum); }
.logo-tiles .lt:nth-child(3) { --r: -3deg; }

.nav-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-pills a { color: var(--plum-soft); font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 999px; min-height: 40px; display: flex; align-items: center; }
.nav-pills a:hover { background: var(--mist); color: var(--plum); }

@media (max-width: 760px) {
  .site-header .container { flex-direction: column; align-items: stretch; gap: 10px; }
  .header-row { justify-content: space-between; }
  .nav-pills { flex-wrap: nowrap; overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .nav-pills a { flex: 0 0 auto; white-space: nowrap; }
}
@media (max-width: 400px) {
  .logo { font-size: 16px; gap: 6px; }
  .logo-tiles .lt { width: 19px; height: 19px; font-size: 11px; }
}

.theme-toggle {
  width: 42px; height: 42px; min-height: 42px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--white); color: var(--plum); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; padding: 0;
}
.theme-toggle:hover { background: var(--mist); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: 13px; color: var(--grey); padding: 16px 0 0; }
.breadcrumb a { color: var(--grey); text-decoration-color: transparent; }
.breadcrumb a:hover { color: var(--plum); text-decoration-color: var(--mustard); }

/* ---------- Hero ---------- */
.hero { padding: 36px 0 10px; text-align: center; }
.hero h1 { max-width: 760px; margin-left: auto; margin-right: auto; }
.hero .lede { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Letter-tile input / result motifs ---------- */
.tile-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 18px 0; }
.letter-tile {
  width: 46px; height: 46px; border-radius: 9px; background: var(--white); border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-family: 'Fraunces', serif; font-weight: 700;
  font-size: 20px; color: var(--plum); box-shadow: var(--shadow-sm); position: relative;
}
.letter-tile .pt { position: absolute; bottom: 2px; right: 4px; font-size: 8px; font-weight: 700; color: var(--mustard); font-family: 'Inter', sans-serif; }

.word-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.word-chip {
  background: var(--white); border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px;
  font-weight: 700; color: var(--plum); font-size: 15px; box-shadow: var(--shadow-sm); display: inline-flex;
  align-items: baseline; gap: 6px;
}
.word-chip .len { font-size: 11px; color: var(--grey); font-weight: 600; }
.word-chip .score { font-size: 11px; color: var(--mustard); font-weight: 800; }

.length-group { margin-top: 18px; }
.length-group h4 { font-family: 'Inter', sans-serif; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); font-weight: 700; margin: 0 0 8px; }

/* ---------- Calc / tool card ---------- */
.calc-card {
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
  max-width: 880px;
  margin: 0 auto;
  text-align: left;
  box-shadow: var(--shadow);
}
.calc-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.calc-field { flex: 1 1 200px; }
.calc-field label { display: block; font-size: 13px; font-weight: 700; color: var(--plum); margin-bottom: 6px; }
.calc-field input[type="text"], .calc-field input[type="number"], .calc-field select, .calc-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--cream);
}
.calc-field input:focus, .calc-field select:focus, .calc-field textarea:focus { outline: 2px solid var(--mustard); outline-offset: 1px; }
.calc-check { display: flex; align-items: center; gap: 8px; margin: 10px 0 18px; font-size: 14px; color: var(--grey); }
.calc-check input { width: 20px; height: 20px; }

.calc-btn {
  min-height: 50px;
  padding: 0 24px;
  background: var(--plum);
  color: var(--cream);
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.calc-btn:hover { background: #4f3a6c; }
.calc-btn:focus-visible { outline: 2px solid var(--mustard); outline-offset: 2px; }
.calc-btn.secondary { background: var(--white); color: var(--plum); border: 2px solid var(--line); }
.calc-btn.secondary:hover { background: var(--mist); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.result-card { margin-top: 20px; background: var(--mist); border-radius: 12px; padding: 20px; }
.result-count { font-size: clamp(32px, 8vw, 54px); color: var(--plum); font-family: 'Fraunces', serif; font-weight: 700; line-height: 1; }
.result-label { font-size: 14px; color: var(--grey); margin-top: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.result-empty { color: var(--grey); font-size: 14px; padding: 8px 0; }

/* ---------- Layout content+aside ---------- */
.layout { display: flex; flex-wrap: wrap; gap: 36px; margin-top: 44px; }
.content { flex: 999 1 560px; min-width: 0; }
.aside { flex: 1 1 280px; min-width: 0; }

.ad-slot { background: var(--mist); border: 2px dashed var(--line); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--grey); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.ad-slot[data-size="300x250"] { width: 300px; height: 250px; max-width: 100%; }
.ad-slot[data-size="320x100"] { width: 320px; height: 100px; max-width: 100%; }

/* ---------- Home: search + tool grid ---------- */
.home-feature {
  background: linear-gradient(135deg, var(--plum), #4f3a6c);
  color: var(--cream);
  border-radius: 18px;
  padding: 30px 24px;
  text-align: center;
  margin: 0 auto 28px;
  max-width: 980px;
  box-shadow: var(--shadow);
}
.home-feature .home-feature-value { font-family: 'Fraunces', serif; font-size: clamp(26px, 5vw, 36px); margin-top: 4px; color: var(--mustard-soft); }
.home-feature-label { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; opacity: .85; }

.search-box { max-width: 980px; margin: 28px auto 0; }
.search-box input {
  width: 100%;
  box-sizing: border-box;
  padding: 15px 20px;
  border: 2px solid var(--line);
  border-radius: 14px;
  font-size: 16px;
  font-family: inherit;
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.search-box input:focus { outline: 2px solid var(--mustard); outline-offset: 1px; }
.no-results { color: var(--grey); margin-top: 16px; text-align: center; }

.cat-heading { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--plum-soft); font-weight: 800; margin: 34px 0 14px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.tool-card {
  background: var(--white); border: 2px solid var(--line); border-radius: 14px; padding: 20px; min-height: 44px;
  box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease;
}
.tool-card:hover { border-color: var(--mustard); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.tool-card strong { display: block; font-size: 16px; color: var(--plum); font-family: 'Fraunces', serif; margin-bottom: 4px; }
.tool-card span { font-size: 13px; color: var(--grey); }
.tool-card.featured { background: linear-gradient(135deg, var(--plum), #4f3a6c); border-color: var(--plum); }
.tool-card.featured strong, .tool-card.featured span { color: var(--cream); }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.pill-row a.pill {
  display: inline-block; padding: 8px 16px; border-radius: 999px; background: var(--mist); color: var(--plum);
  font-size: 13px; font-weight: 700; text-decoration: none; border: 2px solid transparent;
}
.pill-row a.pill:hover { background: var(--plum); color: var(--cream); }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--grey); font-weight: 700; font-size: 12px; text-transform: uppercase; }

/* ---------- FAQ ---------- */
.section-title { font-size: 20px; margin-bottom: 14px; }
details { border-bottom: 2px solid var(--line); padding: 14px 0; }
details summary { cursor: pointer; font-weight: 700; list-style: none; min-height: 24px; display: flex; align-items: center; justify-content: space-between; color: var(--plum); gap: 12px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: '+'; color: var(--mustard); font-size: 22px; flex-shrink: 0; }
details[open] summary::after { content: '\2212'; }
details p { color: var(--grey); margin: 10px 0 0; }

.trivia-box { background: var(--mustard-soft); border-radius: 12px; padding: 16px 18px; margin: 20px 0; color: var(--ink); font-size: 14.5px; }
.trivia-box strong { color: var(--plum); }

.error-list { margin: 14px 0 0; padding-left: 20px; color: var(--ink); font-size: 14.5px; line-height: 1.7; }
.error-list li { margin-bottom: 10px; }
.error-list strong { color: var(--plum); }

/* ---------- Footer ---------- */
.site-footer { border-top: 2px solid var(--line); padding: 30px 0; color: var(--grey); font-size: 13px; text-align: center; }
.site-footer a { color: var(--grey); }
.site-footer a:hover { color: var(--plum); }
.site-footer .source { margin-top: 4px; }

.legal-content h2 { font-size: 18px; margin-top: 28px; margin-bottom: 10px; }
.legal-content p, .legal-content li { color: var(--grey); font-size: 15px; line-height: 1.7; }
.legal-content ul { padding-left: 20px; }

/* ---------- Cookie consent banner ---------- */
#cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 999;
  background: var(--plum); color: var(--cream);
  padding: 16px 20px; box-shadow: 0 -2px 16px rgba(0,0,0,.25);
}
.cookie-banner-inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.cookie-banner-inner p { margin: 0; font-size: 13.5px; flex: 1 1 320px; }
.cookie-banner-inner a { color: var(--mustard-soft); }
.cookie-banner-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn { min-height: 44px; padding: 0 18px; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit; border: 2px solid transparent; }
.cookie-btn-reject { background: transparent; color: var(--cream); border-color: rgba(251,245,236,.4); }
.cookie-btn-reject:hover { background: rgba(251,245,236,.1); }
.cookie-btn-accept { background: var(--mustard); color: var(--ink); }
.cookie-btn-accept:hover { background: var(--mustard-soft); }

@media (max-width: 640px) {
  .cookie-banner-inner { flex-direction: column; align-items: stretch; }
  .cookie-banner-actions { width: 100%; }
  .cookie-btn { flex: 1; }
}

/* ---------- Accessibility ---------- */
a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--mustard); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Dark mode ---------- */
:root[data-theme="dark"] {
  --cream: #1C1428;
  --plum: #F3DCA6;
  --plum-soft: #C9B6DE;
  --mustard: #E8B860;
  --mustard-soft: #3A2A4E;
  --ink: #F3ECF8;
  --mist: #2A2038;
  --white: #251B35;
  --grey: #A79AB5;
  --line: #3A2E4C;
}
:root[data-theme="dark"] .tool-card.featured { background: linear-gradient(135deg, #3A2A4E, #241A33); border-color: #4a3860; }
:root[data-theme="dark"] .home-feature { background: linear-gradient(135deg, #3A2A4E, #241A33); }
:root[data-theme="dark"] .logo-tiles .lt { box-shadow: 0 2px 0 rgba(0,0,0,.4); }
:root[data-theme="dark"] .word-chip, :root[data-theme="dark"] .letter-tile { box-shadow: none; }

@media (max-width: 560px) {
  .letter-tile { width: 38px; height: 38px; font-size: 17px; }
  .data-table { font-size: 13px; }
}
