:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;

  --success: #22c55e;
  --success-soft: #f0fdf4;

  --warning: #f59e0b;
  --warning-soft: #fffbeb;

  --danger: #ef4444;

  --text: #111827;
  --muted: #6b7280;

  --border: rgba(17, 24, 39, 0.10);

  --surface: #ffffff;
  --background: #f8fafc;

  --shadow:
    0 10px 30px rgba(15, 23, 42, 0.07);

  --radius: 14px;
}


/* ---------------------------------------------------------
   GLOBAL
--------------------------------------------------------- */

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  line-height: 1.55;
}

a {
  color: var(--primary);
}

button,
input,
select,
textarea {
  font: inherit;
}

.small-muted {
  color: var(--muted) !important;
}


/* ---------------------------------------------------------
   NAVBAR
--------------------------------------------------------- */

.site-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);

  min-height: 64px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;

  font-weight: 800;
  color: var(--text) !important;
  text-decoration: none;

  letter-spacing: -0.3px;
}

.brand-mark {
  width: 32px;
  height: 32px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 9px;

  background: var(--primary);
  color: #fff;

  font-weight: 900;
}

.site-navbar .nav-link {
  color: #374151;
  font-weight: 600;

  padding-left: 12px !important;
  padding-right: 12px !important;
}

.site-navbar .nav-link:hover {
  color: var(--primary);
}

.dropdown-menu {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 7px;
}

.dropdown-item {
  border-radius: 8px;
  padding: 8px 11px;
  font-weight: 600;
}


/* ---------------------------------------------------------
   MAIN
--------------------------------------------------------- */

.site-main {
  min-height: calc(100vh - 170px);
  padding: 28px 0 50px;
}


/* ---------------------------------------------------------
   HERO
--------------------------------------------------------- */

.hero {
  padding: 8px 0 20px;
}

.title {
  color: var(--text);
  font-weight: 850;
  letter-spacing: -0.7px;
  margin-bottom: 5px;
}

.hero .lead {
  color: var(--muted);
  margin-bottom: 0;
}


/* ---------------------------------------------------------
   CARDS
--------------------------------------------------------- */

.gen-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.gen-card .card-body {
  padding: 22px;
}

.tool-card {
  height: 100%;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    border-color 150ms ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 15px 35px rgba(15, 23, 42, 0.10);

  border-color: rgba(37, 99, 235, 0.20);
}

.tool-card-icon {
  width: 44px;
  height: 44px;

  border-radius: 12px;

  background: var(--primary-soft);
  color: var(--primary);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 20px;
  font-weight: 900;

  margin-bottom: 14px;
}

.tool-card h2 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.tool-card p {
  color: var(--muted);
  margin-bottom: 15px;
  font-size: .92rem;
}


/* ---------------------------------------------------------
   BUTTONS
--------------------------------------------------------- */

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary,
.clear-btn {
  font-weight: 700;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}


/* ---------------------------------------------------------
   FORMS
--------------------------------------------------------- */

.form-label {
  font-weight: 750;
  margin-bottom: 6px;
}

.form-control,
.form-select {
  border-color: rgba(17, 24, 39, .14);
  min-height: 42px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, .12);
}

textarea.form-control {
  min-height: 130px;
}


/* ---------------------------------------------------------
   SECTIONS
--------------------------------------------------------- */

.section-title {
  color: var(--primary);
  font-size: 1.05rem;
  font-weight: 850;
  margin-bottom: 5px;
}

.section-subtitle {
  color: var(--muted);
  font-size: .9rem;
}


/* ---------------------------------------------------------
   RESULTS
--------------------------------------------------------- */

.results-box {
  width: 100%;
}

.results-panel {
  margin-top: 20px;
}

.results-count {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 12px;
}

.result-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.result-word {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  padding: 8px 11px;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: #fff;

  text-decoration: none;
  color: var(--text);

  font-weight: 750;

  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.result-word:hover {
  background: var(--primary-soft);
  border-color: rgba(37, 99, 235, .25);
  color: var(--primary);
}

.result-score {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.definition {
  margin-top: 5px;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.4;
}


/* ---------------------------------------------------------
   ALERTS
--------------------------------------------------------- */

.tool-alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .9rem;
  font-weight: 600;
}

.tool-alert.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.tool-alert.success {
  background: var(--success-soft);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.tool-alert.info {
  background: var(--primary-soft);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}


/* ---------------------------------------------------------
   INSTRUCTIONS
--------------------------------------------------------- */

.instructions-card ul {
  padding-left: 20px;
}

.instructions-card li {
  margin-bottom: 7px;
}

.instructions-card hr {
  border-color: var(--border);
}


/* ---------------------------------------------------------
   UNSCRAMBLER
--------------------------------------------------------- */

.letter-input {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.pattern-help {
  font-size: .84rem;
  color: var(--muted);
}

.advanced-toggle {
  cursor: pointer;
  font-weight: 750;
  color: var(--primary);
  user-select: none;
}

.dictionary-select {
  max-width: 300px;
}


/* ---------------------------------------------------------
   WORDLE SOLVER
--------------------------------------------------------- */

.wordle-input-row {
  display: flex;
  gap: 5px;
}

.wordle-tile-input {
  width: 48px;
  height: 52px;

  border: 2px solid rgba(17, 24, 39, .14);
  border-radius: 8px;

  text-align: center;

  font-size: 1.3rem;
  font-weight: 900;

  text-transform: uppercase;

  background: #fff;
}

.wordle-tile-input:focus {
  outline: none;
  border-color: var(--primary);

  box-shadow:
    0 0 0 3px rgba(37, 99, 235, .10);
}

.wordle-tile-input.has-value.correct {
  color: #15803d;
}

.wordle-tile-input.has-value.present {
  color: #b45309;
}

.wordle-tile-input.has-value.absent {
  color: #6b7280;
}


/* ---------------------------------------------------------
   WORDQUEST
--------------------------------------------------------- */

.wordquest-board {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-start;
}

.wordquest-row {
  display: flex;
  gap: 6px;
}

.wordquest-cell {
  width: 48px;
  height: 48px;

  border-radius: 7px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(17, 24, 39, .10);

  background: #d1d5db;
  color: #111827;

  font-size: 1.2rem;
  font-weight: 900;

  text-transform: uppercase;
}

.wordquest-cell.correct {
  background: #22c55e;
  color: white;
}

.wordquest-cell.present {
  background: #fbbf24;
  color: #111827;
}

.wordquest-cell.absent {
  background: #d1d5db;
  color: #111827;
}


/* ---------------------------------------------------------
   SUDOKU
--------------------------------------------------------- */

.sudoku-wrap {
  max-width: 540px;
  margin: 0 auto;
}

.sudoku-grid {
  display: grid;

  grid-template-columns:
    repeat(9, minmax(0, 1fr));

  border: 3px solid #111827;

  background: #111827;
}

.sudoku-cell {
  aspect-ratio: 1;

  min-width: 0;

  border: 0;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;

  background: white;

  text-align: center;

  font-size: clamp(1rem, 4vw, 1.45rem);
  font-weight: 750;

  color: var(--text);
}

.sudoku-cell:focus {
  outline: none;
  background: #eff6ff;
}

.sudoku-cell.given {
  background: #f1f5f9;
  font-weight: 900;
}

.sudoku-cell.solved {
  color: var(--primary);
}

.sudoku-cell.invalid {
  background: #fee2e2;
  color: #991b1b;
}

.sudoku-cell:nth-child(3n) {
  border-right: 2px solid #111827;
}

.sudoku-cell:nth-child(9n) {
  border-right: 0;
}

/*
  Row separators after rows 3 and 6.
*/
.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 2px solid #111827;
}


/* ---------------------------------------------------------
   DICTIONARY
--------------------------------------------------------- */

.dictionary-word {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  letter-spacing: -1px;
  text-transform: lowercase;
}

.dictionary-source {
  display: inline-block;

  padding: 4px 8px;

  border-radius: 999px;

  background: var(--primary-soft);
  color: var(--primary);

  font-size: .75rem;
  font-weight: 800;

  text-transform: uppercase;
}

.definition-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}

.definition-item:last-child {
  border-bottom: 0;
}

.definition-pos {
  color: var(--primary);
  font-size: .85rem;
  font-weight: 850;
  margin-bottom: 4px;
}


/* ---------------------------------------------------------
   FOOTER
--------------------------------------------------------- */

.site-footer {
  background: #111827;
  color: #e5e7eb;
  padding: 34px 0 20px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 30px;
}

.footer-brand {
  font-weight: 850;
  margin-bottom: 8px;
}

.footer-heading {
  font-weight: 800;
  margin-bottom: 9px;
}

.site-footer a {
  display: block;
  color: #cbd5e1;
  text-decoration: none;
  margin-bottom: 5px;
  font-size: .9rem;
}

.site-footer a:hover {
  color: white;
}

.footer-bottom {
  margin-top: 28px;
  padding-top: 16px;

  border-top: 1px solid rgba(255,255,255,.10);

  display: flex;
  justify-content: space-between;
  gap: 20px;

  color: #94a3b8;
  font-size: .8rem;
}


/* ---------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------- */

@media (max-width: 991.98px) {

  .site-main {
    padding-top: 20px;
  }

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

  .footer-grid > div:first-child {
    grid-column: 1 / -1;
  }
}


@media (max-width: 575.98px) {

  .gen-card .card-body {
    padding: 17px;
  }

  .hero {
    padding-top: 3px;
  }

  .wordle-input-row {
    gap: 3px;
  }

  .wordle-tile-input {
    width: 43px;
    height: 48px;
  }

  .wordquest-cell {
    width: 43px;
    height: 43px;
  }

  .wordquest-row {
    gap: 4px;
  }

  .wordquest-board {
    align-items: center;
  }

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

  .footer-grid > div:first-child {
    grid-column: auto;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 4px;
  }
}
