:root {
  --surface: #fff9fb;
  --surface-soft: #fff1f5;
  --surface-strong: #ffffff;
  --ink: #2b2330;
  --muted: #746775;
  --line: #ead5de;
  --accent: #b8325f;
  --accent-dark: #872040;
  --accent-soft: #ffe1ea;
  --sage: #587367;
  --mist: #eef6f3;
  --shadow: 0 24px 70px rgba(98, 47, 68, 0.14);
  --radius: 28px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 206, 220, 0.72), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(192, 224, 214, 0.68), transparent 26%),
    linear-gradient(135deg, #fffafc 0%, #fff2f6 52%, #eef7f4 100%);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(135, 32, 64, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(135, 32, 64, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 78%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: var(--accent-dark);
  text-decoration-color: rgba(184, 50, 95, 0.35);
  text-underline-offset: 0.2em;
}

.shell {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: clamp(18px, 4vw, 42px);
  align-items: center;
  min-height: clamp(360px, 54dvh, 560px);
}

.intro__copy {
  display: grid;
  gap: clamp(24px, 4vw, 36px);
  padding: 28px 0;
}

.brand-mark {
  display: inline-grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 10px 16px 10px 10px;
  border: 1px solid rgba(184, 50, 95, 0.14);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 18px 42px rgba(98, 47, 68, 0.1);
  backdrop-filter: blur(14px);
}

.brand-mark img {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(184, 50, 95, 0.16);
}

.brand-mark p {
  margin: 0;
}

.brand-mark__cn {
  color: var(--ink);
  font-size: 1.14rem;
  font-weight: 900;
  line-height: 1.15;
}

.brand-mark__en {
  margin-top: 7px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.text-nowrap {
  white-space: nowrap;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2.9rem, 7.5vw, 5.7rem);
  line-height: 1.18;
  letter-spacing: 0;
  font-weight: 900;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.28rem, 2vw, 1.75rem);
  line-height: 1.12;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
}

.lede {
  max-width: 620px;
  margin-bottom: 0;
  color: #5f5261;
  font-size: clamp(1.05rem, 2vw, 1.24rem);
  line-height: 1.75;
}

.measurement-visual {
  position: relative;
  min-height: 360px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: calc(var(--radius) + 10px);
  background:
    radial-gradient(circle at 88% 12%, rgba(184, 50, 95, 0.18), transparent 30%),
    radial-gradient(circle at 4% 92%, rgba(88, 115, 103, 0.16), transparent 34%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.86), rgba(255, 244, 248, 0.72));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.measurement-visual::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(184, 50, 95, 0.12);
  border-radius: 30px;
}

.measurement-visual::before {
  content: "";
  position: absolute;
  left: -16%;
  right: -16%;
  top: 43%;
  height: 74px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(135, 32, 64, 0.22) 0 2px, transparent 2px 28px),
    linear-gradient(90deg, rgba(255, 225, 234, 0.1), rgba(255, 255, 255, 0.62), rgba(238, 246, 243, 0.22));
  transform: rotate(-9deg);
  opacity: 0.82;
}

.guide-card {
  position: absolute;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  width: min(76%, 320px);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 42px rgba(98, 47, 68, 0.12);
  backdrop-filter: blur(14px);
}

.guide-card--primary {
  left: 28px;
  top: 46px;
}

.guide-card--secondary {
  right: 28px;
  bottom: 46px;
}

.guide-card__index {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 900;
}

.guide-card--secondary .guide-card__index {
  background: var(--sage);
}

.guide-card strong,
.guide-card span {
  display: block;
}

.guide-card strong {
  margin-bottom: 5px;
  font-size: 1.08rem;
  font-weight: 900;
}

.guide-card span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.tape-line {
  position: absolute;
  z-index: 1;
  width: 52%;
  height: 10px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.86) 0 2px, transparent 2px 22px),
    currentColor;
  box-shadow: 0 14px 34px rgba(98, 47, 68, 0.12);
}

.tape-line--top {
  right: 8%;
  top: 42%;
  color: var(--accent);
  transform: rotate(-9deg);
}

.tape-line--bottom {
  left: 8%;
  bottom: 38%;
  color: var(--sage);
  transform: rotate(-9deg);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(320px, 1.08fr);
  gap: 22px;
  margin-top: 10px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.calculator,
.result,
.reference,
.sources {
  padding: clamp(20px, 3vw, 30px);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.unit-toggle {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.unit-toggle__button {
  min-width: 58px;
  min-height: 38px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.unit-toggle__button.is-active {
  background: var(--ink);
  color: #fff;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.field__label {
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 900;
}

.field__hint {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.field input {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 0 17px;
  font-size: 1.65rem;
  font-weight: 900;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.field input:focus {
  border-color: rgba(184, 50, 95, 0.75);
  box-shadow: 0 0 0 5px rgba(184, 50, 95, 0.13);
}

.result {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 20%, rgba(255, 213, 225, 0.78), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 246, 249, 0.78));
}

.result::before {
  content: "";
  position: absolute;
  inset: auto -18% -44% 38%;
  height: 78%;
  border-radius: 50%;
  background: rgba(184, 50, 95, 0.08);
}

.result > * {
  position: relative;
}

.result-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.privacy-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.privacy-toggle {
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}

.privacy-toggle:active {
  transform: translateY(1px);
}

.size-output {
  display: grid;
  grid-template-columns: auto minmax(140px, max-content) auto;
  gap: 14px;
  align-items: end;
  margin: 24px 0 26px;
}

.size-output strong {
  font-size: clamp(4.5rem, 10vw, 7.8rem);
  line-height: 0.84;
  color: var(--accent);
  letter-spacing: 0;
  white-space: nowrap;
}

.size-output__label {
  color: var(--muted);
  font-weight: 900;
  padding-bottom: 11px;
}

.share-note {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: max-content;
  max-width: calc(100% - 40px);
  margin: 0;
  padding: 13px 18px;
  border: 1px solid rgba(184, 50, 95, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent-dark);
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 18px 48px rgba(98, 47, 68, 0.16);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.market-block {
  display: grid;
  gap: 14px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid rgba(234, 213, 222, 0.88);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
}

.market-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.market-head h3 {
  margin-bottom: 6px;
}

.market-head p,
.market-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.market-result {
  min-width: 132px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  text-align: right;
}

.market-result span,
.market-result strong {
  display: block;
}

.market-result span {
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 900;
}

.market-result strong {
  font-size: 1.24rem;
  line-height: 1.1;
  white-space: nowrap;
}

.market-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.market-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 900;
}

.market-button.is-active {
  border-color: rgba(184, 50, 95, 0.48);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

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

.metric-grid div {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  padding: 14px;
}

.metric-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.metric-grid dd {
  margin: 8px 0 0;
  font-size: 1.02rem;
  font-weight: 900;
}

.advice {
  display: grid;
  gap: 8px;
  margin: 0 0 22px;
}

.advice__item {
  border: 1px solid rgba(88, 115, 103, 0.18);
  border-radius: 16px;
  background: rgba(238, 246, 243, 0.82);
  padding: 11px 13px;
  color: #38574a;
  font-size: 0.94rem;
  line-height: 1.55;
}

.advice__item--warn {
  border-color: rgba(184, 50, 95, 0.18);
  background: rgba(255, 225, 234, 0.76);
  color: var(--accent-dark);
}

.sister-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sister {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font-weight: 900;
}

.qr-share {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  width: min(320px, 100%);
  margin-left: auto;
  margin-top: 18px;
  padding: 12px;
  border: 1px dashed rgba(184, 50, 95, 0.28);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.5);
}

.qr-share__code {
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  border: 8px solid #fff;
  border-radius: 14px;
  background:
    linear-gradient(90deg, var(--ink) 10px, transparent 10px 18px, var(--ink) 18px 28px, transparent 28px 38px, var(--ink) 38px 48px, transparent 48px),
    linear-gradient(var(--ink) 10px, transparent 10px 18px, var(--ink) 18px 28px, transparent 28px 38px, var(--ink) 38px 48px, transparent 48px),
    #fff;
  background-size: 48px 48px;
  box-shadow: 0 12px 30px rgba(98, 47, 68, 0.1);
  overflow: hidden;
}

.qr-share__code img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-share h3 {
  margin-bottom: 5px;
  color: var(--ink);
}

.qr-share p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 22px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  font-size: 0.94rem;
  line-height: 1.6;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 12px 0;
  vertical-align: top;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

td:first-child,
th:first-child {
  width: 28%;
  padding-right: 18px;
  font-weight: 900;
}

.sources {
  margin-top: 22px;
}

.sources ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  margin: 18px 0 0;
  padding-left: 20px;
}

.sources li {
  line-height: 1.5;
}

body.share-mode .intro,
body.share-mode .calculator,
body.share-mode .reference-grid,
body.share-mode .sources {
  display: none;
}

body.share-mode .shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 0;
}

body.share-mode .workspace {
  width: min(640px, 100%);
  display: block;
  margin: 0;
}

body.share-mode .result {
  min-height: min(680px, calc(100dvh - 56px));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

body.share-mode .metric-grid {
  display: none;
}

body.share-mode .market-picker {
  display: none;
}

body.share-mode .market-block {
  margin-top: 6px;
}

body.share-note-visible .share-note {
  display: block;
}

body.share-mode .result {
  cursor: pointer;
}

body.share-mode .result-actions {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

body.share-mode.share-controls .result-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

body.share-mode .size-output {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: 10px;
}

body.share-mode .size-output__label {
  padding-bottom: 0;
}

body.share-mode .qr-share {
  margin-top: auto;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 24px, 720px);
    padding-top: 18px;
  }

  .intro,
  .workspace,
  .reference-grid,
  .sources ul {
    grid-template-columns: 1fr;
  }

  .intro {
    min-height: 0;
  }

  .intro__copy {
    padding-bottom: 0;
  }

  .measurement-visual {
    min-height: 240px;
  }

  .size-output {
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: start;
  }

  .size-output__label {
    padding-bottom: 0;
  }

  .market-block {
    padding: 14px;
  }

  .qr-share {
    grid-template-columns: 76px minmax(0, 1fr);
    width: 100%;
  }

  .qr-share__code {
    width: 76px;
    height: 76px;
    border-width: 7px;
  }
}

@media (max-width: 540px) {
  .metric-grid,
  .market-head {
    grid-template-columns: 1fr;
  }

  .market-result {
    text-align: left;
  }

  .panel__head {
    flex-direction: column;
  }

  .result-actions,
  .unit-toggle {
    width: 100%;
  }

  .privacy-toggle,
  .unit-toggle__button {
    flex: 1;
    justify-content: center;
  }

  h1 {
    font-size: clamp(2.36rem, 12vw, 3.9rem);
  }

  .size-output strong {
    font-size: clamp(4rem, 24vw, 5.6rem);
  }

  body.share-mode .result {
    min-height: calc(100dvh - 56px);
  }

  body.share-mode .shell {
    width: min(100% - 20px, 420px);
  }

  body.share-mode .market-block {
    gap: 10px;
  }

  body.share-mode .advice__item {
    font-size: 0.88rem;
  }

  .intro {
    gap: 12px;
  }

  .measurement-visual {
    min-height: 210px;
  }
}

@media (max-width: 420px) {
  .shell {
    width: min(100% - 18px, 420px);
  }

  .calculator,
  .result,
  .reference,
  .sources {
    padding: 18px;
  }

  .size-output {
    margin: 18px 0 20px;
  }

  .market-picker {
    gap: 7px;
  }

  .market-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .qr-share {
    grid-template-columns: 68px minmax(0, 1fr);
    padding: 10px;
  }

  .qr-share__code {
    width: 68px;
    height: 68px;
    border-width: 6px;
  }
}
