:root {
  --ink: #172c2a;
  --muted: #60736f;
  --brand: #347b73;
  --brand-deep: #255e58;
  --brand-soft: #eaf4f2;
  --gold: #d6a84e;
  --gold-soft: #fff8e9;
  --danger: #a33e36;
  --danger-soft: #fff1ef;
  --line: #dfe8e6;
  --surface: #ffffff;
  --page: #f4f8f7;
  --shadow: 0 18px 50px rgba(28, 74, 68, 0.1);
  color: var(--ink);
  font-family:
    "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(79, 146, 137, 0.12), transparent 28rem),
    var(--page);
  color: var(--ink);
  line-height: 1.75;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid rgba(52, 123, 115, 0.12);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, #5c9d94, #347b73);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(52, 123, 115, 0.22);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.02em;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.security-note {
  border: 1px solid #e6c67e;
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--gold-soft);
  color: #76571c;
  font-size: 13px;
  font-weight: 700;
}

.legal-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.legal-nav > a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.legal-nav > a:hover,
.legal-nav > a:focus-visible {
  color: var(--brand);
}

.legal-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 72px;
}

.legal-intro {
  max-width: 800px;
  margin-bottom: 28px;
}

.eyebrow,
.document-kicker {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.legal-intro h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.legal-intro > p:not(.eyebrow) {
  max-width: 720px;
  margin: 18px 0;
  color: var(--muted);
}

.version-summary {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  border-radius: 12px;
  padding: 9px 14px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 700;
}

.load-state,
.error-state {
  display: flex;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.load-state p,
.error-state p {
  margin: 2px 0 0;
  color: var(--muted);
}

.load-state__spinner {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 3px solid #dceae7;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.error-state {
  border-color: #efc7c3;
  background: var(--danger-soft);
  color: var(--danger);
}

.load-state[hidden],
.error-state[hidden],
.legal-content[hidden],
.document-panel[hidden],
.consent-success[hidden] {
  display: none;
}

.secondary-button,
.primary-button {
  min-height: 44px;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 800;
}

.secondary-button {
  margin-left: auto;
  border: 1px solid currentColor;
  background: #fff;
  color: var(--danger);
}

.legal-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.special-notices {
  grid-column: 1 / 2;
  border: 1px solid #e6c67e;
  border-radius: 20px;
  padding: clamp(22px, 3vw, 30px);
  background: var(--gold-soft);
}

.special-notices__heading {
  margin-bottom: 16px;
}

.special-notices__heading h2 {
  margin: 0;
  font-size: 23px;
}

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

.special-notice {
  border: 1px solid rgba(159, 125, 53, 0.2);
  border-radius: 13px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
}

.special-notice h3 {
  margin: 0 0 4px;
  color: #654916;
  font-size: 15px;
}

.special-notice p {
  margin: 0;
  color: #6f5729;
  font-size: 14px;
}

.special-notice strong {
  color: #4e3507;
}

.document-tabs {
  display: flex;
  grid-column: 1 / 2;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 0 4px;
}

.document-tab {
  position: relative;
  border: 0;
  padding: 13px 18px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.document-tab::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  content: "";
}

.document-tab.is-active {
  color: var(--brand-deep);
}

.document-tab.is-active::after {
  background: var(--brand);
}

.document-tab:focus-visible,
.inline-link:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.brand:focus-visible {
  outline: 3px solid rgba(52, 123, 115, 0.28);
  outline-offset: 3px;
}

.document-panel {
  grid-column: 1 / 2;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(24px, 4vw, 44px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.document-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}

.document-header h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.3;
}

.document-meta {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: auto auto;
  gap: 3px 10px;
  margin: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 12px;
}

.document-meta div {
  display: contents;
}

.document-meta dt {
  color: var(--muted);
}

.document-meta dd {
  margin: 0;
  font-weight: 800;
}

.document-body {
  color: #304542;
  overflow-wrap: anywhere;
}

.document-body h1,
.document-body h2,
.document-body h3 {
  scroll-margin-top: 94px;
  color: var(--ink);
  line-height: 1.45;
}

.document-body h1 {
  margin: 2.2em 0 0.8em;
  font-size: 25px;
}

.document-body h2 {
  margin: 2em 0 0.7em;
  font-size: 21px;
}

.document-body h3 {
  margin: 1.7em 0 0.6em;
  font-size: 17px;
}

.document-body p,
.document-body li {
  font-size: 15px;
}

.document-body strong {
  border-radius: 4px;
  padding: 0.05em 0.18em;
  background: var(--gold-soft);
  color: #5f4310;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.document-body a {
  color: var(--brand-deep);
  text-underline-offset: 3px;
}

.document-body ol,
.document-body ul {
  padding-left: 1.5em;
}

.consent-card {
  position: sticky;
  grid-column: 2 / 3;
  grid-row: 1 / span 3;
  top: 96px;
  border: 1px solid #dfc483;
  border-radius: 20px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 248, 233, 0.96), rgba(255, 255, 255, 0.98));
  box-shadow: var(--shadow);
}

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

.consent-card__heading h2 {
  margin: 0;
  font-size: 24px;
}

.consent-card__badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f2e2bd;
  color: #72551c;
  font-size: 11px;
  font-weight: 800;
}

.consent-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  border-top: 1px solid rgba(159, 125, 53, 0.18);
  padding: 16px 2px;
  color: #334744;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.65;
}

.consent-item input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--brand);
}

.consent-item:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.58;
}

.consent-item--important {
  margin: 2px -10px 0;
  border: 1px solid #e6c67e;
  border-radius: 12px;
  padding: 14px 12px;
  background: var(--gold-soft);
  color: #5e4515;
}

.inline-link {
  display: inline;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--brand-deep);
  cursor: pointer;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.consent-help {
  min-height: 24px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.consent-help.is-error {
  color: var(--danger);
  font-weight: 700;
}

.primary-button {
  width: 100%;
  border: 0;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 24px rgba(52, 123, 115, 0.24);
}

.primary-button:not(:disabled):hover {
  background: var(--brand-deep);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #b9c7c4;
  box-shadow: none;
}

.consent-success {
  border-top: 1px solid rgba(52, 123, 115, 0.18);
  margin-top: 18px;
  padding-top: 16px;
  color: var(--brand-deep);
}

.consent-success p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.continue-link {
  display: inline-block;
  margin-top: 12px;
  border-radius: 10px;
  padding: 9px 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 20px 36px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

.noscript-message {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 20;
  border: 1px solid #efc7c3;
  border-radius: 12px;
  padding: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  text-align: center;
  font-weight: 800;
}

@media (max-width: 860px) {
  .legal-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .document-tabs,
  .document-panel,
  .special-notices,
  .consent-card {
    grid-column: 1;
  }

  .consent-card {
    position: static;
    grid-row: auto;
    order: 3;
  }
}

@media (max-width: 600px) {
  .site-header__inner,
  .legal-shell {
    width: min(100% - 24px, 1120px);
  }

  .site-header__inner {
    min-height: 64px;
  }

  .security-note {
    display: none;
  }

  .legal-nav {
    gap: 12px;
  }

  .legal-nav > a:not(:last-of-type) {
    display: none;
  }

  .legal-nav > a {
    min-height: 44px;
    padding: 9px 11px;
    border-radius: 12px;
    background: var(--brand-soft);
    line-height: 26px;
  }

  .legal-shell {
    padding-top: 32px;
  }

  .legal-intro h1 {
    font-size: 32px;
  }

  .document-header {
    display: block;
  }

  .document-meta {
    width: fit-content;
    margin-top: 16px;
  }

  .document-tab {
    flex: 1;
    padding-inline: 8px;
  }

  .load-state,
  .error-state {
    align-items: flex-start;
    padding: 18px;
  }

  .error-state {
    flex-wrap: wrap;
  }

  .secondary-button {
    margin-left: 0;
  }
}

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

  .load-state__spinner {
    animation: none;
  }
}
