:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #17283b;
  --muted: #43566b;
  --paper: #f5f8fc;
  --surface: #ffffff;
  --line: #c5d1df;
  --accent: #0758a8;
  --accent-dark: #06477f;
  --soft: #e8f1fa;
  --notice: #18344d;
  --notice-link: #bce3ff;
  --warning-bg: #fff3cd;
  --warning-ink: #493500;
  --focus: #8a4b00;
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e7eef7;
    --muted: #b7c5d5;
    --paper: #101923;
    --surface: #182534;
    --line: #3a4d61;
    --accent: #2879bd;
    --accent-dark: #b9dcff;
    --soft: #24394e;
    --notice: #0c1722;
    --notice-link: #bce3ff;
    --warning-bg: #423719;
    --warning-ink: #ffe9a6;
    --focus: #ffc66d;
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7eef7;
  --muted: #b7c5d5;
  --paper: #101923;
  --surface: #182534;
  --line: #3a4d61;
  --accent: #2879bd;
  --accent-dark: #b9dcff;
  --soft: #24394e;
  --notice: #0c1722;
  --notice-link: #bce3ff;
  --warning-bg: #423719;
  --warning-ink: #ffe9a6;
  --focus: #ffc66d;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.65;
}

a {
  color: var(--accent-dark);
  text-underline-offset: 0.18em;
}

a:hover {
  color: #032f5a;
}

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

button,
input,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  z-index: 10;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.7rem 1rem;
  transform: translateY(-160%);
  border-radius: 0.5rem;
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.header-inner,
.page,
.footer-inner {
  width: min(100% - 2rem, 1100px);
  margin-inline: auto;
}

.header-inner {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 2rem;
  height: 2rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 1rem;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 600;
  text-decoration: none;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.theme-toggle {
  min-height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.35rem 0.65rem;
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--soft);
}

.page {
  padding-block: clamp(2.5rem, 7vw, 5rem);
}

.hero {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin: 0 auto 1rem;
  font-size: clamp(2.25rem, 6vw, 4.4rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.lead {
  max-width: 650px;
  margin: 0 auto 1.6rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  min-height: 2.85rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px solid var(--accent);
  border-radius: 0.65rem;
  padding: 0.65rem 1.05rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
}

.button-secondary {
  background: var(--surface);
  color: var(--accent-dark);
}

.button-secondary:hover {
  background: var(--soft);
  color: var(--accent-dark);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
}

.tools-section {
  margin-top: clamp(3rem, 8vw, 5.5rem);
}

.section-heading {
  max-width: 700px;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.section-heading h2 {
  margin-bottom: 0.55rem;
}

.section-heading > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
  gap: 1rem;
}

.card,
.content-card,
.tool-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 26px rgb(23 40 59 / 5%);
}

.ad-slot {
  display: grid;
  width: min(100%, 1100px);
  min-height: 5rem;
  place-items: center;
  margin: 1.5rem auto;
  border: 1px dashed var(--line);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.ad-slot:not(.is-loaded) {
  display: none !important;
}

.ad-slot.is-loaded {
  display: grid;
}

.ad-slot-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tool-results {
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 1rem;
  background: var(--paper);
}

.diff-output {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.diff-added {
  border-radius: 0.2rem;
  background: #e6f4ea;
  color: #14532d;
}

.diff-removed {
  border-radius: 0.2rem;
  background: #fde8e8;
  color: #8b1e1e;
  text-decoration: line-through;
}

.diff-unchanged {
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .diff-added {
    background: #1d3b2a;
    color: #bde8c9;
  }

  :root:not([data-theme="light"]) .diff-removed {
    background: #512b2b;
    color: #ffc1c1;
  }
}

html[data-theme="dark"] .diff-added {
  background: #1d3b2a;
  color: #bde8c9;
}

html[data-theme="dark"] .diff-removed {
  background: #512b2b;
  color: #ffc1c1;
}

.course-list {
  display: grid;
  gap: 0.75rem;
  margin-block: 1rem;
}

.course-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7rem, 0.45fr) minmax(8rem, 0.55fr) auto;
  align-items: end;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.85rem;
}

.course-row .field {
  margin: 0;
}

.course-row button {
  min-height: 2.9rem;
}

.preference-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block: 1rem;
}

.preference-status {
  min-height: 1.6em;
  color: var(--muted);
  font-weight: 650;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  padding: 0;
  list-style: none;
}

.card {
  padding: 1.25rem;
}

.card h2 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.card p {
  margin-bottom: 0;
  color: var(--muted);
}

.tool-link-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.tool-link-card:hover {
  transform: translateY(-3px);
  border-color: #7d9bb8;
  box-shadow: 0 12px 30px rgb(23 40 59 / 10%);
  color: var(--ink);
}

.tool-icon {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  margin-bottom: 1rem;
  border-radius: 0.75rem;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 1.05rem;
  font-weight: 800;
}

.tool-link-card h3 {
  margin-bottom: 0.35rem;
  font-size: 1.15rem;
}

.tool-link-card p {
  margin-bottom: 1rem;
  color: var(--muted);
}

.card-link {
  margin-top: auto;
  color: var(--accent-dark);
  font-weight: 750;
}

.content-card {
  max-width: 820px;
  margin-inline: auto;
  padding: clamp(1.25rem, 4vw, 2.25rem);
}

.content-card h1 {
  margin-inline: 0;
  font-size: clamp(2rem, 5vw, 3rem);
}

.content-card h2 {
  margin-top: 2rem;
  font-size: 1.25rem;
}

.content-card p,
.content-card li {
  color: var(--muted);
}

.content-card li + li {
  margin-top: 0.4rem;
}

.draft-note {
  margin: 0 0 1.5rem;
  border: 1px solid #9a6b00;
  border-radius: 0.65rem;
  padding: 0.9rem 1rem;
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.tool-card {
  width: min(100%, 760px);
  margin: 2.5rem auto 0;
  padding: clamp(1.2rem, 4vw, 2rem);
}

.tool-card h2 {
  margin-bottom: 0.45rem;
}

.tool-intro,
.field-hint {
  color: var(--muted);
}

.field {
  margin-block: 1rem;
}

.field label,
.fieldset-label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 2.9rem;
  border: 1px solid #70849a;
  border-radius: 0.55rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  color: var(--ink);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: var(--accent);
}

.wide-tool-card {
  width: min(100%, 960px);
}

.text-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.text-area {
  display: block;
  width: 100%;
  min-height: 15rem;
  resize: vertical;
  line-height: 1.5;
}

.code-area {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.93rem;
  tab-size: 2;
}

.writing-area {
  min-height: 17rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tool-status {
  min-height: 1.6em;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-weight: 650;
}

.tool-status.status-error {
  color: #9c1f1f;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.8rem 1rem;
  background: var(--paper);
}

.stat-card dt {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.stat-card dd {
  margin: 0.15rem 0 0;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.25;
}

.converter-card {
  width: min(100%, 780px);
}

.converter-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.result-field input {
  font-weight: 750;
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.25rem;
  margin-block: 0.8rem 1rem;
}

fieldset {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.6rem 1rem 0.9rem;
}

legend {
  padding-inline: 0.35rem;
}

.choice,
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.choice input,
.check-row input {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
}

.check-row {
  margin-block: 1.25rem;
  color: var(--ink);
}

.check-row label {
  display: inline;
}

.form-error {
  min-height: 1.5em;
  margin: 0.75rem 0;
  color: #9c1f1f;
  font-weight: 650;
}

.qr-output {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  text-align: center;
}

.qr-output[hidden] {
  display: none;
}

.qr-image {
  width: min(100%, 320px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #fff;
  image-rendering: pixelated;
}

.image-output {
  display: grid;
  justify-items: start;
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.image-output[hidden] {
  display: none;
}

.image-preview {
  width: auto;
  max-width: 100%;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #fff;
  object-fit: contain;
}

.jwt-output {
  min-height: 2rem;
  overflow-x: auto;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 0.8rem;
  background: var(--paper);
  color: var(--ink);
  white-space: pre-wrap;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.footer-links a {
  color: var(--muted);
  font-weight: 600;
}

.cookie-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem max(1rem, calc((100% - 1100px) / 2));
  background: var(--notice);
  color: #fff;
}

.cookie-notice p {
  margin: 0;
  font-size: 0.92rem;
}

.cookie-notice a {
  color: var(--notice-link);
  font-weight: 700;
}

.cookie-notice button {
  min-height: 2.5rem;
  flex: 0 0 auto;
  border: 1px solid #fff;
  border-radius: 0.45rem;
  padding: 0.4rem 0.75rem;
  background: transparent;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.cookie-notice button:hover {
  background: #fff;
  color: var(--notice);
}

.cookie-notice[hidden] {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 700px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.6rem;
    padding-block: 0.85rem;
  }

  .site-nav {
    justify-content: flex-start;
    gap: 0.25rem 0.9rem;
  }

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

  .text-columns,
  .converter-fields {
    grid-template-columns: 1fr;
  }

  .course-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .preference-actions {
    gap: 0.65rem;
  }

  .preference-actions .button {
    width: 100%;
  }

  .cookie-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions .button {
    width: 100%;
  }

  .action-row .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
