:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #eefaf7;
  --text: #132238;
  --muted: #667085;
  --line: #d6dde8;
  --primary: #13b89d;
  --primary-strong: #07977f;
  --accent: #2764d8;
  --danger: #c24141;
  --shadow: 0 20px 55px rgba(18, 34, 56, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Arial, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px max(20px, calc((100vw - 1080px) / 2));
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  min-width: 44px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}

.top-nav {
  display: flex;
  gap: 20px;
}

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

.top-nav a:hover {
  color: var(--primary-strong);
}

main {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  align-items: end;
  min-height: 180px;
  padding: 34px 0 24px;
}

.hero-copy {
  max-width: 100%;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  line-height: 1.18;
}

h1 {
  max-width: 100%;
  font-size: 40px;
  white-space: nowrap;
}

h2 {
  font-size: 28px;
}

.intro {
  max-width: 100%;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.content-section {
  margin-bottom: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-shell {
  margin-bottom: 28px;
  padding: 24px 28px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.unit-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.unit-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.field-row,
.result-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.field-label {
  min-width: 120px;
  color: #4b5563;
  font-weight: 600;
}

.input-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #667085;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--line);
  background: #f6f8fb;
  color: var(--text);
}

.icon-button svg,
.primary-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  padding: 14px 18px;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  outline: none;
  background: #fff;
  color: #111827;
  font-size: 20px;
}

textarea:focus {
  box-shadow: 0 0 0 4px rgba(19, 184, 157, 0.16);
}

#numberInput {
  height: 72px;
}

#resultText {
  height: 92px;
  min-height: 92px;
}

.hint {
  min-height: 20px;
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.hint.error,
.status.error {
  color: var(--danger);
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 6px 0 20px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 168px;
  min-height: 48px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(19, 184, 157, 0.26);
}

.primary-button:hover {
  background: var(--primary-strong);
}

.status {
  min-width: 130px;
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 600;
}

.result-toolbar {
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0;
}

.case-tabs {
  display: flex;
  flex: 1;
  justify-content: flex-end;
  gap: 8px;
  min-width: 320px;
}

.case-button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  padding: 7px 10px;
  white-space: nowrap;
}

.case-button:hover,
.case-button.active {
  border-color: rgba(39, 100, 216, 0.25);
  background: #eef4ff;
}

.copy {
  margin-left: 2px;
}

.examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.examples div {
  display: grid;
  gap: 4px;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.examples strong {
  font-size: 18px;
  font-weight: 600;
}

.examples span,
.prose p,
.faq p {
  color: var(--muted);
}

.prose p {
  margin: 14px 0 0;
}

.faq details {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

.faq details:first-of-type {
  margin-top: 14px;
}

.faq summary {
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.faq p {
  margin: 8px 0 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1080px, calc(100% - 32px));
  margin: 20px auto 0;
  padding: 28px 0 36px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 14px;
}

@media (max-width: 760px) {
  .site-header {
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
  }

  .brand {
    gap: 8px;
    font-size: 15px;
  }

  .brand-mark {
    min-width: 38px;
    height: 30px;
    font-size: 12px;
  }

  .top-nav {
    gap: 14px;
    font-size: 13px;
  }

  main {
    width: min(100% - 20px, 1080px);
  }

  .hero {
    min-height: auto;
    padding: 24px 0 14px;
  }

  .eyebrow,
  .section-kicker {
    margin-bottom: 5px;
    font-size: 12px;
  }

  h1 {
    font-size: 27px;
    white-space: normal;
  }

  h2 {
    font-size: 24px;
  }

  .intro {
    margin-top: 10px;
    font-size: 15px;
    line-height: 1.55;
  }

  .tool-shell,
  .content-section {
    margin-bottom: 18px;
    padding: 14px;
  }

  .tool-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .field-row {
    display: grid;
    gap: 8px;
  }

  .unit-toggle {
    margin-left: auto;
  }

  .unit-toggle label {
    gap: 6px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .unit-toggle input {
    width: 16px;
    height: 16px;
  }

  .field-label {
    min-width: 0;
    font-size: 14px;
  }

  .input-actions {
    margin-left: 0;
    gap: 4px;
  }

  textarea {
    min-height: 58px;
    padding: 12px;
    font-size: 16px;
  }

  #numberInput {
    height: 64px;
  }

  #resultText {
    height: 86px;
    min-height: 86px;
  }

  .hint {
    margin: 5px 0 10px;
    font-size: 12px;
    line-height: 1.45;
  }

  .controls {
    display: grid;
    justify-items: stretch;
    margin: 4px 0 14px;
  }

  .primary-button {
    width: 100%;
    min-height: 44px;
    font-size: 15px;
  }

  .status {
    min-width: 0;
    text-align: center;
  }

  .result-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .case-tabs {
    grid-column: 1 / -1;
    justify-content: flex-start;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .case-button {
    padding: 6px 9px;
    font-size: 12px;
  }

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

  .site-footer {
    display: grid;
  }
}

@media (max-width: 480px) {
  .site-header {
    display: grid;
  }

  .brand {
    white-space: normal;
  }

  .top-nav {
    width: 100%;
    justify-content: space-between;
  }

  h1 {
    font-size: 25px;
  }
}
