@import url("./tokens.css");

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Material: mesh + grain */
.mesh {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% 10%, color-mix(in srgb, var(--mesh-a) 28%, transparent), transparent 60%),
    radial-gradient(700px 480px at 88% 18%, color-mix(in srgb, var(--mesh-b) 22%, transparent), transparent 55%),
    radial-gradient(600px 400px at 50% 90%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 50%),
    var(--canvas);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#three-root {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.55;
}
.shell { position: relative; z-index: 2; }

.glass {
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 14px;
  padding: 11px 18px; border-radius: 8px;
  transition: transform .16s var(--ease), background .2s, opacity .2s, box-shadow .2s, filter .2s;
}
.btn:hover { filter: brightness(1.06); }
.btn.ae-pressed, .btn:active { transform: scale(0.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ae-btn-done {
  background: color-mix(in srgb, var(--ok) 85%, #042f2e) !important;
  color: #042f2e !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 50%, transparent);
}
.btn-primary { background: var(--accent); color: #042f2e; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
}
.btn-ghost:hover { background: rgba(255,255,255,.04); }
.btn-danger { background: #7f1d1d; color: #fecaca; }

.input, .select, .textarea {
  width: 100%; padding: 11px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: rgba(0,0,0,.28); color: var(--ink);
  font: inherit; outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.label { display:block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px;
  border: 1px solid var(--line); color: var(--muted);
}
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.tag.warn { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: rgba(7,11,18,.55); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
}
.brand-mark {
  font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}
.brand-title { margin: 2px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -0.03em; }

.layout {
  display: grid; grid-template-columns: 220px 1fr; gap: 20px;
  max-width: 1200px; margin: 0 auto; padding: 24px 20px 64px;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}
.nav {
  padding: 12px; display: flex; flex-direction: column; gap: 6px; height: fit-content;
}
.nav button {
  text-align: left; background: transparent; border: 0; color: var(--muted);
  padding: 10px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500;
}
.nav button.active, .nav button:hover {
  color: var(--ink); background: rgba(45, 212, 191, 0.1);
}
.panel { padding: 20px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: -0.02em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 800px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions .btn { padding: 7px 10px; font-size: 12px; }

.reveal {
  opacity: 0; transform: translateY(12px);
  transition: opacity .48s var(--ease), transform .48s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* Landing */
.hero {
  max-width: 1100px; margin: 0 auto; padding: 72px 24px 40px;
  display: grid; gap: 28px;
}
.hero h1 {
  margin: 0; font-size: clamp(36px, 6vw, 64px); font-weight: 600;
  letter-spacing: -0.04em; line-height: 1.05; max-width: 14ch;
}
.hero p.lead { margin: 0; color: var(--muted); font-size: 17px; max-width: 46ch; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.feature-grid {
  max-width: 1100px; margin: 0 auto; padding: 24px 24px 80px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
@media (max-width: 900px) { .feature-grid { grid-template-columns: 1fr; } }
.feature { padding: 22px; }
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }

.style-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
}
.style-card {
  padding: 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer;
  transition: transform .15s var(--ease), border-color .2s;
}
.style-card:hover { transform: translateY(-2px); }
.style-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.style-swatch {
  height: 64px; border-radius: 8px; margin-bottom: 8px;
  border: 1px solid var(--line);
}
.modal-mask {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.55); align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal { width: min(520px, 100%); padding: 22px; }
.token-box {
  margin: 12px 0; padding: 12px; border-radius: 8px;
  background: #042f2e; color: #99f6e4; font-family: var(--mono); word-break: break-all;
}

.auth-box {
  width: min(420px, 100%); margin: 10vh auto; padding: 32px 28px;
}
.auth-box h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.03em; }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px;
}
@media (max-width: 900px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat { padding: 16px; }
.stat b { display:block; font-size: 24px; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  #three-root { display: none; }
}

.nav-sep {
  height: 1px; margin: 8px 4px; background: var(--line);
}
.wizard-steps {
  list-style: none; margin: 16px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
@media (max-width: 800px) {
  .wizard-steps { grid-template-columns: 1fr 1fr; }
}
.wizard-steps li {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted);
  font-size: 13px; cursor: pointer; user-select: none;
}
.wizard-steps li span {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06); font-size: 12px; font-weight: 700;
}
.wizard-steps li.active {
  color: var(--ink); border-color: var(--accent);
  background: rgba(45, 212, 191, 0.08);
}
.wizard-steps li.active span { background: var(--accent); color: #042f2e; }
.wizard-steps li.done { color: var(--ink); }
.wizard-steps li.done span { background: color-mix(in srgb, var(--ok) 55%, transparent); }

.prose-section {
  max-width: 1100px; margin: 0 auto; padding: 8px 24px 40px;
}
.prose h2 { margin: 0 0 12px; font-size: 20px; letter-spacing: -0.02em; }
.prose p, .prose li { color: var(--muted); font-size: 15px; line-height: 1.7; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 1.2em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose code {
  font-family: var(--mono); font-size: 12px;
  background: rgba(0,0,0,.28); padding: 2px 6px; border-radius: 4px;
}

.qr-row {
  display: flex; flex-wrap: wrap; gap: 20px; justify-content: flex-start;
}
.qr-card {
  margin: 0; padding: 16px; text-align: center; width: fit-content;
}
.qr-card img { display: block; border-radius: 8px; }
.qr-card figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); }

.msg-list {
  list-style: none; margin: 0; padding: 0;
}
.msg-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}

.site-foot {
  max-width: 1100px; margin: 0 auto; padding: 24px 24px 72px;
  text-align: center; color: var(--muted); font-size: 14px;
}
.site-foot p { margin: 8px 0 0; }

.capability-strip {
  max-width: 1100px; margin: 0 auto; padding: 0 24px 28px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
@media (max-width: 900px) {
  .capability-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .capability-strip { grid-template-columns: 1fr; }
}
.cap {
  padding: 16px 14px;
}
.cap b {
  display: block; font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.04em; color: var(--accent); font-weight: 500; margin-bottom: 6px;
}
.cap span { font-size: 13px; color: var(--muted); line-height: 1.45; }

.arch-layers { display: grid; gap: 10px; margin-top: 18px; }
.arch-layer {
  display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: start;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.arch-layer:last-child { border-bottom: 1px solid var(--line); }
.arch-tag {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  padding-top: 2px; font-weight: 500;
}
.arch-layer strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.arch-layer p { margin: 0; font-size: 14px; }

.trust-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; margin-top: 16px;
}
@media (max-width: 800px) { .trust-grid { grid-template-columns: 1fr; } }
.trust-grid h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.trust-grid p { margin: 0; font-size: 14px; }

.stack-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
@media (max-width: 900px) { .stack-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .stack-grid { grid-template-columns: 1fr; } }
.stack-card {
  padding: 16px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(0,0,0,.18);
}
.stack-card h3 {
  margin: 0 0 10px; font-size: 14px; color: var(--ink); letter-spacing: -0.01em;
}
.stack-card ul {
  margin: 0; padding: 0; list-style: none;
}
.stack-card li {
  position: relative; padding: 5px 0 5px 14px;
  font-size: 13px; color: var(--muted); border-bottom: 1px solid transparent;
}
.stack-card li::before {
  content: ""; position: absolute; left: 0; top: 0.7em;
  width: 5px; height: 5px; border-radius: 1px; background: var(--accent);
  opacity: 0.7;
}

/* —— Feedback / toast / dialog —— */
.nav button, .style-card { position: relative; overflow: hidden; }
.ae-ripple-wave {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.35) 0%, rgba(255,255,255,0) 70%);
  transform: scale(0); animation: ae-ripple .55s var(--ease) forwards;
}
@keyframes ae-ripple {
  to { transform: scale(1); opacity: 0; }
}
.nav button.ae-pressed, .style-card.ae-pressed {
  transform: scale(0.98);
}

#ae-ui-root {
  position: fixed; inset: 0; z-index: 100;
  pointer-events: none; /* never block page; children opt-in */
}
.ae-toast-host {
  position: fixed; top: 20px; right: 20px; z-index: 120;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.ae-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(14, 22, 34, 0.92); border: 1px solid var(--line);
  backdrop-filter: blur(16px); box-shadow: var(--shadow);
  color: var(--ink); font-size: 13px; line-height: 1.45;
  opacity: 0; transform: translateY(-10px) scale(0.96);
  transition: opacity .28s var(--ease), transform .28s var(--ease);
  cursor: pointer;
}
.ae-toast.in { opacity: 1; transform: none; }
.ae-toast.out { opacity: 0; transform: translateY(-8px); }
.ae-toast-ico { flex: 0 0 auto; width: 28px; height: 28px; color: var(--accent); }
.ae-toast-ico svg { width: 28px; height: 28px; display: block; }
.ae-toast-success .ae-toast-ico { color: var(--ok); }
.ae-toast-error .ae-toast-ico { color: var(--bad); }
.ae-toast-warn .ae-toast-ico { color: var(--accent-2); }
.ae-toast-msg { padding-top: 4px; word-break: break-word; }

.ae-dialog-mask, .ae-loading-mask {
  position: fixed; inset: 0; z-index: 130;
  display: none; /* must stay none when closed — overrides [hidden] fight */
  align-items: center; justify-content: center;
  padding: 20px; background: rgba(0,0,0,.55);
  opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease);
}
.ae-dialog-mask.show, .ae-loading-mask.show {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}
.ae-dialog-mask[hidden], .ae-loading-mask[hidden] {
  display: none !important;
  pointer-events: none !important;
}
.ae-dialog {
  width: min(420px, 100%); padding: 24px 22px 18px; text-align: center;
  transform: translateY(12px) scale(0.96);
  transition: transform .28s var(--ease);
  pointer-events: auto;
}
.ae-dialog-mask.show .ae-dialog { transform: none; }
.ae-dialog-icon { margin: 0 auto 10px; width: 44px; height: 44px; }
.ae-dialog-icon svg { display: block; }
.ae-ico-success { color: var(--ok); }
.ae-ico-error { color: var(--bad); }
.ae-ico-warn { color: var(--accent-2); }
.ae-ico-info { color: var(--accent); }
.ae-dialog-title { margin: 0 0 8px; font-size: 18px; letter-spacing: -0.02em; }
.ae-dialog-body {
  margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; text-align: left;
}
.ae-dialog-input-wrap { margin: 0 0 14px; text-align: left; }
.ae-dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.ae-check { stroke-dasharray: 40; stroke-dashoffset: 40; animation: ae-draw .45s .12s var(--ease) forwards; }
.ae-ring { opacity: .85; }
@keyframes ae-draw { to { stroke-dashoffset: 0; } }

.ae-loading-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; font-size: 14px; color: var(--ink);
  transform: scale(0.96); transition: transform .22s var(--ease);
}
.ae-loading-mask.show .ae-loading-card { transform: none; }
.ae-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  animation: ae-spin .7s linear infinite;
}
@keyframes ae-spin { to { transform: rotate(360deg); } }

.modal-mask.show .modal {
  animation: ae-pop .32s var(--ease);
}
@keyframes ae-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.wizard-steps li {
  transition: transform .15s var(--ease), border-color .2s, background .2s, color .2s;
}
.wizard-steps li:active { transform: scale(0.98); }

@media (prefers-reduced-motion: reduce) {
  .ae-toast, .ae-dialog, .ae-ripple-wave, .ae-spinner, .ae-check, .modal-mask.show .modal {
    animation: none !important; transition: none !important;
  }
  .ae-toast { opacity: 1; transform: none; }
  .ae-check { stroke-dashoffset: 0; }
}

/* Membership plans */
.plan-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
@media (max-width: 1000px) { .plan-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .plan-grid { grid-template-columns: 1fr; } }
.plan-card {
  padding: 18px 16px; display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--line); transition: transform .15s var(--ease), border-color .2s;
}
.plan-card h3 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.plan-card.highlight { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.plan-card.current { box-shadow: 0 0 0 1px var(--accent); }
.plan-feats {
  margin: 4px 0 10px; padding: 0; list-style: none; flex: 1;
}
.plan-feats li {
  position: relative; padding: 5px 0 5px 14px; font-size: 13px; color: var(--muted);
}
.plan-feats li::before {
  content: ""; position: absolute; left: 0; top: 0.7em;
  width: 5px; height: 5px; border-radius: 1px; background: var(--accent); opacity: .75;
}
.style-card.locked { opacity: 0.45; }
.style-card.locked::after {
  content: "锁定"; position: absolute; right: 8px; top: 8px;
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: rgba(0,0,0,.55); color: var(--accent-2); border: 1px solid var(--line);
}

/* Homepage right-edge customer service dock */
.cs-dock {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%);
  z-index: 50; display: flex; align-items: stretch;
  pointer-events: none;
}
.cs-dock-tab, .cs-dock-panel { pointer-events: auto; }
.cs-dock-tab {
  writing-mode: vertical-rl; text-orientation: mixed;
  letter-spacing: 0.2em; font-family: inherit; font-weight: 600; font-size: 13px;
  border: 1px solid var(--line); border-right: 0;
  border-radius: 10px 0 0 10px; padding: 16px 10px;
  background: rgba(14, 22, 34, 0.92); color: var(--accent);
  backdrop-filter: blur(14px); cursor: pointer;
  box-shadow: var(--shadow);
}
.cs-dock-panel {
  width: 0; overflow: hidden; opacity: 0;
  padding: 0; border: 0;
  transition: width .28s var(--ease), opacity .22s var(--ease), padding .28s var(--ease);
}
.cs-dock.open .cs-dock-panel {
  width: 280px; opacity: 1; padding: 14px;
  border: 1px solid var(--line); border-right: 0;
  border-radius: 12px 0 0 12px;
  background: rgba(14, 22, 34, 0.94);
}
.cs-dock-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; gap: 8px;
}
.cs-dock-head strong { font-size: 14px; }
.cs-dock-qrs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.cs-dock-qrs figure { margin: 0; text-align: center; }
.cs-dock-qrs img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); display: block;
  background: #fff;
}
.cs-dock-qrs figcaption {
  margin-top: 6px; font-size: 12px; color: var(--muted);
}
.cs-dock-qrs figcaption b { color: var(--ink); font-weight: 600; }
@media (max-width: 560px) {
  .cs-dock.open .cs-dock-panel { width: min(280px, calc(100vw - 48px)); }
}

.captcha-row {
  display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center;
}
.captcha-img {
  height: 44px; border-radius: 8px; border: 1px solid var(--line);
  background: #0b1220; cursor: pointer; padding: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.captcha-img svg { display: block; width: 120px; height: 40px; }
