:root {
  color-scheme: light;
  --page-bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #fbfcfd;
  --text: #19202b;
  --muted: #697386;
  --border: #e4e7ec;
  --accent: #202938;
  --accent-hover: #111827;
  --success: #15803d;
  --success-bg: #eef8f1;
  --warning: #b45309;
  --warning-bg: #fff8eb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --focus-ring: rgba(32, 41, 56, 0.14);
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.055);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.95), transparent 42%),
    var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] {
  display: none !important;
}

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

.page {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 72px 24px 96px;
}

.page-header {
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1 {
  margin: 10px 0 14px;
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.intro {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.975rem;
  line-height: 1.8;
}

.input-card {
  margin-top: 40px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

textarea {
  display: block;
  width: 100%;
  min-height: 240px;
  padding: 18px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.75;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

textarea::placeholder {
  color: #a2a9b4;
}

textarea:hover {
  border-color: #d3d8e0;
}

textarea:focus {
  border-color: #aeb6c2;
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.input-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

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

.privacy-note {
  text-align: right;
}

.input-error {
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 0.875rem;
  line-height: 1.5;
}

.review-button {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  padding: 12px 24px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.review-button:hover {
  background: var(--accent-hover);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.14);
}

.review-button:active {
  transform: translateY(1px);
}

.review-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.result-panel {
  margin-top: 32px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: reveal 0.34s ease-out both;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

h2 {
  margin: 7px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.score-block {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-shrink: 0;
}

.score-number {
  font-size: clamp(3.2rem, 8vw, 4.2rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  line-height: 0.95;
  transition: color 0.2s ease;
}

.score-number.is-low {
  color: var(--danger);
}

.score-number.is-mid {
  color: var(--warning);
}

.score-number.is-high {
  color: var(--success);
}

.score-total {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.score-summary {
  margin: 20px 0 22px;
  color: var(--muted);
  font-size: 0.925rem;
  line-height: 1.75;
}

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

.dimension-card {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.dimension-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.dimension-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  background: #eef0f3;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dimension-heading h3 {
  min-width: 0;
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.4;
}

.dimension-result {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.dimension-score {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dimension-score span {
  color: var(--muted);
  font-weight: 500;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.6em;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
}

.is-pass .status-pill {
  background: var(--success-bg);
  color: var(--success);
}

.is-fail .status-pill {
  background: var(--danger-bg);
  color: var(--danger);
}

.is-partial .status-pill {
  background: var(--warning-bg);
  color: var(--warning);
}

.dimension-card .dimension-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.score-track {
  height: 4px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9ecf0;
}

.score-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--danger);
  transition: width 0.45s ease;
}

.is-pass .score-fill {
  background: var(--success);
}

.is-partial .score-fill {
  background: var(--warning);
}

.dimension-feedback {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 0.855rem;
  line-height: 1.7;
}

.feedback-label {
  display: inline-block;
  margin-right: 7px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 650;
  vertical-align: 1px;
}

.is-pass .feedback-label {
  background: var(--success-bg);
  color: var(--success);
}

.is-partial .feedback-label {
  background: var(--warning-bg);
  color: var(--warning);
}

@media (max-width: 640px) {
  .page {
    padding: 46px 16px 64px;
  }

  .page-header {
    padding: 0 8px;
  }

  h1 {
    font-size: 2rem;
  }

  .intro {
    font-size: 0.925rem;
  }

  .input-card {
    margin-top: 30px;
    padding: 18px;
    border-radius: 16px;
  }

  textarea {
    min-height: 220px;
    padding: 16px;
    border-radius: 12px;
  }

  .result-panel {
    margin-top: 24px;
    padding: 22px 18px;
    border-radius: 16px;
  }

  .result-heading {
    gap: 16px;
    padding-bottom: 18px;
  }

  .score-number {
    font-size: 3.25rem;
  }

  .dimension-card {
    padding: 16px;
  }

  .dimension-card .dimension-top {
    align-items: flex-start;
    gap: 10px;
  }

  .dimension-result {
    gap: 7px;
  }

  .dimension-score {
    font-size: 0.8rem;
  }

  .status-pill {
    padding: 2px 8px;
  }
}

@media (max-width: 400px) {
  .input-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .privacy-note {
    text-align: left;
  }

  .dimension-card .dimension-top {
    flex-direction: column;
    gap: 9px;
  }

  .dimension-result {
    width: 100%;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
