:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #68736d;
  --line: #d8ddd8;
  --paper: #f3f4f0;
  --surface: #ffffff;
  --green: #1f725b;
  --green-soft: #e8f1ec;
  --cinnabar: #a34135;
  --gold: #aa7a2f;
  --charcoal: #25302c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(24, 32, 29, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 32, 29, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.brand, .home-link { color: inherit; text-decoration: none; }

.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand > span:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 16px; }
.brand small { color: var(--muted); font-size: 11px; }

.brand-seal {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--cinnabar);
  color: #fff;
  font-family: "Songti SC", STSong, serif;
  font-size: 19px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}

.home-link { color: var(--muted); font-size: 13px; }
.home-link:hover { color: var(--green); }
.top-actions, .account-menu { display: flex; align-items: center; gap: 16px; }
.account-menu { padding-right: 16px; border-right: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.account-menu span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 700; }
.account-menu button { border: 0; background: transparent; color: var(--cinnabar); cursor: pointer; font-size: 12px; }

main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 80px; }

.auth-panel {
  min-height: 600px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  align-items: center;
  gap: 80px;
}
.auth-copy h1 { max-width: 620px; }
.auth-copy > p:not(.eyebrow) { max-width: 590px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.auth-copy > a { color: var(--green); font-size: 13px; font-weight: 700; text-decoration: none; }
.auth-form { display: grid; gap: 18px; padding: 34px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 14px 38px rgba(24,32,29,.07); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.auth-tabs button { height: 44px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.auth-tabs button.active { border-bottom-color: var(--green); color: var(--green); }
.auth-form .primary-button { margin-top: 2px; }

.intro {
  min-height: 300px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: center;
  gap: 72px;
  padding: 10px 0 48px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cinnabar);
  font-size: 11px;
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 720px; margin-bottom: 18px; font-family: "Songti SC", STSong, serif; font-size: clamp(38px, 4.4vw, 56px); line-height: 1.16; font-weight: 700; }
.intro-copy > p:not(.eyebrow) { max-width: 690px; color: var(--muted); font-size: 16px; line-height: 1.8; }

.privacy-note { display: flex; align-items: flex-start; gap: 9px; max-width: 620px; color: var(--green); font-size: 13px; line-height: 1.6; }

.chart-visual {
  position: relative;
  width: 280px;
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  place-items: center;
}

.orbit { position: absolute; inset: 0; border: 1px solid #9ba9a1; border-radius: 50%; }
.orbit::before, .orbit::after { content: ""; position: absolute; inset: 12%; border: 1px solid rgba(31, 114, 91, .2); border-radius: 50%; }
.orbit::after { inset: 28%; }
.orbit span { position: absolute; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--paper); color: var(--green); font-family: "Songti SC", STSong, serif; font-size: 16px; }
.orbit-outer span:nth-child(1) { left: calc(50% - 15px); top: -15px; }
.orbit-outer span:nth-child(2) { right: 13px; top: 25%; }
.orbit-outer span:nth-child(3) { right: 45px; bottom: 3px; }
.orbit-outer span:nth-child(4) { left: 45px; bottom: 3px; }
.orbit-outer span:nth-child(5) { left: 13px; top: 25%; }
.orbit-inner { inset: 46px; border-color: var(--gold); animation: slow-spin 32s linear infinite; }
.orbit-inner span { background: var(--paper); color: var(--gold); animation: reverse-spin 32s linear infinite; }
.orbit-inner span:nth-child(1) { left: calc(50% - 15px); top: -15px; }
.orbit-inner span:nth-child(2) { right: -15px; top: calc(50% - 15px); }
.orbit-inner span:nth-child(3) { left: calc(50% - 15px); bottom: -15px; }
.orbit-inner span:nth-child(4) { left: -15px; top: calc(50% - 15px); }

.chart-center { width: 88px; aspect-ratio: 1; display: grid; place-content: center; gap: 4px; border-radius: 50%; background: var(--charcoal); color: #fff; text-align: center; box-shadow: 0 12px 34px rgba(24,32,29,.18); }
.chart-center strong { font-family: "Songti SC", STSong, serif; font-size: 20px; }
.chart-center small { color: #cad2cd; font-size: 10px; }

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

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 24px; align-items: stretch; }
.input-panel, .method-panel { border: 1px solid var(--line); background: var(--surface); }
.input-panel { padding: 32px; }
.method-panel { padding: 32px 28px; background: var(--charcoal); color: #fff; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.section-heading > div { display: flex; align-items: baseline; gap: 12px; }
.step { color: var(--cinnabar); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 800; }
h2 { margin-bottom: 0; font-size: 22px; }

.status-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #98a19d; }
.status-badge.ready::before { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.status-badge.unavailable::before { background: var(--cinnabar); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { min-width: 0; display: grid; align-content: start; gap: 8px; margin: 0; padding: 0; border: 0; }
.field > span, .field legend { color: #3b4641; font-size: 13px; font-weight: 700; }
.field small { color: #89918d; font-size: 11px; font-weight: 500; }
.full-width { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd2cd;
  border-radius: 5px;
  background: #fbfcfa;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,114,91,.12); }

.segmented { height: 46px; display: grid; grid-template-columns: repeat(2, 1fr); padding: 3px; border: 1px solid #cbd2cd; border-radius: 5px; background: #f4f6f3; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { height: 38px; display: grid; place-items: center; border-radius: 3px; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: #fff; color: var(--green); box-shadow: 0 1px 4px rgba(24,32,29,.12); font-weight: 750; }
.segmented input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 1px; }
.analysis-mode-field { margin-top: 2px; }
.analysis-mode { height: 66px; }
.analysis-mode span { height: 58px; align-content: center; gap: 2px; padding: 6px 10px; text-align: center; }
.analysis-mode strong, .analysis-mode small { display: block; }
.analysis-mode strong { font-size: 13px; }
.analysis-mode small { color: inherit; font-size: 10px; font-weight: 500; }

.field-help { margin-top: -2px; }
.form-error { margin-top: 18px; padding: 11px 13px; border-left: 3px solid var(--cinnabar); background: #fbefed; color: #7d3028; font-size: 13px; line-height: 1.5; }

.primary-button, .secondary-button, .icon-button { border: 0; cursor: pointer; }
.primary-button { width: 100%; height: 50px; display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; border-radius: 5px; background: var(--green); color: #fff; font-weight: 750; }
.primary-button:hover { background: #185f4c; }
.primary-button:disabled { background: #8aa298; cursor: wait; }
.button-arrow { font-size: 20px; }

.method-panel .step { color: #e0a84f; }
.method-panel h2 { margin: 8px 0 26px; font-family: "Songti SC", STSong, serif; font-size: 25px; }
.method-panel ol { counter-reset: method-step; list-style: none; margin: 0; padding: 0; }
.method-panel li { counter-increment: method-step; position: relative; display: grid; gap: 4px; padding: 0 0 25px 34px; }
.method-panel li::before { content: counter(method-step, decimal-leading-zero); position: absolute; left: 0; top: 1px; color: #e0a84f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.method-panel li:not(:last-child)::after { content: ""; position: absolute; left: 9px; top: 23px; bottom: 7px; width: 1px; background: #53605a; }
.method-panel li strong { font-size: 14px; }
.method-panel li span { color: #aeb8b3; font-size: 12px; line-height: 1.55; }
.method-panel > p { margin: 4px 0 0; padding-top: 19px; border-top: 1px solid #48544f; color: #aeb8b3; font-size: 12px; line-height: 1.7; }

.usage-panel { margin-top: 28px; border: 1px solid var(--line); background: var(--surface); }
.usage-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 28px; border-bottom: 1px solid var(--line); }
.usage-heading .eyebrow { margin-bottom: 5px; }
.usage-heading h2 { font-size: 18px; }
.usage-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.usage-stats > div { display: grid; gap: 8px; padding: 22px 28px; }
.usage-stats > div:not(:last-child) { border-right: 1px solid var(--line); }
.usage-stats span { color: var(--muted); font-size: 12px; }
.usage-stats strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 24px; }
.usage-recent { overflow-x: auto; }
.usage-recent > p { margin: 0; padding: 22px 28px; color: var(--muted); font-size: 13px; }
.usage-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 12px; }
.usage-table th, .usage-table td { padding: 13px 18px; border-bottom: 1px solid #edf0ed; text-align: left; white-space: nowrap; }
.usage-table th { color: var(--muted); font-weight: 650; }
.usage-table tbody tr:last-child td { border-bottom: 0; }
.log-status { display: inline-flex; align-items: center; gap: 6px; }
.log-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.log-status.error::before { background: var(--cinnabar); }

.loading-panel { min-height: 180px; display: flex; align-items: center; gap: 28px; margin-top: 28px; padding: 34px; border: 1px solid #bdc9c1; background: var(--green-soft); }
.loading-mark { position: relative; width: 74px; height: 74px; flex: 0 0 auto; }
.loading-mark span { position: absolute; inset: 0; border: 1px solid var(--green); border-radius: 50%; animation: pulse-ring 1.8s ease-out infinite; }
.loading-mark span:nth-child(2) { animation-delay: .6s; }
.loading-mark span:nth-child(3) { animation-delay: 1.2s; }
@keyframes pulse-ring { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.loading-panel h2 { margin-bottom: 8px; }
.loading-panel div:last-child > p:last-child { margin: 0; color: var(--muted); line-height: 1.6; }

.result-panel { margin-top: 28px; border-top: 4px solid var(--charcoal); background: var(--surface); box-shadow: 0 16px 42px rgba(24,32,29,.08); }
.result-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 32px; border-bottom: 1px solid var(--line); }
.result-header h2 { margin-bottom: 7px; font-family: "Songti SC", STSong, serif; font-size: 28px; }
.result-header p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.result-actions { display: flex; gap: 8px; }
.icon-button, .secondary-button { height: 38px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); }
.icon-button { width: 38px; font-size: 18px; }
.secondary-button { padding: 0 14px; font-size: 12px; font-weight: 700; }
.icon-button:hover, .secondary-button:hover { border-color: var(--green); color: var(--green); }
.export-button { display: inline-flex; align-items: center; gap: 7px; }
.export-button span { font-size: 16px; line-height: 1; }

.result-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-content section { position: relative; min-width: 0; padding: 30px 32px 34px; border-bottom: 1px solid var(--line); }
.result-content section:nth-child(odd):not(.wide) { border-right: 1px solid var(--line); }
.result-content .wide { grid-column: 1 / -1; }
.result-content section > span { position: absolute; right: 24px; top: 25px; color: #c3cac6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.result-content h3 { margin-bottom: 16px; color: var(--green); font-size: 15px; }
.result-content section > div { color: #35403b; font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.chart-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0 0 18px; border: 1px solid var(--line); background: var(--line); white-space: normal !important; }
.chart-facts > div { min-width: 0; padding: 11px 13px; background: #f8faf8; }
.chart-facts span { display: block; color: var(--muted); font-size: 10px; line-height: 1.4; }
.chart-facts strong { display: block; margin-top: 3px; color: var(--ink); font-size: 13px; font-weight: 700; }
.cycle-table { margin: 0 0 20px; overflow-x: auto; white-space: normal !important; }
.cycle-table table { width: 100%; min-width: 680px; border-collapse: collapse; line-height: 1.5; }
.cycle-table th, .cycle-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; white-space: nowrap; }
.cycle-table th { color: var(--muted); font-weight: 600; background: #f7f8f6; }
.cycle-table tr.current td { background: var(--green-soft); color: var(--green); font-weight: 700; }
.annual-section { background: #faf8f4; }
.annual-list { white-space: normal !important; }
.annual-item { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 24px; padding: 22px 0; border-top: 1px solid var(--line); }
.annual-item:first-child { padding-top: 4px; border-top: 0; }
.annual-year strong { display: block; color: var(--ink); font: 700 22px/1.2 "Songti SC", STSong, serif; }
.annual-year span { display: block; margin-top: 7px; color: var(--cinnabar); font-size: 12px; line-height: 1.6; }
.annual-copy { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 24px; }
.annual-copy p { margin: 0; color: #35403b; font-size: 13px; line-height: 1.75; }
.annual-copy p:first-child { grid-column: 1 / -1; }
.annual-copy b { display: block; margin-bottom: 2px; color: var(--green); font-size: 11px; }
.interaction-section { background: #f7faf8; }
.section-note { margin: -8px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.monthly-section { background: #f5f7f4; }
.monthly-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; white-space: normal !important; }
.monthly-item { min-width: 0; padding: 18px; border: 1px solid var(--line); background: #fff; }
.monthly-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; padding-bottom: 11px; border-bottom: 1px solid #edf0ed; }
.monthly-heading strong { color: var(--ink); font: 700 18px/1.25 "Songti SC", STSong, serif; }
.monthly-heading span { color: var(--cinnabar); font-size: 11px; text-align: right; }
.monthly-copy { display: grid; gap: 9px; }
.monthly-copy p { margin: 0; color: #35403b; font-size: 12px; line-height: 1.7; }
.monthly-copy b { display: block; color: var(--green); font-size: 10px; }
.advice-section { background: #f5f8f5; }
.result-disclaimer { margin: 0; padding: 18px 32px 22px; color: #7a837e; font-size: 11px; line-height: 1.6; }

footer { min-height: 72px; display: flex; justify-content: center; align-items: center; gap: 18px; padding: 18px 24px; border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; }
footer a { color: inherit; }

[hidden] { display: none !important; }

@media (max-width: 820px) {
  main { width: min(100% - 32px, 1180px); padding-top: 36px; }
  .intro { min-height: auto; grid-template-columns: 1fr; gap: 28px; padding-bottom: 38px; }
  .chart-visual { width: 210px; }
  .orbit-inner { inset: 36px; }
  .workspace { grid-template-columns: 1fr; }
  .auth-panel { min-height: auto; grid-template-columns: 1fr; gap: 34px; padding: 20px 0; }
  .method-panel ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .method-panel li { padding-bottom: 0; }
  .method-panel li::after { display: none; }
}

@media (max-width: 580px) {
  .topbar { height: 64px; padding: 0 16px; }
  .brand small { display: none; }
  .account-menu { gap: 8px; padding-right: 8px; }
  .account-menu span { max-width: 92px; }
  .home-link { font-size: 0; }
  .home-link span { font-size: 18px; }
  main { width: calc(100% - 24px); padding: 28px 0 52px; }
  h1 { font-size: 38px; }
  .chart-visual { display: none; }
  .input-panel, .method-panel { padding: 24px 18px; }
  .auth-form { padding: 24px 18px; }
  .form-grid, .result-content { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .method-panel ol { grid-template-columns: 1fr; }
  .result-header { padding: 24px 18px; flex-direction: column; }
  .result-actions { width: 100%; flex-wrap: wrap; }
  .result-actions .secondary-button { flex: 1 1 auto; }
  .result-content section, .result-content .wide { grid-column: auto; padding: 25px 18px 29px; border-right: 0 !important; }
  .chart-facts { grid-template-columns: 1fr; }
  .annual-item { grid-template-columns: 1fr; gap: 12px; }
  .annual-copy { grid-template-columns: 1fr; }
  .annual-copy p:first-child { grid-column: auto; }
  .monthly-list { grid-template-columns: 1fr; }
  .loading-panel { padding: 26px 18px; gap: 16px; }
  .loading-mark { width: 58px; height: 58px; }
  .usage-stats { grid-template-columns: 1fr; }
  .usage-stats > div { grid-template-columns: 1fr auto; align-items: center; padding: 15px 18px; }
  .usage-stats > div:not(:last-child) { border-right: 0; border-bottom: 1px solid var(--line); }
  .usage-stats strong { font-size: 20px; }
  footer { flex-direction: column; gap: 6px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .orbit-inner, .orbit-inner span, .loading-mark span { animation: none; }
}
