/* ════════════════════════════════════════════════════════════════════════
   USTC.Ai — shared.css
   Bold & modern · cream background · strong clay · light only
   ════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;450;500;600;700;800&display=swap');

:root {
  /* ── Clay (signature, strong) ── */
  --clay:        #D9603B;
  --clay-dk:     #BC4A29;
  --clay-darker: #9E3A1E;
  --clay-lt:     #E8845F;
  --clay-soft:   rgba(217, 96, 59, 0.10);
  --clay-soft2:  rgba(217, 96, 59, 0.16);
  --clay-glow:   rgba(217, 96, 59, 0.30);

  /* ── Cream / ivory family ── */
  --cream:       #F4EFE7;
  --cream-2:     #EFE8DD;
  --ivory:       #FBF8F3;
  --paper:       #FFFFFF;
  --sand:        #E8DFD1;

  /* ── Accent supports ── */
  --sage:        #6F9C84;
  --sage-dk:     #517A65;
  --gold:        #C99A3F;
  --ink:         #2A2520;

  /* ── Text ── */
  --text-strong: #211C16;
  --text:        #3A332B;
  --text-muted:  #7C7264;
  --text-faint:  #A99E8C;

  /* ── Lines ── */
  --border:        rgba(33, 28, 22, 0.10);
  --border-strong: rgba(33, 28, 22, 0.16);

  /* ── Semantic ── */
  --ok:      #4E8268;
  --ok-bg:   rgba(111, 156, 132, 0.16);
  --err:     #C0432E;
  --err-bg:  rgba(192, 67, 46, 0.10);
  --info:    var(--clay-dk);
  --info-bg: var(--clay-soft);

  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(33, 28, 22, 0.06);
  --shadow:    0 8px 28px rgba(33, 28, 22, 0.09);
  --shadow-lg: 0 18px 48px rgba(33, 28, 22, 0.13);
  --shadow-clay: 0 10px 30px var(--clay-glow);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Inter', ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Legacy aliases (chat.js inline styles) */
  --muted:       var(--text-muted);
  --text-dark:   var(--text-strong);
  --coral:       var(--clay);
  --salmon:      var(--clay-lt);
  --green:       var(--sage);
  --danger:      var(--err);
  --accent:      var(--clay);
  --accent-dk:   var(--clay-dk);
  --accent-soft: var(--clay-soft);
  --accent-glow: var(--clay-glow);
  --bg-main:     var(--cream);
  --bg-sidebar:  var(--ivory);
  --bg-panel:    var(--paper);
  --bg-input:    var(--paper);
  --bg-base:     var(--cream);
  --bg-elevated: var(--paper);
  --bg-sunk:     var(--cream-2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.55;
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* ── Ambient orbs ─────────────────────────────────────────────────────────── */
.orb-field { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); will-change: transform; }
.orb.o1 { width: 44vw; height: 44vw; background: rgba(217,96,59,0.18); top: -14vw; left: -8vw; animation: drift1 24s var(--ease) infinite alternate; }
.orb.o2 { width: 36vw; height: 36vw; background: rgba(111,156,132,0.16); bottom: -12vw; right: -6vw; animation: drift2 28s var(--ease) infinite alternate; }
.orb.o3 { width: 28vw; height: 28vw; background: rgba(201,154,63,0.14); top: 42%; left: 56%; animation: drift3 32s var(--ease) infinite alternate; }
@keyframes drift1 { to { transform: translate(7vw, 9vh) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-9vw, -7vh) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-12vw, 5vh) scale(0.92); } }
@media (prefers-reduced-motion: reduce) { .orb { animation: none !important; } }

/* ════════════════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ════════════════════════════════════════════════════════════════════════ */
label {
  display: block; margin-bottom: 8px;
  font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
input[type="text"], input[type="password"], input[type="email"], select, textarea {
  width: 100%; padding: 13px 16px; margin-bottom: 14px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  background: var(--paper); color: var(--text-strong);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--clay);
  box-shadow: 0 0 0 4px var(--clay-soft);
}
input[type="file"] {
  width: 100%; padding: 16px; margin-bottom: 14px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--clay-soft); color: var(--text); cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
input[type="file"]:hover { border-color: var(--clay); background: var(--clay-soft2); }

/* ════════════════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 22px; border-radius: var(--radius); border: 0; cursor: pointer;
  font-weight: 600; letter-spacing: 0.01em; position: relative; overflow: hidden;
  transition: transform 0.18s var(--ease), box-shadow 0.25s var(--ease), background 0.2s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.4) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform 0.6s var(--ease);
}
.btn:hover::after { transform: translateX(120%); }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--clay), var(--clay-dk));
  color: #fff; box-shadow: var(--shadow-clay);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 38px var(--clay-glow); }

.btn-ghost {
  width: 100%; background: var(--paper);
  border: 1.5px solid var(--border-strong); color: var(--text-strong);
}
.btn-ghost:hover { background: var(--clay-soft); border-color: var(--clay); }

.btn-danger { background: var(--err-bg); border: 1.5px solid var(--err); color: var(--err); }
.btn-danger::after { display: none; }
.btn-danger:hover { background: var(--err); color: #fff; }

/* ════════════════════════════════════════════════════════════════════════
   CARDS / SURFACES
   ════════════════════════════════════════════════════════════════════════ */
.surface {
  background: var(--paper);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

/* ════════════════════════════════════════════════════════════════════════
   STATUS
   ════════════════════════════════════════════════════════════════════════ */
.status { display: none; margin-top: 14px; padding: 13px 16px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500; }
.status.show { display: block; animation: statusIn 0.3s var(--ease); }
@keyframes statusIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.status.err  { background: var(--err-bg); color: var(--err); border: 1.5px solid var(--err); }
.status.ok   { background: var(--ok-bg); color: var(--ok); border: 1.5px solid var(--sage); }
.status.info { background: var(--info-bg); color: var(--info); border: 1.5px solid var(--clay); }

.fade-up { animation: fadeUp 0.6s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ════════════════════════════════════════════════════════════════════════
   PORTAL CHROME — shared header / nav (matches homepage)
   ════════════════════════════════════════════════════════════════════════ */
.portal-topbar {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 34px;
  background: rgba(244, 239, 231, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1.5px solid var(--border);
}
.portal-topbar.solid-bg { background: var(--paper); }
.portal-topbar .topbar-start { display: flex; align-items: center; gap: 12px; min-width: 0; }
.portal-topbar .topbar-center { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; }
.portal-topbar .topbar-end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 1.4rem;
  color: var(--text-strong); letter-spacing: -0.03em; white-space: nowrap;
}
.brand span { color: var(--clay); }
.brand .tag {
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted); margin-left: 6px; letter-spacing: 0;
}

.nav-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-pill {
  padding: 9px 18px; border-radius: var(--radius-pill);
  font-size: 0.88rem; font-weight: 600; text-decoration: none; color: var(--text);
  border: 1.5px solid var(--border-strong); background: var(--paper);
  transition: all 0.18s var(--ease); cursor: pointer;
  white-space: nowrap;
}
.nav-pill:hover { border-color: var(--clay); color: var(--clay-dk); }
.nav-pill.solid { background: var(--clay); color: #fff; border-color: var(--clay); }
.nav-pill.solid:hover { background: var(--clay-dk); color: #fff; }
.nav-pill.danger:hover { border-color: var(--err); color: var(--err); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 18px; margin-bottom: 22px;
  border-radius: var(--radius-pill); font-size: 0.82rem; font-weight: 600;
  color: var(--clay-dk); background: var(--clay-soft); border: 1.5px solid var(--clay-soft2);
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--sage);
  box-shadow: 0 0 0 4px rgba(111,156,132,0.2);
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(111,156,132,0.2); }
  50% { box-shadow: 0 0 0 9px rgba(111,156,132,0); }
}

.back-link {
  color: var(--clay); text-decoration: none; font-size: 0.88rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px;
  transition: gap 0.18s var(--ease);
}
.back-link:hover { gap: 9px; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px 6px 14px; border-radius: var(--radius-pill);
  background: var(--paper); border: 1.5px solid var(--border);
  font-size: 0.86rem; color: var(--text); font-weight: 500;
}
.user-chip .av {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--clay), var(--clay-dk));
  color: #fff; display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
}

.login-page { min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 2; }
.login-main { flex: 1; display: grid; place-items: center; padding: 24px; }

.icon-mark {
  width: 58px; height: 58px; border-radius: 17px;
  display: grid; place-items: center; font-size: 1.5rem; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--clay), var(--clay-dk));
  color: #fff; box-shadow: var(--shadow-clay);
}
.login-card h1 {
  font-family: var(--font-display); font-weight: 600; margin: 0 0 8px;
  font-size: clamp(1.7rem, 4vw, 2rem); color: var(--text-strong); letter-spacing: -0.03em;
}
.login-card h1 span { color: var(--clay); }
.login-card .lede { margin: 0 0 26px; color: var(--text-muted); font-size: 0.94rem; line-height: 1.6; }
.login-card.signup { width: min(480px, 100%); max-height: calc(100vh - 120px); overflow-y: auto; }
.field-hint { margin: -8px 0 14px; font-size: 0.78rem; color: var(--text-faint); }
label .req { color: var(--err); font-weight: 700; }
.auth-switch {
  margin: 18px 0 0; text-align: center; font-size: 0.9rem; color: var(--text-muted);
}
.auth-switch a { color: var(--clay-dk); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { color: var(--clay); text-decoration: underline; }
.btn-block { width: 100%; }
.otp-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 14px; }
.otp-row input { flex: 1; margin-bottom: 0; }
.otp-row .btn {
  width: auto; flex-shrink: 0; white-space: nowrap; padding: 12px 14px;
}
.otp-row .btn::after { display: none; }
.otp-row .btn:disabled { opacity: 0.6; cursor: not-allowed; }

.stat-num-clay { font-family: var(--font-display); color: var(--clay) !important; }

@media (max-width: 720px) {
  .portal-topbar { padding: 16px 18px; flex-wrap: wrap; }
  .nav-links { width: 100%; justify-content: flex-end; }
}

/* ════════════════════════════════════════════════════════════════════════
   SITE FOOTER — homepage & shared
   ════════════════════════════════════════════════════════════════════════ */
.site-footer {
  position: relative; z-index: 2;
  margin-top: auto;
  border-top: 1.5px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-footer-inner {
  max-width: 1120px; margin: 0 auto;
  padding: 48px 34px 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 36px 28px;
}
.footer-col h4 {
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  color: var(--text-strong); margin: 0 0 16px; letter-spacing: -0.02em;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a, .footer-col .footer-text {
  color: var(--text-muted); text-decoration: none; font-size: 0.86rem;
  line-height: 1.5; transition: color 0.15s var(--ease);
}
.footer-col a:hover { color: var(--clay-dk); }
.footer-col a.is-active { color: var(--clay-dk); font-weight: 600; }
.footer-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; color: var(--clay-dk) !important;
  padding: 8px 0; font-size: 0.88rem !important;
  transition: gap 0.18s var(--ease);
}
.footer-cta:hover { gap: 10px; color: var(--clay) !important; }
.footer-col a.ext::after { content: " ↗"; font-size: 0.75em; opacity: 0.6; }

.social-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.social-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border); background: var(--cream);
  color: var(--text); font-size: 0.78rem; font-weight: 600;
  text-decoration: none; transition: all 0.15s var(--ease);
}
.social-chip:hover { border-color: var(--clay); color: var(--clay-dk); background: var(--clay-soft); }

.wechat-wrap { position: relative; display: inline-block; }
.wechat-trigger {
  cursor: pointer; font: inherit; appearance: none;
  text-decoration: none; color: inherit;
}
.wechat-trigger::after { content: " ▾"; font-size: 0.7em; opacity: 0.65; }

.wechat-popover {
  position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 30;
  min-width: 196px; padding: 14px; text-align: center;
  background: var(--paper); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}
.wechat-popover::after {
  content: ""; position: absolute; left: 20px; bottom: -7px;
  width: 12px; height: 12px; background: var(--paper);
  border-right: 1.5px solid var(--border); border-bottom: 1.5px solid var(--border);
  transform: rotate(45deg);
}
.wechat-popover::before {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px;
}
.wechat-wrap:hover .wechat-popover,
.wechat-wrap:focus-within .wechat-popover {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateY(0);
}
.wechat-qr {
  width: 88px; height: 88px; margin: 0 auto 10px; border-radius: 10px;
  background: var(--cream); border: 1.5px solid var(--border);
  display: grid; place-items: center; font-size: 2rem; color: var(--clay-dk);
}
.wechat-popover strong {
  display: block; font-size: 0.82rem; color: var(--text-strong); margin-bottom: 4px;
}
.wechat-id { font-size: 0.88rem; font-weight: 700; color: var(--clay-dk); margin: 0 0 8px; }
.wechat-popover small {
  display: block; font-size: 0.72rem; color: var(--text-faint); line-height: 1.45;
}

@media (hover: none) {
  .wechat-wrap:focus-within .wechat-popover { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
}

.footer-about { margin: 0 0 12px; font-size: 0.86rem; color: var(--text-muted); line-height: 1.6; }
.footer-about strong { color: var(--text-strong); font-weight: 600; }

.dev-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.dev-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 10px 10px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--paper);
  min-width: 0; flex: 1 1 160px; max-width: 220px;
}
.dev-av {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--clay), var(--clay-dk));
  color: #fff; display: grid; place-items: center;
  font-size: 0.82rem; font-weight: 700;
}
.dev-card strong { display: block; font-size: 0.84rem; color: var(--text-strong); }
.dev-card span { font-size: 0.72rem; color: var(--text-muted); }
.dev-card a { font-size: 0.72rem; color: var(--clay); text-decoration: none; font-weight: 600; }
.dev-card a:hover { text-decoration: underline; }

.footer-join {
  margin-top: 12px; padding: 14px; border-radius: var(--radius-lg);
  background: var(--clay-soft); border: 1.5px solid var(--clay-soft2);
}
.footer-join p { margin: 0 0 10px; font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; }
.footer-join .btn-join {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-pill);
  background: var(--clay); color: #fff; font-size: 0.82rem; font-weight: 600;
  text-decoration: none; border: 0; transition: background 0.15s var(--ease);
}
.footer-join .btn-join:hover { background: var(--clay-dk); }

.footer-legal {
  margin-top: 36px; padding-top: 24px;
  border-top: 1.5px solid var(--border);
  text-align: center;
}
.footer-legal p { margin: 0; font-size: 0.78rem; color: var(--text-faint); }

.footer-disclosure-panels { margin-top: 28px; }
.footer-disclosure-panel {
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--cream); border: 1px solid var(--border);
  font-size: 0.8rem; color: var(--text-muted); line-height: 1.65;
  animation: footerPanelIn 0.2s var(--ease);
}
.footer-disclosure-panel[hidden] { display: none !important; }
.footer-disclosure-label {
  margin: 0 0 8px; font-size: 0.82rem; font-weight: 600; color: var(--text-strong);
}
.footer-disclosure-panel p:last-child { margin: 0; }
@keyframes footerPanelIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .site-footer-inner { padding: 36px 20px 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .dev-card { max-width: none; }
}
