* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  width: 100%;
}

body {
  color: #1d2433;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.3), transparent 30rem),
    radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.28), transparent 28rem),
    linear-gradient(135deg, #f8fbff 0%, #edf8f4 44%, #fff3dd 100%);
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease;
  width: 100%;
}

.site {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
}

header {
  background:
    linear-gradient(135deg, rgba(21, 32, 51, 0.96), rgba(15, 82, 91, 0.96)),
    #152033;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(21, 32, 51, 0.16);
  margin-bottom: 22px;
  padding: 18px;
}

.header-top {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand {
  color: #ffffff;
  display: inline-block;
  font-size: 26px;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-decoration: none;
}

nav {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 900px;
}

nav a {
  align-items: center;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  color: #edf7ff;
  display: flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  line-height: 1.2;
  min-height: 44px;
  overflow-wrap: anywhere;
  padding: 7px 12px;
  text-decoration: none;
}

nav a:hover,
nav a:focus {
  background: #ffffff;
  color: #152033;
}

main {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(132, 151, 176, 0.28);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(48, 65, 90, 0.12);
  padding: 28px;
}

.hero {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.78), transparent 11rem),
    linear-gradient(135deg, #bae6fd 0%, #bbf7d0 48%, #fde68a 100%);
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 14px;
  margin: -8px -8px 22px;
  padding: 26px;
}

h1 {
  color: #111827;
  font-size: 38px;
  line-height: 1.15;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

h2 {
  color: #172033;
  font-size: 23px;
  line-height: 1.25;
  margin: 26px 0 9px;
  overflow-wrap: anywhere;
}

h3 {
  color: #172033;
  font-size: 18px;
  line-height: 1.3;
  margin: 12px 0 6px;
}

p {
  margin: 0 0 12px;
}

.intro {
  color: #3f4f63;
  font-size: 17px;
  margin-left: auto;
  margin-right: auto;
  max-width: 760px;
}

.compact-copy p,
.compact-copy li,
.example-box p,
.faq p {
  font-size: 15px;
}

ol,
ul {
  margin-top: 8px;
  padding-left: 22px;
  text-align: left;
}

.feature-pair {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}

.feature-card {
  background: linear-gradient(180deg, #ffffff, #f0fdfa);
  border: 1px solid #bdeee8;
  border-radius: 14px;
  padding: 18px;
}

.feature-card:nth-child(2) {
  background: linear-gradient(180deg, #ffffff, #fff7ed);
  border-color: #fed7aa;
}

.feature-card h2 {
  margin-top: 0;
}

.tool-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}

.tool-grid a {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid #d8e4f2;
  border-left: 5px solid #14b8a6;
  border-radius: 12px;
  color: #111827;
  display: block;
  min-height: 100%;
  padding: 16px;
  text-decoration: none;
}

.tool-grid li:nth-child(2n) a {
  border-left-color: #f59e0b;
}

.tool-grid li:nth-child(3n) a {
  border-left-color: #3b82f6;
}

.tool-grid a:hover,
.tool-grid a:focus {
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.13);
  transform: translateY(-1px);
}

.tool-grid strong {
  display: block;
  font-size: 18px;
  margin-bottom: 5px;
}

.tool-grid span {
  color: #52606d;
  display: block;
  font-size: 14px;
}

.ad-slot {
  background: #f7fafc;
  border: 1px dashed #aebbd0;
  border-radius: 10px;
  margin: 20px 0;
  min-height: 90px;
}

.solver {
  background: linear-gradient(135deg, #111827, #155e75 54%, #0f766e);
  border-radius: 14px;
  box-shadow: 0 16px 34px rgba(21, 32, 51, 0.18);
  color: #ffffff;
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 18px;
}

label {
  display: block;
  font-weight: 800;
}

input {
  -webkit-appearance: none;
  appearance: none;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 17px;
  line-height: 1.25;
  padding: 13px;
  min-width: 0;
  width: 100%;
}

input:focus {
  border-color: #67e8f9;
  outline: none;
}

.controls {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
}

button {
  -webkit-appearance: none;
  appearance: none;
  background: #f59e0b;
  border: 0;
  border-radius: 10px;
  color: #111827;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  min-height: 44px;
  padding: 13px 20px;
  touch-action: manipulation;
}

.theme-toggle {
  background: #ffffff;
  color: #152033;
  min-width: 120px;
}

.theme-toggle:hover,
.theme-toggle:focus {
  background: #ccfbf1;
}

button:hover,
button:focus {
  background: #fbbf24;
}

.hint {
  color: #dbeafe;
  font-size: 14px;
  margin: 0;
}

.etymology-tool {
  background: linear-gradient(135deg, #f8fafc, #ecfeff);
  border: 1px solid #bae6fd;
  border-radius: 14px;
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 18px;
}

.etymology-tool label {
  color: #172033;
}

.etymology-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
}

.results-summary {
  color: #48576b;
  font-weight: 700;
  margin-top: 16px;
}

#results,
#tool-results,
.etymology-result {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

#results li,
#tool-results li,
.etymology-result li {
  background: #ecfeff;
  border: 1px solid #bae6fd;
  border-radius: 14px;
  color: #164e63;
  padding: 12px;
  text-align: center;
}

#results strong,
#tool-results strong,
.etymology-result strong {
  display: block;
  font-size: 18px;
  margin-bottom: 5px;
}

#results span,
#tool-results span,
.etymology-result span {
  color: #475569;
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.etymology-link {
  background: #ffffff;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  color: #0f766e;
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-top: 8px;
  min-height: 40px;
  padding: 9px 10px;
  text-decoration: none;
  touch-action: manipulation;
  width: 100%;
}

.etymology-link:hover,
.etymology-link:focus {
  background: #ccfbf1;
  color: #134e4a;
  text-decoration: none;
}

.example-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 14px 0;
}

.example-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 14px;
}

.example-box:nth-child(2n) {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.faq {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
}

.faq h3,
.example-box h3 {
  margin-top: 0;
}

footer {
  color: #52606d;
  font-size: 14px;
  padding: 20px 0;
  text-align: center;
}

footer a {
  color: #0f766e;
  font-weight: 700;
  margin: 0 6px;
}

.legal-page {
  margin-left: auto;
  margin-right: auto;
  max-width: 780px;
}

.legal-page ul {
  display: inline-block;
}

body.dark-mode {
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.22), transparent 30rem),
    radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.16), transparent 28rem),
    linear-gradient(135deg, #08111f 0%, #0f202d 50%, #1f2937 100%);
  color: #e5edf7;
}

body.dark-mode main {
  background: rgba(15, 23, 42, 0.94);
  border-color: rgba(148, 163, 184, 0.22);
}

body.dark-mode .hero {
  background: linear-gradient(135deg, #0f766e 0%, #1e3a8a 58%, #78350f 100%);
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
  color: #f8fafc;
}

body.dark-mode .intro,
body.dark-mode .results-summary,
body.dark-mode footer {
  color: #cbd5e1;
}

body.dark-mode .feature-card,
body.dark-mode .faq,
body.dark-mode .example-box,
body.dark-mode .tool-grid a {
  background: #111827;
  border-color: #334155;
  color: #f8fafc;
}

body.dark-mode .tool-grid span,
body.dark-mode .faq p,
body.dark-mode .example-box p {
  color: #cbd5e1;
}

body.dark-mode #results li,
body.dark-mode .etymology-result li {
  background: #164e63;
  border-color: #0891b2;
  color: #ecfeff;
}

body.dark-mode #results span,
body.dark-mode .etymology-result span {
  color: #dbeafe;
}

body.dark-mode .etymology-link {
  background: #0f172a;
  border-color: #0f766e;
  color: #99f6e4;
}

body.dark-mode .etymology-link:hover,
body.dark-mode .etymology-link:focus {
  background: #134e4a;
  color: #ccfbf1;
}

body.dark-mode .etymology-tool {
  background: #111827;
  border-color: #334155;
}

body.dark-mode .etymology-tool label {
  color: #f8fafc;
}

@media (max-width: 640px) {
  .site {
    padding: 12px;
  }

  header,
  main {
    border-radius: 12px;
  }

  main {
    padding: 18px;
  }

  .hero {
    margin: 0 0 18px;
    padding: 20px;
  }

  h1 {
    font-size: 30px;
  }

  .header-top {
    align-items: stretch;
    flex-direction: column;
  }

  nav {
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  nav a {
    font-size: 12px;
    min-height: 48px;
    padding: 7px 6px;
  }

  .feature-pair {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .etymology-controls {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .site {
    padding: 10px;
  }

  header {
    padding: 14px;
  }

  main {
    padding: 16px;
  }

  .brand {
    font-size: 23px;
  }

  nav {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 21px;
  }

  .hero {
    padding: 18px;
  }

  #results,
  #tool-results,
  .etymology-result {
    grid-template-columns: 1fr;
  }
}

#tool-results {
  margin-top: 14px;
}

.related-tools {
  margin-bottom: 8px;
}


.content-guide {
  margin-top: 26px;
  text-align: left;
}

.content-guide p {
  color: #344256;
  margin-left: auto;
  margin-right: auto;
  max-width: 850px;
}

.content-guide strong {
  color: #111827;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-template-columns: none;
  justify-content: center;
  margin: 0 auto 8px;
  max-width: none;
}

.footer-links a {
  background: transparent;
  border: 0;
  color: #0f766e;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  min-height: auto;
  padding: 2px 6px;
  text-decoration: underline;
}

.footer-links a:hover,
.footer-links a:focus {
  background: transparent;
  color: #134e4a;
}

body.dark-mode .content-guide p {
  color: #d5e0ef;
}

body.dark-mode .content-guide strong {
  color: #ffffff;
}

body.dark-mode .footer-links a {
  color: #99f6e4;
}
