/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #0f172a;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: #6aaa64; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* === Layout === */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; width: 100%; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 1.25rem; width: 100%; }

main { flex: 1; }

/* === Header === */
.site-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-size: 1.5rem;
  font-weight: 900;
  color: #6aaa64;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand:hover { opacity: 0.8; text-decoration: none; }
.nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.nav a {
  color: #475569;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.nav a:hover { color: #0f172a; text-decoration: none; }
.nav a.active { color: #6aaa64; }

/* === Hero === */
.hero {
  text-align: center;
  padding: 4rem 0 2.5rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}
.hero h1 .accent { color: #6aaa64; }
.hero p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: #64748b;
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

/* === Solver Tool === */
.solver { padding: 3rem 0; }
.mode-toggle {
  display: inline-flex;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  margin: 0 auto 2rem;
  position: relative;
}
.mode-toggle-wrap { display: flex; justify-content: center; }
.mode-btn {
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}
.mode-btn.active {
  background: #6aaa64;
  color: #fff;
}
.mode-btn:not(.active):hover { color: #0f172a; }

.tiles {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.tile {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  background: #e5e7eb;
  color: #94a3b8;
  transition: transform 0.2s, background-color 0.3s, color 0.3s;
  user-select: none;
}
.tile.has-letter {
  background: #787c7e;
  color: #fff;
  cursor: pointer;
}
.tile.has-letter:hover { transform: translateY(-2px); }
.tile.gray { background: #787c7e; color: #fff; }
.tile.yellow { background: #c9b458; color: #fff; }
.tile.green { background: #6aaa64; color: #fff; }
@media (min-width: 640px) {
  .tile { width: 84px; height: 84px; border-radius: 18px; font-size: 2.4rem; }
}

.input-wrap {
  max-width: 420px;
  margin: 1rem auto;
  position: relative;
}
.guess-input {
  width: 100%;
  padding: 1rem 1.5rem;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.guess-input::placeholder { color: #cbd5e1; letter-spacing: 0.1em; }
.guess-input:focus { border-color: #6aaa64; box-shadow: 0 0 0 4px rgba(106, 170, 100, 0.12); }


.guess-input.error { border-color: #ef4444; }
.error-msg {
  color: #ef4444;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  margin-top: 0.5rem;
  display: none;
}
.error-msg.visible { display: block; }

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: #64748b;
  margin: 1.5rem 0;
}
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-gray { background: #787c7e; }
.dot-yellow { background: #c9b458; }
.dot-green { background: #6aaa64; }

/* Results */
.results { margin-top: 1.5rem; }
.results-card {
  background: #c9b458;
  color: #fff;
  border-radius: 28px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: 0 8px 24px rgba(201, 180, 88, 0.2);
}
.results-title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}
.results-count {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
}
.results-empty {
  margin-top: 1rem;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  display: inline-block;
}
.matching-list {
  margin-top: 2rem;
  background: #fff;
  color: #0f172a;
  border-radius: 16px;
  padding: 1.25rem;
  text-align: left;
}
.matching-list h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.75rem;
}
.matching-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 250px;
  overflow-y: auto;
}
.word-chip {
  padding: 0.4rem 0.75rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Solution Mode card */
.solution-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 28px;
  padding: 2rem 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  margin-top: 1.5rem;
}
.solution-card h3 {
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.5rem;
}
.solution-card .sub {
  color: #64748b;
  text-align: center;
  font-size: 0.95rem;
  max-width: 420px;
  margin: 0 auto 1.5rem;
}
.guess-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}
.guess-pill {
  padding: 0.75rem 1.25rem;
  background: #6aaa64;
  color: #fff;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: transform 0.2s, filter 0.2s;
}
.guess-pill:hover { transform: translateY(-2px); filter: brightness(1.05); }

.all-words-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 28px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.all-words-card h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 1rem;
}
.all-words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.all-words-grid .word-chip {
  text-align: center;
  background: #f1f5f9;
  padding: 0.6rem 0.5rem;
}

.reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  background: #e2e8f0;
  color: #0f172a;
  border-radius: 12px;
  font-weight: 700;
  margin: 1.5rem auto 0;
  transition: filter 0.2s, transform 0.1s;
}
.reset-btn:hover { filter: brightness(0.95); }
.reset-btn:active { transform: scale(0.98); }
.reset-btn-wrap { text-align: center; }

.dict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: #64748b;
  margin: 2rem auto 0;
}
.dict-badge strong { color: #0f172a; }
.dict-badge .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.dict-badge-wrap { text-align: center; }

.hidden { display: none !important; }

/* === Generic content sections === */
.section { padding: 4rem 0; }
.section h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  text-align: center;
}
.section .lead {
  color: #64748b;
  text-align: center;
  max-width: 560px;
  margin: 0 auto 3rem;
  font-size: 1.05rem;
}
.steps { display: flex; flex-direction: column; gap: 3rem; }
.step {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}
@media (min-width: 768px) {
  .step { flex-direction: row; }
  .step.reverse { flex-direction: row-reverse; }
}
.step > div { flex: 1; }
.step-num {
  display: inline-flex;
  width: 48px;
  height: 48px;
  background: rgba(106, 170, 100, 0.1);
  color: #6aaa64;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-bottom: 1rem;
}
.step h3 { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.75rem; }
.step p { color: #64748b; }
.step-visual {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 2rem;
  display: flex;
  justify-content: center;
}
.mini-tiles { display: flex; gap: 0.4rem; }
.mini-tile {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #787c7e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
}
.mini-tile.yellow { background: #c9b458; }
.mini-tile.green { background: #6aaa64; }

/* Bento features */
.bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .bento { grid-template-columns: 2fr 1fr; }
}
.bento-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 28px;
  padding: 2rem;
}
.bento-card.accent { background: #c9b458; color: #fff; border-color: #c9b458; }
.bento-card.accent p { color: rgba(255,255,255,0.85); }
.bento-card.full { grid-column: 1 / -1; background: #475569; color: #fff; display: flex; gap: 1.5rem; align-items: center; flex-direction: column; }
.bento-card.full p { color: rgba(255,255,255,0.85); max-width: 600px; }
@media (min-width: 768px) { .bento-card.full { flex-direction: row; } }
.bento-card h3 { font-size: 1.4rem; font-weight: 800; margin: 1rem 0 0.5rem; }
.bento-card p { color: #64748b; line-height: 1.6; }
.bento-icon {
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  font-size: 1.4rem;
}

/* Quick-link buttons row */
.link-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 0;
  border-top: 1px solid #e2e8f0;
  margin-top: 2rem;
}
.link-btn {
  padding: 0.75rem 1.25rem;
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
}
.link-btn:hover { background: #e2e8f0; text-decoration: none; }

/* === Article / legal content === */
.article-page { padding: 3rem 0; }
.article-page h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.article-page > p.lead-para {
  font-size: 1.2rem;
  color: #64748b;
  margin-bottom: 3rem;
  line-height: 1.6;
}
.article-page h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 2.5rem 0 1rem;
}
.article-page h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}
.article-page p {
  margin-bottom: 1rem;
  color: #1f2937;
}
.article-page ul, .article-page ol {
  margin: 1rem 0 1rem 1.25rem;
  color: #1f2937;
}
.article-page li { margin-bottom: 0.5rem; }
.callout {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.callout-danger {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
  display: flex;
  gap: 1rem;
}
.callout-danger .icon { font-size: 1.5rem; }
.callout-danger h3 { color: #b91c1c; margin: 0 0 0.5rem; }
.callout-danger p { margin: 0; }

/* FAQ accordion */
.faq-list { display: flex; flex-direction: column; gap: 0.75rem; }
.faq-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.faq-item summary {
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "▾";
  color: #94a3b8;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item p { color: #475569; margin-top: 0.75rem; }

/* Contact form */
.form-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.form-row { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 640px) { .form-row.two { grid-template-columns: 1fr 1fr; } }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font: inherit;
  color: #0f172a;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: #6aaa64;
  box-shadow: 0 0 0 3px rgba(106, 170, 100, 0.12);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: #6aaa64;
  color: #fff;
  border-radius: 12px;
  font-weight: 800;
  width: 100%;
  transition: filter 0.2s, transform 0.1s;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.form-success {
  background: #ecfdf5;
  border: 1px solid #6aaa64;
  color: #166534;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 1.25rem;
}
.form-error-box {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 1.25rem;
}
.field-error {
  display: block;
  margin-top: 0.35rem;
  color: #b91c1c;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 1.1em;
}
[aria-invalid="true"] { border-color: #ef4444 !important; }
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  z-index: 100;
  animation: toast-in 0.3s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* === Footer === */
.site-footer {
  background: #fff;
  border-top: 1px solid #e2e8f0;
  margin-top: 4rem;
  padding: 3rem 0 1.5rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-col h4 {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0f172a;
  margin-bottom: 1rem;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.65rem; }
.footer-col a {
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}
.footer-col a:hover { color: #6aaa64; text-decoration: none; }
.footer-col p { font-size: 0.9rem; color: #64748b; }
.footer-bottom {
  border-top: 1px solid #e2e8f0;
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* Scrollbar polish */
.matching-words::-webkit-scrollbar,
.all-words-grid::-webkit-scrollbar { width: 6px; }
.matching-words::-webkit-scrollbar-thumb,
.all-words-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
