:root {
  --ink: #17312f;
  --ink-soft: #55706d;
  --paper: #f4f0e7;
  --paper-deep: #e9e2d5;
  --card: rgba(255, 253, 248, 0.92);
  --line: rgba(23, 49, 47, 0.13);
  --teal: #0e6b62;
  --teal-deep: #123b3a;
  --teal-wash: #dbeae5;
  --coral: #d5654f;
  --gold: #c89336;
  --success: #28795f;
  --danger: #b34a3e;
  --shadow: 0 20px 60px rgba(36, 55, 49, 0.11);
  --radius-lg: 30px;
  --radius-md: 20px;
  --radius-sm: 13px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 3%, rgba(213, 101, 79, 0.12), transparent 29rem),
    radial-gradient(circle at 96% 18%, rgba(14, 107, 98, 0.12), transparent 31rem),
    linear-gradient(165deg, #f7f3eb 0%, #f1ede4 54%, #ede8df 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.24;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
}

button,
input,
select {
  font: inherit;
}

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

button {
  color: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(100%, 860px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 22px 28px;
  display: flex;
  flex-direction: column;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--teal-deep);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.brand-mark {
  width: 31px;
  height: 31px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--teal-deep);
  transform: rotate(-4deg);
  box-shadow: 0 7px 16px rgba(18, 59, 58, 0.18);
}

.brand-mark span {
  width: 5px;
  border-radius: 999px;
  background: #f7dfb5;
  transform: rotate(4deg);
}

.brand-mark span:nth-child(1) { height: 9px; margin-top: 7px; }
.brand-mark span:nth-child(2) { height: 17px; margin: 0 3px; }
.brand-mark span:nth-child(3) { height: 12px; margin-top: 4px; }

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.54);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(40, 121, 95, 0.11);
}

#app {
  flex: 1;
}

.screen {
  animation: screen-in 420ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen h1 {
  max-width: 690px;
  margin: 10px 0 13px;
  color: var(--teal-deep);
  font-family: "STSong", "Songti SC", "Noto Serif CJK SC", serif;
  font-size: clamp(36px, 7vw, 58px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.lead {
  max-width: 600px;
  margin: 0 0 30px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.8;
}

.lead.compact {
  margin-bottom: 21px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--coral);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.eyebrow::before {
  width: 24px;
  height: 1px;
  content: "";
  background: currentColor;
}

.muted {
  color: var(--ink-soft);
}

.micro-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.micro-note span {
  color: var(--coral);
  font-size: 7px;
}

.intro-screen {
  padding-top: clamp(20px, 7vh, 70px);
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.group-card {
  position: relative;
  overflow: hidden;
  min-height: 137px;
  padding: 20px;
  border: 1px solid rgba(23, 49, 47, 0.11);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: 0 8px 28px rgba(36, 55, 49, 0.055);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.group-card::after {
  position: absolute;
  width: 90px;
  height: 90px;
  right: -28px;
  bottom: -36px;
  content: "";
  border-radius: 50%;
  background: var(--teal-wash);
  transition: transform 220ms ease;
}

.group-card:hover,
.group-card:focus-visible {
  border-color: rgba(14, 107, 98, 0.35);
  outline: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.group-card:hover::after,
.group-card:focus-visible::after {
  transform: scale(1.2);
}

.group-number {
  display: block;
  color: var(--coral);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1;
}

.group-name {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 29px;
  color: var(--teal-deep);
  font-size: 19px;
  font-weight: 800;
}

.group-count {
  position: absolute;
  z-index: 1;
  right: 17px;
  bottom: 16px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.group-card:nth-child(3n + 2)::after {
  background: #efdfc6;
}

.group-card:nth-child(3n + 3)::after {
  background: #eadbd7;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 31px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.back-button span {
  font-size: 18px;
  transition: transform 150ms ease;
}

.back-button:hover span {
  transform: translateX(-3px);
}

.group-heading,
.rating-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.group-heading h1,
.rating-intro h1 {
  margin-top: 4px;
}

.section-kicker {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.count-chip {
  flex: 0 0 auto;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--teal-wash);
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.name-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.name-card {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition: border-color 170ms ease, transform 170ms ease, background 170ms ease;
}

.name-card:hover,
.name-card:focus-visible {
  border-color: rgba(14, 107, 98, 0.38);
  outline: none;
  background: #fffefb;
  transform: translateY(-2px);
}

.avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--teal-wash);
  color: var(--teal-deep);
  font-family: "STSong", "Songti SC", serif;
  font-size: 18px;
  font-weight: 800;
}

.name-card:nth-child(3n + 2) .avatar {
  background: #f2e2cb;
}

.name-card:nth-child(3n + 3) .avatar {
  background: #ecdeda;
}

.name-card-name {
  font-size: 15px;
  font-weight: 800;
}

.privacy-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 27px;
  padding: 17px 18px;
  border: 1px dashed rgba(14, 107, 98, 0.24);
  border-radius: var(--radius-sm);
  background: rgba(219, 234, 229, 0.42);
}

.privacy-card-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  font-size: 14px;
}

.privacy-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.privacy-card strong {
  color: var(--teal-deep);
  font-size: 13px;
}

.rating-screen {
  padding-bottom: 10px;
}

.step-seal {
  flex: 0 0 auto;
  width: 73px;
  height: 73px;
  display: grid;
  place-items: center;
  align-content: center;
  margin-bottom: 13px;
  border: 1px solid rgba(213, 101, 79, 0.32);
  border-radius: 50%;
  color: var(--coral);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 0.82;
  transform: rotate(7deg);
}

.step-seal span {
  font-size: 12px;
}

.self-card {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 4px 0 25px;
  padding: 13px 15px;
  border-left: 3px solid var(--coral);
  border-radius: 0 14px 14px 0;
  background: rgba(255, 253, 248, 0.72);
}

.micro-label {
  margin: 0 0 2px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.self-name {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.local-only {
  margin-left: auto;
  color: var(--success);
  font-size: 10px;
  font-weight: 800;
}

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

.rating-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  align-items: center;
  gap: 15px;
  padding: 17px 17px 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: 0 8px 22px rgba(36, 55, 49, 0.04);
  transition: border-color 170ms ease, background 170ms ease;
}

.rating-card.is-scored {
  border-color: rgba(14, 107, 98, 0.3);
  background: #fffefb;
}

.rating-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.rating-person .avatar {
  width: 44px;
  height: 44px;
}

.rating-person-name {
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rating-person-note {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
}

.score-select {
  width: 100%;
  height: 48px;
  padding: 0 33px 0 15px;
  border: 1px solid rgba(23, 49, 47, 0.16);
  border-radius: 12px;
  appearance: none;
  background-color: #f7f4ed;
  background-image: linear-gradient(45deg, transparent 50%, var(--teal) 50%), linear-gradient(135deg, var(--teal) 50%, transparent 50%);
  background-position: calc(100% - 16px) 21px, calc(100% - 11px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.score-select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(14, 107, 98, 0.13);
}

.score-select.is-empty {
  color: #8a9a96;
  font-weight: 600;
}

.rating-card.is-invalid {
  border-color: rgba(179, 74, 62, 0.48);
  animation: nudge 260ms ease;
}

@keyframes nudge {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.submit-panel {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid rgba(23, 49, 47, 0.12);
  border-radius: 19px;
  background: rgba(248, 245, 238, 0.92);
  box-shadow: 0 14px 44px rgba(36, 55, 49, 0.14);
  backdrop-filter: blur(15px);
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
  cursor: pointer;
}

.consent-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--teal);
}

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

.completion-text {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.button {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 170ms ease, box-shadow 170ms ease, opacity 170ms ease;
}

.button:focus-visible {
  outline: 3px solid rgba(14, 107, 98, 0.22);
  outline-offset: 2px;
}

.button:not(:disabled):hover {
  transform: translateY(-2px);
}

.button-primary {
  background: var(--teal-deep);
  color: #fffdf7;
  box-shadow: 0 9px 20px rgba(18, 59, 58, 0.2);
}

.button-primary:not(:disabled):hover {
  box-shadow: 0 13px 24px rgba(18, 59, 58, 0.24);
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.button-secondary {
  background: var(--teal-wash);
  color: var(--teal-deep);
}

.button-quiet {
  background: #ece7de;
  color: var(--ink);
}

.submit-button {
  min-width: 144px;
}

.form-status {
  min-height: 0;
  margin: 0;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.5;
}

.form-status:not(:empty) {
  min-height: 17px;
  margin-top: 9px;
}

.loading-screen,
#error-screen {
  min-height: 58vh;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.loading-screen p {
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.loading-orbit {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(14, 107, 98, 0.16);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 50%;
  background: #ecd9d4;
  color: var(--danger);
  font-family: Georgia, serif;
  font-size: 26px;
}

#error-screen h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

#error-screen .button {
  margin-top: 12px;
}

.success-screen {
  max-width: 590px;
  margin: 0 auto;
  padding: clamp(44px, 10vh, 95px) 0 20px;
  text-align: center;
}

.success-screen h1 {
  margin-inline: auto;
}

.success-screen .lead {
  margin-inline: auto;
}

.success-mark {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  margin: 0 auto 26px;
  border-radius: 50%;
  background: var(--teal-deep);
  box-shadow: 0 18px 45px rgba(18, 59, 58, 0.22);
}

.success-mark span {
  color: #f7dfb5;
  font-size: 43px;
  font-weight: 300;
  transform: rotate(-5deg);
}

.success-screen .eyebrow {
  justify-content: center;
}

.success-details {
  width: fit-content;
  max-width: 100%;
  margin: 5px auto 28px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.62);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 42px;
  color: #84918e;
  font-size: 10px;
}

.site-footer a {
  text-underline-offset: 3px;
}

.confirm-dialog {
  width: min(calc(100% - 36px), 420px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: #fbf8f1;
  color: var(--ink);
  box-shadow: 0 25px 90px rgba(18, 59, 58, 0.28);
}

.confirm-dialog::backdrop {
  background: rgba(18, 43, 41, 0.48);
  backdrop-filter: blur(4px);
}

.confirm-dialog form {
  padding: 28px;
}

.dialog-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #efdfc6;
  color: #8d611f;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 800;
}

.confirm-dialog h2 {
  margin: 19px 0 8px;
  color: var(--teal-deep);
  font-family: "STSong", "Songti SC", serif;
  font-size: 27px;
}

.confirm-dialog p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}

.dialog-actions .button {
  min-height: 45px;
}

@media (min-width: 650px) {
  .page-shell {
    padding-inline: 38px;
  }

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

  .group-card {
    min-height: 165px;
    padding: 18px;
  }

  .group-name {
    margin-top: 38px;
    font-size: 17px;
  }

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

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

  .rating-card {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .submit-panel {
    bottom: 20px;
  }
}

@media (max-width: 430px) {
  .page-shell {
    padding-inline: 17px;
  }

  .site-header {
    height: 78px;
  }

  .brand {
    font-size: 14px;
  }

  .screen h1 {
    font-size: 35px;
  }

  .group-card {
    min-height: 126px;
    padding: 17px;
  }

  .group-name {
    margin-top: 26px;
    font-size: 18px;
  }

  .name-grid {
    gap: 9px;
  }

  .name-card {
    gap: 10px;
    padding: 10px;
  }

  .name-card .avatar {
    width: 38px;
    height: 38px;
  }

  .rating-card {
    grid-template-columns: minmax(0, 1fr) 116px;
    padding: 13px;
  }

  .rating-person .avatar {
    width: 39px;
    height: 39px;
  }

  .score-select {
    height: 44px;
    padding-left: 12px;
    font-size: 14px;
  }

  .submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .submit-button {
    width: 100%;
  }

  .step-seal {
    width: 63px;
    height: 63px;
    font-size: 17px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .button {
    width: 100%;
  }
}

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