/* MT5 Cloud Console - 移动端PWA优化 */

/* 禁用移动端点击高亮和选择 */
* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 允许输入框和文本区域选择 */
input, textarea, [contenteditable] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* 防止文本选择导致的蓝色高亮 */
::selection {
  background: rgba(212, 175, 55, 0.3);
  color: #f3ead7;
}

::-moz-selection {
  background: rgba(212, 175, 55, 0.3);
  color: #f3ead7;
}

/* 移动端根元素 */
html {
  /* 防止字体缩放 */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;

  /* 流畅滚动 */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scroll-padding-bottom: calc(128px + env(safe-area-inset-bottom));

  /* 固定viewport，防止缩放 */
  touch-action: pan-y;
}

body {
  /* 防止下拉刷新和橡皮筋效果 */
  overscroll-behavior-x: none;
  overscroll-behavior-y: auto;

  /* 移动端字体优化 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-smoothing: antialiased;

  /* 防止横向滚动 */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  /* 移动端安全区域 */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);

  /* 全屏高度 - 隐藏地址栏 */
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* 让点击目标沿用系统手势判定，避免浏览器等待 300ms 再派发点击。 */
button,
a,
select,
input[type="checkbox"],
input[type="radio"] {
  touch-action: manipulation;
}

/* Native-sized controls. The generic input rule in mobile.css must not make
   checkboxes fill an entire row (which turns account pickers into large white
   blocks on iOS). */
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--lime, #d7ff4a);
}

#app.route-changing {
  animation: pwa-route-enter 220ms ease-out both;
}

@keyframes pwa-route-enter {
  from { opacity: .55; }
  to { opacity: 1; }
}

/* pointer 反馈只改当前控件，不触发整页重排。 */
.is-pressed {
  opacity: .72;
}

/* fixed 导航不能放在带 transform 的祖先中，否则 iOS PWA 会把它当成
   局部定位元素，滚动到页面底部时既遮挡内容又吞掉触摸事件。 */
#app,
.phone {
  transform: none;
  -webkit-transform: none;
  -webkit-backface-visibility: visible;
  backface-visibility: visible;
}

/* 移动端特定样式 */
@media (max-width: 768px) {
  :root {
    /* 移动端调整颜色 - 增强对比度 */
    --bg: #080809;
    --card: #151412;
    --line: #3a3428;
    --text: #f5f0e5;

    /* 调整圆角和阴影 */
    --radius: 14px;
    --radius-lg: 18px;
    --shadow-card: 0 3px 12px rgba(0, 0, 0, 0.3);
  }

  /* 移动端布局 */
  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
    min-height: 100dvh; /* 动态viewport高度 */
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    max-height: 70vh;
    margin: 0;
    border-radius: 0 0 20px 20px;
    z-index: 100;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    transform: translateY(0);
  }

  /* 移动端导航栏 */
  .mobile-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--line);
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 90;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    min-width: 60px;
  }

  .mobile-nav-item:active {
    transform: scale(0.95);
  }

  .mobile-nav-item.active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
  }

  .mobile-nav-icon {
    font-size: 22px;
    line-height: 1;
  }

  /* 移动端主内容区 */
  .main {
    padding: 16px 16px calc(80px + env(safe-area-inset-bottom));
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* 移动页面实际使用 .phone + .tabbar，底部留出完整安全区。 */
  .phone {
    width: min(480px, 100%);
    min-height: 100dvh;
    padding-bottom: calc(128px + env(safe-area-inset-bottom));
  }

  .tabbar {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 120;
    padding-bottom: 8px;
  }

  .tabbar a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 9px 2px;
    font-size: 12px;
    pointer-events: auto;
    min-height: 44px;
  }

  /* 移动端页面头部 */
  .page-head h1 {
    font-size: 24px;
  }

  .workspace-hero h1 {
    font-size: 28px;
  }

  /* 移动端卡片 */
  .card {
    padding: 16px;
    border-radius: var(--radius);
  }

  .mt5-card {
    padding: 16px 18px;
  }

  .mt5-card .equity {
    font-size: 30px;
  }

  /* 移动端KPI */
  .kpis {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .kpi {
    min-height: 100px;
    padding: 14px 16px;
  }

  .kpi .value {
    font-size: 28px;
  }

  /* 移动端表单 */
  input, select, textarea, button {
    font-size: 16px; /* 防止iOS自动缩放 */
    min-height: 44px; /* iOS推荐的最小触摸目标 */
  }

  button {
    padding: 12px 18px;
  }

  /* 移动端表格 */
  table.sheet {
    font-size: 12px;
  }

  table.sheet th, table.sheet td {
    padding: 8px 6px;
  }

  /* 移动端模态框 */
  .notify-modal {
    width: calc(100% - 32px);
    max-width: 400px;
    padding: 20px;
  }

  /* 移动端开发者控制台 */
  .dev-console-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .dev-console-tabs::-webkit-scrollbar {
    display: none;
  }

  /* 移动端许可证步骤 */
  .license-steps {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .license-step {
    padding: 10px;
  }
}

/* 下拉刷新指示器 */
.pull-to-refresh {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  color: var(--gold);
  font-weight: 600;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  z-index: 999;
  pointer-events: none;
}

.pull-to-refresh.visible {
  transform: translateY(0);
}

.pull-to-refresh-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(212, 175, 55, 0.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 触摸反馈动画 */
.touchable {
  position: relative;
  overflow: hidden;
}

.touchable::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.touchable:active::after {
  width: 300px;
  height: 300px;
}

/* 移动端侧边栏遮罩 */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* 移动端汉堡菜单按钮 */
.mobile-menu-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 101;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

.mobile-menu-btn span {
  width: 20px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  position: relative;
  transition: all 0.3s ease;
}

.mobile-menu-btn span::before,
.mobile-menu-btn span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-btn span::before {
  top: -6px;
}

.mobile-menu-btn span::after {
  bottom: -6px;
}

.mobile-menu-btn.active span {
  background: transparent;
}

.mobile-menu-btn.active span::before {
  top: 0;
  transform: rotate(45deg);
}

.mobile-menu-btn.active span::after {
  bottom: 0;
  transform: rotate(-45deg);
}

/* 横屏适配 */
@media (max-width: 768px) and (orientation: landscape) {
  .mobile-nav-bar {
    padding: 6px 12px;
  }

  .mobile-nav-item {
    padding: 6px 12px;
    font-size: 10px;
  }

  .mobile-nav-icon {
    font-size: 18px;
  }

  .main {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }
}

/* iOS特定优化 */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari专用 */
  body {
    /* 防止iOS下拉露出网页背景 */
    background: var(--bg);
    background-attachment: fixed;
  }

  /* 修复iOS输入框缩放问题 */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* 修复iOS 100vh问题 */
  .app-shell,
  .main {
    min-height: -webkit-fill-available;
  }
}

/* Android特定优化 */
@media (max-width: 768px) {
  /* Chrome地址栏自动隐藏 */
  html {
    scroll-padding-top: 60px;
  }
}

/* 骨架屏加载动画 */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--card) 0%,
    rgba(212, 175, 55, 0.1) 50%,
    var(--card) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 空状态插图 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state-text {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 300px;
}

/* 移动端优化的动画性能 */
@media (max-width: 768px) {
  /* 减少动画以提升性能 */
  .card:hover,
  .mt5-card:hover,
  .kpi:hover {
    transform: none;
  }

  /* 只给交互元素保留短过渡，避免给整棵 DOM 树加 transition。 */
  button, a, input, select, textarea {
    transition-duration: 0.18s;
  }
}

/* 深色模式适配（系统级） */
@media (prefers-color-scheme: dark) {
  /* 已经是深色主题，保持现有样式 */
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  :root {
    --line: #5a5438;
    --text: #ffffff;
    --gold: #f0c050;
  }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* PWA安装提示 */
.pwa-install-prompt {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  z-index: 88;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-install-prompt.visible {
  transform: translateY(0);
}

.pwa-install-icon {
  width: 48px;
  height: 48px;
  background: var(--gold);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.pwa-install-content {
  flex: 1;
}

.pwa-install-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.pwa-install-desc {
  font-size: 12px;
  color: var(--muted);
}

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

.pwa-install-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
}

/* 移动端通知标签样式优化 */
@media (max-width: 768px) {
  .notify-tab-panel {
    padding: 0;
  }

  .param-grid {
    grid-template-columns: 1fr !important;
  }

  .dev-console-tabs button {
    font-size: 13px;
    padding: 9px 14px;
  }
}

/* Native-style visual layer -------------------------------------------------
   Keep the data layout intact and tune the surface, depth and primary action
   treatment to match a dark mobile app rather than a web page. */
@media (max-width: 768px) {
  :root {
    --bg: #070707;
    --bg-2: #101010;
    --card: #1b1b1d;
    --card-hover: #252527;
    --line: rgba(255, 255, 255, .11);
    --line-light: rgba(255, 255, 255, .07);
    --text: #f3f3f1;
    --muted: #89898d;
    --gold: #d7ff4a;
    --gold-light: #ff984d;
    --gold-ink: #0b0b0b;
    --lime: #d7ff4a;
    --lime-ink: #0b0b0b;
    --fresh: #c7ff52;
    --off: #ff6956;
    --shadow: 0 18px 42px rgba(0, 0, 0, .42);
    --shadow-light: 0 8px 24px rgba(0, 0, 0, .3);
  }

  body {
    background:
      radial-gradient(420px 300px at 92% -8%, rgba(255, 103, 74, .12), transparent 62%),
      radial-gradient(360px 260px at -12% 30%, rgba(193, 255, 68, .08), transparent 64%),
      var(--bg);
  }

  .phone {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
    background: rgba(7, 7, 7, .74);
    border-bottom: 1px solid rgba(255, 255, 255, .05);
  }

  .icon-btn {
    background: rgba(255, 255, 255, .07);
    border-color: rgba(255, 255, 255, .12);
    border-radius: 15px;
  }

  .mobile-dashboard-hero {
    background: linear-gradient(150deg, #202022 0%, #101011 72%);
    border-color: rgba(255, 255, 255, .14);
    box-shadow: 0 20px 52px rgba(0, 0, 0, .42);
    overflow: hidden;
  }

  .mobile-dashboard-hero::before {
    content: "";
    display: block;
    height: 3px;
    margin: -20px -20px 18px;
    background: linear-gradient(90deg, #caff48 0%, #ffd34b 46%, #ff6652 100%);
    box-shadow: 0 0 22px rgba(217, 255, 73, .45);
  }

  .card,
  .tile,
  .goal,
  .list,
  .mobile-account-card,
  .mobile-risk-card,
  .mobile-metrics article,
  .auth-card {
    background: rgba(27, 27, 29, .94);
    border-color: rgba(255, 255, 255, .11);
    box-shadow: var(--shadow-light);
  }

  .mobile-risk-card {
    background: linear-gradient(155deg, rgba(40, 40, 42, .96), rgba(22, 22, 24, .96));
  }

  .mobile-account-card:active,
  .list a:active,
  .list button:active {
    background: #242426;
  }

  .live-badge,
  .chip {
    background: rgba(214, 255, 73, .1);
    border-color: rgba(214, 255, 73, .34);
    color: var(--gold);
  }

  .tabbar {
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    gap: 4px;
    padding: 7px;
    background: rgba(34, 34, 36, .88);
    border-color: rgba(255, 255, 255, .16);
    border-radius: 25px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .55), inset 0 1px rgba(255, 255, 255, .06);
    backdrop-filter: blur(22px) saturate(130%);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
  }

  .tabbar a {
    position: relative;
    gap: 3px;
    padding: 7px 3px 6px;
    color: #a2a2a6;
    border-radius: 19px;
    font-size: 10px;
    line-height: 1.1;
  }

  .tabbar-icon {
    display: block;
    height: 20px;
    font-size: 21px;
    line-height: 20px;
    font-weight: 400;
  }

  .tabbar a.active {
    color: #0b0b0b;
    background: linear-gradient(105deg, #d6ff4a 0%, #ffca4a 48%, #ff6652 100%);
    box-shadow: 0 4px 16px rgba(255, 152, 72, .28);
  }

  .template-grid { display: grid; gap: 10px; margin: 12px 0; }
  .template-card { display: grid; gap: 8px; }
  .template-card .tiles { grid-template-columns: 1fr 1fr; }
  .template-card .muted { line-height: 1.5; overflow-wrap: anywhere; }
  #template-upload-form { display: grid; gap: 12px; }

  button.primary,
  .auth button.primary {
    background: linear-gradient(105deg, #d6ff4a 0%, #ffc849 48%, #ff6652 100%);
    color: #0a0a0a;
    box-shadow: 0 5px 18px rgba(255, 140, 68, .24);
  }

  button.primary:active {
    box-shadow: 0 2px 8px rgba(255, 140, 68, .22);
  }

  button.ghost,
  input,
  select {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .12);
  }

  input:focus,
  select:focus {
    border-color: #ff9b51;
    box-shadow: 0 0 0 3px rgba(255, 151, 75, .16);
  }

  .quick-risk.resume,
  .account-actions a,
  .section-head a {
    color: var(--gold);
  }

  /* Shared risk control panel, sized for thumb use and narrow screens. */
  .global-risk {
    margin: 0 0 14px;
    padding: 16px;
    border-radius: 20px;
    background: linear-gradient(150deg, rgba(31, 31, 34, .98), rgba(20, 20, 22, .98));
  }
  .global-risk-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
  .global-risk-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
  .global-risk-picks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
  }
  .risk-account-pick {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 13px;
    background: rgba(255,255,255,.045);
  }
  .risk-account-pick span { min-width: 0; }
  .risk-account-pick strong,
  .risk-account-pick small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .risk-account-pick strong { color: var(--text); font-size: 13px; }
  .risk-account-pick small { margin-top: 3px; color: var(--muted); font-size: 10px; }
  .global-risk-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .global-risk-action {
    min-height: 44px;
    padding: 10px 8px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: #fff;
    font-size: 13px;
    font-weight: 650;
  }
  .global-risk-action.all { background: #ff5c62; }
  .global-risk-action.pause { background: #2f2d49; color: #d5d0ff; }
  .global-risk-action.force { background: transparent; border-color: #f07a27; color: #f28a3c; }
  .global-risk-action.resume { background: #d5a24f; color: #1d170c; }
  .global-risk-action.long { background: #1f3b2e; color: #52d990; }
  .global-risk-action.short { background: #432b20; color: #ff9a67; }
  .global-risk-action:disabled { opacity: .45; }
  .global-risk-result { margin-top: 10px; line-height: 1.45; }

  /* Parameter workflow rhythm and account rows. */
  .params-workflow { display: grid; gap: 8px; }
  .params-workflow strong { font-size: 18px; line-height: 1.25; }
  .params-workflow span { color: var(--muted); font-size: 12px; line-height: 1.4; }
  .params-workflow select { margin-top: 3px; }
  .param-form { gap: 12px; }
  .param-form h2 { line-height: 1.25; overflow-wrap: anywhere; }
  .param-account {
    margin: 0;
    padding: 10px 11px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 12px;
    background: rgba(255,255,255,.035);
  }
  .param-account + .param-account { margin-top: 7px; }
  .param-account .check { padding: 0; color: var(--text); }
  .param-account-actions { margin: 4px 0 0; padding: 11px; border-radius: 13px; }
  .param-account-actions strong { font-size: 13px; }
  .param-form > .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .param-form > .tiles button,
  .param-form > .tiles .file-btn { min-width: 0; padding: 10px 6px; font-size: 12px; }

  @media (max-width: 390px) {
    .global-risk-picks { grid-template-columns: 1fr; }
    .param-form > .tiles { grid-template-columns: 1fr; }
  }

  .pull-to-refresh {
    top: env(safe-area-inset-top);
    height: 52px;
    background: rgba(27, 27, 29, .92);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #app.route-changing { animation: none; }
}

/* 登录和注册页沿用黑金主题，以低饱和金色作为强调，避免荧光渐变。 */
.auth {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  align-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  scroll-padding-block: 20px 32px;
}

.auth-card {
  width: min(420px, 100%);
  padding: clamp(20px, 6vw, 28px);
  background: linear-gradient(155deg, rgba(29, 28, 25, .98), rgba(17, 17, 17, .99));
  border-color: rgba(212, 163, 86, .16);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .38), inset 0 1px rgba(255, 255, 255, .035);
}

.auth-card .brand-mark {
  background: linear-gradient(145deg, #d4a356, #ad7d38);
  color: #17130d;
  box-shadow: 0 0 0 4px rgba(212, 163, 86, .10);
}

.auth-card h2 { margin: 0 0 14px; color: #f3f0e9; letter-spacing: .02em; }
.auth-card .auth-banner {
  margin: 0 0 16px;
  padding: 11px 13px;
  background: rgba(212, 163, 86, .075);
  color: #c9c0af;
  border: 1px solid rgba(212, 163, 86, .14);
  border-radius: 13px;
  line-height: 1.6;
}

.auth-card .tabs { gap: 8px; margin: 0 0 14px; }
.auth-card .tabs button {
  min-height: 42px;
  flex: 1;
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(145, 162, 190, .16);
  color: #b8b2a8;
}
.auth-card .tabs button.primary,
.auth-card form > button.primary {
  background: linear-gradient(180deg, #d4a356, #bd8b48);
  color: #18130b;
  border: 1px solid rgba(231, 190, 119, .24);
  box-shadow: 0 7px 18px rgba(173, 125, 56, .17);
}
.auth-card .tabs button.primary { box-shadow: none; }
.auth-card form > button.primary { min-height: 50px; border-radius: 13px; }
.auth-card form > button.primary:active { background: #ad7d38; }

.auth-card input {
  min-height: 50px;
  color: #f1eee8;
  background: rgba(7, 7, 7, .52);
  border-color: rgba(212, 163, 86, .18);
  border-radius: 13px;
}
.auth-card input::placeholder { color: #918b80; opacity: 1; }
.auth-card input:focus {
  background: rgba(12, 11, 9, .86);
  border-color: #bd8b48;
  box-shadow: 0 0 0 3px rgba(212, 163, 86, .12);
}

.password-field { position: relative; min-width: 0; }
.password-field input { padding-right: 72px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-width: 52px;
  min-height: 38px;
  transform: translateY(-50%);
  padding: 0 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #d4a356;
  font-size: 13px;
  font-weight: 600;
  touch-action: manipulation;
}
.password-toggle:active { background: rgba(212, 163, 86, .10); }
.auth-card .muted { color: #9b968c; }
.auth-card .muted a { color: #d4a356; text-decoration: none; }
.auth-card .muted a:active { color: #e4c17e; }

/* 键盘弹出后将表单改为顶部对齐并保留页面滚动空间，避免密码框和提交按钮被遮挡。 */
body.keyboard-open { min-height: 0; }
body.keyboard-open .auth {
  min-height: 0;
  min-height: 100%;
  align-items: start;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: 28px;
}
body.keyboard-open .auth-card { margin-block: 0 20px; }

@media (max-height: 620px) {
  .auth { align-items: start; padding-top: max(14px, env(safe-area-inset-top)); }
}
