/* Readability layer: scalable type, stronger contrast and reflow-friendly controls. */
:root {
  font-size: 100%;
}

:root[data-font-size="large"] {
  font-size: 112.5%;
}

:root[data-font-size="xlarge"] {
  font-size: 125%;
}

body {
  --muted: #4d625a;
  color: #1b3935;
  font-size: 1rem;
  line-height: 1.8;
  letter-spacing: .01em;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
input,
textarea,
select {
  font-size: 1rem;
  line-height: 1.55;
}

input,
select,
textarea {
  min-height: 2.875rem;
  padding: .65rem .8rem;
  border-color: #b8ccc1;
}

textarea {
  line-height: 1.8;
}

input::placeholder,
textarea::placeholder {
  color: #5f7269;
  opacity: 1;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  min-height: 0;
  flex: 0 0 1.25rem;
  margin-top: .18rem;
}

h1 {
  font-size: 1.875rem;
  line-height: 1.45;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.55;
}

h3 {
  font-size: 1.125rem;
}

.app-header {
  gap: 1.5rem;
  min-height: 7.5rem;
  padding: .75rem 2.25rem;
}

.version,
.save-state {
  font-size: .75rem;
  line-height: 1.7;
  color: var(--muted);
}

.document-info label {
  font-size: .875rem;
  line-height: 1.55;
}

.document-info label span {
  color: var(--muted);
}

.document-info input {
  min-height: 2.75rem;
  padding: .55rem .75rem;
  font-size: 1.0625rem;
}

.font-size-control {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex: 0 0 auto;
  padding: .3rem;
  border: 1px solid #c9d9d0;
  border-radius: .65rem;
  background: #f7faf8;
}

.font-size-label {
  padding: 0 .35rem 0 .45rem;
  color: #435850;
  font-size: .8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.font-size-option {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: .4rem .55rem;
  border: 1px solid transparent;
  border-radius: .45rem;
  background: transparent;
  color: #40564e;
  font-size: .875rem;
  font-weight: 700;
}

.font-size-option:hover {
  background: #e7f3ed;
}

.font-size-option[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.font-size-option:focus-visible {
  outline: 3px solid #38b4b3;
  outline-offset: 2px;
}

.icon-btn {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1rem;
}

.toolbar {
  padding: .75rem 2.25rem;
}

.btn {
  min-height: 2.75rem;
  padding: .55rem 1rem;
  font-size: 1rem;
  line-height: 1.55;
}

.btn.small {
  min-height: 2.5rem;
  padding: .45rem .75rem;
  font-size: .875rem;
}

.text-btn {
  min-height: 2.25rem;
  padding: .3rem .4rem;
  font-size: .875rem;
}

.number-badge {
  font-size: .75rem;
}

.local-note {
  color: var(--muted);
  font-size: .8125rem;
}

.app-layout {
  grid-template-columns: 16.875rem minmax(0, 1fr);
}

.sidebar {
  padding: 2rem 1.25rem 1.25rem 1.5rem;
}

.nav-caption {
  margin-bottom: 1.25rem;
  color: var(--muted);
  font-size: .8125rem;
  letter-spacing: .08em;
}

.step {
  gap: .7rem;
  padding: .8rem .65rem;
  color: #4d6259;
}

.step .step-num {
  width: 2rem;
  height: 2rem;
  flex-basis: 2rem;
  font-size: .8125rem;
}

.step .step-label {
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.55;
}

.step .step-sub {
  margin-top: .1rem;
  font-size: .75rem;
  line-height: 1.6;
}

.sidebar-note strong {
  font-size: 1.0625rem;
}

.sidebar-note p {
  font-size: .875rem;
  color: var(--muted);
}

.sidebar-bottom,
.sidebar-bottom span {
  color: #596d64;
  font-size: .75rem;
}

main {
  padding: 2rem;
}

.eyebrow {
  font-size: .75rem;
  letter-spacing: .12em;
}

.page-description {
  margin-top: .5rem;
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.8;
}

.step-meter {
  font-size: .875rem;
}

.step-meter strong {
  font-size: 1.5rem;
}

.content-layout {
  grid-template-columns: minmax(0, 1fr) 17.625rem;
  gap: 1.5rem;
}

.card {
  padding: 1.625rem;
}

.card-desc {
  margin-top: .4rem;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.8;
}

.optional,
.required,
.tag {
  font-size: .75rem;
  line-height: 1.7;
}

.optional {
  color: #465a51;
}

.purpose-card {
  min-height: 7.25rem;
  padding: 1.125rem 1rem;
}

.purpose-card.selected {
  padding: calc(1.125rem - 1px) calc(1rem - 1px);
}

.purpose-text strong {
  font-size: 1rem;
  line-height: 1.6;
}

.purpose-text span {
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.75;
}

.field-title,
.helper-heading,
.length-caption {
  font-size: .9375rem;
  font-weight: 700;
}

.field-hint,
.field small {
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.8;
}

.check {
  gap: .6rem;
  font-size: .9375rem;
  line-height: 1.75;
}

.check.prominent {
  padding: 1rem;
  font-size: 1rem;
}

.chips {
  gap: .6rem;
}

.chip {
  min-height: 2.5rem;
  padding: .45rem .7rem;
  font-size: .875rem;
  line-height: 1.55;
}

.chip input {
  width: 1.125rem;
  height: 1.125rem;
  flex-basis: 1.125rem;
}

.radio-card {
  min-width: 9.5rem;
  min-height: 3.5rem;
  align-items: flex-start;
  padding: .75rem;
  font-size: .9375rem;
  line-height: 1.6;
}

.radio-card small {
  margin-top: .15rem;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.65;
}

.details summary {
  min-height: 2.5rem;
  padding: .3rem 0;
  font-size: .9375rem;
  line-height: 1.7;
}

.hint-box {
  padding: .9rem 1rem;
  color: #3f5b4b;
  font-size: .9375rem;
  line-height: 1.85;
}

.small {
  font-size: .875rem;
}

.summary-title {
  padding: 1.125rem;
  font-size: 1rem;
  line-height: 1.6;
}

.summary-row dt {
  color: var(--muted);
  font-size: .75rem;
}

.summary-row dd {
  font-size: .9375rem;
}

.summary-inner .tag {
  font-size: .75rem;
}

.checkline {
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.7;
}

.summary-note {
  color: var(--muted);
  font-size: .8125rem;
}

.workspace-note {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.8;
}

.empty {
  font-size: .9375rem;
}

.empty strong {
  font-size: 1.0625rem;
}

.candidate,
.replacement input {
  font-size: .9375rem;
}

.candidate {
  line-height: 1.7;
}

.tab {
  min-height: 2.875rem;
  color: #4c6157;
  font-size: .9375rem;
  line-height: 1.55;
}

.output-area {
  font: 1rem/1.85 "Yu Gothic UI", "Meiryo", sans-serif;
}

.output-meta,
.status-box,
.review-item,
.review-disclaimer,
.library-row p,
.library-note {
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.75;
}

.review-item strong,
.check-progress,
.input-error {
  font-size: .9375rem;
}

.library-row strong {
  font-size: 1rem;
}

.help-list {
  color: #405a4b;
  font-size: 1rem;
  line-height: 1.8;
}

.file-note {
  font-size: .9375rem;
  line-height: 1.85;
}

.dialog-head h2 {
  font-size: 1.25rem;
}

#toast {
  padding: .8rem 1.25rem;
  font-size: .9375rem;
  line-height: 1.65;
}

.error-list {
  font-size: .875rem;
  line-height: 1.75;
}

.right-count,
.inline-help {
  color: var(--muted);
  font-size: .75rem;
}

@media (max-width: 1250px) {
  .app-header {
    flex-wrap: wrap;
  }

  .document-info {
    max-width: none;
    min-width: 18rem;
  }

  .font-size-control {
    margin-left: auto;
  }

  .help-btn {
    margin-left: 0;
  }
}

@media (max-width: 800px) {
  .app-header {
    gap: .75rem 1rem;
    padding: .75rem 1.25rem;
  }

  .document-info {
    min-width: 15rem;
  }

  .font-size-control {
    margin-left: 0;
  }

  .toolbar {
    padding: .65rem 1.25rem;
  }

  .toolbar .btn,
  .toolbar .text-btn {
    font-size: .875rem;
  }

  .sidebar {
    padding: 1rem 1.25rem .5rem;
  }

  .step {
    padding: .6rem;
  }

  .step .step-num {
    width: 1.75rem;
    height: 1.75rem;
    flex-basis: 1.75rem;
    font-size: .75rem;
  }

  .step .step-label {
    font-size: .875rem;
  }

  main {
    padding: 1.5rem 1.25rem;
  }

  h1 {
    font-size: 1.625rem;
  }

  .card {
    padding: 1.375rem;
  }

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

@media (max-width: 520px) {
  body {
    font-size: 1rem;
  }

  .app-header {
    justify-content: flex-start;
    padding: .7rem 1rem;
  }

  .brand {
    align-items: center;
  }

  .version {
    font-size: .75rem;
  }

  .document-info label {
    font-size: .875rem;
  }

  .document-info {
    min-width: 0;
  }

  .document-info input {
    font-size: 1rem;
  }

  .font-size-control {
    width: 100%;
    justify-content: space-between;
  }

  .font-size-label {
    flex: 1;
  }

  .toolbar {
    padding: .65rem 1rem;
  }

  .toolbar .btn,
  .toolbar .text-btn,
  .step-footer .btn,
  .output-actions .btn,
  .section-tools .btn,
  .card-head .btn.small {
    min-height: 2.75rem;
    padding: .5rem .7rem;
    font-size: .875rem;
  }

  .local-note {
    font-size: .8125rem;
  }

  .sidebar {
    padding: .75rem;
  }

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

  .step {
    gap: .5rem;
    padding: .6rem .45rem;
  }

  .step .step-label {
    font-size: .8125rem;
  }

  .step:last-child {
    grid-column: 1 / -1;
  }

  main {
    padding: 1.375rem .875rem 1rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .eyebrow {
    font-size: .75rem;
  }

  .page-description {
    font-size: .875rem;
  }

  .step-meter {
    font-size: .8125rem;
  }

  .step-meter strong {
    font-size: 1.25rem;
  }

  .card {
    padding: 1.125rem 1rem;
  }

  .card-head h2 {
    font-size: 1.125rem;
  }

  .card-desc,
  .purpose-text span,
  .field-hint,
  .field small,
  .hint-box {
    font-size: .875rem;
  }

  .purpose-card,
  .purpose-card.selected {
    padding: .875rem .75rem;
  }

  .purpose-card.selected {
    padding: calc(.875rem - 1px) calc(.75rem - 1px);
  }

  .purpose-text strong,
  .field-title,
  .check.prominent {
    font-size: .9375rem;
  }

  .chip,
  .radio-card,
  .tab,
  .output-area,
  .replacement input {
    font-size: .875rem;
  }

  .radio-card {
    min-width: 9rem;
    flex-basis: 9rem;
  }

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

  .sns-length-row .radio-card {
    min-height: 0;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tab {
    flex: 1 1 8.5rem;
  }

  .replacement {
    grid-template-columns: minmax(0, 1fr) 2.75rem;
    gap: .5rem;
  }

  .replacement > input:first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .replacement > span {
    grid-column: 1;
    grid-row: 2;
    text-align: left;
  }

  .replacement > input:nth-of-type(2) {
    grid-column: 1;
    grid-row: 3;
  }

  .replacement > .icon-btn {
    grid-column: 2;
    grid-row: 1 / 4;
    align-self: center;
  }

  .dialog-head h2 {
    font-size: 1.125rem;
  }

  .workspace-note {
    font-size: .75rem;
  }
}

@media (max-width: 340px) {
  .font-size-control {
    flex-wrap: wrap;
  }

  .font-size-label {
    flex-basis: 100%;
  }

  .font-size-option {
    flex: 1;
  }
}

/* The full manual remains reachable on every screen size, including mobile. */
.manual-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 2.75rem;
  font-weight: 700;
  line-height: 1.45;
  text-decoration: none;
  white-space: nowrap;
}

.manual-link:hover {
  text-decoration: none;
}

.toolbar-manual-link {
  padding: .45rem .75rem;
  border: 1px solid #b8ccc1;
  border-radius: .55rem;
  background: #f7faf8;
  color: var(--primary-dark);
}

.toolbar-manual-link:hover {
  border-color: #79ae9b;
  background: var(--mint);
}

.help-manual-link {
  margin-top: .5rem;
  white-space: normal;
  text-align: center;
}

@media (max-width: 520px) {
  .toolbar-manual-link {
    min-height: 2.75rem;
    font-size: .875rem;
  }
}
