/* ============================================================
   CODEWORD SOLVER — Design System & Styles
   ============================================================ */

/* --- Design Tokens --- */
:root {
  /* Colors — Dark Mode (default) */
  --bg-primary: #0a0a14;
  --bg-secondary: #0f0f1e;
  --bg-card: rgba(18, 18, 35, 0.85);
  --bg-card-hover: rgba(25, 25, 50, 0.9);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.08);
  --bg-result: rgba(255, 255, 255, 0.04);
  --bg-result-hover: rgba(255, 255, 255, 0.08);

  --text-primary: #f0f0f5;
  --text-secondary: #9898b0;
  --text-muted: #747494;
  --text-inverse: #0a0a14;

  --accent-1: #6c5ce7;
  --accent-2: #a855f7;
  --accent-3: #06b6d4;
  --gradient-primary: linear-gradient(135deg, #6c5ce7 0%, #a855f7 50%, #06b6d4 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(168, 85, 247, 0.1));

  --border-color: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(108, 92, 231, 0.5);
  --border-input: rgba(255, 255, 255, 0.1);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

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

  /* Known letter */
  --known-bg: rgba(6, 182, 212, 0.15);
  --known-border: rgba(6, 182, 212, 0.5);
  --known-text: #22d3ee;

  /* Unknown letter */
  --unknown-bg: rgba(255, 255, 255, 0.05);
  --unknown-border: rgba(255, 255, 255, 0.15);
  --unknown-text: #9898b0;

  /* Repeated letter */
  --repeat-bg: rgba(168, 85, 247, 0.15);
  --repeat-border: rgba(168, 85, 247, 0.5);
  --repeat-text: #c084fc;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(108, 92, 231, 0.3);
  color: #fff;
}

code {
  font-family: var(--font-mono);
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-2);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  font-weight: 500;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Animated Background --- */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: blobFloat 20s ease-in-out infinite;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.3), transparent);
  top: -10%;
  right: -10%;
  animation-delay: 0s;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.2), transparent);
  bottom: 10%;
  left: -5%;
  animation-delay: -7s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.2), transparent);
  top: 50%;
  right: 20%;
  animation-delay: -14s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.1); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 30px) scale(1.05); }
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(10, 10, 20, 0.7);
  border-bottom: 1px solid var(--border-color);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-accent {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--text-primary);
  background: rgba(108, 92, 231, 0.12);
}

/* --- Hero Section --- */
.hero {
  padding: 60px 0 40px;
}

.hero-content {
  text-align: center;
  margin-bottom: 40px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- Solver Card (Glassmorphism) --- */
.solver-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 0;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
  transition: box-shadow 0.4s ease;
}

.solver-card:focus-within {
  box-shadow: var(--shadow-lg), 0 0 60px rgba(108, 92, 231, 0.2);
}

/* --- Mode Tabs --- */
.mode-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}

.mode-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform 0.3s var(--ease-out-expo);
}

.mode-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.mode-tab.active {
  color: var(--text-primary);
}

.mode-tab.active::after {
  transform: scaleX(1);
}

/* --- Tab Panels --- */
.tab-panel {
  padding: 28px 28px 0;
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeSlideIn 0.35s var(--ease-out-expo);
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* --- Input Section --- */
.input-section {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

/* --- Letter Boxes --- */
.letter-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.letter-box {
  width: 46px;
  height: 52px;
  border: 2px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  transition: all 0.2s ease;
  caret-color: var(--accent-2);
}

.letter-box::placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.letter-box:focus {
  border-color: var(--accent-1);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
  transform: translateY(-2px);
}

/* Dynamic coloring based on content */
.letter-box.has-letter {
  border-color: var(--known-border);
  background: var(--known-bg);
  color: var(--known-text);
}

.letter-box.has-wildcard {
  border-color: var(--unknown-border);
  background: var(--unknown-bg);
  color: var(--unknown-text);
}

.letter-box.has-number {
  border-color: var(--repeat-border);
  background: var(--repeat-bg);
  color: var(--repeat-text);
}

.input-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  transform: scale(1.05);
}

.btn-ghost {
  padding: 8px 16px;
  font-size: 0.8rem;
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-primary {
  padding: 12px 28px;
  font-size: 0.95rem;
  background: var(--gradient-primary);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(108, 92, 231, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* --- Options Row --- */
.options-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px 28px;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.select-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.custom-select select {
  appearance: none;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 10px 36px 10px 14px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%239898b0' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.custom-select select:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.custom-select select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* --- Results Area --- */
.results-area {
  padding: 0 28px 28px;
  animation: fadeSlideIn 0.4s var(--ease-out-expo);
}

.results-area[hidden] {
  display: none;
}

.results-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.results-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.results-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.results-grid::-webkit-scrollbar {
  width: 6px;
}

.results-grid::-webkit-scrollbar-track {
  background: transparent;
}

.results-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.result-word {
  padding: 10px 14px;
  background: var(--bg-result);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  color: var(--text-primary);
  cursor: default;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.result-word:hover {
  background: var(--bg-result-hover);
  border-color: var(--accent-1);
  transform: translateY(-1px);
}

/* Multi-word result pairs */
.result-pair {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-result);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.result-pair:hover {
  background: var(--bg-result-hover);
  border-color: var(--accent-1);
}

.result-pair .word {
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.result-pair .separator {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* No results */
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.no-results-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.no-results h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* --- Loading --- */
.loading {
  text-align: center;
  padding: 40px 28px;
}

.loading[hidden] {
  display: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(108, 92, 231, 0.2);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Examples Section --- */
.examples-section {
  padding: 80px 0;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 48px;
  font-size: 1rem;
  line-height: 1.7;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.example-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  transition: all 0.3s ease;
}

.example-card:hover {
  border-color: rgba(108, 92, 231, 0.3);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.example-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--gradient-subtle);
  color: var(--accent-2);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 20px;
  margin-bottom: 20px;
  border: 1px solid rgba(168, 85, 247, 0.15);
}

.example-pattern {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.char {
  width: 36px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid;
}

.char.known {
  background: var(--known-bg);
  border-color: var(--known-border);
  color: var(--known-text);
}

.char.unknown {
  background: var(--unknown-bg);
  border-color: var(--unknown-border);
  color: var(--unknown-text);
}

.char.repeat {
  background: var(--repeat-bg);
  border-color: var(--repeat-border);
  color: var(--repeat-text);
}

.example-arrow {
  font-size: 1.4rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.example-result {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-3);
  margin-bottom: 14px;
}

.example-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Legend --- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid;
  flex-shrink: 0;
}

.known-bg {
  background: var(--known-bg);
  border-color: var(--known-border);
}

.unknown-bg {
  background: var(--unknown-bg);
  border-color: var(--unknown-border);
}

.repeat-bg {
  background: var(--repeat-bg);
  border-color: var(--repeat-border);
}

/* --- Features Section --- */
.features-section {
  padding: 0 0 80px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.feature-card {
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.feature-card:hover {
  border-color: rgba(108, 92, 231, 0.3);
  transform: translateY(-3px);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 14px;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 24px 0;
  margin-top: 40px;
}

.footer-bottom {
  text-align: center;
}

.footer-bottom p {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-inline-links {
  display: inline-flex;
  gap: 16px;
  align-items: center;
}

.footer-inline-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-inline-links a:hover {
  color: var(--text-primary);
}

/* --- Content Sections (SEO / AdSense) --- */
.content-section {
  padding: 40px 0 60px;
}

.content-block {
  margin-bottom: 48px;
}

.content-block .section-title {
  font-size: 1.5rem;
  text-align: left;
  margin-bottom: 20px;
}

.content-block p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 16px;
}

.content-list {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  padding-left: 24px;
  margin-bottom: 16px;
}

.content-list li {
  margin-bottom: 10px;
}

.content-list li strong {
  color: var(--text-primary);
}

/* --- FAQ --- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.faq-item[open] {
  border-color: rgba(108, 92, 231, 0.3);
}

.faq-item summary {
  padding: 18px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.2s ease;
}

.faq-item summary:hover {
  background: rgba(255, 255, 255, 0.02);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  content: '−';
  color: var(--accent-2);
}

.faq-item p {
  padding: 0 24px 18px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0;
}

/* --- Legal Pages --- */
.legal-section {
  padding: 60px 0 80px;
}

.legal-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.legal-updated {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.legal-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 36px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.legal-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.legal-content p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.8;
  margin-bottom: 14px;
}

.legal-content ul,
.legal-content ol {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.8;
  padding-left: 24px;
  margin-bottom: 14px;
}

.legal-content li {
  margin-bottom: 6px;
}

.legal-content a {
  color: var(--accent-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.legal-content a:hover {
  color: var(--accent-2);
}

/* --- Contact Form --- */
.contact-form {
  margin-top: 32px;
  margin-bottom: 40px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.form-group select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%239898b0' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-group select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-submit {
  min-width: 200px;
}

.contact-note {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.contact-note h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.contact-note p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .site-header .container {
    height: auto;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 5px 10px;
  }

  .hero {
    padding: 40px 0 24px;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .tab-panel {
    padding: 20px 16px 0;
  }

  .letter-box {
    width: 40px;
    height: 46px;
    font-size: 1.1rem;
  }

  .options-row {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 16px 20px;
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .results-area {
    padding: 0 16px 20px;
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }

  .examples-grid {
    grid-template-columns: 1fr;
  }

  .legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-title {
    font-size: 1.5rem;
  }

  .legal-section {
    padding: 40px 0 60px;
  }
}

@media (max-width: 400px) {
  .letter-box {
    width: 34px;
    height: 42px;
    font-size: 1rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Animations for result items --- */
@keyframes resultPop {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.result-word, .result-pair {
  animation: resultPop 0.3s var(--ease-spring) backwards;
}


