:root {
  --ink: #0B1F33;
  --ink-2: #123A56;
  --gold: #C4A46A;
  --gold-soft: rgba(196, 164, 106, 0.22);
  --paper: #F4F6F8;
  --white: #ffffff;
  --muted: #3A4654;
  --line: #E3E8EE;
  --danger: #B42318;
  --shadow: 0 18px 50px rgba(11, 31, 51, 0.12);
  --radius: 14px;
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

.portal-body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--ink-2); text-decoration: none; }
a:hover { color: var(--gold); }

.desktop-only { display: flex; }
.mobile-only { display: none; }

/* Header */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 246, 248, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.portal-header.scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 4px 20px rgba(11, 31, 51, 0.06);
}
.portal-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
}
.brand-sub { font-size: 13px; color: var(--muted); }
.portal-nav { gap: 22px; flex: 1; justify-content: center; }
.portal-nav a {
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 500;
}
.portal-nav a.is-active {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--gold);
}
.portal-header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-auth-btn {
  border: 1px solid var(--ink-2);
  background: transparent;
  color: var(--ink-2);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.nav-auth-btn:hover { background: var(--ink-2); color: #fff; }
.nav-menu-btn {
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  color: var(--ink);
  padding: 4px 8px;
}
.nav-drawer {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px 20px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  padding: 12px 4px;
  font-size: 15px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 18% -10%, rgba(18, 58, 86, 0.18), transparent 60%),
    radial-gradient(700px 380px at 88% 0%, rgba(196, 164, 106, 0.16), transparent 55%),
    linear-gradient(180deg, #E9EEF3 0%, var(--paper) 70%);
  padding: 56px 20px 40px;
}
.hero-inner { max-width: 820px; margin: 0 auto; text-align: center; }
.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.hero-brand {
  font-family: var(--font-serif);
  font-size: clamp(42px, 8vw, 64px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.08em;
  line-height: 1.15;
  margin-bottom: 14px;
}
.hero-lead {
  font-size: 16px;
  color: #1A2430;
  max-width: 560px;
  margin: 0 auto 28px;
}

.ai-panel {
  text-align: left;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(18, 58, 86, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  transition: box-shadow .25s, border-color .25s;
}
.ai-panel:focus-within {
  border-color: rgba(196, 164, 106, 0.65);
  box-shadow: 0 20px 55px rgba(11, 31, 51, 0.16);
}
.ai-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ai-panel-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-2);
}
.ai-remaining { font-size: 12px; color: var(--muted); }
.ai-welcome-text { font-size: 14px; color: #000000; margin-bottom: 12px; font-weight: 500; }
.ai-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ai-preset {
  border: 1px solid var(--line);
  background: #fff;
  color: #0B1F33;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .2s, background .2s;
}
.ai-preset:hover { border-color: var(--gold); background: #fffaf0; }
.ai-welcome.collapsed .ai-welcome-text,
.ai-welcome.collapsed .ai-presets { display: none; }

.ai-messages {
  max-height: 340px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.ai-msg { margin-bottom: 14px; animation: msgIn .28s ease; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.ai-msg-user { display: flex; justify-content: flex-end; }
.ai-msg-assistant { display: flex; gap: 10px; align-items: flex-start; }
.ai-avatar {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(145deg, var(--ink-2), #1a4f73);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-name { font-size: 12px; color: #1A2430; margin-bottom: 4px; font-weight: 600; }
.ai-bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.65;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-bubble.user {
  background: var(--ink-2);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-bubble.assistant {
  background: #F7F9FB;
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  color: var(--ink);
}
.ai-thinking { color: var(--muted); font-style: italic; }
.ai-tools { margin-bottom: 8px; }
.ai-tool-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); margin-bottom: 4px;
}
.ai-tool-step .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #B8C2CC;
}
.ai-tool-step.done .dot { background: #2F6B4F; }
.ai-tool-step.fail .dot { background: var(--danger); }
.ai-cards { margin-top: 10px; }
.ai-cards-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.ai-card {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #E8D7B5;
  background: linear-gradient(135deg, #FFFBF3, #fff);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.ai-card-name { font-size: 13px; color: var(--ink); font-weight: 500; }
.ai-card-btn {
  flex-shrink: 0;
  background: var(--ink-2);
  color: #fff;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
}

.ai-composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.ai-composer textarea {
  flex: 1;
  min-height: 48px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  background: #fff;
}
.ai-composer textarea:focus { border-color: var(--gold); }
.ai-composer .portal-btn-primary {
  min-width: 88px;
  height: 48px;
  flex-shrink: 0;
}
.ai-hint {
  margin-top: 10px;
  font-size: 12px;
  color: #3A4654;
  text-align: center;
}

.hero-download-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.mini-dl {
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff !important;
}
.mini-dl:hover { color: #fff !important; opacity: 0.92; }
.mini-dl.ghost {
  background: transparent;
  color: var(--ink-2) !important;
  border: 1px solid var(--ink-2);
}
.mini-dl.ghost:hover {
  color: var(--ink) !important;
  background: rgba(18, 58, 86, 0.06);
  opacity: 1;
}

/* Sections */
.section-inner { max-width: 1120px; margin: 0 auto; padding: 64px 20px; }
.section-head { max-width: 640px; margin-bottom: 32px; }
.section-eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 10px;
}
.section-title {
  font-family: var(--font-serif);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.35;
}
.section-desc { color: #1A2430; font-size: 15px; }

.chanfu-section {
  background:
    linear-gradient(180deg, #0B1F33 0%, #123A56 100%);
  color: #fff;
}
.chanfu-section .section-eyebrow { color: var(--gold); }
.chanfu-section .section-title { color: #fff; }
.chanfu-section .section-desc { color: rgba(255,255,255,0.72); }
.chanfu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.chanfu-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(196, 164, 106, 0.28);
  border-radius: var(--radius);
  padding: 22px 20px;
}
.chanfu-card h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  margin-bottom: 4px;
}
.chanfu-sub {
  color: var(--gold);
  font-size: 13px;
  margin-bottom: 12px;
}
.chanfu-card p:last-child {
  color: rgba(255,255,255,0.78);
  font-size: 14px;
}
.chanfu-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.chanfu-section .portal-btn-ghost {
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}
.chanfu-section .portal-btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.ip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.ip-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
}
.ip-item h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--ink-2);
}
.ip-item p { font-size: 14px; color: #1A2430; }

.download-section { background: #fff; border-top: 1px solid var(--line); }
.download-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.dl-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  background: var(--paper);
}
.dl-card h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  margin-bottom: 14px;
}
.qr-wrap {
  width: 160px;
  height: 160px;
  margin: 0 auto 12px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.qr-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dl-tip, .dl-desc { font-size: 13px; color: #3A4654; margin-bottom: 14px; }

/* Buttons */
.portal-btn-primary,
.portal-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
  transition: background .2s, color .2s, opacity .2s;
}
.portal-btn-primary {
  background: var(--ink-2);
  color: #fff;
  border-color: var(--ink-2);
}
.portal-btn-primary:hover { background: var(--ink); color: #fff; }
.portal-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.portal-btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--ink-2);
}
.portal-btn-ghost:hover { background: rgba(18,58,86,0.06); }
.portal-btn-ghost.is-disabled,
a.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.portal-btn-block { width: 100%; }
.portal-btn-ghost:disabled,
.portal-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Footer */
.portal-footer {
  background: #0B1F33;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}
.footer-inner { padding: 36px 20px; text-align: center; }
.portal-footer a { color: var(--gold); }
.portal-footer p { margin: 6px 0; }
.sep { margin: 0 8px; opacity: 0.5; }

/* Float */
.float-buttons {
  position: fixed;
  right: 18px;
  bottom: 28px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.float-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ink-2);
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(11,31,51,0.25);
}
.float-btn-complaint { background: #9B2C2C; }

/* Modal */
.portal-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.portal-modal.open { display: flex; }
.portal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 31, 51, 0.45);
}
.portal-modal-panel {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
  z-index: 1;
}
.portal-modal-close {
  position: absolute;
  right: 14px;
  top: 10px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.portal-modal-title {
  font-family: var(--font-serif);
  font-size: 22px;
  margin-bottom: 6px;
}
.portal-modal-sub { font-size: 13px; color: #3A4654; margin-bottom: 18px; }
.portal-login-tabs {
  display: flex;
  gap: 0;
  margin: 4px 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #F7F9FB;
}
.portal-login-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #3A4654;
  cursor: pointer;
  font-family: inherit;
}
.portal-login-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--gold);
}
.portal-field { margin-bottom: 12px; }
.portal-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.portal-field input:focus { border-color: var(--gold); }
.portal-field-row { display: flex; gap: 8px; }
.portal-field-row input { flex: 1; }
.portal-agree {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 16px;
  cursor: pointer;
}
.portal-agree a { color: var(--ink-2); text-decoration: underline; }
body.portal-modal-open { overflow: hidden; }

.portal-toast {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translate(-50%, -8px);
  background: rgba(11, 31, 51, 0.88);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: 86vw;
  text-align: center;
}
.portal-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 协议确认弹窗（叠在登录弹层之上） */
.portal-confirm {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.portal-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 31, 51, 0.4);
}
.portal-confirm-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 14px;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow);
}
.portal-confirm-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: #0B1F33;
  margin-bottom: 10px;
}
.portal-confirm-body {
  font-size: 14px;
  color: #1A2430;
  line-height: 1.7;
  margin-bottom: 18px;
}
.portal-confirm-body a {
  color: var(--ink-2);
  text-decoration: underline;
}
.portal-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.portal-confirm-actions .portal-btn-ghost,
.portal-confirm-actions .portal-btn-primary {
  min-width: 96px;
}

/* Inner pages shell */
.portal-page-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}
.page-title {
  font-family: var(--font-serif);
  font-size: 28px;
  margin-bottom: 8px;
}
.page-sub { color: #1A2430; font-size: 14px; margin-bottom: 24px; }
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.tab-btn {
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn.active {
  color: var(--ink-2);
  font-weight: 600;
  border-bottom-color: var(--gold);
}
.asset-list { display: flex; flex-direction: column; gap: 10px; }
.asset-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.asset-card:hover {
  border-color: rgba(196,164,106,0.6);
  box-shadow: 0 8px 24px rgba(11,31,51,0.06);
}
.asset-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.asset-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.asset-name-row .asset-name { margin-bottom: 0; flex: 1; min-width: 0; }
.asset-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.asset-status {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #EEF3F8;
  color: var(--ink-2);
  flex-shrink: 0;
  white-space: nowrap;
}
.asset-status.st-pending { background: #FFF7E8; color: #8A5A12; }
.asset-status.st-ok { background: #EAF7EF; color: #1F6B3A; }
.asset-status.st-muted { background: #F0F2F5; color: #6B7280; }
.asset-card-static { cursor: default; }
.asset-card-static:hover { border-color: var(--line); box-shadow: none; }
.asset-tip {
  margin-top: 10px;
  font-size: 12px;
  color: #8A5A12;
  background: #FFF7E8;
  border-radius: 6px;
  padding: 8px 10px;
}
.asset-files {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.file-link {
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: underline;
}
.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.pager-info {
  align-self: center;
  font-size: 13px;
  color: var(--muted);
}
.my-card-title {
  font-family: var(--font-serif);
  margin-bottom: 14px;
  font-size: 18px;
}
.my-menu-card { padding: 0; overflow: hidden; }
.my-menu-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.my-menu-item:last-child { border-bottom: none; }
.my-menu-item:hover {
  background: #FAFBFC;
  color: var(--ink);
}
.my-menu-label { font-size: 15px; font-weight: 600; }
.my-menu-desc { font-size: 12px; color: var(--muted); text-align: right; }
.my-menu-arrow { color: #A0AAB6; font-size: 20px; line-height: 1; }
.user-plain, .vip-expire { font-size: 13px; color: var(--muted); }
.empty-state, .loading-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  background: #fff;
  border-radius: 12px;
  border: 1px dashed var(--line);
}
.pager {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}
.my-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 16px;
}
.my-phone {
  font-family: var(--font-serif);
  font-size: 24px;
  margin-bottom: 8px;
}
.badge-vip {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #FFF4E0;
  color: #8A5A12;
  margin-right: 6px;
}
.my-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

@media (max-width: 860px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-flex; }
  .chanfu-grid,
  .ip-grid,
  .download-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; }
  .float-buttons { right: 12px; bottom: 18px; }
  .float-btn { width: 46px; height: 46px; font-size: 12px; }
  .ai-messages { max-height: 280px; }
}
