:root {
  color-scheme: light;
  --ink: #17233b;
  --ink-soft: #5d6678;
  --paper: #f3f5f1;
  --card: #ffffff;
  --line: #dfe4dd;
  --accent: #625bf6;
  --accent-dark: #4b44d8;
  --accent-pale: #eeedff;
  --teal: #0f7466;
  --teal-pale: #e7f5ef;
  --amber: #8f550d;
  --amber-pale: #fff2d9;
  --coral: #ad3f3f;
  --coral-pale: #fde9e5;
  --shadow: 0 24px 70px rgba(28, 38, 55, 0.09);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 35, 59, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 35, 59, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 40px 40px;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
}

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

button:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(98, 91, 246, 0.28);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.ambient--one {
  top: -210px;
  right: -80px;
  background: radial-gradient(circle, rgba(98, 91, 246, 0.13), transparent 68%);
}

.ambient--two {
  bottom: -240px;
  left: -120px;
  background: radial-gradient(circle, rgba(22, 133, 117, 0.12), transparent 68%);
}

.site-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 26px 32px 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 15px 15px 15px 4px;
  color: #fff;
  background: var(--ink);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(23, 35, 59, 0.16);
}

.brand-mark::after {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a7f3d0;
  content: "";
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.brand-subtitle {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid rgba(23, 35, 59, 0.09);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 650;
  backdrop-filter: blur(10px);
}

.mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(22, 133, 117, 0.1);
}

.intro {
  max-width: 820px;
  margin: 62px auto 34px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0;
  font-size: clamp(36px, 5.1vw, 62px);
  font-weight: 780;
  letter-spacing: -0.055em;
  line-height: 1.16;
  text-wrap: balance;
}

.intro h1 span {
  color: var(--accent);
}

.intro-description {
  max-width: 600px;
  margin: 20px auto 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.8;
}

.workspace {
  border: 1px solid rgba(23, 35, 59, 0.08);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.editing-panel {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px;
}

.panel-heading,
.result-toolbar,
.sentence-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  margin-bottom: 20px;
}

.panel-title,
.result-title {
  display: flex;
  align-items: center;
  gap: 11px;
}

.step-number {
  display: inline-grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-pale);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.panel-heading h2,
.result-toolbar h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.text-button {
  padding: 7px 2px;
  color: var(--accent);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.text-button:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.textarea-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #f8f9f6;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.textarea-shell:focus-within {
  border-color: rgba(98, 91, 246, 0.72);
  box-shadow: 0 0 0 4px rgba(98, 91, 246, 0.08);
}

.textarea-shell.has-error {
  border-color: rgba(197, 76, 76, 0.72);
}

.textarea-shell textarea {
  display: block;
  width: 100%;
  min-height: 248px;
  padding: 22px 22px 12px;
  resize: vertical;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
  line-height: 1.85;
}

.textarea-shell textarea::placeholder {
  color: #969daa;
}

.input-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 18px;
  border-top: 1px solid #e7eae4;
  color: #818997;
  font-size: 12px;
}

.char-count {
  font-variant-numeric: tabular-nums;
}

.char-count strong {
  color: var(--ink);
  font-weight: 700;
}

.error-message {
  margin: 12px 4px 0;
  color: var(--coral);
  font-size: 13px;
  line-height: 1.6;
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
}

.action-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 21px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(98, 91, 246, 0.24);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
  box-shadow: 0 13px 28px rgba(98, 91, 246, 0.28);
}

.button-arrow {
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
}

.secondary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  box-shadow: none;
}

.secondary-button:hover {
  border-color: #c8ceca;
  background: #f8f9f7;
}

.loading-panel {
  display: flex;
  max-width: 960px;
  min-height: 440px;
  margin: 0 auto;
  padding: 54px 9%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.progress-ring {
  position: relative;
  display: grid;
  width: 176px;
  height: 176px;
  margin-bottom: 26px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0 var(--ring-angle, 0deg), #e9ebea var(--ring-angle, 0deg) 360deg);
  box-shadow: 0 16px 40px rgba(98, 91, 246, 0.14);
}

.progress-ring::before {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--card);
  content: "";
}

.progress-ring-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progress-ring-content strong {
  color: var(--accent);
  font-size: 42px;
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.progress-ring-content span {
  color: var(--ink-soft);
  font-size: 12px;
}

.loading-panel h2 {
  margin: 0;
  font-size: clamp(23px, 3vw, 30px);
  letter-spacing: -0.035em;
}

.progress-label {
  min-height: 24px;
  margin: 12px 0 28px;
  color: var(--ink-soft);
  font-size: 14px;
}

.loading-steps {
  display: flex;
  margin: 32px 0 0;
  padding: 0;
  gap: 26px;
  list-style: none;
}

.loading-steps li {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #a0a6af;
  font-size: 12px;
  transition: color 160ms ease;
}

.loading-steps li::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d4d8d9;
  content: "";
}

.loading-steps li.is-active {
  color: var(--accent);
  font-weight: 700;
}

.loading-steps li.is-active::before {
  background: var(--accent);
}

.loading-steps li.is-complete {
  color: var(--teal);
}

.loading-steps li.is-complete::before {
  background: var(--teal);
}

.results-panel {
  padding: 4px 0 0;
}

.result-toolbar {
  margin-bottom: 20px;
  padding: 0 4px;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.45fr);
  gap: 20px;
  align-items: start;
}

.score-card,
.sentences-card {
  border: 1px solid rgba(23, 35, 59, 0.08);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.score-card {
  position: sticky;
  top: 24px;
  overflow: hidden;
  padding: 34px 30px 28px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0%, rgba(143, 136, 255, 0.35), transparent 43%),
    var(--ink);
  text-align: center;
}

.score-ring {
  position: relative;
  display: grid;
  width: 190px;
  height: 190px;
  margin: 0 auto 27px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#a9a4ff 0 var(--ring-angle, 0deg), rgba(255, 255, 255, 0.12) var(--ring-angle, 0deg) 360deg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
}

.score-ring::before {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--ink);
  content: "";
}

.score-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.score-content strong {
  font-size: 49px;
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-content span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.score-card h3 {
  margin: 0 0 11px;
  font-size: 20px;
  letter-spacing: -0.025em;
  line-height: 1.45;
}

.score-summary {
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  line-height: 1.75;
}

.score-scale {
  display: flex;
  margin-top: 25px;
  padding-top: 18px;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.48);
  font-size: 10px;
}

.sentences-card {
  overflow: hidden;
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
}

.sentence-heading {
  align-items: flex-start;
}

.sentence-heading .eyebrow {
  margin-bottom: 7px;
  font-size: 9px;
}

.sentence-heading h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.sentence-total {
  padding: 6px 10px;
  border-radius: 9px;
  color: var(--ink-soft);
  background: #f2f4f1;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.legend {
  display: flex;
  margin: 21px 0 17px;
  gap: 17px;
  color: var(--ink-soft);
  font-size: 11px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.legend .low {
  background: #8ed6c2;
}

.legend .medium {
  background: #efbf6c;
}

.legend .high {
  background: #e88c81;
}

.sentence-list {
  display: flex;
  margin: 0;
  padding: 0;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}

.sentence-item {
  display: grid;
  padding: 16px 17px;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 15px;
}

.sentence-item--low {
  border-color: rgba(22, 133, 117, 0.09);
  background: var(--teal-pale);
}

.sentence-item--medium {
  border-color: rgba(169, 102, 18, 0.09);
  background: var(--amber-pale);
}

.sentence-item--high {
  border-color: rgba(197, 76, 76, 0.09);
  background: var(--coral-pale);
}

.sentence-index {
  align-self: start;
  padding-top: 3px;
  color: rgba(23, 35, 59, 0.4);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.sentence-item p {
  margin: 0;
  color: #263248;
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.sentence-score {
  display: flex;
  min-width: 48px;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.sentence-score strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.sentence-item--low .sentence-score strong {
  color: var(--teal);
}

.sentence-item--medium .sentence-score strong {
  color: var(--amber);
}

.sentence-item--high .sentence-score strong {
  color: var(--coral);
}

.sentence-score span {
  color: rgba(23, 35, 59, 0.45);
  font-size: 9px;
  white-space: nowrap;
}

.empty-sentences {
  margin: 20px 0 4px;
  padding: 24px;
  border-radius: 14px;
  color: var(--ink-soft);
  background: #f5f6f4;
  font-size: 13px;
  text-align: center;
}

.result-note {
  display: flex;
  margin: 18px 4px 0;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.result-note::before {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.page-footer {
  display: flex;
  max-width: 960px;
  margin: 24px auto 0;
  padding: 0 5px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #858c96;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.footer-brand {
  font-weight: 800;
  letter-spacing: 0.2em;
}

.noscript-message {
  max-width: 600px;
  margin: 60px auto;
  padding: 20px;
  border-radius: 12px;
  background: #fff;
  text-align: center;
}

.sr-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .intro {
    margin-top: 48px;
  }

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

  .score-card {
    position: static;
    display: grid;
    padding: 26px 30px;
    grid-template-columns: 150px minmax(0, 1fr);
    column-gap: 28px;
    align-items: center;
    text-align: left;
  }

  .score-ring {
    width: 150px;
    height: 150px;
    margin: 0;
    grid-row: span 3;
  }

  .score-content strong {
    font-size: 39px;
  }

  .score-card h3 {
    align-self: end;
  }

  .score-summary {
    align-self: start;
  }

  .score-scale {
    margin-top: 4px;
    padding-top: 13px;
  }
}

@media (max-width: 640px) {
  .site-shell {
    padding: 18px 16px 26px;
  }

  .brand-mark {
    width: 39px;
    height: 39px;
    border-radius: 13px 13px 13px 4px;
    font-size: 18px;
  }

  .brand-name {
    font-size: 17px;
  }

  .brand-subtitle {
    font-size: 8px;
  }

  .mode-pill {
    padding: 7px 10px;
    font-size: 11px;
  }

  .intro {
    margin: 40px auto 25px;
  }

  .intro h1 {
    font-size: clamp(32px, 10.4vw, 45px);
    letter-spacing: -0.06em;
  }

  .intro-description {
    margin-top: 15px;
    font-size: 14px;
    line-height: 1.75;
  }

  .workspace,
  .score-card,
  .sentences-card {
    border-radius: 21px;
  }

  .editing-panel {
    padding: 18px;
  }

  .panel-heading {
    margin-bottom: 15px;
  }

  .textarea-shell {
    border-radius: 15px;
  }

  .textarea-shell textarea {
    min-height: 235px;
    padding: 17px 16px 10px;
    font-size: 15px;
  }

  .input-meta {
    padding: 10px 13px;
  }

  .action-row {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .action-hint {
    text-align: center;
  }

  .primary-button {
    width: 100%;
  }

  .loading-panel {
    min-height: 410px;
    padding: 42px 24px;
  }

  .progress-ring {
    width: 150px;
    height: 150px;
    margin-bottom: 22px;
  }

  .progress-ring-content strong {
    font-size: 36px;
  }

  .loading-steps {
    gap: 13px;
  }

  .loading-steps li {
    gap: 5px;
    font-size: 10px;
  }

  .result-toolbar {
    padding: 0 2px;
  }

  .result-toolbar h2 {
    font-size: 16px;
  }

  .secondary-button {
    min-height: 40px;
    padding: 0 14px;
    font-size: 12px;
  }

  .score-card {
    display: block;
    padding: 28px 24px;
    text-align: center;
  }

  .score-ring {
    width: 168px;
    height: 168px;
    margin: 0 auto 23px;
  }

  .score-card h3 {
    font-size: 18px;
  }

  .score-scale {
    margin-top: 21px;
    padding-top: 16px;
  }

  .sentences-card {
    padding: 21px 17px;
  }

  .sentence-heading h3 {
    font-size: 18px;
  }

  .legend {
    gap: 12px;
  }

  .sentence-item {
    padding: 14px 12px;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .sentence-item p {
    font-size: 13px;
  }

  .sentence-score {
    min-width: 40px;
  }

  .sentence-score strong {
    font-size: 14px;
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
}

@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;
  }
}
