:root {
  color-scheme: light;
  --ink: #111111;
  --text: #2a2a2a;
  --muted: #747470;
  --quiet: #969691;
  --paper: #f5f5f7;
  --paper-2: #ececef;
  --panel: #ffffff;
  --panel-soft: #f9f9fb;
  --line: #e5e5e8;
  --line-strong: #d2d2d7;
  --accent: #0071e3;
  --danger: #d44732;
  --warn: #a36c00;
  --pass: #1f7a4d;
  --status: var(--accent);
  --radius: 26px;
  --radius-small: 16px;
  --radius-pill: 999px;
  --shadow: 0 34px 100px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.06);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter,
    ui-sans-serif, system-ui, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

body[data-status="pass"] {
  --status: var(--pass);
}

body[data-status="warn"] {
  --status: var(--warn);
}

body[data-status="fail"] {
  --status: var(--danger);
}

body[data-status="empty"],
body:not([data-status]) {
  --status: #b4b4b8;
}

a {
  color: inherit;
  text-decoration-color: rgba(0, 113, 227, 0.28);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

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

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

button {
  cursor: pointer;
}

.site-header,
.site-footer,
.workbench,
.link-band,
.text-page {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: #111;
  font-weight: 700;
}

nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

nav::-webkit-scrollbar,
.preset-tabs::-webkit-scrollbar {
  display: none;
}

nav a {
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 620;
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover,
nav a[aria-current="page"] {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}

.workbench {
  padding: 42px 0 18px;
}

.intro {
  max-width: 660px;
  margin-inline: auto;
  text-align: center;
}

.kicker,
.mini-kicker,
.section-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 10px;
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mini-kicker,
.section-kicker {
  justify-content: flex-start;
}

.mini-kicker {
  color: var(--quiet);
}

.intro h1,
.text-page h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.35rem, 4.4vw, 3.75rem);
  font-weight: 720;
  line-height: 1.02;
  letter-spacing: 0;
}

.intro p:not(.kicker) {
  max-width: 600px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 1.06rem;
  font-weight: 470;
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  margin: 30px auto 0;
  max-width: 880px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.tool-shell > * {
  min-width: 0;
}

.writer-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.toolbar {
  margin-bottom: 18px;
}

.preset-tabs {
  display: inline-flex;
  max-width: 100%;
  gap: 2px;
  overflow-x: auto;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--paper-2);
  scrollbar-width: none;
}

.preset-tab {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.preset-tab:hover,
.preset-tab.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.quick-strip {
  display: grid;
  grid-template-columns: minmax(142px, 0.75fr) minmax(100px, 0.38fr) minmax(190px, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.quick-main,
.quick-side,
.quick-strip > p {
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--panel-soft);
}

.quick-main,
.quick-side {
  padding: 15px 16px;
}

.quick-main span,
.quick-side span {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  line-height: 0.95;
  font-weight: 720;
}

.quick-main span {
  font-size: clamp(2.35rem, 5vw, 3.55rem);
}

.quick-side span {
  font-size: clamp(1.55rem, 3vw, 2.05rem);
}

.quick-main p,
.quick-side p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 620;
}

.quick-strip > p {
  display: flex;
  align-items: center;
  padding: 15px 16px;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 570;
}

.editor-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 650;
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 320px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 20px;
  outline: none;
  padding: 18px;
  color: var(--ink);
  background: #fff;
  font-size: 1.03rem;
  line-height: 1.62;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025);
}

textarea:focus {
  border-color: rgba(0, 113, 227, 0.55);
  box-shadow:
    0 0 0 4px rgba(0, 113, 227, 0.11),
    inset 0 1px 0 rgba(0, 0, 0, 0.025);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  color: #fff;
  background: #111;
  font-weight: 650;
  white-space: nowrap;
}

.icon-button:hover {
  background: #2c2c2e;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.icon-button.quiet {
  color: var(--ink);
  background: var(--paper-2);
}

.icon-button.quiet:hover {
  background: #e1e1e5;
}

.tool-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  stroke-width: 2.15;
}

.mini-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  stroke-width: 2.25;
}

.shorten-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: var(--panel-soft);
}

.shorten-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.shorten-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.28rem;
  line-height: 1.08;
  font-weight: 700;
}

.shorten-heading p:last-child {
  margin: 7px 0 0;
  max-width: 430px;
  color: var(--muted);
  font-size: 0.94rem;
}

.shorten-heading > span {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.shorten-controls {
  display: grid;
  grid-template-columns: minmax(140px, 0.75fr) minmax(140px, 0.7fr) max-content;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

.shorten-controls label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.shorten-controls input,
.shorten-controls select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  padding: 8px 11px;
  color: var(--ink);
  background: #fff;
  font-size: 0.94rem;
  font-weight: 560;
}

.shorten-controls input:focus,
.shorten-controls select:focus {
  border-color: rgba(0, 113, 227, 0.55);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.smart-button {
  min-width: 154px;
}

.shorten-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.shorten-result {
  margin-top: 14px;
}

.shorten-result[hidden] {
  display: none;
}

.shorten-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.shorten-result-head span:last-child {
  text-align: right;
}

#shortenOutput {
  min-height: 132px;
  resize: vertical;
  background: #fff;
}

.result-actions {
  margin-top: 10px;
}

.metrics-panel {
  display: block;
  min-width: 0;
  padding: 0;
  background: transparent;
}

.metrics-panel > summary {
  width: fit-content;
  margin: 0 auto;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 620;
  list-style: none;
}

.metrics-panel > summary::-webkit-details-marker {
  display: none;
}

.metrics-panel > summary:hover {
  color: var(--ink);
  background: var(--paper-2);
}

.metrics-panel[open] {
  display: grid;
  gap: 12px;
}

.limit-card {
  display: none;
}

.limit-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 680;
  line-height: 1.08;
}

.limit-card p:last-of-type {
  min-height: 40px;
  margin: 14px 0 13px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 560;
}

.meter {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: #dedee3;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--status);
  transition:
    width 160ms ease,
    background 160ms ease;
}

.metric-grid,
.detail-list {
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background: var(--panel-soft);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 2px;
}

.metric-grid article {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
}

.metric-grid article:first-child {
  border-top: 0;
}

.metric-grid article:nth-child(2),
.metric-grid article:nth-child(3) {
  border-top: 0;
}

.metric-grid article:nth-child(3n + 1),
.metric-grid article:nth-child(3n + 2) {
  border-right: 1px solid var(--line);
}

.metric-grid span {
  order: 2;
  display: block;
  overflow-wrap: anywhere;
  white-space: nowrap;
  color: var(--ink);
  font-size: 1.28rem;
  line-height: 1;
  font-weight: 680;
  text-align: right;
}

.metric-grid p {
  order: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.detail-list {
  display: grid;
  gap: 0;
}

.detail-list p {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.87rem;
}

.detail-list p:first-child {
  border-top: 0;
}

.detail-list strong {
  color: var(--text);
  font-weight: 600;
}

.detail-list span {
  color: var(--ink);
  font-weight: 650;
  text-align: right;
}

.help-section {
  padding: 62px 0 18px;
}

.section-heading {
  max-width: 690px;
}

.section-heading h2,
.link-band h2,
.text-page h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
}

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

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.info-card,
.checklist {
  border: 0;
  border-radius: 22px;
  background: var(--panel);
}

.info-card {
  padding: 20px;
}

.info-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 670;
}

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

.link-band {
  padding: 34px 0 70px;
}

.link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.link-grid a {
  padding: 9px 13px;
  border: 0;
  border-radius: var(--radius-pill);
  color: var(--ink);
  background: #fff;
  font-weight: 650;
  text-decoration: none;
}

.link-grid a:hover {
  color: var(--accent);
  background: #fff;
}

.text-page {
  max-width: 780px;
  padding: 56px 0 82px;
}

.text-page > p:first-of-type:not(.kicker),
.text-page > p:nth-of-type(2) {
  color: var(--muted);
  font-size: 1.08rem;
}

.text-page h2 {
  margin-top: 32px;
  font-size: 1.4rem;
}

.text-page p,
.text-page li {
  color: #3f3f3c;
}

.updated {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.checklist {
  margin: 32px 0;
  padding: 20px 24px;
}

.checklist h2 {
  margin-top: 0;
}

.checklist ul,
.text-links {
  padding-left: 22px;
}

.checklist li,
.text-links li {
  margin: 8px 0;
}

.ad-wide {
  display: grid;
  min-height: 92px;
  margin-top: 18px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  font-size: 0.8rem;
  font-weight: 650;
  text-transform: uppercase;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.footer-links a {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

@media (max-width: 980px) {
  .tool-shell {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .writer-panel {
    min-height: 0;
    padding: 0;
  }

  .metrics-panel {
    display: block;
  }

  .metrics-panel[open] {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .metric-grid article {
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .metric-grid article:nth-child(1),
  .metric-grid article:nth-child(2) {
    border-top: 0;
  }

  .metric-grid article:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

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

@media (max-width: 680px) {
  .site-header,
  .site-footer,
  .workbench,
  .link-band,
  .text-page {
    width: min(1120px, calc(100% - 22px));
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding-top: 14px;
  }

  nav {
    width: 100%;
    justify-content: flex-start;
  }

  .workbench {
    padding-top: 30px;
  }

  .intro {
    text-align: left;
  }

  .kicker {
    justify-content: flex-start;
  }

  .intro h1,
  .text-page h1 {
    font-size: clamp(2.25rem, 12vw, 3.18rem);
    line-height: 0.98;
  }

  .intro p:not(.kicker) {
    margin-top: 13px;
    font-size: 0.98rem;
  }

  .tool-shell {
    margin-top: 20px;
    padding: 12px;
    border-radius: 24px;
  }

  .quick-strip {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr);
    gap: 8px;
  }

  .quick-strip > p {
    grid-column: 1 / -1;
    min-height: 44px;
  }

  .quick-main,
  .quick-side,
  .quick-strip > p {
    padding: 12px 13px;
  }

  .quick-main span {
    font-size: 2.08rem;
  }

  .quick-side span {
    font-size: 1.52rem;
  }

  textarea {
    min-height: 245px;
    padding: 15px;
    border-radius: 18px;
    font-size: 1rem;
  }

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

  .shorten-panel {
    padding: 14px;
    border-radius: 20px;
  }

  .shorten-heading {
    flex-direction: column;
    gap: 10px;
  }

  .shorten-controls {
    grid-template-columns: 1fr;
  }

  .icon-button {
    width: 100%;
    min-width: 0;
    padding-inline: 9px;
  }

  .metrics-panel {
    gap: 9px;
  }

  .limit-card {
    padding: 15px;
    border-radius: 20px;
  }

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

  .metric-grid article {
    min-height: 52px;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .metric-grid article:first-child {
    border-top: 0;
  }

  .metric-grid article:nth-child(2) {
    border-top: 1px solid var(--line);
  }

  .detail-list p {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .detail-list span {
    text-align: left;
  }

  .help-section {
    padding-top: 46px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-links {
    justify-content: flex-start;
  }
}
