:root {
  color-scheme: light;
  --ink: #17191d;
  --muted: #626873;
  --surface: #ffffff;
  --canvas: #f4f5f7;
  --line: #dfe2e7;
  --accent: #0b6bcb;
  --accent-soft: #eaf4ff;
  --success: #16734a;
  --success-soft: #ebf7f0;
  --focus: #ffbf47;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
textarea {
  font: inherit;
}

.site-header,
main,
footer {
  width: min(calc(100% - 32px), 820px);
  margin-inline: auto;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  font-size: 0.9rem;
}

.version {
  color: var(--muted);
  font-size: 0.8rem;
}

main {
  padding-block: 56px 72px;
}

.intro {
  max-width: 620px;
}

.category {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.08;
}

.intro > p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.privacy-note {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding: 16px;
  border: 1px solid #b9dfca;
  border-radius: 6px;
  background: var(--success-soft);
}

.privacy-icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-weight: 700;
}

.privacy-note strong {
  color: #105d3c;
}

.privacy-note div {
  min-width: 0;
}

.privacy-note p {
  margin: 4px 0 0;
  color: #35624e;
  font-size: 0.9rem;
  line-height: 1.45;
}

.tool,
.tool-list {
  min-width: 0;
  margin-top: 24px;
}

.tool {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(23, 25, 29, 0.06);
}

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

.tool-list a {
  display: block;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.tool-list strong,
.tool-list span {
  display: block;
}

.tool-list span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.tool-heading,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tool-heading {
  margin-bottom: 10px;
}

.tool-heading label {
  font-weight: 700;
}

.action-row {
  flex-wrap: wrap;
  margin-top: 16px;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #aeb4bd;
  background: #f7f8f9;
}

button:disabled {
  color: #9a9fa8;
  cursor: not-allowed;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.primary-button:hover:not(:disabled) {
  background: #095eaf;
}

textarea {
  width: 100%;
  min-width: 0;
  min-height: 260px;
  resize: vertical;
  padding: 16px;
  border: 1px solid #bfc4cc;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  line-height: 1.6;
}

textarea::placeholder {
  color: #858b94;
}

textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.limit-note,
.status-message {
  color: var(--muted);
  font-size: 0.78rem;
}

.limit-note {
  margin: 8px 0 0;
  text-align: right;
}

.status-message {
  min-height: 1.3em;
  margin: 0;
}

.results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.result {
  min-width: 0;
  padding: 16px;
  background: #f8f9fa;
}

.result span,
.result strong {
  display: block;
}

.result span {
  min-height: 2.4em;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.result strong {
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 1.5rem;
}

.result-primary {
  background: var(--accent-soft);
}

.result-primary strong {
  color: var(--accent);
}

.output-block {
  margin-top: 24px;
}

.output-block label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-block: 24px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

footer a {
  color: inherit;
}

@media (max-width: 640px) {
  .site-header,
  main,
  footer {
    width: min(calc(100% - 24px), 820px);
  }

  main {
    padding-block: 36px 48px;
  }

  .tool {
    padding: 16px;
  }

  textarea {
    min-height: 220px;
  }

  .results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
