:root {
  /* Upper bound for header / banner / grid width. Actual width is never wider than the viewport
     (minus horizontal padding), so raising this past ~your window width will not look wider. */
  --layout-max: 1330px;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #d5dde5;
  --text: #1a222c;
  --muted: #5c6b78;
  --accent: #0b6bcb;
  --accent-dim: #084f96;
  --danger: #c62828;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1419;
  --surface: #1a222c;
  --border: #2d3a47;
  --text: #e7edf3;
  --muted: #9aa7b2;
  --accent: #5eb8ff;
  --accent-dim: #3d89c9;
  --danger: #ff7a7a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

a:hover {
  color: var(--accent-dim);
}

.site-header,
.site-footer {
  width: min(100%, var(--layout-max));
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0;
}

.site-header {
  padding-right: 3.5rem;
}

.theme-toggle {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle__icon {
  display: block;
  pointer-events: none;
}

[data-theme="light"] .theme-toggle__icon--sun {
  display: none;
}

[data-theme="light"] .theme-toggle__icon--moon {
  display: block;
}

[data-theme="dark"] .theme-toggle__icon--moon {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--sun {
  display: block;
}

.site-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 650;
}

.site-header__download {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
  max-width: 100%;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.site-header__download strong {
  font-weight: 650;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 70ch;
}

.site-footer {
  padding: 2rem 1.25rem 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.banner {
  width: min(100%, var(--layout-max));
  max-width: var(--layout-max);
  margin: 1rem auto 0;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.banner--info {
  border-color: var(--accent-dim);
}

.banner--ok {
  border-color: #4caf50;
}

.banner--err {
  border-color: var(--danger);
  color: var(--danger);
}

.banner__text {
  font-size: 0.95rem;
}

/* Nine tool cards in row-major order; .card--full spans all columns. */
.grid {
  width: min(100%, var(--layout-max));
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 920px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .card--full {
    grid-column: 1 / -1;
  }
}

.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.15rem;
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.hint {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
  min-width: 0;
}

.btn-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.btn-row .btn {
  flex-shrink: 0;
}

.btn-row .field--check {
  margin-left: auto;
}

.field--check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
}

.field--check input {
  margin: 0;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.field-row {
  display: flex;
  flex-direction: row;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  align-items: stretch;
}

.field-row > .field {
  flex: 1 1 0;
  margin-bottom: 0;
  min-width: 0;
}

@media (max-width: 480px) {
  .field-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .field-row > .field {
    flex: none;
  }
}

textarea.input-numeric {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.45;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  min-height: 2.75rem;
  overflow-wrap: anywhere;
  word-break: break-all;
}

textarea.input-numeric:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

textarea.input-numeric::placeholder {
  color: var(--muted);
  opacity: 0.45;
}

.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  background: var(--accent);
  color: #0a0a0a;
}

[data-theme="light"] .btn {
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--ghost {
  margin-top: 0.5rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

.icons-def {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.out-shell {
  position: relative;
  margin-top: 0.75rem;
}

.out-shell--const {
  margin-top: 0;
}

.out-shell > .out {
  margin-top: 0;
  padding: 0.55rem 2.35rem 0.65rem 0.65rem;
  min-height: 3.5rem;
}

.out-copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
}

.out-copy:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.out-copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.out-copy:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.out-copy__icon {
  display: block;
  pointer-events: none;
}

.out {
  margin: 0.75rem 0 0;
  min-height: 3.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.mono {
  font-family: var(--mono);
}

.card--muted {
  opacity: 0.95;
}

.const-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.const-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 0.65rem;
  align-items: start;
  min-width: 0;
}

.const-item__name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--muted);
  padding-top: 0.35rem;
}

.const-item__val {
  font-size: 0.78rem;
  line-height: 1.4;
}

@media (max-width: 520px) {
  .const-item {
    grid-template-columns: 1fr;
  }
}
