/* PChat 控制台 · 暗黑黑金主题（统一：公网中转管理 + 试用转正） */
:root {
  --bg: #07070a;
  --bg-2: #0c0c11;
  --surface: rgba(20, 20, 27, 0.72);
  --surface-2: rgba(28, 28, 37, 0.82);
  --line: rgba(231, 198, 106, 0.16);
  --line-soft: rgba(255, 255, 255, 0.06);
  --gold: #e7c66a;
  --gold-bright: #f7e7a6;
  --gold-deep: #b8893a;
  --gold-grad: linear-gradient(135deg, #fbe7a6 0%, #e7c66a 42%, #c79a3e 100%);
  --text: #ecebe6;
  --text-2: #9c978c;
  --text-3: #6e6a62;
  --danger: #ff6b6b;
  --ok: #5fd49a;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(1200px 700px at 50% -10%, #14110a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* 背景装饰 */
.bg-aurora {
  position: fixed;
  inset: -20% -20% auto -20%;
  height: 70vh;
  background:
    radial-gradient(40% 60% at 20% 20%, rgba(231, 198, 106, 0.16), transparent 70%),
    radial-gradient(40% 60% at 80% 10%, rgba(184, 137, 58, 0.14), transparent 70%);
  filter: blur(30px);
  pointer-events: none;
  z-index: 0;
  animation: drift 16s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translateY(-10px);
  }

  to {
    transform: translateY(20px);
  }
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(231, 198, 106, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 198, 106, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(70% 60% at 50% 25%, #000 0%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

.hidden {
  display: none !important;
}

/* 加载 */
.portal-loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 5;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(231, 198, 106, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 玻璃描边光晕（卡片通用） */
.glow::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(231, 198, 106, 0.55), transparent 40%, transparent 70%, rgba(231, 198, 106, 0.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ───────── 登录 ───────── */
.wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  position: relative;
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 30px 26px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

/* 品牌 */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .5px;
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  opacity: .85;
  font-weight: 600;
  margin-top: 2px;
}

.title {
  margin: 4px 0 24px;
  font-size: 26px;
  font-weight: 800;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 表单 */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 7px;
  font-weight: 500;
}

.input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s, background .2s;
  outline: none;
}

.input::placeholder {
  color: var(--text-3);
}

.input:focus {
  border-color: rgba(231, 198, 106, 0.55);
  box-shadow: 0 0 0 3px rgba(231, 198, 106, 0.12);
  background: rgba(0, 0, 0, 0.5);
}

.input-code {
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.field-code {
  display: flex;
  gap: 10px;
}

.field-code .input {
  flex: 1;
}

/* 按钮 */
.btn {
  font-family: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, background .2s, opacity .2s, border-color .2s;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-soft);
}

.btn:hover:not(:disabled) {
  border-color: var(--line);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
  margin-top: 6px;
}

.btn-gold {
  color: #1a1407;
  background: var(--gold-grad);
  border-color: transparent;
  font-weight: 800;
  letter-spacing: 2px;
  box-shadow: 0 8px 24px rgba(231, 198, 106, 0.28);
}

.btn-gold:hover:not(:disabled) {
  box-shadow: 0 10px 30px rgba(231, 198, 106, 0.42);
  border-color: transparent;
}

.btn-code {
  white-space: nowrap;
  border-color: var(--line);
  color: var(--gold);
  background: rgba(231, 198, 106, 0.06);
  min-width: 116px;
}

.btn-code:hover:not(:disabled) {
  background: rgba(231, 198, 106, 0.12);
}

.btn-ghost {
  border-color: var(--line-soft);
  color: var(--text-2);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--line);
  color: var(--text);
}

.btn--sm {
  padding: 7px 12px;
  font-size: 13px;
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.28);
  background: rgba(255, 107, 107, 0.08);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.16);
  border-color: rgba(255, 107, 107, 0.45);
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-top: 10px;
}

/* ───────── App ───────── */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 8, 11, 0.6);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 4;
}

.app-header .brand {
  margin: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-email {
  color: var(--text-2);
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 22px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 账号状态卡 */
.status-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  backdrop-filter: blur(16px);
}

.status-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.status-email {
  font-size: 17px;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
}

.status-meta {
  margin-top: 14px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
}

.status-meta b {
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-trial {
  color: var(--gold);
  background: rgba(231, 198, 106, 0.12);
  border: 1px solid var(--line);
}

.badge-expired {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.25);
}

.badge-formal {
  color: var(--ok);
  background: rgba(95, 212, 154, 0.1);
  border: 1px solid rgba(95, 212, 154, 0.25);
}

/* 升级卡（试用账号可见） */
.upgrade-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px 22px;
  text-align: center;
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.upgrade-emblem {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: #1a1407;
  background: var(--gold-grad);
  box-shadow: 0 10px 30px rgba(231, 198, 106, 0.4);
}

.upgrade-title {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 800;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.upgrade-desc {
  margin: 0 0 20px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
}

.upgrade-desc b {
  color: var(--gold-bright);
}

.upgrade-card .field {
  text-align: left;
}

.upgrade-note {
  margin-top: 12px;
  color: var(--text-3);
  font-size: 12px;
}

/* 中转配置：概要卡 */
.summary-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  backdrop-filter: blur(16px);
}

.summary-info h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
}

.summary-info p {
  margin: 0 0 12px;
  color: var(--text-3);
  font-size: 12.5px;
}

.quota {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.quota-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 24px;
  font-weight: 700;
  color: var(--gold-bright);
}

.quota-num .sep {
  color: var(--text-3);
  font-weight: 400;
}

.quota-label {
  font-size: 12px;
  color: var(--text-3);
}

/* 区块标题 */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px;
  margin-top: 2px;
}

.section-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.hint {
  font-size: 12px;
  color: var(--text-3);
}

/* 配置卡片 */
.tunnel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.tunnel-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 18px 18px 16px;
  transition: border-color .2s, transform .12s;
}

.tunnel-card:hover {
  border-color: var(--line);
  transform: translateY(-2px);
}

.tc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.tc-name {
  font-size: 15.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-online {
  color: var(--ok);
  background: rgba(95, 212, 154, 0.1);
}

.status-online .status-dot {
  box-shadow: 0 0 8px rgba(95, 212, 154, 0.8);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: .4;
  }
}

.status-offline {
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.04);
}

.tc-id {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 12px;
}

.tc-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-3);
  font-size: 12px;
  margin-bottom: 14px;
}

.tc-meta b {
  color: var(--text-2);
  font-weight: 600;
}

.tc-actions {
  display: flex;
  gap: 8px;
}

.tc-actions .btn {
  flex: 1;
}

/* 空态 */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-3);
}

.empty-state .emoji {
  font-size: 42px;
  margin-bottom: 12px;
}

.empty-state p {
  margin: 0 0 18px;
  font-size: 14px;
}

/* 中转区块（正式版）：内部卡片纵向间距 */
#tunnel-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 试用占位：公网中转需转正后可用 */
.locked-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 36px 26px;
  text-align: center;
  backdrop-filter: blur(16px);
}

.locked-card .lock-emoji {
  font-size: 34px;
  margin-bottom: 12px;
  opacity: .9;
}

.locked-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.locked-card p {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
}

/* ───────── 弹窗 ───────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 86vh;
  overflow: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color .2s;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px 22px;
}

.modal-body p {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
}

.modal-body p b {
  color: var(--gold-bright);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line-soft);
}

.code-box {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--gold-bright);
  word-break: break-all;
  max-height: 180px;
  overflow: auto;
  margin-bottom: 14px;
}

.kv {
  margin-top: 16px;
}

.kv .k {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.kv .v {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px 12px;
  word-break: break-all;
}

.steps {
  margin: 18px 0 0;
  padding-left: 20px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.9;
}

.steps b {
  color: var(--gold-bright);
}

.notice {
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.7;
}

.notice b {
  color: var(--danger);
}

/* ───────── toast ───────── */
.toast-stack {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.toast {
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.toast-ok {
  border-color: rgba(95, 212, 154, 0.4);
  color: var(--ok);
}

.toast-err {
  border-color: rgba(255, 107, 107, 0.4);
  color: var(--danger);
}

/* ───────── 响应式 ───────── */
@media (max-width: 600px) {
  .card {
    padding: 28px 22px 22px;
  }

  .app-header {
    padding: 14px 16px;
  }

  .app-main {
    padding: 20px 16px 50px;
  }

  .summary-card {
    flex-direction: column;
    align-items: stretch;
  }

  .summary-card .btn {
    width: 100%;
  }

  .tunnel-grid {
    grid-template-columns: 1fr;
  }

  .user-email {
    display: none;
  }
}
