@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&family=Nunito+Sans:wght@400;500;600;700&family=Shadows+Into+Light&display=swap");

:root {
  --bg: #f9fbff;
  --bg-soft: rgba(244, 249, 255, 0.95);
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: rgba(255, 255, 255, 0.99);
  --line: rgba(36, 82, 154, 0.08);
  --line-strong: rgba(36, 82, 154, 0.16);
  --text: #173f7a;
  --muted: #4f6f97;
  --accent: #2f7fda;
  --accent-strong: #4e9ef1;
  --success: #18a957;
  --shadow: 0 14px 30px rgba(43, 69, 112, 0.18);
  --shadow-soft: 0 8px 18px rgba(43, 69, 112, 0.14);
  --radius: 24px;
  --radius-sm: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Nunito Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 42%, rgba(182, 214, 249, 0.85), transparent 21%),
    radial-gradient(circle at 82% 36%, rgba(205, 228, 255, 0.9), transparent 24%),
    radial-gradient(circle at 60% 74%, rgba(226, 240, 255, 0.75), transparent 25%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 44%, #eff6ff 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 18% 34%, rgba(174, 207, 245, 0.35), transparent 0 32%),
    radial-gradient(circle at 78% 30%, rgba(190, 221, 255, 0.28), transparent 0 26%);
  pointer-events: none;
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  margin-bottom: 14px;
}

.topbar-outer {
  margin-bottom: 14px;
  padding: 0 4px;
  width: 100%;
}

.site-title {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  font-family: "Montserrat", ui-sans-serif, system-ui, sans-serif;
}

.site-title-word {
  color: #2B4570;
}

.site-title-utilities {
  color: #000000;
}

.site-subtitle {
  margin: 6px 0 0;
  font-size: 1.4rem;
  font-weight: 600 !important;
  letter-spacing: -0.04em;
  color: var(--muted);
}

.hero,
.panel {
  border: 1px solid rgba(200, 220, 247, 0.75);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero {
  padding: 2px 28px 4px;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -70px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: none;
  pointer-events: none;
}

.topbar,
.hero-content,
.section-heading,
.tool-layout,
.field-grid,
.form-actions,
.results-header,
.utility-card-header,
.mini-form,
.mini-actions,
.strategy-grid,
.stats-grid {
  display: flex;
}

.topbar,
.section-heading,
.results-header,
.utility-card-header {
  justify-content: space-between;
  align-items: center;
}

.topbar {
  justify-content: flex-start;
  width: 100%;
}

.brand,
.hero-actions,
.hero-points,
.metric-card,
.field,
.results-panel,
.utility-card,
.strategy-grid article {
  display: flex;
  flex-direction: column;
}

.brand {
  flex-direction: row;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(91, 124, 255, 0.28);
}

.brand-name,
.brand-tag,
.eyebrow,
.section-kicker,
.metric-label,
.metric-value,
.helper-text,
.badge,
.chip,
.mini-output,
.field span,
.results-group-label,
.stat-label,
.stat-value {
  margin: 0;
}

.field span {
  font-weight: 600;
  color: #21487f;
}

.brand-name {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
}

.brand-tag,
.hero-text,
.section-heading p,
.helper-text,
.utility-card p,
.strategy-grid p,
#results-summary,
.mini-output,
.muted {
  color: var(--muted);
}

.brand-tag {
  margin-top: 4px;
  font-size: 1rem;
}

.topbar-links {
  display: flex;
  gap: 10px 12px;
  flex-wrap: wrap;
  row-gap: 8px;
  align-items: center;
  width: 100%;
}

.topbar-links a {
  color: #456992;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(208, 225, 245, 0.7);
  opacity: 1;
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.topbar-links a:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(47, 127, 218, 0.18);
  transform: translateY(-1px);
}

.hero-content {
  margin-top: 34px;
  gap: 28px;
  align-items: stretch;
}

.hero-copy {
  flex: 1.4;
}

.hero-panel {
  flex: 0.8;
  display: grid;
  gap: 16px;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid rgba(47, 127, 218, 0.18);
  border-radius: 999px;
  color: #235da8;
  background: rgba(78, 158, 241, 0.1);
  font-size: 0.88rem;
  font-weight: 600;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
  font-family: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  color: #2B4570;
}

h1 {
  margin-top: 18px;
  max-width: none;
  font-size: clamp(3.6rem, 5vw, 5.6rem);
  line-height: 0.94;
  white-space: nowrap;
}

.home-hero-title {
  max-width: 16ch;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.98;
  white-space: normal;
}

.home-hero-title + .hero-text {
  padding-top: 10px;
  font-size: 1.3rem;
  line-height: 1.45;
}

.hero-text {
  margin-top: 12px;
  max-width: 54ch;
  font-size: 1.04rem;
  line-height: 1.5;
}

.hero-actions {
  margin-top: 24px;
  flex-direction: row;
  gap: 14px;
}

.hero-points {
  margin: 22px 0 0;
  padding-left: 18px;
  gap: 8px;
  color: #29548f;
}

.metric-card,
.results-panel,
.utility-card,
.strategy-grid article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(241, 247, 255, 0.97));
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.results-panel {
  border-radius: 6px;
  padding-top: 5px;
}

.metric-card:hover,
.utility-card:hover,
.strategy-grid article:hover,
.results-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(58, 103, 179, 0.15);
  border-color: rgba(47, 127, 218, 0.18);
}

.metric-value {
  margin-top: 8px;
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 800;
  color: #203252;
}

.panel {
  margin-top: 24px;
  padding: 28px;
  border-radius: 6px;
}

.hero-compact {
  padding-bottom: 22px;
}

.tool-page .hero {
  background: #2B4570;
  border-color: #2B4570;
}

.page-title {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1;
}

.tool-page .page-title {
  color: #ffffff;
}

.tool-page-hero {
  margin-top: 28px;
}

.tool-page .tool-page-hero .hero-text {
  color: #d9dee2;
  max-width: none;
}

.page-intro {
  margin-top: 24px;
}

.home-tools-merged {
  margin-top: 16px;
  padding-top: 0;
  padding-bottom: 0;
  border-top: 0;
}

.badge,
.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(78, 158, 241, 0.11);
  color: #205ea9;
  border: 1px solid rgba(47, 127, 218, 0.18);
  font-size: 0.84rem;
  font-weight: 700;
}

.tool-layout {
  gap: 22px;
  align-items: flex-start;
}

.tool-layout-stacked {
  flex-direction: column;
  align-items: stretch;
}

.tool-form,
.results-panel {
  min-width: 0;
}

.tool-form {
  flex: 1;
  width: 100%;
}

.results-panel {
  flex: 1;
}

.results-panel-fullwidth {
  width: 100%;
  margin-top: 4px;
  padding: 22px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.results-panel-fullwidth:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

.instructions-panel {
  width: 100%;
  margin-top: 20px;
  padding: 20px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.instructions-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #203252;
}

.instructions-copy {
  margin-top: 14px;
}

.instructions-copy h2 {
  margin: 22px 0 8px;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #203252;
}

.instructions-copy h3 {
  margin: 18px 0 6px;
  font-size: 1.05rem;
  color: #2B4570;
}

.instructions-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.instructions-copy p + p {
  margin-top: 10px;
}

.privacy-copy p + p,
.privacy-copy h2 + p,
.privacy-copy p + ul,
.privacy-copy ul + p {
  margin-top: 10px;
}

.privacy-copy ul {
  margin: 10px 0 0 20px;
  padding: 0;
  color: var(--muted);
  line-height: 1.6;
}

.privacy-copy li + li {
  margin-top: 6px;
}

.privacy-copy a {
  color: #2B4570;
  text-decoration: none;
}

.results-panel-lowered {
  margin-top: 42px;
}

.field {
  gap: 10px;
}

.field-wide {
  margin-top: 18px;
}

#unscrambler-form > .field-wide,
#unscrambler-form > .advanced-toggle {
  width: min(50%, 560px);
}

#unscrambler-form > .field-wide {
  margin-top: 0;
  padding-top: 10px;
}

.password-length-field,
.password-options-toggle,
.password-form-actions,
.word-counter-field {
  width: min(50%, 560px);
}

.password-options-intro {
  width: min(50%, 560px);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.password-length-field {
  gap: 6px;
  padding-top: 10px;
}

.word-counter-field {
  width: 100%;
  padding-top: 10px;
}

.anagram-form {
  display: grid;
  gap: 8px;
}

.anagram-input-field,
.anagram-form-actions {
  width: min(50%, 560px);
}

.anagram-form-actions {
  margin-top: 8px;
}

.picker-button {
  width: 124px;
  white-space: nowrap;
}

.picker-result-group {
  max-width: 420px;
}

.picker-selected-word {
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.2;
  color: #203252;
  text-align: center;
  word-break: break-word;
}

.crossword-form {
  display: grid;
  gap: 8px;
}

.crossword-field,
.crossword-form-actions {
  width: min(50%, 560px);
}

.crossword-field {
  padding-top: 10px;
}

.crossword-form-actions {
  margin-top: 4px;
}

#crossword-pattern-input {
  text-transform: uppercase;
}

.scrabble-max-form {
  display: grid;
  gap: 8px;
}

.scrabble-max-top-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  width: min(100%, 1140px);
  padding-top: 10px;
}

.scrabble-max-form > .advanced-toggle,
.scrabble-max-form > .scrabble-max-options-helper,
.scrabble-max-form > .form-actions,
#scrabble-max-options {
  width: min(50%, 560px);
}

.scrabble-max-rules,
.scrabble-max-options-helper {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-soft);
}

.scrabble-max-rules {
  width: min(100%, 1140px);
}

.scrabble-max-options-helper {
  position: relative;
  top: -2px;
}

.scrabble-max-actions {
  margin-top: 8px;
}

.scrabble-max-input {
  text-transform: uppercase;
}

.scrabble-score-result .scrabble-tile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px;
}

.scrabble-tile {
  position: relative;
  width: 86px;
  min-height: 86px;
  border: 1px solid rgba(186, 125, 53, 0.55);
  border-radius: 12px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.22) 8%, rgba(255, 255, 255, 0) 12%, rgba(255, 255, 255, 0.16) 18%, rgba(255, 255, 255, 0) 24%, rgba(255, 255, 255, 0.14) 30%, rgba(255, 255, 255, 0) 37%, rgba(255, 255, 255, 0.12) 44%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(180deg, #ffd89a 0%, #ffd08a 42%, #f6bf74 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px 10px;
  overflow: hidden;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -4px 10px rgba(171, 102, 26, 0.26),
    0 10px 18px rgba(137, 92, 31, 0.18);
}

.scrabble-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    repeating-linear-gradient(100deg,
      rgba(201, 131, 44, 0.04) 0 18px,
      rgba(255, 228, 178, 0.18) 18px 30px,
      rgba(201, 131, 44, 0.03) 30px 48px);
  opacity: 0.9;
  pointer-events: none;
}

.scrabble-tile::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 10px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.scrabble-tile-letter {
  position: relative;
  z-index: 1;
  font-family: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  font-size: 3.3rem;
  font-weight: 700;
  line-height: 1;
  color: #000000;
  transform: translateY(-4px);
}

.scrabble-tile-score {
  position: absolute;
  right: 7px;
  bottom: 4px;
  z-index: 1;
  font-size: 1rem;
  font-weight: 700;
  color: #000000;
}

#scrabble-score-input {
  text-transform: uppercase;
}

.scrabble-score-message {
  font-size: 1.05rem;
}

.scrabble-max-group-body {
  display: grid;
  gap: 14px;
  padding: 12px;
}

.scrabble-max-word {
  display: grid;
  gap: 8px;
}

.scrabble-max-word + .scrabble-max-word {
  padding-top: 14px;
  border-top: 1px solid var(--line-strong);
}

.scrabble-max-tile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scrabble-max-tile-list .scrabble-tile {
  width: 58px;
  min-height: 58px;
  padding: 10px 8px 8px;
  border-radius: 10px;
}

.scrabble-max-tile-list .scrabble-tile::after {
  left: 6px;
  right: 6px;
  top: 7px;
  height: 14px;
}

.scrabble-max-tile-list .scrabble-tile-letter {
  font-size: 2.2rem;
  transform: translateY(-2px);
}

.scrabble-max-tile-list .scrabble-tile-score {
  right: 5px;
  bottom: 3px;
  font-size: 0.78rem;
}

.scrabble-max-word-meta {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-soft);
}

.password-length-field .mini-form {
  flex-direction: row;
  gap: 0;
}

.password-length-field .helper-text {
  margin-top: 4px;
}

.field-grid {
  margin-top: 18px;
  gap: 16px;
  flex-wrap: wrap;
}

.field-grid .field {
  flex: 1 1 220px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.98);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}

textarea {
  resize: vertical;
  min-height: 124px;
}

.select-with-arrow {
  position: relative;
}

.select-with-arrow select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  background-image: none;
}

.select-with-arrow .select-arrow {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(47, 127, 218, 0.42);
  box-shadow: 0 0 0 4px rgba(78, 158, 241, 0.11);
}

.advanced-toggle,
.button {
  border: 0;
  cursor: pointer;
}

.advanced-toggle {
  width: 100%;
  margin-top: 18px;
  min-height: 52px;
  padding: 14px 38px 14px 16px;
  display: block;
  position: relative;
  text-align: left;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
  font-weight: 400;
  transform: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.advanced-toggle.password-options-toggle {
  width: 100%;
  margin-top: 0;
}

.password-options-intro {
  margin-top: 10px;
}

.password-options-helper {
  margin-top: 0;
  position: relative;
  top: -4px;
  line-height: 1.3;
  font-size: 0.9rem;
}

#password-options {
  width: min(50%, 560px);
  margin-top: 4px;
}

.password-form-actions {
  margin-top: 6px;
}

#password-output {
  margin-top: 12px;
}

.password-output-row {
  width: min(50%, 560px);
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.password-output-input {
  flex: 1;
  height: 48px;
  font-size: 1.1rem;
  font-weight: 700;
}

#password-copy {
  min-width: 96px;
  min-height: 48px;
  height: 48px;
  color: #ffffff;
  background: #2B4570;
  box-shadow: 0 6px 16px rgba(43, 69, 112, 0.18);
  align-self: stretch;
  position: relative;
  top: 11px;
}

.advanced-arrow {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #2B4570;
  border-bottom: 2px solid #2B4570;
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.18s ease;
}

.advanced-toggle[aria-expanded="true"] .advanced-arrow {
  transform: translateY(-35%) rotate(225deg);
}

.advanced-options {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #f8fbff;
  box-shadow: var(--shadow-soft);
}

.advanced-options .field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.advanced-options .field-grid .field-wide {
  grid-column: 1 / -1;
  margin-top: 0;
}

.password-options-list {
  display: grid;
  gap: 10px;
}

.password-option,
.toggle-option {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.4;
  cursor: pointer;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  border-radius: 999px;
  background: #d7e2f2;
  border: 1px solid #c6d6ec;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(25, 52, 97, 0.18);
  transition: transform 0.18s ease;
}

.toggle-input:checked + .toggle-switch {
  background: #2B4570;
  border-color: #2B4570;
}

.toggle-input:checked + .toggle-switch::after {
  transform: translateX(18px);
}

.toggle-input:focus-visible + .toggle-switch {
  box-shadow: 0 0 0 4px rgba(43, 69, 112, 0.14);
}

.form-actions {
  margin-top: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-secondary:hover,
.button-ghost:hover,
.advanced-toggle:hover {
  border-color: rgba(47, 127, 218, 0.28);
}

.advanced-toggle:focus-visible {
  border-color: rgba(47, 127, 218, 0.42);
  box-shadow: 0 0 0 4px rgba(78, 158, 241, 0.11);
  outline: none;
}

.button-primary {
  color: white;
  background: #2B4570;
  box-shadow: 0 6px 16px rgba(43, 69, 112, 0.18);
}

.button-secondary {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(248, 251, 255, 1));
  border: 1px solid var(--line-strong);
  box-shadow: 0 4px 12px rgba(78, 126, 202, 0.1);
}

.button-ghost {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
  border: 1px dashed var(--line-strong);
}

.small {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.92rem;
}

.helper-text {
  margin-top: 14px;
  font-size: 0.92rem;
}

.results-header {
  gap: 18px;
}

.results-groups {
  margin-top: 0;
  display: grid;
  gap: 14px;
}

.results-summary {
  margin: 0 0 18px;
}

.result-group {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(250, 252, 255, 1), rgba(246, 249, 255, 1));
  border: 1px solid var(--line);
}

.results-group-label {
  color: #1f4b85;
  font-size: 0.95rem;
  font-weight: 700;
}

.result-chip-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.unscrambler-result-group {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.unscrambler-result-header {
  padding: 6px 12px;
  background: #eef5ff;
  border-bottom: 1px solid rgba(47, 127, 218, 0.18);
}

.unscrambler-result-header .results-group-label {
  color: #1f4b85;
  font-size: 1.1rem;
}

.unscrambler-result-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.unscrambler-result-body {
  width: 100%;
  margin-top: 0;
  padding: 12px 14px 14px;
}

.result-chip {
  padding: 8px 12px;
  border-radius: 5px;
  background: transparent;
  border: 1px solid rgba(47, 127, 218, 0.18);
  font-weight: 600;
  color: #20518d;
}

.utility-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tool-card-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 30px !important;
  padding-bottom: 30px;
}

.home-tools-spacer {
  height: 30px;
}

.tool-card-link {
  color: inherit;
  text-decoration: none;
}

.tool-card-link .utility-card {
  min-height: 100%;
}

.utility-card {
  gap: 14px;
}

.no-min-height {
  min-height: auto;
}

.utility-card textarea,
.utility-card input {
  background: rgba(250, 252, 255, 0.96);
}

.mini-form,
.mini-actions {
  gap: 10px;
}

.sorter-form {
  display: grid;
  gap: 4px;
}

.sorter-form .form-actions {
  margin-top: 8px;
}

.sorter-form + .field.field-wide {
  margin-top: 6px;
}

.sorter-copy-actions {
  margin-top: 8px;
  justify-content: flex-start;
}

#word-sorter-copy {
  width: 132px;
  white-space: nowrap;
}

.sorter-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  align-items: end;
}

.sorter-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: fit-content;
  min-height: 52px;
  padding-bottom: 2px;
}

#word-sorter-input,
#word-sorter-output {
  min-height: 220px;
}

.mini-form {
  align-items: center;
}

.mini-form input {
  flex: 1;
}

.mini-actions {
  flex-wrap: wrap;
}

.mini-output {
  min-height: 24px;
  line-height: 1.7;
}

.crossword-results-group {
  display: grid;
  gap: 12px;
}

.crossword-results-list {
  display: grid;
  gap: 12px;
}

.crossword-result-word {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 2px 0;
}

.crossword-cell {
  position: relative;
  width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #000000;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 254, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  color: #2454a4;
  text-transform: uppercase;
  user-select: none;
}

.crossword-cell + .crossword-cell {
  margin-left: -2px;
}

.crossword-cell-letter {
  font-family: "Shadows Into Light", "Nunito Sans", cursive;
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1;
  color: #2454a4;
}

.crossword-cell-number {
  position: absolute;
  top: 3px;
  left: 4px;
  font-family: "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  color: #2454a4;
}

.stats-grid {
  margin-top: 4px;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-card {
  min-width: 120px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(252, 253, 255, 0.92);
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-value {
  margin-top: 6px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #203252;
}

.strategy-grid {
  margin-top: 22px;
  gap: 18px;
}

.strategy-grid article {
  flex: 1;
}

.content-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.content-single {
  grid-template-columns: 1fr;
}

.site-footer {
  margin-top: 10px;
  padding-top: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  text-align: center;
}

body:not(.tool-page) .site-footer {
  margin-top: 10px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.site-footer a:hover {
  color: #2B4570;
  text-decoration: underline;
}

.tool-page .hero.hero-compact {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding-bottom: 14px;
}

.tool-page .tool-page-hero {
  margin-top: 18px;
}

.tool-page .content-grid.content-single {
  margin-top: 0;
}

.tool-page .single-tool-panel.panel,
.tool-page .content-single > .panel:first-child {
  margin-top: 3px;
  border-top: 0;
  border-top: 3px solid #2B4570;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  padding-top: 10px;
}

.sidebar-stack {
  display: grid;
  gap: 24px;
}

.sidebar-card h3 {
  margin-bottom: 14px;
}

.related-links {
  display: grid;
  gap: 10px;
}

.related-links a {
  color: #27406d;
  text-decoration: none;
  font-weight: 600;
}

.related-links a:hover {
  color: var(--accent);
}

.single-tool-panel .utility-card {
  min-height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#password-generate,
#password-reset {
  min-width: 0;
}

.password-generator-card {
  gap: 8px;
}

.single-tool-panel .utility-card:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

@media (max-width: 960px) {
  .hero-content,
  .tool-layout,
  .strategy-grid,
  .mini-form {
    flex-direction: column;
  }

  .results-panel-lowered {
    margin-top: 0;
  }

  .utility-grid,
  .tool-card-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .sorter-field-grid {
    grid-template-columns: 1fr;
  }

  .advanced-options .field-grid {
    grid-template-columns: 1fr;
  }

  #unscrambler-form > .field-wide,
  #unscrambler-form > .advanced-toggle {
    width: 100%;
  }

  .password-length-field,
  .password-options-intro,
  .password-form-actions,
  .password-output-row,
  .word-counter-field,
  .anagram-input-field,
  .anagram-form-actions,
  .crossword-field,
  .crossword-form-actions,
  .scrabble-max-form > .advanced-toggle,
  .scrabble-max-form > .scrabble-max-options-helper,
  .scrabble-max-form > .form-actions,
  #scrabble-max-options {
    width: 100%;
  }

  #password-options {
    width: 100%;
  }

  .scrabble-max-top-grid {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .content-grid {
    gap: 18px;
  }

  .sidebar-stack {
    order: 2;
  }

  .single-tool-panel {
    order: 1;
  }

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 10px;
  }

  .hero,
  .panel {
    padding: 20px;
    border-radius: 18px;
  }

  .topbar-links,
  .hero-actions,
  .section-heading,
  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-links {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 8px;
  }

  .topbar-links a {
    width: auto;
    text-align: center;
  }

  h1 {
    max-width: none;
    font-size: 0.98rem;
    letter-spacing: -0.05em;
    white-space: nowrap;
  }

  .home-hero-title {
    max-width: 16ch;
    font-size: clamp(1.9rem, 8vw, 2.6rem);
    letter-spacing: -0.04em;
    white-space: normal;
  }

  .home-hero-title + .hero-text {
    padding-top: 8px;
    line-height: 1.4;
  }

  .tool-card-grid {
    grid-template-columns: 1fr;
  }
}
