:root {
  --bg: #050509;
  --bg-elevated: #0d0f16;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --gold: #d4a857;
  --gold-soft: rgba(212, 168, 87, 0.16);
  --text: #f5f5f5;
  --text-muted: #9da3b5;
  --radius: 10px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.75);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, 'SF Pro Text', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, #17192a 0, #050509 55%, #020206 100%);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.app {
  width: 100%;
  max-width: 640px;
  padding: 18px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  min-height: 72px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(7, 7, 14, 0.8), rgba(12, 10, 6, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(18px);
}

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 25% 10%, #fff7e0, #e7bd6b 30%, #7b5a25 70%, #271809 100%);
  box-shadow:
    0 0 0 1px rgba(245, 218, 160, 0.35),
    0 8px 22px rgba(0, 0, 0, 0.95);
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-title {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.app-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-link {
  font-size: 0.78rem;
}

.header-current-user {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  flex-shrink: 0;
}

.header-current-user strong {
  color: var(--gold);
  font-weight: 500;
}

.header-logout {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(5, 5, 10, 0.8);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 5px 10px;
  cursor: pointer;
  display: none; /* 默认在未登录状态隐藏 */
}

.header-logout:hover {
  border-color: rgba(212, 168, 87, 0.65);
  color: var(--gold);
}

.app-main {
  flex: 1;
  display: flex;
}

.screen {
  flex: 1;
  display: none;
}

.screen--active {
  display: block;
}

.card {
  margin-top: 6px;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at top, #181a29, #050509 60%);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 18px 16px 20px;
}

.card-title {
  margin: 0 0 6px;
  font-size: 1.02rem;
}

.card-tip {
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.field-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.field-input {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  font-size: 0.92rem;
  font-family: inherit;
  background: rgba(7, 8, 15, 0.9);
  color: var(--text);
  outline: none;
  transition:
    border-color 130ms ease,
    box-shadow 130ms ease,
    background 130ms ease;
}

.field-input::placeholder {
  color: rgba(157, 163, 181, 0.7);
}

.field-input:focus {
  border-color: rgba(212, 168, 87, 0.85);
  box-shadow: 0 0 0 1px rgba(212, 168, 87, 0.5);
  background: rgba(9, 10, 18, 0.95);
}

.input-with-toggle {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-toggle .field-input {
  padding-right: 52px;
}

.input-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 6px;
}

.input-toggle-btn:hover {
  color: var(--gold);
}

.auth-links {
  margin: -4px 0 10px;
}

.forgot-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.forgot-panel .card-title {
  margin-top: 0;
}

.forgot-panel .link-btn {
  margin-top: 10px;
  display: block;
}

.btn {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.8rem 1.1rem;
  margin-top: 6px;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 0.94rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.btn-primary {
  background: linear-gradient(135deg, #d4a857, #f1e1b6);
  color: #18110a;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(248, 241, 220, 0.1);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(255, 255, 255, 0.16);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.16);
}

.btn-ghost {
  background: rgba(11, 12, 20, 0.8);
  color: var(--gold);
  border: 1px solid rgba(212, 168, 87, 0.55);
  margin-top: 10px;
}

.btn-ghost:hover {
  background: rgba(19, 18, 12, 0.9);
}

.tab-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  background: rgba(7, 8, 14, 0.9);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--border-subtle);
}

.tab {
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 6px 4px;
  cursor: pointer;
}

.tab--active {
  background: linear-gradient(135deg, rgba(212, 168, 87, 0.15), rgba(212, 168, 87, 0.4));
  color: var(--text);
}

.tab-panel {
  display: none;
  margin-top: 10px;
}

.tab-panel--active {
  display: block;
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-card {
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, rgba(10, 11, 18, 0.95), rgba(13, 10, 6, 0.95));
  padding: 10px 10px 12px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
}

.product-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: radial-gradient(circle at 20% 0, #f9f0da, #e2b869 30%, #835c26 70%, #26160a 100%);
}

.product-info-title {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.product-info-desc {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.product-stock {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.product-stock.sold-out {
  color: #e57373;
}

.product-buy-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.orders-empty {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.order-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(6, 7, 14, 0.6);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.order-product {
  font-weight: 500;
}

.order-price {
  color: var(--gold);
}

.order-download-btn {
  margin-left: auto;
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 168, 87, 0.5);
  background: rgba(212, 168, 87, 0.12);
  color: var(--gold);
  cursor: pointer;
}

.order-download-btn:hover {
  background: rgba(212, 168, 87, 0.22);
}

.order-date {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.wallet-stats {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.withdraw-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.withdraw-item {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ai-chat-section {
  margin-bottom: 20px;
}

.ai-chat-messages {
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 12px;
  background: rgba(6, 7, 14, 0.8);
  border: 1px solid var(--border-subtle);
  margin-bottom: 10px;
}

.ai-msg {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.ai-msg:last-child {
  margin-bottom: 0;
}

.ai-msg-user {
  background: rgba(212, 168, 87, 0.2);
  margin-left: 24px;
}

.ai-msg-bot {
  background: rgba(255, 255, 255, 0.06);
  margin-right: 24px;
}

.ai-chat-input-row {
  display: flex;
  gap: 8px;
}

.ai-chat-input-row .field-input {
  flex: 1;
}

.ai-chat-input-row .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 52px;
  padding: 0.45rem 0.9rem;
  margin-top: 0;
  font-size: 0.86rem;
}

.human-booking-divider {
  text-align: center;
  margin: 20px 0;
  padding: 10px 0;
  border-top: 1px dashed var(--border-subtle);
  border-bottom: 1px dashed var(--border-subtle);
  font-size: 0.86rem;
  color: var(--text-muted);
}

.non-buyer-tip {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(212, 168, 87, 0.08);
  border: 1px solid rgba(212, 168, 87, 0.25);
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.non-buyer-tip a {
  color: var(--gold);
  text-decoration: none;
}

.non-buyer-tip a:hover {
  text-decoration: underline;
}

.human-booking-section .field-label {
  margin-top: 0;
}

.consult-rules {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(212, 168, 87, 0.08);
  border: 1px solid rgba(212, 168, 87, 0.3);
}

.consult-rules h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--gold);
}

.consult-rules ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.my-bookings-section {
  margin-top: 20px;
}

.my-bookings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.booking-item-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(6, 7, 14, 0.6);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.booking-status {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.bookings-empty {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.consult-session-wrap {
  margin-top: 16px;
  padding: 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(212, 168, 87, 0.15), rgba(212, 168, 87, 0.05));
  border: 1px solid rgba(212, 168, 87, 0.4);
}

.consult-session-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.consult-timer {
  font-size: 2rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 8px;
}

.consult-status {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.product-price {
  font-size: 0.9rem;
}

.product-price-amount {
  color: var(--gold);
  font-weight: 600;
}

.product-buy-btn {
  border-radius: 999px;
  border: none;
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  background: linear-gradient(135deg, #d4a857, #f1e2b6);
  color: #18110a;
}

.status-message {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wallet-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.wallet-field-row .wallet-highlight {
  flex-shrink: 0;
}

.wallet-highlight {
  font-size: 0.95rem;
  color: var(--gold);
  font-weight: 500;
}

.wallet-subtext {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.wallet-commission-breakdown {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
}

.commission-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.commission-breakdown-item:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.commission-breakdown-amount {
  color: var(--gold);
  font-weight: 500;
  margin-left: 8px;
}

.share-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.share-input {
  flex: 1;
}

.btn-share-copy {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(10, 10, 18, 0.95);
  color: var(--text);
  font-size: 0.8rem;
  padding: 6px 10px;
  cursor: pointer;
}

.btn-share-copy:hover {
  border-color: rgba(212, 168, 87, 0.7);
  color: var(--gold);
}

.network-tip {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.network-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.network-tree-node {
  margin-bottom: 4px;
}

.network-tree-node[data-depth="0"] {
  padding-left: 0;
}

.network-tree-node[data-depth="1"] {
  padding-left: 16px;
  border-left: 2px solid rgba(212, 168, 87, 0.3);
}

.network-tree-node[data-depth="2"] {
  padding-left: 28px;
  border-left: 2px solid rgba(212, 168, 87, 0.25);
}

.network-tree-node[data-depth="3"] {
  padding-left: 40px;
  border-left: 2px solid rgba(212, 168, 87, 0.2);
}

.network-tree-node[data-depth="4"] {
  padding-left: 52px;
  border-left: 2px solid rgba(212, 168, 87, 0.15);
}

.network-node-content {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(6, 7, 14, 0.6);
  font-size: 0.82rem;
}

.network-node-toggle {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.network-node-toggle:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold);
}

.network-node-toggle:disabled {
  cursor: default;
  opacity: 0.5;
}

.network-node-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.network-node-chevron.expanded {
  transform: rotate(90deg);
}

.network-node-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.network-tree-children.collapsed {
  display: none;
}

.network-node-stats {
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 100%;
}

.network-node-code {
  color: var(--gold);
  font-weight: 500;
}

.network-node-email {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.network-node-level {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

.network-tree-children {
  margin-left: 8px;
  margin-top: 4px;
}

.announcement-box {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(6, 7, 14, 0.9);
  border: 1px dashed rgba(212, 168, 87, 0.4);
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.announcement-box .announcement-image {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 10px;
}

.announcement-box .announcement-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.auth-footer {
  margin-top: 14px;
  margin-bottom: 0;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover {
  color: var(--gold);
}

.purchase-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.purchase-modal[hidden] {
  display: none !important;
}

.purchase-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.purchase-modal-content {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  max-width: 360px;
}

.purchase-modal-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.purchase-modal-tip {
  margin: 0 0 16px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.purchase-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.purchase-modal-actions .btn {
  flex: 1;
}

@media (min-width: 640px) {
  .app {
    padding-top: 28px;
  }
}

