/* AC建站 — shared visual system */
:root {
  color-scheme: light;
  --paper: #f4f0e7;
  --paper-soft: #fbf9f4;
  --paper-deep: #ebe5d8;
  --ink: #141410;
  --ink-2: #24241e;
  --muted: #726e63;
  --muted-2: #989387;
  --line: #ded7c8;
  --line-strong: #c9c0ae;
  --orange: #ff5a2d;
  --orange-deep: #e8461a;
  --orange-soft: #ffe2d7;
  --sun: #f2c94c;
  --sage: #b9d6b0;
  --green: #1b7f58;
  --green-soft: #dff0e7;
  --danger: #c83a2a;
  --white: #fffefa;
  --font-sans: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-display: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-serif: "Georgia", "Songti SC", "STSong", "SimSun", serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-sm: 0 2px 8px rgba(54, 45, 27, .04);
  --shadow-md: 0 18px 50px rgba(54, 45, 27, .1);
  --shadow-lg: 0 40px 100px rgba(45, 37, 21, .16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open { overflow: hidden; }

::selection {
  color: var(--ink);
  background: var(--sun);
}

img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4, h5 { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

html[data-auth="in"] [data-guest],
html[data-auth="out"] [data-user] { display: none !important; }

.container {
  width: min(1240px, calc(100% - 64px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  transform: translateY(-160%);
  transition: transform .2s;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.04em;
  line-height: 1;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -.08em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}

.brand-word { display: flex; align-items: baseline; gap: 3px; }
.brand-cn { font-size: 9px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  transition: background .22s var(--ease), color .22s var(--ease), border-color .22s var(--ease), transform .22s var(--ease), box-shadow .22s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.99); }
.btn .arr { transition: transform .25s var(--ease); }
.btn:hover .arr { transform: translateX(3px); }

.btn-dark { background: var(--ink); color: var(--white); }
.btn-dark:hover { background: var(--orange); color: var(--ink); }
.btn-orange { background: var(--orange); color: var(--ink); }
.btn-orange:hover { background: var(--ink); color: var(--white); }
.btn-light { background: var(--white); border-color: var(--line); }
.btn-light:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); background: rgba(255, 255, 255, .45); }
.btn-quiet { min-height: 40px; padding: 0 14px; color: var(--muted); }
.btn-quiet:hover { color: var(--ink); background: rgba(20, 20, 16, .05); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 13px; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { cursor: not-allowed; opacity: .45; transform: none; box-shadow: none; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn-label { opacity: .65; }

.btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 76px;
  border-bottom: 1px solid transparent;
  transition: background .25s var(--ease), border-color .25s var(--ease), height .25s var(--ease);
}
.site-header.is-scrolled {
  height: 68px;
  border-color: var(--line);
  background: rgba(244, 240, 231, .82);
  backdrop-filter: blur(18px) saturate(150%);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 28px;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 26px;
  margin-right: auto;
}
.main-nav a {
  position: relative;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: color .2s, background .2s;
}
.main-nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .5); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-login {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  border-radius: 999px;
  transition: background .2s;
}
.header-login:hover { background: rgba(255, 255, 255, .6); }

.console-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 8px 0 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  transition: background .22s, transform .22s;
}
.console-pill:hover { background: var(--orange); color: var(--ink); transform: translateY(-1px); }
.console-pill .avatar-mini {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.console-pill .pill-arrow {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

/* ---------- decorative ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow .pulse-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
}
.eyebrow .pulse-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--orange);
  opacity: .5;
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(.6); opacity: .7; }
  70%, 100% { transform: scale(1.8); opacity: 0; }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: var(--paper-deep);
  color: var(--ink);
}
.badge-orange { background: var(--orange-soft); color: var(--orange-deep); }
.badge-green { background: var(--green-soft); color: var(--green); }

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #43d18d;
  box-shadow: 0 0 0 3px rgba(67, 209, 141, .16);
}

/* ---------- forms ---------- */
.field { display: grid; gap: 8px; }
.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.field-label .optional { color: var(--muted-2); font-weight: 500; }
.field-hint { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.field-hint.is-ok { color: var(--green); }
.field-hint.is-error { color: var(--danger); }

.input,
.textarea,
.select {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.textarea { height: auto; min-height: 100px; padding: 12px 15px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #aaa497; }
.input:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20, 20, 16, .08);
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 170px; }
.input-suffix {
  position: absolute;
  right: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 150px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-display);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.input-suffix::before {
  content: ".";
  color: var(--muted-2);
}
.checkline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
}
.checkline input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--ink); }
.checkline a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.visibility-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  user-select: none;
}
.visibility-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #d8d0c1;
  transition: background .22s var(--ease);
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(20, 20, 16, .18);
  transition: transform .22s var(--ease);
}
.visibility-toggle input:checked + .toggle-switch { background: var(--ink); }
.visibility-toggle input:checked + .toggle-switch::after { transform: translateX(14px); }
.visibility-toggle input:focus-visible + .toggle-switch { outline: 2px solid var(--orange); outline-offset: 3px; }
.toggle-copy { min-width: 0; display: grid; gap: 2px; }
.toggle-copy strong { font-size: 10.5px; font-weight: 700; }
.toggle-copy small { color: var(--muted); font-size: 9px; line-height: 1.4; }

/* ---------- toast ---------- */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 300;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--white);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toastIn .35s var(--ease-out);
}
.toast.is-error { background: #77271c; }
.toast.is-success { background: #155c40; }
.toast-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  font-size: 11px;
}
.toast.is-leaving { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- dialog ---------- */
dialog {
  width: auto;
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}
dialog[open] {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 24px;
  overflow: auto;
  background: transparent;
}
dialog::backdrop {
  background: rgba(20, 20, 16, .58);
  backdrop-filter: blur(8px) saturate(90%);
}
dialog[open] .dialog-shell { animation: dialogIn .38s var(--ease-out); margin: auto; }
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(22px) scale(.975); }
}

.dialog-shell {
  width: min(600px, calc(100vw - 32px));
  max-height: min(90vh, 900px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 26px;
  background: var(--paper-soft);
  box-shadow: var(--shadow-lg);
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 28px 18px;
  background: linear-gradient(var(--paper-soft) 72%, rgba(251, 249, 244, .84) 100%);
}
.dialog-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--orange-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.dialog-title {
  font-family: var(--font-display);
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: -.04em;
  font-weight: 700;
}
.dialog-sub { margin-top: 7px; color: var(--muted); font-size: 13px; }
.dialog-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--muted);
  transition: color .2s, border-color .2s, transform .2s;
}
.dialog-close:hover { color: var(--ink); border-color: var(--ink); transform: rotate(90deg); }
.dialog-body { padding: 0 28px 26px; }
.dialog-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 22px;
  border-top: 1px solid var(--line);
  background: rgba(251, 249, 244, .92);
  backdrop-filter: blur(12px);
}
.dialog-foot .foot-note { margin-right: auto; color: var(--muted); font-size: 11.5px; }

/* ---------- reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
  transition-delay: var(--delay, 0s);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .container { width: min(100% - 40px, 760px); }
  .main-nav { display: none; }
}
@media (max-width: 600px) {
  .container { width: calc(100% - 32px); }
  .site-header { height: 66px; }
  .site-header.is-scrolled { height: 62px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 9px; }
  .header-login { display: none; }
  .console-pill { height: 40px; padding-left: 11px; }
  .console-pill .avatar-mini { width: 26px; height: 26px; }
  dialog[open] { padding: 12px; }
  dialog[open] .dialog-shell { max-height: calc(100vh - 24px); }
  .dialog-head { padding: 22px 20px 16px; }
  .dialog-body { padding: 0 20px 22px; }
  .dialog-foot { padding: 14px 20px 18px; flex-wrap: wrap; }
  .dialog-foot .btn { flex: 1; }
  .dialog-foot .foot-note { width: 100%; margin: 0 0 6px; text-align: center; }
}
