/* iOS-style design system */
:root {
  --ios-bg: #f2f2f7;
  --ios-group: #ffffff;
  --ios-separator: rgba(60, 60, 67, 0.12);
  --ios-separator-strong: rgba(60, 60, 67, 0.22);
  --ios-label: #3c3c43;
  --ios-label-secondary: rgba(60, 60, 67, 0.6);
  --ios-label-tertiary: rgba(60, 60, 67, 0.4);
  --ios-blue: #007aff;
  --ios-blue-pressed: #0062cc;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --ios-orange: #ff9500;
  --ios-gray-fill: #e5e5ea;
  --ios-gray-fill2: #d1d1d6;
  --ios-up: #34c759;
  --ios-down: #ff3b30;
  --ios-up-soft: rgba(52, 199, 89, 0.1);
  --ios-up-soft2: rgba(52, 199, 89, 0.15);
  --ios-up-border: rgba(52, 199, 89, 0.22);
  --ios-up-border2: rgba(52, 199, 89, 0.35);
  --ios-up-mid: rgba(52, 199, 89, 0.38);
  --ios-up-solid: rgba(52, 199, 89, 0.92);
  --ios-down-soft: rgba(255, 59, 48, 0.08);
  --ios-down-soft2: rgba(255, 59, 48, 0.12);
  --ios-down-border: rgba(255, 59, 48, 0.2);
  --ios-down-border2: rgba(255, 59, 48, 0.35);
  --ios-down-mid: rgba(255, 59, 48, 0.38);
  --ios-radius-group: 13px;
  --ios-radius-btn: 12px;
  --ios-radius-chip: 8px;
  --ios-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --ios-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --ios-font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --nav-blur: saturate(180%) blur(20px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Motion — iOS-like spring curves */
  --ease-ios: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 0.2s;
  --dur-normal: 0.35s;
  --dur-slow: 0.55s;
  /* Semantic (theme-overridable) */
  --nav-bg: rgba(242, 242, 247, 0.82);
  --title-color: #000000;
  --emphasis-color: #000000;
  --segment-active-color: #000000;
  --segment-on-glider-color: var(--segment-active-color);
  --chart-empty-bg: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  --segment-bar-bg: rgba(242, 242, 247, 0.5);
  --table-head-bg: rgba(242, 242, 247, 0.6);
  --select-color-scheme: light;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.5 1.5L6 6l4.5-4.5'/%3E%3C/svg%3E");
  --option-color: #1c1c1e;
  --option-bg: #ffffff;
  --glider-bg: var(--ios-group);
  --glider-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  --accent-glow: rgba(0, 122, 255, 0.35);
  --body-bg-image: none;
  --group-backdrop: none;
  --group-border: none;
  --chart-grid: rgba(60, 60, 67, 0.08);
  --chart-axis: rgba(60, 60, 67, 0.12);
  --chart-tick: rgba(60, 60, 67, 0.6);
  --candle-up: #34c759;
  --candle-down: #ff3b30;
  --candle-neutral: #8e8e93;
  --theme-transition: background-color 0.4s var(--ease-ios), color 0.4s var(--ease-ios),
    border-color 0.4s var(--ease-ios), box-shadow 0.4s var(--ease-ios);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  font-family: var(--ios-font);
  background: var(--ios-bg);
  background-image: var(--body-bg-image);
  background-attachment: fixed;
  background-size: cover;
  color: var(--ios-label);
  min-height: 100vh;
  line-height: 1.47;
  letter-spacing: -0.01em;
  transition: var(--theme-transition);
  overflow-x: clip;
}

html.is-native-app body {
  padding-top: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overscroll-behavior-y: none;
  overflow-anchor: none;
}

html.is-native-app {
  scroll-behavior: auto;
}

html.is-native-app body.app-ready .content > *,
html.is-native-app body.app-ready .nav-bar-inner {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

html.is-native-app .nav-bar {
  padding-top: max(var(--native-top-inset, 28px), env(safe-area-inset-top, 0px));
}

html.is-native-app .nav-bar-inner {
  padding-top: 6px;
}

html.is-native-app .nav-actions {
  position: relative;
  z-index: 2;
}

@media (max-width: 640px) {
  html.is-native-app .nav-bar-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    row-gap: 6px;
  }

  html.is-native-app .nav-title-block {
    grid-column: 1;
    grid-row: 1;
    padding-right: 8px;
  }

  html.is-native-app .nav-actions {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 2px;
  }

  html.is-native-app .site-nav {
    grid-column: 1;
    grid-row: 3;
  }

  html.is-native-app .auth-user-btn.is-logged-in {
    max-width: none;
    height: 26px;
    padding: 0 8px 0 4px;
    border-radius: 13px;
    gap: 4px;
  }

  html.is-native-app .auth-user-name {
    display: none;
  }

  html.is-native-app .auth-user-chevron {
    display: none;
  }

  html.is-native-app .auth-user-avatar {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  html.is-native-app .auth-user-balance {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--ios-tint-fill, rgba(0, 122, 255, 0.12));
    line-height: 1.2;
  }

  html.is-native-app .auth-user-btn.is-low-balance .auth-user-balance {
    background: rgba(255, 149, 0, 0.14);
  }

  html.is-native-app .billing-balance-card {
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 10px;
  }

  html.is-native-app .billing-balance-amount {
    font-size: 18px;
    margin: 0;
    font-weight: 700;
  }

  html.is-native-app .billing-balance-label,
  html.is-native-app .billing-balance-user,
  html.is-native-app .billing-balance-estimate {
    margin: 0;
    font-size: 11px;
  }

  html.is-native-app .billing-balance-card .billing-balance-main {
    flex: 1;
    min-width: 0;
  }

  html.is-native-app .billing-refresh-btn {
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: 11px;
  }
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(24px + var(--safe-bottom));
}

/* ── Navigation Bar (iOS large title style) ── */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  border-bottom: 0.5px solid var(--ios-separator);
  padding-top: var(--safe-top);
  transition: var(--theme-transition);
}

.nav-bar-inner,
.flow-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 20px 10px;
  display: grid;
  grid-template-columns: var(--header-title-width, 248px) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 16px;
  row-gap: 8px;
}

.nav-actions,
.flow-header-right {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--ios-group);
  box-shadow: var(--ios-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--ios-blue);
  transition: transform var(--dur-fast) var(--ease-spring), var(--theme-transition);
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle-btn:active { transform: scale(0.92); }

.theme-sheet {
  max-width: 400px;
  text-align: left;
  padding: 20px 20px 16px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0 12px;
}

.theme-card {
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  background: var(--ios-gray-fill);
  font-family: var(--ios-font);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  transition: transform var(--dur-fast) var(--ease-spring),
    border-color var(--dur-fast) var(--ease-ios),
    box-shadow var(--dur-fast) var(--ease-ios);
  -webkit-tap-highlight-color: transparent;
}

.theme-card:active { transform: scale(0.97); }

.theme-card.active {
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 1px var(--ios-blue), 0 4px 16px var(--accent-glow);
}

.theme-card-preview {
  height: 44px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 0.5px solid var(--ios-separator);
}

.theme-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--emphasis-color);
}

.theme-card-desc {
  font-size: 11px;
  color: var(--ios-label-secondary);
  margin-top: 2px;
}

.nav-eyebrow {
  font-size: 12px;
  font-weight: 400;
  color: var(--ios-label-secondary);
  margin-bottom: 1px;
}

.nav-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--title-color);
  transition: color 0.4s var(--ease-ios);
}

.nav-title-block {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--ios-group);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ios-label-secondary);
  box-shadow: var(--ios-shadow);
  flex-shrink: 0;
  transition: background var(--dur-normal) var(--ease-ios),
    box-shadow var(--dur-normal) var(--ease-ios),
    transform var(--dur-fast) var(--ease-ios);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ios-gray-fill2);
}

.status-pill.online .status-dot { background: var(--ios-green); box-shadow: 0 0 8px rgba(52, 199, 89, 0.5); }
.status-pill.offline .status-dot { background: var(--ios-red); }
.status-pill.busy .status-dot {
  background: var(--ios-orange);
  animation: ios-pulse 1.2s ease-in-out infinite;
}
.status-pill.status-flash {
  animation: status-flash 0.45s var(--ease-out-expo);
}

@keyframes ios-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

@keyframes status-flash {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ── Content layout ── */
.content {
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 16px 0;
}

.section-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--ios-label-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 20px 16px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--ios-label-tertiary);
  text-transform: none;
  letter-spacing: 0;
  background: var(--ios-gray-fill);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ── Data source segment (iOS style) ── */
.source-panel { padding: 12px 16px 14px; }

/* ── Rankings drawer (right side) ── */
.rank-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
.rank-drawer.hidden { display: none; }
.rank-drawer:not(.hidden) { display: block; }

.rank-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}
.rank-drawer.is-open { pointer-events: auto; }
.rank-drawer.is-open .rank-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.rank-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 92vw);
  max-width: 100%;
  background: var(--ios-group);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  padding-top: calc(var(--safe-top, 0px) + 8px);
  padding-bottom: var(--safe-bottom, 0px);
}
.rank-drawer.is-open .rank-drawer-panel {
  transform: translateX(0);
}

.rank-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 8px;
  flex-shrink: 0;
}
.rank-drawer-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--ios-label-primary);
}
.rank-drawer-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.rank-refresh-btn,
.rank-close-btn {
  border: none;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}
.rank-close-btn { font-size: 22px; }
.rank-refresh-btn:active,
.rank-close-btn:active { opacity: 0.7; }

.rank-drawer-tab,
.alert-drawer-tab {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 199;
  border: none;
  color: #fff;
  min-width: 34px;
  padding: 12px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  pointer-events: auto;
  background: var(--ios-blue, #007aff);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.rank-drawer-tab {
  right: 0;
  border-radius: 10px 0 0 10px;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
}

.alert-drawer-tab {
  left: 0;
  border-radius: 0 10px 10px 0;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}
.rank-drawer-tab.hidden { display: none; }
.rank-drawer-tab:active { opacity: 0.85; }
.rank-drawer.is-open .rank-drawer-tab {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(8px);
}
.rank-tab-text,
.alert-tab-text {
  writing-mode: vertical-rl;
  letter-spacing: 0.08em;
}

.rank-board-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 8px;
  flex-shrink: 0;
  max-height: 88px;
  overflow-y: auto;
}
.rank-row-static { cursor: default; opacity: 0.92; }
.rank-row-static:hover { background: transparent; }
.rank-board-btn {
  border: none;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.rank-board-btn.active {
  background: var(--ios-tint, #007aff);
  color: #fff;
}
.rank-meta {
  font-size: 11px;
  color: var(--ios-label-tertiary);
  margin: 2px 0 0;
  min-height: 14px;
}
.rank-table-wrap {
  flex: 1;
  overflow: auto;
  padding: 0 8px 12px;
  -webkit-overflow-scrolling: touch;
}
.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.rank-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ios-group);
  text-align: left;
  font-weight: 500;
  color: var(--ios-label-tertiary);
  padding: 6px 6px;
  border-bottom: 1px solid var(--ios-separator, rgba(60,60,67,0.12));
}
.rank-table td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--ios-separator, rgba(60,60,67,0.08));
  vertical-align: middle;
}
.rank-row { cursor: pointer; }
.rank-row:hover td { background: var(--ios-gray-fill); }
.rank-num {
  width: 22px;
  color: var(--ios-label-tertiary);
  font-variant-numeric: tabular-nums;
}
.rank-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-sym {
  display: block;
  font-weight: 600;
  font-size: 11px;
  color: var(--ios-label-primary);
}
.rank-price, .rank-amt {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 11px;
}
.rank-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
.rank-up { color: #e54545; }
.rank-down { color: #1aab58; }
.rank-placeholder {
  text-align: center;
  color: var(--ios-label-tertiary);
  padding: 24px 8px !important;
}
.rank-error { color: #e54545; }
.rank-empty-hint {
  font-size: 12px;
  color: var(--ios-label-tertiary);
}

@media (min-width: 900px) {
  .rank-drawer-backdrop { display: none; }
  .rank-drawer.is-open { pointer-events: none; }
  .rank-drawer-panel { pointer-events: auto; }
  .rank-drawer.is-open .rank-drawer-tab {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(-360px);
  }
}

/* ── 我的提醒 · 左侧抽屉（镜像榜单） ── */
.alert-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.alert-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.alert-drawer.is-open { pointer-events: auto; }
.alert-drawer.is-open .alert-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.alert-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(360px, 92vw);
  max-width: 100%;
  background: var(--ios-group);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  padding-top: calc(var(--safe-top, 0px) + 8px);
  padding-bottom: var(--safe-bottom, 0px);
  overflow: hidden;
}

.alert-drawer.is-open .alert-drawer-panel {
  transform: translateX(0);
}

.alert-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 8px;
  flex-shrink: 0;
}

.alert-drawer-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--ios-label-primary);
}

.alert-drawer-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ios-label-tertiary);
}

.alert-drawer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.alert-refresh-btn,
.alert-close-btn {
  border: none;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.alert-close-btn { font-size: 22px; }
.alert-refresh-btn:active,
.alert-close-btn:active { opacity: 0.7; }

.alert-drawer-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 14px 12px;
}

.alert-drawer-tab:active { opacity: 0.85; }

.alert-drawer.is-open .alert-drawer-tab {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-8px);
}

.alert-tab-icon { font-size: 16px; }

.alert-tab-badge {
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ios-blue, #007aff);
}

.alert-tab-badge.hidden { display: none; }

@media (min-width: 900px) {
  .alert-drawer-backdrop { display: none; }
  .alert-drawer.is-open { pointer-events: none; }
  .alert-drawer-panel { pointer-events: auto; }
  .alert-drawer.is-open .alert-drawer-tab {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(360px);
  }
}

.source-segment {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--ios-gray-fill);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
  scrollbar-width: none;
  position: relative;
  isolation: isolate;
}

.source-segment::-webkit-scrollbar { display: none; }

.source-btn {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 0 10px;
  height: 32px;
  border: none;
  border-radius: 7px;
  background: transparent;
  font-family: var(--ios-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: color var(--dur-normal) var(--ease-ios),
    transform var(--dur-fast) var(--ease-spring);
}

.source-btn:active { transform: scale(0.94); }

.source-btn.active {
  color: var(--segment-on-glider-color, var(--segment-active-color));
  background: transparent;
  box-shadow: none;
}

.source-glider {
  position: absolute;
  top: 2px;
  left: 2px;
  height: 32px;
  border-radius: 7px;
  background: var(--glider-bg);
  box-shadow: var(--glider-shadow);
  transition: transform var(--dur-normal) var(--ease-out-expo),
    width var(--dur-normal) var(--ease-out-expo);
  z-index: 0;
  pointer-events: none;
}

.source-desc {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ios-label-secondary);
  line-height: 1.4;
  transition: opacity var(--dur-fast) var(--ease-ios);
}

.source-desc.is-fading { opacity: 0; }

.cncs-mode-wrap {
  margin-top: 10px;
}

.cncs-mode-segment {
  display: flex;
  background: var(--ios-gray-fill);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.cncs-mode-btn {
  flex: 1;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: var(--ios-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-ios), color var(--dur-fast) var(--ease-ios);
}

.cncs-mode-btn.active {
  background: var(--ios-group);
  color: var(--ios-label);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.cncs-mode-btn:active {
  transform: scale(0.98);
}

#platformCell.hidden { display: none; }

.ios-cell-row.ashare-mode {
  grid-template-columns: 1fr 1fr;
}

.ios-cell-row.ashare-mode .ios-cell:last-child {
  border-right: none;
}

/* ── Grouped list (iOS inset grouped style) ── */
.ios-group {
  background: var(--ios-group);
  border-radius: var(--ios-radius-group);
  overflow: hidden;
  box-shadow: var(--ios-shadow);
  backdrop-filter: var(--group-backdrop);
  -webkit-backdrop-filter: var(--group-backdrop);
  border: var(--group-border);
  transition: box-shadow var(--dur-normal) var(--ease-ios),
    transform var(--dur-normal) var(--ease-ios), var(--theme-transition);
}

.ios-group:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ios-separator {
  height: 0.5px;
  background: var(--ios-separator);
  margin-left: 16px;
}

.ios-cell {
  padding: 11px 16px;
  position: relative;
}

.ios-cell-search {
  padding-bottom: 12px;
  overflow: visible;
}

.controls-panel.ios-group {
  overflow: visible;
}

.ios-cell-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.ios-cell-row .ios-cell:not(:last-child) {
  border-right: 0.5px solid var(--ios-separator);
}

.cell-label {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--ios-label-secondary);
  margin-bottom: 4px;
}

.ios-input,
.ios-select {
  width: 100%;
  font-family: var(--ios-font);
  font-weight: 400;
  color: var(--ios-label);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: var(--select-color-scheme);
}

.ios-input {
  border: none;
  background: transparent;
  font-size: 17px;
  padding: 0;
  transition: color var(--dur-fast) var(--ease-ios);
}

select.ios-select {
  display: block;
  min-height: 38px;
  padding: 8px 36px 8px 12px;
  font-size: 15px;
  line-height: 1.25;
  border-radius: 10px;
  border: 1px solid rgba(120, 120, 128, 0.22);
  background-color: var(--ios-gray-fill);
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    border-color 0.2s var(--ease-ios),
    box-shadow 0.2s var(--ease-ios),
    background-color 0.2s var(--ease-ios);
}

select.ios-select:hover {
  background-color: var(--ios-gray-fill2);
  border-color: rgba(0, 122, 255, 0.28);
}

select.ios-select:focus-visible {
  border-color: rgba(120, 120, 128, 0.32);
  box-shadow: none;
}

/* Custom select shell (select_enhance.js) */
.ios-select-shell {
  position: relative;
  width: 100%;
}

select.ios-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.ios-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font-family: var(--ios-font);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 400;
  color: var(--ios-label);
  text-align: left;
  border-radius: 10px;
  border: 1px solid rgba(120, 120, 128, 0.22);
  background-color: var(--ios-gray-fill);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    border-color 0.2s var(--ease-ios),
    background-color 0.2s var(--ease-ios);
}

.ios-select-trigger:hover:not(:disabled) {
  background-color: var(--ios-gray-fill2);
  border-color: rgba(120, 120, 128, 0.32);
}

.ios-select-trigger:focus-visible {
  outline: none;
  border-color: rgba(120, 120, 128, 0.38);
  box-shadow: none;
}

.ios-select-shell.is-open .ios-select-trigger {
  border-color: rgba(120, 120, 128, 0.38);
  background-color: var(--ios-gray-fill2);
}

.ios-select-trigger:disabled,
.ios-select-shell.is-disabled .ios-select-trigger {
  opacity: 0.45;
  cursor: not-allowed;
}

.ios-select-trigger-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ios-select-trigger-chevron {
  flex-shrink: 0;
  width: 12px;
  height: 8px;
  background: var(--select-chevron) center / contain no-repeat;
  transition: transform 0.28s var(--ease-out-expo);
}

.ios-select-shell.is-open .ios-select-trigger-chevron {
  transform: rotate(180deg);
}

.ios-select-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 100%;
  max-height: 280px;
  overflow: hidden;
  overscroll-behavior: contain;
  padding: 6px;
  border-radius: 12px;
  background: var(--ios-group);
  border: 0.5px solid var(--ios-separator-strong);
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 12px 28px rgba(0, 0, 0, 0.14),
    0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform-origin: top center;
}

.ios-select-menu.is-scrollable {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 120, 128, 0.32) transparent;
}

.ios-select-menu.is-scrollable::-webkit-scrollbar {
  width: 5px;
}

.ios-select-menu.is-scrollable::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 128, 0.32);
  border-radius: 999px;
}

.ios-select-menu.is-scrollable::-webkit-scrollbar-track {
  background: transparent;
}

.ios-select-menu.is-animating {
  overflow: hidden !important;
}

.ios-select-menu.is-open {
  visibility: visible;
  pointer-events: auto;
}

.ios-select-menu.is-open:not(.is-animating) {
  opacity: 1;
  transform: none;
}

.ios-select-option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: var(--ios-font);
  font-size: 15px;
  line-height: 1.25;
  color: var(--ios-label);
  text-align: left;
  cursor: pointer;
  transition: background 0.16s var(--ease-ios), color 0.16s var(--ease-ios);
  transform-origin: top center;
}

.ios-select-option:hover {
  background: var(--ios-gray-fill);
}

.ios-select-option.is-selected {
  color: var(--ios-blue);
  font-weight: 500;
  background: rgba(0, 122, 255, 0.1);
}

.ios-select-option.is-selected:hover {
  background: rgba(0, 122, 255, 0.14);
}

.backtest-field .ios-select-shell .ios-select-trigger,
.backtest-lb-filter .ios-select-shell .ios-select-trigger {
  font-size: 14px;
  min-height: 36px;
}

.ios-cell .ios-select-shell .ios-select-trigger {
  margin-top: 2px;
  font-size: 16px;
}

.ios-cell select.ios-select {
  margin-top: 2px;
  font-size: 16px;
}

.backtest-field select.ios-select,
.backtest-lb-filter select.ios-select {
  font-size: 14px;
  min-height: 36px;
}

.ios-input:focus,
select.ios-select:focus {
  outline: none;
}

.ios-cell:focus-within .cell-label {
  color: var(--ios-blue);
  transition: color var(--dur-fast) var(--ease-ios);
}

.ios-input::placeholder { color: var(--ios-label-tertiary); }

.ios-input-compact { font-size: 17px; }

.ios-select option {
  color: var(--option-color);
  background-color: var(--option-bg);
}

/* Search dropdown */
.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--ios-group);
  border-radius: var(--ios-radius-group);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 0.5px solid var(--ios-separator);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity var(--dur-normal) var(--ease-out-expo),
    transform var(--dur-normal) var(--ease-out-expo);
}

.search-results.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.search-results.is-floating {
  position: fixed;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 12000;
}

.search-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 0.5px solid var(--ios-separator);
  transition: background var(--dur-fast) var(--ease-ios),
    transform var(--dur-fast) var(--ease-ios);
  animation: list-item-in var(--dur-normal) var(--ease-out-expo) backwards;
}

.search-item:nth-child(1) { animation-delay: 0.02s; }
.search-item:nth-child(2) { animation-delay: 0.04s; }
.search-item:nth-child(3) { animation-delay: 0.06s; }
.search-item:nth-child(4) { animation-delay: 0.08s; }
.search-item:nth-child(5) { animation-delay: 0.1s; }

.search-item:hover { background: rgba(0, 122, 255, 0.06); }
.search-item:active { background: var(--ios-gray-fill); transform: scale(0.99); }
.search-item:last-child { border-bottom: none; }
.search-item .name { font-size: 17px; color: var(--emphasis-color); }
.search-item .sub { font-size: 13px; color: var(--ios-label-secondary); margin-top: 2px; }

/* ── Buttons ── */
.action-row {
  display: flex;
  gap: 10px;
  padding: 16px 0 0;
}

.action-row .ios-btn.is-ai-busy,
.rank-ai-btn.is-ai-busy {
  opacity: 0.55;
  cursor: not-allowed;
}

.sheet-actions #aiRerunBtn:not(.hidden) {
  margin-right: auto;
}

.ios-btn {
  flex: 1;
  height: 50px;
  border: none;
  border-radius: var(--ios-radius-btn);
  font-family: var(--ios-font);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) var(--ease-ios),
    background var(--dur-fast) var(--ease-ios),
    opacity var(--dur-fast) var(--ease-ios);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.ios-btn:active:not(:disabled) {
  transform: scale(0.96);
  opacity: 0.92;
}

.ios-btn-filled {
  background: var(--ios-blue);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.ios-btn-filled:hover:not(:disabled) {
  box-shadow: 0 6px 20px var(--accent-glow);
}

.ios-btn-filled:active:not(:disabled) {
  background: var(--ios-blue-pressed);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.ios-btn-gray {
  background: var(--ios-gray-fill);
  color: var(--emphasis-color);
  flex: 0 0 auto;
  min-width: 88px;
  padding: 0 20px;
}

.ios-btn-tinted {
  background: rgba(88, 86, 214, 0.14);
  color: var(--ios-blue);
  flex: 0 0 auto;
  min-width: 96px;
  padding: 0 16px;
  font-weight: 600;
}

.ios-btn-tinted:disabled {
  opacity: 0.45;
}

.ios-btn-plain {
  background: transparent;
  color: var(--ios-blue);
  flex: none;
  width: 100%;
  height: 44px;
  font-weight: 400;
}

/* ── Alert banner ── */
.ios-alert {
  margin-top: 0;
  padding: 0 16px;
  border-radius: var(--ios-radius-group);
  font-size: 15px;
  line-height: 1.4;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition: max-height var(--dur-normal) var(--ease-out-expo),
    opacity var(--dur-normal) var(--ease-out-expo),
    transform var(--dur-normal) var(--ease-out-expo),
    margin-top var(--dur-normal) var(--ease-out-expo),
    padding var(--dur-normal) var(--ease-out-expo);
}

.ios-alert.is-visible {
  margin-top: 12px;
  padding: 12px 16px;
  max-height: 160px;
  opacity: 1;
  transform: translateY(0);
}

.ios-alert.hidden { display: none; }

.ios-alert-error {
  background: rgba(255, 59, 48, 0.1);
  color: #d70015;
  border: 0.5px solid rgba(255, 59, 48, 0.2);
}

.ios-alert-warn {
  background: rgba(255, 149, 0, 0.12);
  color: #c93400;
  border: 0.5px solid rgba(255, 149, 0, 0.25);
}

.candle-extra-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
  flex-wrap: wrap;
}

.candle-extra-row.hidden { display: none; }

.extra-period-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.extra-period-chip {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.extra-period-chip input { display: none; }

.extra-period-chip span {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  transition: background var(--dur-fast) var(--ease-ios);
}

.extra-period-chip input:checked + span {
  background: var(--ios-blue);
  color: #fff;
}

.source-segment-wrap {
  position: relative;
}

.source-segment-wrap::after {
  content: "";
  position: absolute;
  right: 0;
  top: 2px;
  bottom: 2px;
  width: 28px;
  background: linear-gradient(to left, var(--ios-gray-fill), transparent);
  pointer-events: none;
  border-radius: 0 9px 9px 0;
}

.ios-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.meta-group { padding: 4px 0; }

.meta-box {
  padding: 12px 16px 16px;
  font-size: 15px;
}

.meta-box .placeholder {
  color: var(--ios-label-secondary);
  font-size: 15px;
}

.meta-grid.meta-animate .meta-item {
  animation: meta-item-in var(--dur-normal) var(--ease-out-expo) backwards;
}

.meta-grid.meta-animate .meta-item:nth-child(1) { animation-delay: 0.03s; }
.meta-grid.meta-animate .meta-item:nth-child(2) { animation-delay: 0.06s; }
.meta-grid.meta-animate .meta-item:nth-child(3) { animation-delay: 0.09s; }
.meta-grid.meta-animate .meta-item:nth-child(4) { animation-delay: 0.12s; }
.meta-grid.meta-animate .meta-item:nth-child(5) { animation-delay: 0.15s; }
.meta-grid.meta-animate .meta-item:nth-child(6) { animation-delay: 0.18s; }
.meta-grid.meta-animate .meta-item:nth-child(7) { animation-delay: 0.21s; }
.meta-grid.meta-animate .meta-item:nth-child(8) { animation-delay: 0.24s; }
.meta-grid.meta-animate .meta-item:nth-child(9) { animation-delay: 0.27s; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px 16px;
}

.meta-item .label {
  font-size: 12px;
  color: var(--ios-label-secondary);
  margin-bottom: 2px;
}

.meta-item .value {
  font-size: 17px;
  font-weight: 600;
  color: var(--emphasis-color);
  letter-spacing: -0.02em;
}

/* ── Chart panel ── */
.chart-panel { padding-bottom: 0; }

.chart-controls-bar {
  position: relative;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px 8px;
  border-bottom: 0.5px solid var(--ios-separator);
}

.chart-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  max-width: 100%;
}

.chart-fullscreen-btn {
  border: none;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-spring), opacity var(--dur-fast) var(--ease-ios);
}

.chart-fullscreen-btn:active { transform: scale(0.94); opacity: 0.85; }

.chart-fullscreen-btn.is-active {
  background: var(--ios-blue);
  color: #fff;
}

.chart-view-segment {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--ios-gray-fill);
  flex-shrink: 0;
  max-width: 100%;
}

.chart-view-scroll {
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chart-view-scroll::-webkit-scrollbar { display: none; }

.chart-view-scroll .chart-view-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.chart-view-btn {
  border: none;
  background: transparent;
  color: var(--ios-label-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-ios), color var(--dur-fast) var(--ease-ios);
}

.chart-view-btn.active {
  background: var(--ios-group);
  color: var(--segment-active-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chart-view-btn:active { opacity: 0.75; }

.chart-frame.view-chip .kline-dual-wrap,
.chart-frame.view-drawdown .kline-dual-wrap {
  display: none !important;
  flex: 0 0 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  border: none !important;
}

.chart-frame.view-chip #chipChart:not(.hidden),
.chart-frame.view-drawdown #analysisChart:not(.hidden) {
  flex: 1 1 auto;
  min-height: 240px;
  height: auto !important;
}

.chart-frame.view-kline #chipChart,
.chart-frame.view-kline #analysisChart {
  flex: 0 0 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}

.chip-canvas {
  display: block;
  width: 100%;
  height: 420px;
  flex: 1 1 auto;
  min-height: 240px;
}

.chip-canvas.hidden { display: none; }

.chip-disclaimer {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  z-index: 7;
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ios-orange);
  background: rgba(255, 149, 0, 0.1);
  border: 0.5px solid rgba(255, 149, 0, 0.25);
  border-radius: var(--ios-radius-chip);
}

.chip-disclaimer.hidden { display: none; }

.chip-meta {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  max-width: none;
  justify-content: flex-start;
  pointer-events: none;
}

.chip-meta.hidden { display: none; }

.analysis-meta {
  top: 8px;
  left: auto;
  right: 12px;
  justify-content: flex-end;
  max-width: min(72%, 520px);
}

.chip-meta-item {
  font-size: 11px;
  line-height: 1.2;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ios-label);
  border: 0.5px solid var(--ios-separator);
  backdrop-filter: blur(8px);
}

html[data-theme="dark"] .chip-meta-item,
html[data-theme="terminal"] .chip-meta-item,
html[data-theme="aurora"] .chip-meta-item {
  background: rgba(28, 28, 30, 0.82);
}

.chart-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--emphasis-color);
  letter-spacing: -0.02em;
}

.segment-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--ios-separator);
  background: var(--segment-bar-bg);
  transition: var(--theme-transition);
}

.segment-chip {
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.segment-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.segment-chip span {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ios-label-secondary);
  background: var(--ios-gray-fill);
  border-radius: var(--ios-radius-chip);
  transition: background var(--dur-fast) var(--ease-ios),
    color var(--dur-fast) var(--ease-ios),
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) var(--ease-ios);
}

.segment-chip input:checked + span {
  background: var(--ios-blue);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
  transform: scale(1.02);
}

.segment-chip:active span { transform: scale(0.94); opacity: 0.85; }
.segment-chip input:checked:active + span { transform: scale(0.98); }

.overlay-style-inner {
  overflow: hidden;
  min-height: 0;
}

.overlay-style-wrap.is-open .overlay-style-inner {
  overflow: visible;
  padding-bottom: 4px;
}

.overlay-style-wrap.is-open {
  overflow: visible;
}

.chart-panel:has(.overlay-style-wrap.is-open),
.chart-panel:has(.alert-style-wrap.is-open) {
  overflow: visible;
}

.overlay-toolbar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 6px;
}

.overlay-magnet-field {
  flex: 1;
  min-width: 0;
}

.overlay-undo-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  background: var(--ios-gray-fill);
  border-radius: var(--ios-radius-chip);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-spring), opacity var(--dur-fast) var(--ease-ios),
    background var(--dur-fast) var(--ease-ios), color var(--dur-fast) var(--ease-ios);
}

.overlay-undo-btn:not(:disabled):active { transform: scale(0.96); opacity: 0.88; }

.overlay-undo-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.overlay-tool-wrap {
  position: relative;
  flex-shrink: 0;
}

.brush-settings-panel {
  padding: 8px 16px 10px;
  border-top: 0.5px solid var(--ios-separator);
  background: var(--segment-bar-bg);
}

.brush-settings-panel.hidden {
  display: none;
}

.brush-settings-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: center;
}

.brush-settings-grid .brush-pop-field {
  margin-bottom: 0;
  grid-column: 1 / -1;
}

.brush-settings-grid .brush-pop-clear {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.brush-pop-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.brush-mode-btn {
  flex: 1;
  border: none;
  padding: 5px 0;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ios-label-secondary);
  background: var(--ios-gray-fill);
}

.brush-mode-btn.active {
  background: var(--ios-blue);
  color: #fff;
}

.brush-pop-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--ios-label-secondary);
}

.brush-pop-field span:first-child {
  width: 28px;
  flex-shrink: 0;
}

.brush-pop-field input[type="color"] {
  width: 28px;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.brush-pop-field input[type="range"] {
  flex: 1;
  min-width: 0;
}

.brush-pop-field .brush-size-label {
  width: 32px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.brush-pop-clear {
  width: 100%;
  margin-top: 2px;
  border: none;
  padding: 6px 0;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  background: #ff3b30;
}

.brush-pop-clear:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.brush-start-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--ios-blue);
  border-radius: 8px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-spring), opacity var(--dur-fast) var(--ease-ios);
}

.brush-start-btn.active {
  background: #ff3b30;
}

.brush-start-btn:active { transform: scale(0.96); opacity: 0.88; }

.overlay-tool-btn.overlay-tool-hidden {
  display: none;
}

.brush-canvas.is-eraser {
  cursor: cell;
}

.overlay-clear-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #ff3b30;
  border-radius: var(--ios-radius-chip);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-spring), opacity var(--dur-fast) var(--ease-ios);
}

.overlay-clear-btn:active { transform: scale(0.96); opacity: 0.88; }

.overlay-clear-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.overlay-tool-scroll {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  overflow: visible;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 16px 8px;
}

.overlay-tool-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ios-label-secondary);
  background: var(--ios-gray-fill);
  border-radius: var(--ios-radius-chip);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) var(--ease-ios),
    color var(--dur-fast) var(--ease-ios),
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) var(--ease-ios);
}

.overlay-tool-btn.active {
  background: var(--ios-blue);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.overlay-tool-btn:active { transform: scale(0.94); opacity: 0.85; }

.overlay-tool-btn.active:active { transform: scale(0.98); }

.overlay-tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.overlay-hint {
  margin: 0;
  padding: 0 16px 10px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ios-label-secondary);
}

.image-mark-file-input {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-mark-layer {
  position: absolute;
  inset: 0;
  z-index: 620;
  pointer-events: none;
  overflow: hidden;
}

.image-mark-layer.is-drop-target {
  outline: 2px dashed rgba(0, 122, 255, 0.65);
  outline-offset: -4px;
  background: rgba(0, 122, 255, 0.06);
}

.image-mark-stamp {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  box-sizing: border-box;
}

.image-mark-stamp.is-selected {
  border: 2px solid #007aff;
}

.image-mark-stamp:not(.is-selected) {
  border: 2px solid transparent;
}

.image-mark-stamp:active {
  cursor: grabbing;
}

.image-mark-inner {
  width: 100%;
  height: 100%;
  transform-origin: center center;
}

.image-mark-stamp img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.image-mark-handle {
  position: absolute;
  display: none;
  box-sizing: border-box;
}

.image-mark-stamp.is-selected .image-mark-handle {
  display: block;
}

.image-mark-delete {
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
}

.image-mark-rotate {
  top: -28px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: #007aff;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab;
}

.image-mark-resize {
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #fff;
  border: 2px solid #007aff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: nwse-resize;
}

.annotation-sheet .ios-input {
  width: 100%;
  margin-bottom: 12px;
}

.candle-style-wrap {
  border-bottom: 0.5px solid var(--ios-separator);
  background: var(--segment-bar-bg);
  transition: var(--theme-transition);
}

.candle-style-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: none;
  background: transparent;
  font-family: var(--ios-font);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) var(--ease-ios);
}

.candle-style-toggle:active { background: var(--ios-gray-fill); }

.candle-style-toggle-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--ios-label-secondary);
  flex-shrink: 0;
}

.candle-style-summary {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--emphasis-color);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.candle-style-chevron {
  font-size: 16px;
  line-height: 1;
  color: var(--ios-label-tertiary);
  transform: rotate(0deg);
  transition: transform var(--dur-normal) var(--ease-out-expo);
  flex-shrink: 0;
}

.candle-style-wrap.is-open .candle-style-chevron {
  transform: rotate(90deg);
}

.candle-style-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-normal) var(--ease-out-expo);
}

.candle-style-wrap.is-open .candle-style-panel {
  grid-template-rows: 1fr;
}

.candle-style-fields {
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding: 0 16px;
  min-height: 0;
}

.candle-style-wrap.is-open .candle-style-fields {
  padding-bottom: 10px;
}

.candle-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.candle-field-label {
  font-size: 11px;
  color: var(--ios-label-tertiary);
}

.candle-select {
  font-size: 14px;
  padding: 6px 18px 6px 8px;
  background-color: var(--ios-gray-fill);
  border-radius: 8px;
  background-position: right 6px center;
}

@media (max-width: 640px) {
  .candle-style-fields { grid-template-columns: 1fr; }
}

.chart-frame {
  position: relative;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.chart-frame.brush-drawing-active .kline-dual-wrap,
.chart-frame.brush-drawing-active #chipChart:not(.hidden),
.chart-frame.brush-drawing-active #analysisChart:not(.hidden) {
  pointer-events: none;
}

.chart-frame .kline-dual-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* 全屏：工具栏单行，设置面板绝对浮层，不挤压图表 */
.chart-panel.is-fullscreen .chart-controls-bar,
.chart-panel:fullscreen .chart-controls-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px 8px;
  padding: 4px 10px 6px;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 50;
  border-bottom: 0.5px solid var(--ios-separator);
}

.chart-panel.is-fullscreen .chart-controls-bar > .segment-bar,
.chart-panel:fullscreen .chart-controls-bar > .segment-bar {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chart-panel.is-fullscreen .chart-controls-bar > .segment-bar::-webkit-scrollbar,
.chart-panel:fullscreen .chart-controls-bar > .segment-bar::-webkit-scrollbar {
  display: none;
}

.chart-panel.is-fullscreen .chart-controls-bar > #overlayToggles,
.chart-panel:fullscreen .chart-controls-bar > #overlayToggles,
.chart-panel.is-fullscreen .chart-controls-bar > #candleStyleWrap,
.chart-panel:fullscreen .chart-controls-bar > #candleStyleWrap,
.chart-panel.is-fullscreen .chart-controls-bar > #alertStyleWrap,
.chart-panel:fullscreen .chart-controls-bar > #alertStyleWrap {
  flex: 0 0 auto;
  position: static;
  width: auto;
  border-bottom: none;
}

.chart-panel.is-fullscreen .chart-controls-bar .candle-style-wrap,
.chart-panel:fullscreen .chart-controls-bar .overlay-style-wrap,
.chart-panel.is-fullscreen .chart-controls-bar .overlay-style-wrap,
.chart-panel:fullscreen .chart-controls-bar .candle-style-wrap,
.chart-panel.is-fullscreen .chart-controls-bar .alert-style-wrap,
.chart-panel:fullscreen .chart-controls-bar .alert-style-wrap {
  width: auto;
  border-bottom: none;
  min-width: 0;
}

.chart-panel.is-fullscreen .chart-controls-bar .candle-style-toggle,
.chart-panel:fullscreen .chart-controls-bar .candle-style-toggle {
  width: auto;
  padding: 5px 11px;
  border-radius: 8px;
  background: var(--ios-gray-fill);
  gap: 4px;
}

.chart-panel.is-fullscreen .chart-controls-bar .candle-style-summary,
.chart-panel:fullscreen .chart-controls-bar .candle-style-summary,
.chart-panel.is-fullscreen .chart-controls-bar .candle-style-chevron,
.chart-panel:fullscreen .chart-controls-bar .candle-style-chevron {
  display: none;
}

.chart-panel.is-fullscreen .chart-controls-bar .candle-style-toggle-text,
.chart-panel:fullscreen .chart-controls-bar .candle-style-toggle-text {
  font-size: 12px;
  font-weight: 600;
}

/* 面板相对整条工具栏定位，右对齐、固定宽度，避免过宽溢出 */
.chart-panel.is-fullscreen .chart-controls-bar > #overlayToggles .candle-style-panel,
.chart-panel:fullscreen .chart-controls-bar > #overlayToggles .candle-style-panel,
.chart-panel.is-fullscreen .chart-controls-bar > #candleStyleWrap .candle-style-panel,
.chart-panel:fullscreen .chart-controls-bar > #candleStyleWrap .candle-style-panel,
.chart-panel.is-fullscreen .chart-controls-bar > #alertStyleWrap .candle-style-panel,
.chart-panel:fullscreen .chart-controls-bar > #alertStyleWrap .candle-style-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: auto;
  right: 10px;
  width: min(340px, calc(100vw - 24px));
  min-width: 0;
  max-width: min(340px, calc(100vw - 24px));
  max-height: min(30vh, 220px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 60;
  background: var(--ios-group);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  border: 0.5px solid var(--ios-separator);
  grid-template-rows: unset;
  transition: none;
  margin-top: 0;
}

.chart-panel.is-fullscreen #overlayToggles.is-open > .candle-style-panel,
.chart-panel:fullscreen #overlayToggles.is-open > .candle-style-panel,
.chart-panel.is-fullscreen #candleStyleWrap.is-open > .candle-style-panel,
.chart-panel:fullscreen #candleStyleWrap.is-open > .candle-style-panel,
.chart-panel.is-fullscreen #alertStyleWrap.is-open > .candle-style-panel,
.chart-panel:fullscreen #alertStyleWrap.is-open > .candle-style-panel {
  display: block;
}

.chart-panel.is-fullscreen .chart-controls-bar > #alertStyleWrap .candle-style-panel,
.chart-panel:fullscreen .chart-controls-bar > #alertStyleWrap .candle-style-panel {
  width: min(320px, calc(100vw - 24px));
  max-width: min(320px, calc(100vw - 24px));
  max-height: none;
}

.chart-panel.is-fullscreen #alertStyleWrap.is-open .alert-panel-inner,
.chart-panel:fullscreen #alertStyleWrap.is-open .alert-panel-inner {
  overflow: visible;
  max-height: none;
  padding: 0 10px 6px;
}

.chart-panel.is-fullscreen .overlay-style-inner,
.chart-panel:fullscreen .overlay-style-inner,
.chart-panel.is-fullscreen .alert-panel-inner,
.chart-panel:fullscreen .alert-panel-inner {
  overflow: visible;
  min-height: auto;
  max-height: none;
}

.chart-panel.is-fullscreen .candle-style-wrap.is-open .candle-style-fields,
.chart-panel:fullscreen .candle-style-wrap.is-open .candle-style-fields {
  overflow: visible;
  min-height: auto;
  padding-top: 10px;
}

.chart-panel.is-fullscreen .chart-controls-bar .overlay-tool-btn,
.chart-panel:fullscreen .chart-controls-bar .overlay-tool-btn {
  flex-shrink: 0;
}

.chart-panel .chart-annotation-overlay {
  z-index: 10050;
}

.chart-panel.is-fullscreen .chart-header,
.chart-panel:fullscreen .chart-header {
  flex-shrink: 0;
  padding: 10px 12px 6px;
}

.chart-panel.is-fullscreen .chart-header-actions,
.chart-panel:fullscreen .chart-header-actions {
  flex-shrink: 0;
}

.chart-panel.is-fullscreen .chart-view-segment,
.chart-panel:fullscreen .chart-view-segment {
  flex-shrink: 0;
}

.chart-panel.is-fullscreen .chart-view-btn,
.chart-panel:fullscreen .chart-view-btn {
  flex-shrink: 0;
}

.chart-panel.is-fullscreen,
.chart-panel:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0 !important;
  margin: 0;
  background: var(--ios-bg);
  background-image: var(--body-bg-image);
  background-size: cover;
  background-attachment: fixed;
  backdrop-filter: var(--group-backdrop, none);
  -webkit-backdrop-filter: var(--group-backdrop, none);
}

.chart-panel.is-fullscreen .chart-frame,
.chart-panel:fullscreen .chart-frame {
  flex: 1;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.chart-panel.is-fullscreen .chart-frame .chart-container:not(.chart-container-sub),
.chart-panel:fullscreen .chart-frame .chart-container:not(.chart-container-sub) {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100% !important;
}

.chart-panel.is-fullscreen .chart-frame .brush-canvas,
.chart-panel:fullscreen .chart-frame .brush-canvas {
  position: absolute;
  inset: 0;
  flex: unset;
}

.chart-panel.is-fullscreen .chart-frame .brush-canvas:not(.hidden),
.chart-panel:fullscreen .chart-frame .brush-canvas:not(.hidden) {
  z-index: 500;
  pointer-events: none;
}

.chart-panel.is-fullscreen .chart-frame .brush-canvas.is-drawing,
.chart-panel:fullscreen .chart-frame .brush-canvas.is-drawing {
  z-index: 501;
  pointer-events: auto;
}

.chart-panel.is-fullscreen .chart-frame .chip-canvas,
.chart-panel:fullscreen .chart-frame .chip-canvas {
  flex: 1;
  min-height: 0;
  height: 100% !important;
  width: 100%;
}

.chart-panel.is-fullscreen .chart-container,
.chart-panel:fullscreen .chart-container,
.chart-panel.is-fullscreen .brush-canvas,
.chart-panel:fullscreen .brush-canvas,
.chart-panel.is-fullscreen .chip-canvas,
.chart-panel:fullscreen .chip-canvas {
  min-height: 240px;
}

.chart-container {
  position: relative;
  height: 420px;
  width: 100%;
  opacity: 1;
  transition: opacity var(--dur-slow) var(--ease-out-expo);
}

.chart-container.chart-animate {
  animation: chart-reveal var(--dur-slow) var(--ease-out-expo);
}

.chart-reveal-overlay {
  position: absolute;
  inset: 0;
  z-index: 480;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.35s var(--ease-ios);
}

.chart-reveal-overlay.is-active {
  opacity: 1;
}

.chart-reveal-overlay.hidden {
  display: none;
}

.chart-reveal-sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    transparent 42%,
    rgba(0, 122, 255, 0.08) 50%,
    rgba(52, 199, 89, 0.06) 58%,
    transparent 68%,
    transparent 100%
  );
  animation: chart-reveal-sweep 2.4s var(--ease-ios) infinite;
}

.chart-reveal-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-blue);
  background: rgba(0, 122, 255, 0.1);
  border: 0.5px solid rgba(0, 122, 255, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chart-reveal-spark {
  animation: chart-reveal-spark 1.2s ease-in-out infinite;
}

@keyframes chart-reveal-sweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

@keyframes chart-reveal-spark {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

.brush-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 420px;
  z-index: 500;
  pointer-events: none;
  touch-action: none;
  image-rendering: auto;
  opacity: 1;
}

.brush-canvas:not(.hidden) {
  z-index: 500;
}

.brush-canvas.is-drawing {
  pointer-events: auto;
  cursor: crosshair;
  z-index: 501;
}

.custom-watermark,
.page-watermark {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}

.custom-watermark::before,
.page-watermark::before {
  content: "";
  position: absolute;
  width: 220%;
  height: 220%;
  top: -60%;
  left: -60%;
  transform: rotate(-28deg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='380' height='220' viewBox='0 0 380 220'%3E%3Ctext x='190' y='110' fill='%23808088' font-family='system-ui,-apple-system,sans-serif' font-size='22' font-weight='600' text-anchor='middle' dominant-baseline='middle'%3Eqilezhibiao.top%3C/text%3E%3C/svg%3E");
  background-size: 380px 220px;
  opacity: 0.13;
}

html[data-theme="dark"] .custom-watermark::before,
html[data-theme="dark"] .page-watermark::before,
html[data-theme="midnight"] .custom-watermark::before,
html[data-theme="midnight"] .page-watermark::before,
html[data-theme="oled"] .custom-watermark::before,
html[data-theme="oled"] .page-watermark::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='380' height='220' viewBox='0 0 380 220'%3E%3Ctext x='190' y='110' fill='%23ffffff' font-family='system-ui,-apple-system,sans-serif' font-size='22' font-weight='600' text-anchor='middle' dominant-baseline='middle'%3Eqilezhibiao.top%3C/text%3E%3C/svg%3E");
  opacity: 0.07;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: var(--ios-label-tertiary);
  background: var(--chart-empty-bg);
  transition: opacity var(--dur-normal) var(--ease-ios), var(--theme-transition);
}

.chart-empty.hidden {
  opacity: 0;
  visibility: hidden;
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  position: relative;
  opacity: 0.8;
  animation: empty-float 3s ease-in-out infinite;
}

.empty-icon::before,
.empty-icon::after {
  content: "";
  position: absolute;
  background: var(--ios-label-tertiary);
  border-radius: 2px;
}

.empty-icon::before {
  width: 4px;
  height: 20px;
  left: 14px;
  bottom: 12px;
}

.empty-icon::after {
  width: 24px;
  height: 4px;
  left: 14px;
  bottom: 12px;
  box-shadow: 6px -8px 0 var(--ios-label-tertiary), 12px -14px 0 var(--ios-label-tertiary);
}

.chart-empty p {
  font-size: 17px;
  font-weight: 500;
  color: var(--ios-label-secondary);
}

.chart-empty .hint {
  font-size: 13px;
  font-weight: 400;
  color: var(--ios-label-tertiary);
  margin-top: 4px;
}

/* ── Table (iOS list style) ── */
.table-panel { padding: 0; }

.table-wrap {
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ios-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.ios-table th,
.ios-table td {
  padding: 10px 16px;
  text-align: right;
  border-bottom: 0.5px solid var(--ios-separator);
  white-space: nowrap;
}

.ios-table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--ios-label-secondary);
  background: var(--table-head-bg);
  position: sticky;
  top: 0;
  z-index: 1;
  transition: var(--theme-transition);
}

.ios-table td:first-child,
.ios-table th:first-child { text-align: left; }

.ios-table tbody tr {
  transition: background var(--dur-fast) var(--ease-ios);
}

.ios-table tbody tr.table-row-in {
  animation: table-row-in var(--dur-normal) var(--ease-out-expo) backwards;
}

.ios-table tbody tr:active { background: var(--ios-gray-fill); }

.price-up { color: var(--ios-up); font-weight: 500; }
.price-down { color: var(--ios-down); font-weight: 500; }

.table-download-btn {
  margin-left: auto;
  border: none;
  cursor: pointer;
  font-family: var(--ios-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-blue);
  background: var(--ios-gray-fill);
  padding: 4px 12px;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity var(--dur-fast) var(--ease-ios), transform var(--dur-fast) var(--ease-spring);
}

.table-download-btn:not(:disabled):active {
  transform: scale(0.96);
  opacity: 0.85;
}

.table-download-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.download-sheet {
  max-width: 360px;
  text-align: left;
}

.download-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.download-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.download-range-all {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--emphasis-color);
  cursor: pointer;
}

.download-range-all input {
  width: 16px;
  height: 16px;
  accent-color: var(--ios-blue);
}

.download-range-fields {
  display: grid;
  gap: 10px;
}

.download-range-fields.hidden {
  display: none;
}

.download-field-label {
  font-size: 12px;
  color: var(--ios-label-secondary);
}

.download-sheet .ios-input,
.download-select {
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: var(--ios-gray-fill);
  color: var(--emphasis-color);
  font-family: var(--ios-font);
}

.download-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238E8E93' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.chart-export-sheet {
  max-width: 380px;
}

.chart-export-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ios-gray-fill);
}

.chart-export-opt.hidden {
  display: none;
}

.ios-btn-tradingagents {
  background: linear-gradient(135deg, rgba(88, 86, 214, 0.22) 0%, rgba(0, 122, 255, 0.14) 100%);
  color: var(--ios-blue);
  border: 0.5px solid rgba(88, 86, 214, 0.35);
}

.ai-agent-log {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
  line-height: 1.45;
}

.ai-agent-log-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.ai-agent-log-item .ai-team-agent-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.ai-agent-log-label {
  min-width: 0;
  color: var(--ios-label);
}

.ai-agent-log-item.is-start .ai-agent-log-label {
  color: var(--ios-label-secondary);
}

.ai-agent-log-item.is-done .ai-agent-log-label {
  font-weight: 600;
}

.ai-agent-log-item.is-done .ai-team-agent-icon {
  color: var(--ios-label);
  background: rgba(120, 120, 128, 0.14);
}

.ai-agent-log-item.is-skip .ai-team-agent-icon {
  opacity: 0.45;
}

.ai-agent-log-item.is-skip .ai-agent-log-label,
.ai-agent-log-reason {
  color: var(--ios-label-tertiary);
}

.ai-agent-log li { margin: 2px 0; }

.chart-export-color {
  width: 100%;
  height: 36px;
  padding: 2px 4px;
  border: none;
  border-radius: 8px;
  background: var(--ios-gray-fill);
  cursor: pointer;
}

/* ── 自选 / 最近（紧凑横滑） ── */
.watchlist-compact {
  padding: 6px 12px 8px;
}

.watchlist-compact.hidden {
  display: none;
}

.watchlist-compact-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.watchlist-tab {
  flex: 0 0 auto;
  border: none;
  border-radius: 6px;
  padding: 3px 8px;
  font-family: var(--ios-font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  line-height: 1.2;
}

.watchlist-tab.active {
  background: var(--ios-blue);
  color: #fff;
}

.watchlist-scroll {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 1px 0;
}

.watchlist-scroll::-webkit-scrollbar {
  display: none;
}

.watchlist-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 148px;
  padding: 4px 8px 4px 6px;
  border: none;
  border-radius: 14px;
  background: var(--ios-gray-fill);
  cursor: pointer;
  font-family: var(--ios-font);
  -webkit-tap-highlight-color: transparent;
}

.watchlist-chip:active {
  opacity: 0.82;
}

.watchlist-chip-star {
  flex-shrink: 0;
  border: none;
  background: transparent;
  font-size: 13px;
  line-height: 1;
  padding: 0 1px;
  cursor: pointer;
  color: var(--ios-label-tertiary);
}

.watchlist-chip-star.is-fav {
  color: #ff9500;
}

.watchlist-chip-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--emphasis-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 双周期同屏 ── */
.kline-dual-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: visible;
}

.kline-dual-wrap > .brush-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 500;
}

.kline-main-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.kline-sub-pane {
  flex: 0 0 38%;
  min-height: 160px;
  max-height: 45%;
  display: flex;
  flex-direction: column;
  border-top: 0.5px solid var(--ios-separator);
  background: var(--segment-bar-bg);
  position: relative;
  min-width: 0;
}

.kline-sub-chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.kline-sub-chart-wrap .chart-container-sub {
  flex: 1;
  min-height: 0;
}

.kline-pane-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  padding: 4px 10px 2px;
  flex-shrink: 0;
}

.chart-container-sub {
  flex: 1;
  min-height: 140px;
  height: auto !important;
}

.kline-dual-wrap:not(.is-dual) .kline-sub-pane {
  display: none !important;
  flex: 0 0 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  border: none !important;
}

.kline-dual-wrap:not(.is-dual) .kline-main-pane {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

.kline-dual-wrap.is-dual .kline-main-pane .chart-container {
  flex: 1;
  min-height: 180px;
  height: auto !important;
}

.chart-panel.is-fullscreen .kline-dual-wrap,
.chart-panel:fullscreen .kline-dual-wrap {
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
}

.chart-panel.is-fullscreen .kline-main-pane,
.chart-panel:fullscreen .kline-main-pane {
  flex: 1.15;
  min-height: 0;
}

.chart-panel.is-fullscreen .kline-sub-pane,
.chart-panel:fullscreen .kline-sub-pane {
  flex: 0 0 34%;
  min-height: 120px;
  max-height: 42%;
}

.chart-panel.is-fullscreen .kline-sub-chart-wrap,
.chart-panel:fullscreen .kline-sub-chart-wrap {
  flex: 1;
  min-height: 0;
}

.chart-panel.is-fullscreen .chart-container-sub,
.chart-panel:fullscreen .chart-container-sub {
  flex: 1;
  min-height: 0;
  height: 100% !important;
}

.chart-panel.is-fullscreen .kline-dual-wrap.is-dual .kline-main-pane .chart-container,
.chart-panel:fullscreen .kline-dual-wrap.is-dual .kline-main-pane .chart-container {
  min-height: 0;
  height: 100% !important;
}

.extra-period-chip input[type="radio"] {
  accent-color: var(--ios-blue);
}

.fundamental-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid var(--ios-separator);
}

.fundamental-block .meta-grid {
  margin-top: 0;
}

.finance-metrics-block {
  margin-top: 10px;
}

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

.finance-metrics-head .section-label {
  flex: 1;
  min-width: 0;
}

.finance-metrics-block .finance-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ios-blue);
  background: color-mix(in srgb, var(--ios-blue) 12%, transparent);
  border-radius: 4px;
  vertical-align: middle;
}

.finance-metrics-block .finance-period {
  font-size: 12px;
  font-weight: 400;
  color: var(--ios-label-tertiary);
}

.finance-metrics-block .finance-hint {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--ios-label-tertiary);
}

.finance-metrics-block .ios-btn-compact {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.finance-metrics-block .finance-hint-muted {
  margin-top: -4px;
  font-size: 11px;
  line-height: 1.45;
}

.finance-metrics-block .finance-sub-label {
  margin: 10px 0 6px;
  padding: 0;
  font-size: 12px;
  color: var(--ios-label-secondary);
}

.profile-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid var(--ios-separator);
}

.meta-item-wide {
  grid-column: 1 / -1;
}

.meta-item-wide .value {
  word-break: break-all;
}

.table-foot {
  padding: 10px 16px 14px;
  font-size: 12px;
  color: var(--ios-label-tertiary);
}

/* ── Log panel ── */
.log-panel { padding: 0; }

#logOutput {
  padding: 12px 16px 16px;
  font-size: 12px;
  font-family: var(--ios-font-mono);
  max-height: 180px;
  overflow-y: auto;
  color: var(--ios-label-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}

/* ── Overlays & sheets ── */
.ios-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-normal) var(--ease-ios),
    visibility var(--dur-normal) var(--ease-ios);
}

dialog.ios-overlay {
  border: none;
  margin: 0;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  background: transparent;
  color: inherit;
  overflow: visible;
  opacity: 1;
  visibility: visible;
}

dialog.ios-overlay:not([open]) {
  display: none !important;
}

dialog.ios-overlay[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  overflow: hidden;
}

#loadingOverlay.ios-overlay {
  z-index: 11000;
}

#loadingOverlay.ios-overlay .loading-sheet {
  overflow: hidden;
  contain: layout style paint;
}

#loadingOverlay.is-open .ios-sheet {
  transform: none;
  opacity: 1;
  transition: none;
}

.loading-sheet .sheet-title { margin-top: 16px; }
.loading-sheet .sheet-sub { margin-top: 4px; }

.loading-sheet .activity-indicator {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid var(--ios-gray-fill);
  border-top-color: var(--ios-label-tertiary);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
  transform-origin: 50% 50%;
  flex-shrink: 0;
  will-change: transform;
}

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

body.is-fetching .rank-drawer-tab,
body.is-fetching .alert-drawer-tab,
body.is-fetching .assistant-widget {
  visibility: hidden;
  pointer-events: none;
}

body.is-fetching > .ios-select-menu,
body.is-fetching > .search-results.is-floating {
  visibility: hidden !important;
  pointer-events: none !important;
}

dialog.ios-overlay .ios-select-menu {
  z-index: 30;
}

dialog.ios-overlay::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-ios);
}

dialog.ios-overlay.is-open::backdrop {
  opacity: 1;
}

.ios-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ios-overlay.hidden { display: none; }

.ios-sheet {
  background: var(--ios-group);
  border-radius: 14px;
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  transform: translateY(24px) scale(0.96);
  opacity: 0;
  transition: transform var(--dur-normal) var(--ease-out-expo),
    opacity var(--dur-normal) var(--ease-out-expo);
  overflow: visible;
}

.chart-video-export-sheet,
.chart-export-sheet {
  overflow: visible;
}

.ios-overlay.is-open .ios-sheet {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.captcha-sheet {
  max-width: 520px;
  text-align: left;
  padding: 20px;
}

.sheet-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--emphasis-color);
  margin-bottom: 6px;
}

.sheet-sub {
  font-size: 13px;
  color: var(--ios-label-secondary);
  line-height: 1.4;
}

.loading-sheet .sheet-title { margin-top: 16px; }
.loading-sheet .sheet-sub { margin-top: 4px; }

.activity-indicator {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid var(--ios-gray-fill);
  border-top-color: var(--ios-label-tertiary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.captcha-viewport {
  background: #000;
  border-radius: 10px;
  overflow: auto;
  max-height: 50vh;
  margin: 16px 0;
}

#captchaCanvas {
  display: block;
  cursor: crosshair;
  max-width: 100%;
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hidden { display: none !important; }

/* ── Motion keyframes & page entrance ── */
@keyframes list-item-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes meta-item-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes chart-reveal {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes empty-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes table-row-in {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

body:not(.app-ready) .content > * {
  opacity: 0;
}

body.app-ready .content > * {
  animation: page-enter var(--dur-slow) var(--ease-out-expo) backwards;
}

body.app-ready .content > *:nth-child(1) { animation-delay: 0.03s; }
body.app-ready .content > *:nth-child(2) { animation-delay: 0.06s; }
body.app-ready .content > *:nth-child(3) { animation-delay: 0.09s; }
body.app-ready .content > *:nth-child(4) { animation-delay: 0.12s; }
body.app-ready .content > *:nth-child(5) { animation-delay: 0.15s; }
body.app-ready .content > *:nth-child(6) { animation-delay: 0.18s; }
body.app-ready .content > *:nth-child(7) { animation-delay: 0.21s; }
body.app-ready .content > *:nth-child(8) { animation-delay: 0.24s; }
body.app-ready .content > *:nth-child(9) { animation-delay: 0.27s; }
body.app-ready .content > *:nth-child(10) { animation-delay: 0.3s; }
body.app-ready .content > *:nth-child(11) { animation-delay: 0.33s; }
body.app-ready .content > *:nth-child(12) { animation-delay: 0.36s; }
body.app-ready .content > *:nth-child(13) { animation-delay: 0.39s; }
body.app-ready .content > *:nth-child(14) { animation-delay: 0.42s; }
body.app-ready .content > *:nth-child(15) { animation-delay: 0.45s; }

body.app-ready .nav-bar-inner {
  animation: page-enter var(--dur-slow) var(--ease-out-expo) backwards;
}

.search-results.hidden {
  display: block !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(-8px) scale(0.98) !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body:not(.app-ready) .content > * { opacity: 1; }
  .empty-icon { animation: none; }
  .status-pill.busy .status-dot { animation: none; }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav-title { font-size: 17px; }
  .nav-bar-inner,
  .flow-header-inner {
    padding: 8px 12px 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
  }
  .nav-title-block {
    grid-column: 1;
    grid-row: 1;
  }
  .nav-actions,
  .flow-header-right {
    grid-column: 2;
    grid-row: 1;
  }
  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
  }
  .nav-actions { margin-left: 0; }
  .content { padding: 4px 12px 0; }
  .theme-grid { grid-template-columns: 1fr 1fr; }
  .ios-cell-row { grid-template-columns: 1fr; }
  .ios-cell-row .ios-cell:not(:last-child) { border-right: none; border-bottom: 0.5px solid var(--ios-separator); }
  .chart-container { height: 340px; }
  .chart-frame { min-height: 340px; }
  .page-watermark::before,
  .custom-watermark::before {
    opacity: 0.11;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='148' viewBox='0 0 260 148'%3E%3Ctext x='130' y='74' fill='%23808088' font-family='system-ui,-apple-system,sans-serif' font-size='22' font-weight='600' text-anchor='middle' dominant-baseline='middle'%3Eqilezhibiao.top%3C/text%3E%3C/svg%3E");
    background-size: 260px 148px;
  }

  html[data-theme="dark"] .page-watermark::before,
  html[data-theme="dark"] .custom-watermark::before,
  html[data-theme="midnight"] .page-watermark::before,
  html[data-theme="midnight"] .custom-watermark::before,
  html[data-theme="oled"] .page-watermark::before,
  html[data-theme="oled"] .custom-watermark::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='148' viewBox='0 0 260 148'%3E%3Ctext x='130' y='74' fill='%23ffffff' font-family='system-ui,-apple-system,sans-serif' font-size='22' font-weight='600' text-anchor='middle' dominant-baseline='middle'%3Eqilezhibiao.top%3C/text%3E%3C/svg%3E");
    background-size: 260px 148px;
  }
  .action-row { flex-direction: column; }
  .ios-btn-gray { flex: 1; min-width: unset; }
}

/* ── UI Themes ── */
html[data-theme="ios"],
:root {
  color-scheme: light;
  --ios-bg: #f2f2f7;
  --ios-group: #ffffff;
  --ios-separator: rgba(60, 60, 67, 0.12);
  --ios-label: #3c3c43;
  --ios-label-secondary: rgba(60, 60, 67, 0.6);
  --ios-label-tertiary: rgba(60, 60, 67, 0.4);
  --ios-blue: #007aff;
  --ios-blue-pressed: #0062cc;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --ios-orange: #ff9500;
  --ios-gray-fill: #e5e5ea;
  --ios-gray-fill2: #d1d1d6;
  --ios-up: #34c759;
  --ios-down: #ff3b30;
  --ios-radius-group: 13px;
  --ios-radius-btn: 12px;
  --ios-radius-chip: 8px;
  --ios-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --ios-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --nav-bg: rgba(242, 242, 247, 0.82);
  --nav-blur: saturate(180%) blur(20px);
  --title-color: #000000;
  --emphasis-color: #000000;
  --segment-active-color: #000000;
  --segment-on-glider-color: var(--segment-active-color);
  --chart-empty-bg: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  --segment-bar-bg: rgba(242, 242, 247, 0.5);
  --table-head-bg: rgba(242, 242, 247, 0.6);
  --select-color-scheme: light;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.5 1.5L6 6l4.5-4.5'/%3E%3C/svg%3E");
  --option-color: #1c1c1e;
  --option-bg: #ffffff;
  --glider-bg: #ffffff;
  --glider-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  --accent-glow: rgba(0, 122, 255, 0.35);
  --body-bg-image: none;
  --group-backdrop: none;
  --group-border: none;
  --chart-grid: rgba(60, 60, 67, 0.08);
  --chart-axis: rgba(60, 60, 67, 0.12);
  --chart-tick: rgba(60, 60, 67, 0.6);
  --candle-up: #34c759;
  --candle-down: #ff3b30;
  --candle-neutral: #8e8e93;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ios-bg: #000000;
  --ios-group: #1c1c1e;
  --ios-separator: rgba(84, 84, 88, 0.65);
  --ios-label: #ffffff;
  --ios-label-secondary: rgba(235, 235, 245, 0.6);
  --ios-label-tertiary: rgba(235, 235, 245, 0.4);
  --ios-blue: #0a84ff;
  --ios-blue-pressed: #0066cc;
  --ios-green: #34c759;
  --ios-red: #ff453a;
  --ios-orange: #ff9f0a;
  --ios-gray-fill: #2c2c2e;
  --ios-gray-fill2: #3a3a3c;
  --ios-up: #30d158;
  --ios-down: #ff453a;
  --ios-radius-group: 13px;
  --ios-radius-btn: 12px;
  --ios-radius-chip: 8px;
  --ios-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  --ios-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --nav-bg: rgba(0, 0, 0, 0.88);
  --nav-blur: saturate(180%) blur(20px);
  --title-color: #ffffff;
  --emphasis-color: #ffffff;
  --segment-active-color: #ffffff;
  --chart-empty-bg: linear-gradient(180deg, #1c1c1e 0%, #000000 100%);
  --segment-bar-bg: rgba(28, 28, 30, 0.85);
  --table-head-bg: rgba(28, 28, 30, 0.98);
  --select-color-scheme: dark;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23aaa' d='M1.5 1.5L6 6l4.5-4.5'/%3E%3C/svg%3E");
  --option-color: #ffffff;
  --option-bg: #2c2c2e;
  --glider-bg: #3a3a3c;
  --glider-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  --accent-glow: rgba(10, 132, 255, 0.45);
  --body-bg-image: none;
  --group-backdrop: none;
  --group-border: none;
  --chart-grid: rgba(255, 255, 255, 0.07);
  --chart-axis: rgba(255, 255, 255, 0.14);
  --chart-tick: rgba(235, 235, 245, 0.55);
  --candle-up: #30d158;
  --candle-down: #ff453a;
  --candle-neutral: #8e8e93;
}

html[data-theme="glass"] {
  color-scheme: light;
  --ios-bg: transparent;
  --ios-group: rgba(255, 255, 255, 0.52);
  --ios-separator: rgba(255, 255, 255, 0.4);
  --ios-label: #1a1a2e;
  --ios-label-secondary: rgba(26, 26, 46, 0.7);
  --ios-label-tertiary: rgba(26, 26, 46, 0.48);
  --ios-gray-fill: rgba(255, 255, 255, 0.38);
  --ios-gray-fill2: rgba(255, 255, 255, 0.52);
  --ios-shadow: 0 8px 32px rgba(31, 38, 135, 0.18);
  --ios-blue: #5b6cf0;
  --ios-blue-pressed: #4a5bd9;
  --ios-radius-group: 18px;
  --ios-radius-btn: 14px;
  --ios-radius-chip: 10px;
  --ios-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --nav-bg: rgba(255, 255, 255, 0.42);
  --nav-blur: saturate(200%) blur(24px);
  --title-color: #1a1a2e;
  --emphasis-color: #1a1a2e;
  --segment-active-color: #1a1a2e;
  --chart-empty-bg: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.18) 100%);
  --segment-bar-bg: rgba(255, 255, 255, 0.28);
  --table-head-bg: rgba(255, 255, 255, 0.38);
  --select-color-scheme: light;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6cf0' d='M1.5 1.5L6 6l4.5-4.5'/%3E%3C/svg%3E");
  --option-color: #1a1a2e;
  --option-bg: #ffffff;
  --accent-glow: rgba(91, 108, 240, 0.45);
  --body-bg-image: linear-gradient(135deg, #667eea 0%, #764ba2 45%, #f093fb 100%);
  --group-backdrop: blur(18px) saturate(180%);
  --group-border: 0.5px solid rgba(255, 255, 255, 0.5);
  --glider-bg: rgba(255, 255, 255, 0.78);
  --glider-shadow: 0 2px 14px rgba(91, 108, 240, 0.25);
  --chart-grid: rgba(91, 108, 240, 0.12);
  --chart-axis: rgba(26, 26, 46, 0.15);
  --chart-tick: rgba(26, 26, 46, 0.55);
  --candle-up: #34c759;
  --candle-down: #ff3b30;
  --candle-neutral: #8e8e93;
}

html[data-theme="glass"] .ios-group,
html[data-theme="glass"] .status-pill,
html[data-theme="glass"] .theme-toggle-btn,
html[data-theme="glass"] .search-results {
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
}

html[data-theme="terminal"] {
  --ios-bg: #0d1117;
  --ios-group: #161b22;
  --ios-separator: rgba(48, 54, 61, 0.8);
  --ios-label: #c9d1d9;
  --ios-label-secondary: rgba(201, 209, 217, 0.65);
  --ios-label-tertiary: rgba(201, 209, 217, 0.4);
  --ios-gray-fill: #21262d;
  --ios-gray-fill2: #30363d;
  --ios-shadow: 0 0 0 1px rgba(48, 54, 61, 0.8);
  --ios-blue: #3fb950;
  --ios-blue-pressed: #2ea043;
  --ios-green: #3fb950;
  --ios-red: #f85149;
  --ios-up: #3fb950;
  --ios-down: #f85149;
  --ios-radius-group: 6px;
  --ios-radius-btn: 6px;
  --ios-radius-chip: 4px;
  --ios-font: "SF Mono", ui-monospace, Menlo, Consolas, "PingFang SC", monospace;
  --nav-bg: rgba(13, 17, 23, 0.95);
  --title-color: #3fb950;
  --emphasis-color: #c9d1d9;
  --segment-active-color: #3fb950;
  --chart-empty-bg: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
  --segment-bar-bg: rgba(22, 27, 34, 0.9);
  --table-head-bg: rgba(22, 27, 34, 0.98);
  --select-color-scheme: dark;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%233fb950' d='M1.5 1.5L6 6l4.5-4.5'/%3E%3C/svg%3E");
  --option-color: #c9d1d9;
  --option-bg: #21262d;
  --glider-bg: #21262d;
  --glider-shadow: 0 0 8px rgba(63, 185, 80, 0.25);
  --accent-glow: rgba(63, 185, 80, 0.35);
  --chart-grid: rgba(63, 185, 80, 0.08);
  --chart-axis: rgba(63, 185, 80, 0.2);
  --chart-tick: rgba(201, 209, 217, 0.55);
  --candle-up: #3fb950;
  --candle-down: #f85149;
  --candle-neutral: #8b949e;
}

html[data-theme="minimal"] {
  --ios-bg: #ffffff;
  --ios-group: #ffffff;
  --ios-separator: rgba(0, 0, 0, 0.08);
  --ios-label: #111111;
  --ios-label-secondary: rgba(0, 0, 0, 0.55);
  --ios-label-tertiary: rgba(0, 0, 0, 0.35);
  --ios-gray-fill: #f5f5f5;
  --ios-gray-fill2: #e0e0e0;
  --ios-shadow: none;
  --ios-blue: #111111;
  --ios-blue-pressed: #333333;
  --ios-radius-group: 4px;
  --ios-radius-btn: 4px;
  --ios-radius-chip: 4px;
  --nav-bg: rgba(255, 255, 255, 0.95);
  --title-color: #111111;
  --emphasis-color: #111111;
  --segment-active-color: #111111;
  --segment-on-glider-color: #ffffff;
  --chart-empty-bg: #fafafa;
  --segment-bar-bg: #fafafa;
  --table-head-bg: #fafafa;
  --accent-glow: rgba(0, 0, 0, 0.12);
  --group-border: 1px solid rgba(0, 0, 0, 0.08);
  --glider-bg: #111111;
  --glider-shadow: none;
  --chart-grid: rgba(0, 0, 0, 0.05);
  --chart-axis: rgba(0, 0, 0, 0.1);
  --chart-tick: rgba(0, 0, 0, 0.45);
  --candle-up: #111111;
  --candle-down: #999999;
  --candle-neutral: #cccccc;
}

html[data-theme="minimal"] .source-btn.active { color: var(--segment-on-glider-color); }
html[data-theme="minimal"] .segment-chip input:checked + span { background: #111; color: #fff; }

html[data-theme="aurora"] {
  --ios-bg: #0f0a1a;
  --ios-group: rgba(30, 20, 50, 0.75);
  --ios-separator: rgba(168, 85, 247, 0.2);
  --ios-label: #f0e6ff;
  --ios-label-secondary: rgba(240, 230, 255, 0.65);
  --ios-label-tertiary: rgba(240, 230, 255, 0.4);
  --ios-gray-fill: rgba(168, 85, 247, 0.15);
  --ios-gray-fill2: rgba(168, 85, 247, 0.25);
  --ios-shadow: 0 4px 24px rgba(168, 85, 247, 0.15);
  --ios-blue: #a855f7;
  --ios-blue-pressed: #9333ea;
  --ios-green: #22d3ee;
  --ios-red: #f472b6;
  --ios-up: #22d3ee;
  --ios-down: #f472b6;
  --ios-radius-group: 16px;
  --nav-bg: rgba(15, 10, 26, 0.85);
  --title-color: #f0e6ff;
  --emphasis-color: #f0e6ff;
  --segment-active-color: #f0e6ff;
  --chart-empty-bg: linear-gradient(180deg, rgba(30,20,50,0.8) 0%, rgba(15,10,26,0.9) 100%);
  --segment-bar-bg: rgba(168, 85, 247, 0.08);
  --table-head-bg: rgba(30, 20, 50, 0.9);
  --select-color-scheme: dark;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a855f7' d='M1.5 1.5L6 6l4.5-4.5'/%3E%3C/svg%3E");
  --option-color: #f0e6ff;
  --option-bg: #1e1432;
  --accent-glow: rgba(168, 85, 247, 0.45);
  --body-bg-image: radial-gradient(ellipse at 20% 0%, rgba(168,85,247,0.35) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(34,211,238,0.2) 0%, transparent 50%),
    linear-gradient(180deg, #0f0a1a 0%, #1a0f2e 100%);
  --group-backdrop: blur(12px);
  --group-border: 0.5px solid rgba(168, 85, 247, 0.25);
  --glider-bg: rgba(168, 85, 247, 0.35);
  --glider-shadow: 0 0 16px rgba(168, 85, 247, 0.3);
  --chart-grid: rgba(168, 85, 247, 0.08);
  --chart-axis: rgba(168, 85, 247, 0.2);
  --chart-tick: rgba(240, 230, 255, 0.5);
  --candle-up: #22d3ee;
  --candle-down: #f472b6;
  --candle-neutral: #a78bfa;
}

/* ── AI 解读 / 日报 ── */
.ai-sheet-overlay {
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ai-sheet-overlay.hidden {
  display: none;
}

.ai-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.ai-sheet {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  margin-bottom: env(safe-area-inset-bottom, 0);
}

.ai-sheet-overlay .ios-sheet {
  transform: translateY(100%) scale(1);
  opacity: 1;
  overflow: hidden;
  contain: layout style paint;
}

.ai-sheet-overlay.is-open .ios-sheet {
  transform: translateY(0) scale(1);
}

.ai-loading .activity-indicator {
  transform-origin: 50% 50%;
  contain: strict;
}

.ai-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ai-question-row {
  display: none;
}

.ai-token-ticker {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ios-blue);
  letter-spacing: 0.02em;
}

.ai-token-ticker span {
  display: inline-block;
  min-width: 5ch;
  text-align: right;
}

.ai-token-ticker span.is-tick {
  animation: token-pop 0.22s ease;
}

@keyframes token-pop {
  0% { transform: scale(1); opacity: 0.72; }
  45% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  color: var(--ios-label-secondary);
}

.ai-loading.hidden {
  display: none;
}

.ai-output-wrap {
  flex: 1;
  overflow: auto;
  min-height: 120px;
  max-height: 50vh;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  padding: 14px 16px;
}

.ai-output {
  font-size: 14px;
  line-height: 1.55;
  color: var(--emphasis-color);
}

.ai-output h2,
.ai-output h3,
.ai-output h4 {
  margin: 12px 0 6px;
  font-size: 15px;
}

.ai-output ul {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.ai-error {
  color: var(--ios-down);
}

.ai-disclaimer {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ios-label-tertiary);
}

.ai-usage {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-blue);
}

.ai-output-wrap.hidden {
  display: none;
}

.rank-ai-btn-recommend {
  color: #34c759;
  border-color: rgba(52, 199, 89, 0.35);
  background: rgba(52, 199, 89, 0.08);
}

.rank-ai-btn {
  border: none;
  background: rgba(88, 86, 214, 0.12);
  color: var(--ios-blue);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.rank-ai-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── K 线 AI HUD / B·T 标记 ── */
.ai-trade-marks-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 420;
  overflow: hidden;
}

.ai-trade-marks-layer.hidden {
  display: none;
}

.ai-trade-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1.5px dashed;
  opacity: 0.85;
}

.ai-trade-line-buy { border-color: #34C759; }
.ai-trade-line-sell { border-color: #FF3B30; }
.ai-trade-line-stop { border-color: #FF9500; }
.ai-trade-line-support { border-color: #007AFF; }
.ai-trade-line-resistance { border-color: #AF52DE; }
.ai-trade-line-chip { border-color: #AC8E68; }
.ai-trade-line-trend { border-color: #64D2FF; }

.ai-trade-badge {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  z-index: 2;
}

.ai-trade-badge:not(.ai-trade-badge-point):not(.ai-trade-badge-bar) {
  transform: translate(0, -50%);
}

.ai-trade-badge-bar {
  transform: translate(-50%, -50%);
}

.ai-trade-badge-pin-right {
  transform: translate(-100%, -50%);
}

.ai-trade-note-right {
  transform: translate(-100%, 0);
  text-align: right;
}

.ai-trade-badge-point {
  width: 26px;
  height: 26px;
  font-size: 13px;
  box-shadow: 0 0 0 2px var(--ios-group), 0 2px 10px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

.ai-trade-badge-buy { background: #34C759; }
.ai-trade-badge-sell { background: #FF3B30; }
.ai-trade-badge-stop { background: #FF9500; }
.ai-trade-badge-buy_zone { background: #30D158; }
.ai-trade-badge-sell_zone { background: #FF6961; }
.ai-trade-badge-support { background: #007AFF; }
.ai-trade-badge-resistance { background: #AF52DE; }
.ai-trade-badge-golden { background: #FFD60A; color: #1c1c1e; }
.ai-trade-badge-pattern { background: #5856D6; }
.ai-trade-badge-ma_cross { background: #32ADE6; }
.ai-trade-badge-volume { background: #FF6482; }
.ai-trade-badge-chip { background: #AC8E68; }
.ai-trade-badge-trend { background: #64D2FF; color: #1c1c1e; }

.ai-trade-note {
  position: absolute;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--ios-group);
  border: 0.5px solid var(--ios-separator);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-trade-note-buy { color: #34C759; }
.ai-trade-note-sell { color: #FF3B30; }
.ai-trade-note-stop { color: #FF9500; }
.ai-trade-note-support { color: #007AFF; }
.ai-trade-note-resistance { color: #AF52DE; }
.ai-trade-note-golden { color: #B8860B; }
.ai-trade-note-pattern { color: #5856D6; }
.ai-trade-note-ma_cross { color: #32ADE6; }
.ai-trade-note-volume { color: #FF6482; }
.ai-trade-note-chip { color: #AC8E68; }
.ai-trade-note-trend { color: #0096C7; }

.ai-mark-legend {
  position: absolute;
  bottom: 8px;
  right: 8px;
  left: auto;
  z-index: 425;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: min(340px, calc(100% - 16px));
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--ios-group);
  border: 0.5px solid var(--ios-separator);
  box-shadow: var(--ios-shadow);
  pointer-events: auto;
}

.ai-mark-legend.hidden {
  display: none;
}

.ai-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--ios-label-secondary);
  white-space: nowrap;
  border: none;
  background: transparent;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: default;
}

.ai-legend-item.is-off {
  opacity: 0.5;
}

.ai-legend-item.is-off span {
  color: var(--ios-label-tertiary);
  text-decoration: line-through;
}

.ai-legend-item i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.ai-legend-item.is-off i {
  background: #8e8e93 !important;
  color: #fff !important;
  filter: grayscale(0.35);
}

.ai-legend-item i:hover {
  filter: brightness(1.08);
}

.ai-trade-zone {
  position: absolute;
  box-sizing: border-box;
  border-radius: 8px;
  pointer-events: none;
  overflow: hidden;
}

.ai-trade-zone-label {
  position: absolute;
  left: 6px;
  top: 4px;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.9;
  max-width: calc(100% - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-trade-zone-buy_zone {
  background: rgba(48, 209, 88, 0.12);
  border: 1px dashed rgba(48, 209, 88, 0.55);
}
.ai-trade-zone-buy_zone .ai-trade-zone-label { color: #30d158; }

.ai-trade-zone-sell_zone {
  background: rgba(255, 105, 97, 0.12);
  border: 1px dashed rgba(255, 105, 97, 0.55);
}
.ai-trade-zone-sell_zone .ai-trade-zone-label { color: #ff6961; }

.ai-trade-zone-support {
  background: rgba(0, 122, 255, 0.14);
  border: 1px solid rgba(0, 122, 255, 0.35);
}

.ai-trade-zone-support .ai-trade-zone-label { color: #007aff; }

.ai-trade-zone-resistance {
  background: rgba(175, 82, 222, 0.12);
  border: 1px solid rgba(175, 82, 222, 0.35);
}

.ai-trade-zone-resistance .ai-trade-zone-label { color: #af52de; }

.ai-trade-zone-chip {
  background: rgba(172, 142, 104, 0.16);
  border: 1px solid rgba(172, 142, 104, 0.4);
}

.ai-trade-zone-chip .ai-trade-zone-label { color: #ac8e68; }

.ai-trade-zone-trend {
  background: rgba(100, 210, 255, 0.12);
  border: 1px solid rgba(100, 210, 255, 0.35);
}

.ai-trade-zone-trend .ai-trade-zone-label { color: #0096c7; }

.ai-trade-zone-predict {
  background: linear-gradient(90deg, rgba(48, 209, 88, 0.06) 0%, rgba(48, 209, 88, 0.18) 100%);
  border: 1px dashed rgba(48, 209, 88, 0.45);
}

.ai-trade-zone-predict .ai-trade-zone-label { color: #30d158; }

.ai-legend-buy i { background: #34C759; }
.ai-legend-sell i { background: #FF3B30; }
.ai-legend-stop i { background: #FF9500; }
.ai-legend-support i { background: #007AFF; }
.ai-legend-resistance i { background: #AF52DE; }
.ai-legend-golden i { background: #FFD60A; color: #1c1c1e; }
.ai-legend-pattern i { background: #5856D6; }
.ai-legend-ma_cross i { background: #32ADE6; }
.ai-legend-volume i { background: #FF6482; }
.ai-legend-chip i { background: #AC8E68; }
.ai-legend-trend i { background: #64D2FF; color: #1c1c1e; }
.ai-legend-predict i { background: #30D158; }

.chart-ai-hud-mini {
  border: none;
  background: rgba(255, 59, 48, 0.12);
  color: var(--ios-red);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.chart-ai-hud {
  position: absolute;
  top: 6px;
  right: 6px;
  left: auto;
  width: min(280px, calc(100% - 12px));
  max-width: 280px;
  z-index: 430;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  background: var(--ios-group);
  color: var(--ios-label);
  box-shadow: var(--ios-shadow);
  border: 0.5px solid var(--ios-separator);
  overflow: hidden;
  pointer-events: auto;
}

.chart-ai-hud.hidden {
  display: none;
}

.chart-ai-hud.is-loading .chart-ai-hud-body {
  opacity: 0.92;
}

.chart-ai-hud.is-loading .chart-ai-hud-body .ai-hud-status::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 8px;
  border: 2px solid var(--ios-gray-fill);
  border-top-color: var(--ios-label-tertiary);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
  transform-origin: 50% 50%;
}

.chart-ai-hud-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--ios-separator);
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-label);
  cursor: pointer;
  user-select: none;
}

.chart-ai-hud-head #chartAiHudTitle {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-ai-hud-token {
  font-size: 10px;
  font-weight: 600;
  color: var(--ios-blue);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-ai-hud-token.hidden {
  display: none;
}

.chart-ai-hud-toggle,
.chart-ai-hud-close {
  border: none;
  background: transparent;
  font-size: 12px;
  line-height: 1;
  color: var(--ios-label-secondary);
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}

.chart-ai-hud-close {
  font-size: 16px;
}

.chart-ai-hud-body {
  overflow: auto;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ios-label);
  max-height: 120px;
  transition: max-height 0.2s ease, padding 0.2s ease, opacity 0.2s ease;
}

.chart-ai-hud.collapsed .chart-ai-hud-body,
.chart-ai-hud.collapsed .chart-ai-hud-disc {
  display: none;
}

.chart-ai-hud-body h2,
.chart-ai-hud-body h3,
.chart-ai-hud-body h4 {
  margin: 6px 0 3px;
  font-size: 12px;
  color: var(--ios-label);
}

.chart-ai-hud-body strong {
  color: var(--ios-label);
}

.chart-ai-hud-disc {
  margin: 0;
  padding: 4px 10px 8px;
  font-size: 10px;
  color: var(--ios-label-tertiary);
  border-top: 0.5px solid var(--ios-separator);
}

.chart-ai-hud-disc.hidden {
  display: none;
}

.ai-hud-status {
  color: var(--ios-label-secondary);
  font-size: 11px;
}

.rank-ai-hud {
  margin: 0 0 8px;
  border-radius: 10px;
  background: var(--ios-group);
  color: var(--ios-label);
  border: 0.5px solid var(--ios-separator);
  overflow: hidden;
  box-shadow: var(--ios-shadow);
}

.rank-ai-hud.hidden {
  display: none;
}

.rank-ai-hud-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-label);
  border-bottom: 0.5px solid var(--ios-separator);
  cursor: pointer;
}

.rank-ai-hud-head #rankAiHudTitle {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-ai-hud-token {
  font-size: 10px;
  font-weight: 600;
  color: var(--ios-blue);
  white-space: nowrap;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-ai-hud-token.hidden {
  display: none;
}

.rank-ai-hud-toggle,
.rank-ai-hud-close {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--ios-label-secondary);
  cursor: pointer;
  padding: 2px 4px;
}

.rank-ai-hud-close {
  font-size: 16px;
}

.rank-ai-hud-body {
  max-height: 120px;
  overflow: auto;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ios-label);
  transition: max-height 0.2s ease;
}

.rank-ai-hud.collapsed .rank-ai-hud-body,
.rank-ai-hud.collapsed .rank-ai-hud-disc {
  display: none;
}

.rank-ai-hud-disc {
  margin: 0;
  padding: 4px 10px 8px;
  font-size: 10px;
  color: var(--ios-label-tertiary);
}

.rank-ai-hud-disc.hidden {
  display: none;
}

.rank-ai-hud-actions {
  display: flex;
  gap: 8px;
  padding: 6px 10px 10px;
  border-top: 1px solid var(--ios-separator);
}

.rank-ai-hud-actions.hidden {
  display: none;
}

.rank-ai-hud-act {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
  border-radius: 8px;
  border: none;
  background: var(--ios-gray-fill);
  color: var(--ios-label);
  cursor: pointer;
}

.rank-ai-hud-act:hover {
  background: var(--ios-gray-fill-strong, rgba(120, 120, 128, 0.24));
}

.rank-pick-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
}

.rank-pick-buy { background: rgba(52, 199, 89, 0.18); color: #34c759; }
.rank-pick-sell { background: rgba(255, 59, 48, 0.16); color: #ff3b30; }
.rank-pick-hold { background: rgba(255, 149, 0, 0.16); color: #ff9500; }
.rank-pick-wait { background: rgba(142, 142, 147, 0.16); color: var(--ios-label-secondary); }

.rank-pick-res {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 9px;
  background: rgba(175, 82, 222, 0.15);
  color: #af52de;
}

.rank-pick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(52, 199, 89, 0.12), rgba(52, 199, 89, 0.04));
  border: 1px solid rgba(52, 199, 89, 0.28);
}

.rank-pick-bar.hidden {
  display: none;
}

.rank-pick-bar-label {
  font-size: 11px;
  font-weight: 700;
  color: #248a3d;
  white-space: nowrap;
}

.rank-pick-bar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.rank-pick-chip {
  border: 1px solid rgba(52, 199, 89, 0.35);
  background: rgba(255, 255, 255, 0.75);
  color: #248a3d;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.rank-pick-chip.is-buy {
  background: rgba(52, 199, 89, 0.18);
}

.rank-pick-chip-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: #34c759;
  vertical-align: middle;
}

.rank-pick-chip-name {
  vertical-align: middle;
}

.rank-pick-chip-meta {
  margin-left: 4px;
  font-size: 10px;
  font-weight: 500;
  color: rgba(36, 138, 61, 0.85);
  vertical-align: middle;
}

.rank-pick-chip-off {
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  color: #ff9500;
  background: rgba(255, 149, 0, 0.15);
  vertical-align: middle;
}

.rank-pick-chip[data-off-board="1"] {
  border-style: dashed;
  opacity: 0.88;
}

.rank-pick-chip:hover {
  background: rgba(52, 199, 89, 0.28);
}

.rank-pick-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: #34c759;
  vertical-align: middle;
}

.rank-pick-src {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 700;
  vertical-align: middle;
}

.rank-pick-src-rec {
  background: rgba(52, 199, 89, 0.2);
  color: #248a3d;
}

.rank-pick-src-daily {
  background: rgba(0, 122, 255, 0.15);
  color: #007aff;
}

.rank-row-pick {
  position: relative;
}

.rank-row-pick-buy {
  background: rgba(52, 199, 89, 0.1);
  box-shadow: inset 3px 0 0 #34c759;
}

.rank-row-pick-recommend.rank-row-pick-buy {
  background: rgba(52, 199, 89, 0.14);
  box-shadow: inset 4px 0 0 #30d158;
}

.rank-row-pick-flash {
  animation: rank-pick-flash 1.2s ease;
}

@keyframes rank-pick-flash {
  0% { background: rgba(52, 199, 89, 0.35); }
  100% { background: rgba(52, 199, 89, 0.1); }
}

.rank-num-pick {
  color: #34c759;
  font-weight: 800;
  font-size: 13px;
}

.rank-pick-divider td {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  color: var(--ios-label-tertiary);
  background: rgba(52, 199, 89, 0.06);
  border-top: 1px dashed rgba(52, 199, 89, 0.25);
  border-bottom: 1px dashed rgba(52, 199, 89, 0.25);
}

.rank-row-pick .rank-name {
  font-weight: 600;
}

.rank-row-pick-buy .rank-name {
  color: #248a3d;
}

.rank-row-pick .rank-sym {
  display: inline-block;
  margin-right: 4px;
  color: #248a3d;
  font-weight: 600;
}

/* ── 模型广场 ── */
.ai-model-sheet {
  max-height: min(88vh, 820px);
  max-width: min(960px, 96vw);
  width: min(960px, 96vw);
  display: flex;
  flex-direction: column;
  text-align: left;
}

.ai-model-sheet .sheet-title,
.ai-model-sheet .sheet-sub {
  text-align: left;
}

.ai-model-sheet-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  max-height: calc(min(88vh, 820px) - 140px);
}

.ai-model-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-model-col-left {
  border-right: 1px solid var(--ios-separator);
  padding-right: 12px;
  min-width: 0;
}

.ai-model-col-right {
  padding-left: 2px;
  overflow-y: auto;
  min-width: 0;
}

.ai-model-mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  padding: 3px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
}

.ai-model-mode-tab {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  background: transparent;
  cursor: pointer;
}

.ai-model-mode-tab.active {
  color: var(--ios-label);
  background: var(--ios-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.ai-tuning-panel.hidden {
  display: none;
}

.team-dual-model-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 10px;
}

.ai-team-model-note {
  margin: 0;
  font-size: 11px;
  color: var(--ios-label-secondary);
  line-height: 1.4;
}

.ai-team-agents-title {
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-label-secondary);
}

.ai-team-agents {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-team-agent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--ios-gray-fill);
  cursor: pointer;
}

.ai-team-agent-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ai-team-agent-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
}

.ai-team-agent-icon {
  position: relative;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(120, 120, 128, 0.1);
  color: var(--ios-label-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-team-agent-icon::before,
.ai-team-agent-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
}

/* 技术 — 折线趋势 */
.ai-team-icon-technical::before {
  left: 7px;
  bottom: 8px;
  width: 3px;
  height: 3px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
}

.ai-team-icon-technical::after {
  left: 8px;
  bottom: 8px;
  width: 12px;
  height: 10px;
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: skewY(-28deg);
  transform-origin: bottom left;
}

/* 基本面 — 柱状图 */
.ai-team-icon-fundamentals::before {
  left: 8px;
  bottom: 7px;
  width: 2px;
  height: 5px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 4px 3px 0 0 currentColor, 8px -2px 0 0 currentColor;
}

/* 情绪/新闻 — 文档 */
.ai-team-icon-sentiment::before {
  left: 8px;
  top: 7px;
  width: 12px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.ai-team-icon-sentiment::after {
  left: 10px;
  top: 10px;
  width: 8px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 3px 0 currentColor, 0 6px 0 currentColor;
}

/* 多头 — 向上箭头 */
.ai-team-icon-bull::before {
  left: 50%;
  top: 12px;
  width: 1.5px;
  height: 8px;
  background: currentColor;
  border-radius: 1px;
  transform: translateX(-50%);
}

.ai-team-icon-bull::after {
  left: 50%;
  top: 7px;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
}

/* 空头 — 向下箭头 */
.ai-team-icon-bear::before {
  left: 50%;
  top: 7px;
  width: 1.5px;
  height: 8px;
  background: currentColor;
  border-radius: 1px;
  transform: translateX(-50%);
}

.ai-team-icon-bear::after {
  left: 50%;
  top: 13px;
  width: 7px;
  height: 7px;
  border-bottom: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
}

/* 交易员 — 公文包 */
.ai-team-icon-trader::before {
  left: 8px;
  bottom: 7px;
  width: 12px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.ai-team-icon-trader::after {
  left: 11px;
  top: 7px;
  width: 6px;
  height: 3px;
  border: 1.5px solid currentColor;
  border-bottom: none;
  border-radius: 2px 2px 0 0;
}

/* 风控 — 盾牌 */
.ai-team-icon-risk::before {
  left: 8px;
  top: 7px;
  width: 12px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-radius: 2px 2px 50% 50%;
}

.ai-team-agent-tier {
  font-size: 10px;
  color: var(--ios-label-secondary);
}

.ai-tuning-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ios-label);
}

.ai-tuning-source {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--ios-label-secondary);
  line-height: 1.4;
}

.ai-tuning-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.ai-tuning-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  cursor: pointer;
}

.ai-tuning-row.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ai-tuning-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ai-tuning-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
}

.ai-tuning-row-desc {
  font-size: 11px;
  line-height: 1.35;
  color: var(--ios-label-secondary);
}

.ai-tuning-check {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--ios-blue);
  cursor: pointer;
}

.ai-tuning-row.is-disabled .ai-tuning-check {
  pointer-events: none;
}

.ai-skill-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-skill-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--ios-separator);
  background: var(--ios-secondary-bg, rgba(255, 255, 255, 0.04));
  cursor: pointer;
}

.ai-skill-item input {
  margin-top: 2px;
  accent-color: var(--ios-blue);
}

.ai-skill-item strong {
  display: inline;
  font-size: 12px;
  font-weight: 600;
}

.ai-skill-title-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 2px;
  flex-wrap: nowrap;
}

.ai-skill-title-row strong {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
}

.ai-skill-help-wrap {
  position: relative;
  flex: 0 0 auto;
  margin-top: 1px;
}

.ai-skill-help {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--ios-separator);
  border-radius: 50%;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-skill-help:hover {
  color: var(--ios-blue);
  border-color: var(--ios-blue);
}

.ai-skill-help-pop {
  position: fixed;
  z-index: 10100;
  width: min(300px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--ios-separator);
  background: var(--ios-bg, #fff);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  text-align: left;
}

.ai-skill-help-pop[hidden] {
  display: none !important;
}

.ai-skill-help-pop-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ios-label);
  margin-bottom: 8px;
}

.ai-skill-hint-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-skill-hint-row {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ios-separator);
}

.ai-skill-hint-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.ai-skill-hint-scenario {
  display: block;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ios-label);
  margin-bottom: 3px;
}

.ai-skill-hint-verdict {
  display: block;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ios-label-secondary);
}

.ai-skill-hint-row.is-yes .ai-skill-hint-verdict::before {
  content: "✅ ";
}

.ai-skill-hint-row.is-no .ai-skill-hint-verdict::before {
  content: "❌ ";
}

.ai-skill-meta-wrap {
  display: block;
  margin: 2px 0 4px;
}

.ai-skill-meta {
  font-size: 11px;
  color: var(--ios-blue);
  text-decoration: none;
  font-weight: 600;
}

.ai-skill-meta:hover {
  text-decoration: underline;
}

.ai-skill-item span {
  display: block;
  font-size: 11px;
  color: var(--ios-label-secondary);
  line-height: 1.35;
}

@media (max-width: 720px) {
  .ai-model-sheet {
    max-width: 100%;
    width: 100%;
    border-radius: 14px 14px 0 0;
  }

  .ai-model-sheet-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
    max-height: calc(min(88vh, 820px) - 120px);
  }

  .ai-model-col-left {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--ios-separator);
    padding-bottom: 12px;
    max-height: none;
  }

  .ai-model-col-right {
    overflow: visible;
  }

  .ai-model-list {
    max-height: 36vh;
  }
}

.ai-strength-block {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
}

.ai-strength-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ai-strength-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
}

.ai-strength-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-blue);
  font-variant-numeric: tabular-nums;
}

.ai-strength-slider {
  width: 100%;
  height: 4px;
  margin: 0;
  accent-color: var(--ios-blue);
  cursor: pointer;
}

.ai-strength-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--ios-label-secondary);
}

.ai-strength-ends span:nth-child(2) {
  color: var(--ios-orange);
}

.ai-strength-ends span:nth-child(3) {
  color: var(--ios-red);
  font-weight: 700;
}

.ai-provider-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ai-provider-tab {
  border: 1px solid var(--ios-separator);
  background: var(--ios-gray-fill);
  color: var(--ios-label);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 16px;
  cursor: pointer;
}

.ai-provider-tab.active {
  background: rgba(0, 122, 255, 0.12);
  border-color: var(--ios-blue);
  color: var(--ios-blue);
}

.ai-model-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
  max-height: 46vh;
}

.ai-model-card {
  text-align: left;
  border: 1px solid var(--ios-separator);
  background: var(--ios-gray-fill);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ios-label);
}

.ai-model-card.active {
  border-color: var(--ios-blue);
  background: rgba(0, 122, 255, 0.08);
}

.ai-model-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ai-model-card-head strong {
  color: var(--ios-label);
  font-size: 14px;
}

.ai-model-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--ios-blue);
  vertical-align: middle;
}

.ai-model-badge-free {
  background: #34a853;
}

.ai-model-card-free {
  border-color: rgba(52, 168, 83, 0.35);
}

.ai-model-card-free.active {
  box-shadow: 0 0 0 2px rgba(52, 168, 83, 0.25);
}

.free-captcha-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.free-captcha-modal.hidden {
  display: none;
}

.free-captcha-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.free-captcha-sheet {
  position: relative;
  width: min(360px, calc(100vw - 32px));
  padding: 18px 18px 16px;
  border-radius: 16px;
  background: var(--ios-bg-elevated, #fff);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.free-captcha-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.free-captcha-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--ios-label-secondary, #666);
  line-height: 1.45;
}

.free-captcha-puzzle {
  position: relative;
  margin: 0 auto 12px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--ios-separator, #e8eaed);
  background: #eef1f5;
}

.free-captcha-bg {
  position: relative;
  z-index: 1;
}

.free-captcha-piece {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.free-captcha-piece-inner {
  position: absolute;
  left: 0;
  top: 0;
}

.free-captcha-track-wrap {
  margin-bottom: 10px;
}

.free-captcha-track {
  position: relative;
  height: 40px;
  margin: 0 auto;
  border-radius: 20px;
  background: #f1f3f4;
  border: 1px solid #e0e0e0;
}

.free-captcha-slider {
  position: absolute;
  top: 2px;
  left: 0;
  width: 40px;
  height: 34px;
  border-radius: 17px;
  background: #4285f4;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.35);
}

.free-captcha-slider:active {
  cursor: grabbing;
}

.free-captcha-status {
  min-height: 18px;
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--ios-label-secondary, #666);
}

.free-captcha-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.ai-model-provider {
  font-size: 11px;
  color: var(--ios-label-secondary);
}

.ai-model-price {
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-blue);
}

.ai-model-note {
  font-size: 11px;
  color: var(--ios-label-tertiary);
}

.ai-model-empty {
  text-align: center;
  padding: 24px;
  color: var(--ios-label-secondary);
  font-size: 13px;
}

.ai-model-foot {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ios-label-secondary);
}

.ai-fable-warn-overlay {
  z-index: 1300;
  align-items: center;
}

.ai-fable-warn-backdrop {
  position: absolute;
  inset: 0;
}

.ai-fable-warn-sheet {
  position: relative;
  z-index: 1;
  width: min(320px, calc(100% - 32px));
  padding: 18px 16px 14px;
}

.ai-fable-warn-text {
  margin: 10px 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ios-label);
}

.ai-fable-warn-actions {
  display: flex;
  gap: 10px;
}

.ai-fable-warn-actions .ios-btn {
  flex: 1;
}

.ai-fable-warn-ok {
  background: #ff3b30 !important;
  border-color: #ff3b30 !important;
}

.ai-model-card-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.ai-history-sheet {
  max-height: min(85vh, 720px);
}

.ai-history-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.ai-history-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52vh;
}

.ai-history-item {
  text-align: left;
  border: 1px solid var(--ios-separator);
  background: var(--ios-gray-fill);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--ios-label);
}

.ai-history-item-title {
  font-size: 13px;
  font-weight: 600;
}

.ai-history-item-sub {
  font-size: 11px;
  color: var(--ios-label-secondary);
}

.ai-history-item-time {
  font-size: 10px;
  color: var(--ios-label-tertiary);
}

.ai-history-empty {
  text-align: center;
  padding: 28px;
  color: var(--ios-label-secondary);
  font-size: 13px;
}

/* ── 盲测回测页 ── */
.backtest-page .backtest-main-wrap {
  max-width: 1180px;
  padding: 0 16px 40px;
}

.backtest-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  margin: 12px 0 16px;
  border-radius: var(--ios-radius-group);
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.08) 0%, rgba(52, 199, 89, 0.06) 100%);
  animation: bt-fade-up 0.55s var(--ease-out-expo) backwards;
}

.backtest-hero-title {
  font-size: 17px;
  font-weight: 650;
  color: var(--title-color, var(--ios-label));
  letter-spacing: -0.02em;
}

.backtest-hero-desc {
  font-size: 13px;
  color: var(--ios-label-secondary);
  margin-top: 4px;
  max-width: 420px;
  line-height: 1.45;
}

.backtest-steps {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.backtest-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ios-label-secondary);
  padding: 6px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--ios-separator);
  transition: transform 0.25s var(--ease-out-expo), background 0.25s, color 0.25s, box-shadow 0.25s;
  animation: bt-fade-up 0.5s var(--ease-out-expo) backwards;
}

.backtest-step:nth-child(1) { animation-delay: 0.06s; }
.backtest-step:nth-child(2) { animation-delay: 0.12s; }
.backtest-step:nth-child(3) { animation-delay: 0.18s; }

.backtest-step.is-active {
  color: var(--ios-blue);
  background: rgba(0, 122, 255, 0.12);
  border-color: rgba(0, 122, 255, 0.25);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.08);
  transform: scale(1.02);
}

.backtest-step.is-done {
  color: var(--ios-green);
  border-color: rgba(52, 199, 89, 0.3);
}

.backtest-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--ios-gray-fill);
  color: var(--ios-label);
}

.backtest-step.is-active .backtest-step-num {
  background: var(--ios-blue);
  color: #fff;
}

.backtest-step.is-done .backtest-step-num {
  background: var(--ios-green);
  color: #fff;
}

.backtest-tab-segment {
  position: relative;
  display: flex;
  margin: 0 0 16px;
  padding: 4px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  animation: bt-fade-up 0.5s var(--ease-out-expo) 0.1s backwards;
  max-width: min(100%, 400px);
}

.backtest-tab {
  flex: 1;
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ios-label-secondary);
  transition: color 0.25s var(--ease-ios);
  white-space: nowrap;
  min-width: 0;
}

.backtest-tab.active {
  color: var(--segment-on-glider-color, var(--segment-active-color, var(--ios-label)));
}

.backtest-tab-glider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc((100% - 8px) / 2);
  height: calc(100% - 8px);
  border-radius: 9px;
  background: var(--glider-bg, var(--ios-group));
  box-shadow: var(--glider-shadow, var(--ios-shadow));
  transition: left 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
  will-change: left;
}

.backtest-tab-segment[data-active-index="1"] > .backtest-tab-glider {
  left: calc(4px + (100% - 8px) / 2);
}

.backtest-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 14px;
  align-items: start;
}

.backtest-card {
  padding: 16px;
  margin-bottom: 14px;
  animation: bt-fade-up 0.55s var(--ease-out-expo) backwards;
}

.backtest-card-fetch { animation-delay: 0.12s; }
.backtest-card-model { animation-delay: 0.15s; }
.backtest-card-judge { animation-delay: 0.18s; }
.backtest-chart-card { animation-delay: 0.14s; }
.backtest-result-card { animation-delay: 0.2s; }

.backtest-card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ios-label-secondary);
  margin-bottom: 12px;
}

.backtest-model-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  font-size: 12px;
  color: var(--ios-label);
  line-height: 1.35;
}

.backtest-model-pill[data-state="empty"] .backtest-model-name {
  color: var(--ios-label-secondary);
}

.backtest-model-icon {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--ios-blue);
  opacity: 0.85;
}

.backtest-model-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backtest-model-btn {
  width: 100%;
}

.backtest-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.backtest-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ios-label-secondary);
}

.backtest-field-full { margin-top: 10px; margin-bottom: 12px; }

.backtest-fetch-btn,
.backtest-run-btn {
  width: 100%;
  margin-top: 4px;
  transition: transform 0.2s var(--ease-spring), opacity 0.2s;
}

.backtest-fetch-btn:active,
.backtest-run-btn:active { transform: scale(0.98); }

.backtest-fetch-btn.is-loading .bt-fetch-label { opacity: 0.6; }

.backtest-judge-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  margin-bottom: 12px;
  transition: background 0.3s, box-shadow 0.3s, transform 0.3s var(--ease-out-expo);
}

.backtest-judge-pill[data-state="selected"] {
  background: rgba(0, 122, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.22);
  animation: bt-pulse-once 0.6s var(--ease-out-expo);
}

.backtest-judge-icon {
  font-size: 18px;
  color: var(--ios-label-tertiary);
  transition: color 0.25s;
}

.backtest-judge-pill[data-state="selected"] .backtest-judge-icon {
  color: var(--ios-blue);
}

.backtest-judge-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--ios-label);
}

.backtest-market-hint {
  font-size: 11px;
  line-height: 1.45;
  color: var(--ios-label-tertiary);
  margin: -4px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 122, 255, 0.06);
  border: 1px solid rgba(0, 122, 255, 0.1);
}

.backtest-market-hint[data-settlement="T+7"] {
  background: rgba(88, 86, 214, 0.08);
  border-color: rgba(88, 86, 214, 0.15);
}

.backtest-eval-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-green);
  margin-left: 4px;
}

.backtest-sim-note {
  font-size: 11px;
  color: var(--ios-label-tertiary);
  margin-top: 10px;
  line-height: 1.4;
}

.backtest-chart-frame.is-picking-segment {
  box-shadow: 0 0 0 2px rgba(88, 86, 214, 0.45), 0 8px 32px rgba(88, 86, 214, 0.12);
}

.backtest-tab-segment-sub {
  margin: 0 0 14px;
  max-width: min(100%, 320px);
}

.backtest-tab-segment-lb {
  margin: 0 0 16px;
  max-width: min(100%, 480px);
}

.backtest-tab-segment-lb .backtest-tab {
  font-size: 13px;
  padding: 10px 10px;
}

.backtest-lb-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ios-label-secondary);
  flex-shrink: 0;
  min-width: 128px;
}

.backtest-lb-filter select.ios-select {
  min-width: 128px;
}

.backtest-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.backtest-index-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--ios-label-secondary);
  flex: 1;
}

.backtest-index-field input { width: 100%; }

#backtestPickBtn.active {
  background: rgba(0, 122, 255, 0.15);
  color: var(--ios-blue);
  box-shadow: inset 0 0 0 1.5px rgba(0, 122, 255, 0.35);
  animation: bt-pick-pulse 1.2s ease-in-out infinite;
}

.backtest-pick-hint {
  font-size: 12px;
  color: var(--ios-orange);
  margin-bottom: 10px;
  animation: bt-fade-up 0.3s var(--ease-out-expo);
}

.backtest-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
}

.backtest-bar-count {
  font-size: 12px;
  color: var(--ios-label-tertiary);
  font-variant-numeric: tabular-nums;
}

.backtest-chart-frame {
  position: relative;
  min-height: 380px;
  height: min(52vh, 460px);
  margin: 8px 12px 12px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--chart-empty-bg);
  transition: box-shadow 0.35s var(--ease-out-expo), transform 0.35s var(--ease-out-expo);
}

.backtest-chart-frame .chart-container {
  height: 100%;
  opacity: 0;
  transform: scale(0.99);
  transition: opacity 0.45s var(--ease-out-expo), transform 0.45s var(--ease-out-expo);
}

.backtest-chart-frame.is-ready .chart-container {
  opacity: 1;
  transform: scale(1);
}

.backtest-chart-frame.is-picking {
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.45), 0 8px 32px rgba(0, 122, 255, 0.12);
}

.backtest-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.35s;
}

.backtest-chart-frame.is-ready .backtest-chart-empty {
  opacity: 0;
  pointer-events: none;
}

.backtest-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.15), rgba(52, 199, 89, 0.12));
  margin-bottom: 4px;
  animation: bt-float 3s ease-in-out infinite;
}

.backtest-chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  z-index: 5;
  font-size: 13px;
  color: var(--ios-label-secondary);
}

html[data-theme="dark"] .backtest-chart-loading,
html[data-theme="terminal"] .backtest-chart-loading,
html[data-theme="aurora"] .backtest-chart-loading {
  background: rgba(0, 0, 0, 0.55);
}

.backtest-result-card { padding: 16px; min-height: 120px; }

.backtest-result-placeholder {
  font-size: 13px;
  color: var(--ios-label-tertiary);
  text-align: center;
  padding: 24px 12px;
}

.backtest-result { font-size: 13px; }

.backtest-result.has-result {
  animation: bt-fade-up 0.5s var(--ease-out-expo);
}

.backtest-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  color: var(--ios-label-secondary);
}

.backtest-loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid var(--ios-gray-fill2);
  border-top-color: var(--ios-blue);
  border-radius: 50%;
  animation: bt-spin 0.7s linear infinite;
}

.backtest-score-card {
  text-align: center;
  padding: 20px 16px;
  border-radius: 14px;
  margin-bottom: 14px;
  background: linear-gradient(160deg, rgba(0, 122, 255, 0.08) 0%, var(--ios-gray-fill) 100%);
  animation: bt-score-in 0.65s var(--ease-out-expo);
}

.backtest-score-main {
  font-size: 42px;
  font-weight: 750;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--ios-blue), #5856d6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}

.backtest-score-meta,
.backtest-score-pred {
  font-size: 12px;
  color: var(--ios-label-secondary);
  margin-top: 6px;
}

.backtest-score-badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.backtest-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.backtest-badge.ok { background: rgba(52, 199, 89, 0.15); color: var(--ios-green); }
.backtest-badge.fail { background: rgba(255, 59, 48, 0.12); color: var(--ios-red); }

.backtest-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.backtest-col {
  padding: 14px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  animation: bt-fade-up 0.5s var(--ease-out-expo) backwards;
}

.backtest-col:nth-child(2) { animation-delay: 0.08s; }

.backtest-col h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ios-label);
}

.backtest-md,
.backtest-path {
  font-size: 12px;
  line-height: 1.55;
  max-height: 280px;
  overflow: auto;
  color: var(--ios-label-secondary);
}

.backtest-path-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--ios-separator);
}

.backtest-path-item:last-child { border-bottom: none; }

/* ── 真实模拟结果：迷你 K 线 + 逐根标签 ── */
.sim-result { display: flex; flex-direction: column; gap: 12px; }

.sim-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ios-label-secondary);
  padding: 4px 2px 0;
}

.sim-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ios-blue);
  animation: sim-pulse 1.2s ease-in-out infinite;
}

.sim-result.sim-done .sim-progress-dot {
  animation: none;
  background: var(--ios-green);
}

@keyframes sim-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.sim-mini-chart-wrap {
  padding: 10px 8px 6px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  overflow-x: auto;
}

.sim-candles {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  min-height: 78px;
  padding-top: 18px;
}

.sim-candle {
  position: relative;
  flex: 1 1 0;
  min-width: 10px;
  max-width: 22px;
  height: 68px;
}

.sim-candle.active .sim-body { box-shadow: 0 0 0 2px var(--ios-blue); }
.sim-candle.has-tag .sim-body { opacity: 1; }

.sim-wick,
.sim-body {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 1px;
}

.sim-wick {
  width: 1px;
  background: var(--ios-label-tertiary);
}

.sim-body {
  width: 6px;
  border-radius: 1px;
}

.sim-candle.up .sim-body { background: var(--ios-green); }
.sim-candle.down .sim-body { background: var(--ios-red); }
.sim-candle.up .sim-wick { background: var(--ios-green); }
.sim-candle.down .sim-wick { background: var(--ios-red); }

.sim-candle-tag {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  font-weight: 600;
  pointer-events: none;
}

.sim-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.sim-round-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--ios-gray-fill);
  font-size: 11px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s var(--ease-out-expo), transform 0.35s var(--ease-out-expo);
}

.sim-round-item.sim-round-visible {
  opacity: 1;
  transform: translateY(0);
}

.sim-round-idx {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ios-gray-fill2);
  color: var(--ios-label-secondary);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sim-tag {
  font-size: 10px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.2;
}

.sim-tag-watch { background: rgba(142, 142, 147, 0.18); color: var(--ios-label-secondary); }
.sim-tag-buy { background: rgba(255, 59, 48, 0.12); color: var(--ios-red); }
.sim-tag-sell { background: rgba(52, 199, 89, 0.15); color: var(--ios-green); }
.sim-tag-adjust { background: rgba(0, 122, 255, 0.12); color: var(--ios-blue); }

.sim-round-price {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--ios-label-tertiary);
  font-size: 10px;
}

.sim-round-note {
  font-size: 10px;
  color: var(--ios-label-tertiary);
}

.sim-score-card {
  margin-bottom: 0;
  animation: bt-score-in 0.65s var(--ease-out-expo);
}

.sim-final.hidden { display: none; }

.backtest-lb-card { padding: 18px; animation: bt-fade-up 0.5s var(--ease-out-expo); }

.backtest-lb-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.backtest-lb-sub {
  font-size: 12px;
  color: var(--ios-label-tertiary);
  margin-top: 2px;
}

.backtest-top-markets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.backtest-top-chip {
  font-size: 12px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.1), rgba(88, 86, 214, 0.08));
  border: 1px solid var(--ios-separator);
  border-radius: 10px;
  animation: bt-fade-up 0.4s var(--ease-out-expo) backwards;
}

.backtest-lb-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

.backtest-lb-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ios-label-tertiary);
  padding: 10px 12px;
  border-bottom: 1px solid var(--ios-separator);
  text-align: left;
}

.backtest-lb-table td {
  padding: 12px;
  border-bottom: 1px solid var(--ios-separator);
}

.backtest-lb-table tbody tr {
  transition: background 0.15s;
  animation: bt-fade-up 0.4s var(--ease-out-expo) backwards;
}

.backtest-lb-table tbody tr:hover { background: rgba(0, 122, 255, 0.04); }

.backtest-lb-table tbody tr:nth-child(1) { animation-delay: 0.04s; }
.backtest-lb-table tbody tr:nth-child(2) { animation-delay: 0.08s; }
.backtest-lb-table tbody tr:nth-child(3) { animation-delay: 0.12s; }

.backtest-panel {
  transition: opacity 0.3s var(--ease-ios), transform 0.35s var(--ease-out-expo);
}

.backtest-panel.hidden {
  display: none;
}

.backtest-panel.is-leaving {
  opacity: 0;
  transform: translateY(8px);
}

.backtest-panel.is-entering {
  animation: bt-fade-up 0.45s var(--ease-out-expo);
}

.backtest-error { color: var(--ios-red); padding: 16px; text-align: center; }
.backtest-empty { color: var(--ios-label-tertiary); padding: 32px; text-align: center; }

@keyframes bt-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bt-pulse-once {
  0% { transform: scale(1); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes bt-pick-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1.5px rgba(0, 122, 255, 0.35); }
  50% { box-shadow: inset 0 0 0 2px rgba(0, 122, 255, 0.6), 0 0 12px rgba(0, 122, 255, 0.15); }
}

@keyframes bt-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

@keyframes bt-score-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  .backtest-grid { grid-template-columns: 1fr; }
  .backtest-hero { flex-direction: column; align-items: flex-start; }
  .backtest-steps { flex-wrap: wrap; }
  .backtest-chart-frame { min-height: 320px; height: 340px; }
  .backtest-compare { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .backtest-field-grid { grid-template-columns: 1fr; }
  .backtest-score-main { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .backtest-step,
  .backtest-card,
  .backtest-hero,
  .backtest-tab-glider,
  .backtest-chart-frame .chart-container,
  .backtest-score-card,
  .backtest-col,
  .backtest-top-chip,
  .backtest-lb-table tbody tr {
    animation: none !important;
    transition: none !important;
  }
  #backtestPickBtn.active { animation: none; }
  .backtest-empty-icon { animation: none; }
}

/* ── 提醒 / 助手（保留） ── */
.backtest-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chart-container > .alert-zone-layer {
  display: none !important;
}

.alert-zone-layer {
  display: none !important;
}

/* 止盈止损 — 锚定 K 线右侧半透明红绿面（参考开源库样式） */
.alert-tpsl-panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.alert-zone-layer.is-dragging {
  cursor: ns-resize;
}

.alert-rr-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.alert-drag-handle {
  pointer-events: auto;
  cursor: ns-resize;
  touch-action: none;
}

.alert-style-wrap.is-open {
  overflow: visible;
}

.alert-style-wrap.is-open .alert-panel-inner,
.chart-panel.is-fullscreen .alert-style-wrap.is-open .alert-panel-inner,
.chart-panel:fullscreen .alert-style-wrap.is-open .alert-panel-inner {
  overflow: visible;
  max-height: none;
  padding: 0 10px 6px;
}

.alert-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-context-compact {
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
}

.alert-type-segment-compact {
  margin: 0;
}

.alert-monitor-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--ios-gray-fill);
  font-size: 11px;
  font-weight: 600;
}

.alert-monitor-inline {
  flex: 1;
  min-width: 0;
}

.alert-monitor-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-monitor-bars {
  width: 52px;
  text-align: center;
  padding: 4px 6px !important;
  font-size: 12px !important;
}

.alert-monitor-hint {
  font-size: 10px;
  color: var(--ios-label-secondary);
  white-space: nowrap;
}

.alert-interval-field {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--ios-gray-fill);
}

.alert-interval-field.is-24h,
.alert-interval-field:not(.is-24h) {
  display: flex;
}

.alert-interval-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.alert-interval-copy > span:first-child {
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-label);
  flex-shrink: 0;
}

.alert-interval-hint {
  display: block;
  flex: 1;
  min-width: 0;
  font-size: 10px;
  line-height: 1.35;
  color: var(--ios-label-secondary);
  text-align: right;
}

.alert-interval-select {
  flex-shrink: 0;
  width: auto;
  min-width: 56px;
  max-width: 38%;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 22px 4px 8px !important;
}

.alert-interval-fixed {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  white-space: nowrap;
}

.alert-interval-field.is-fixed .alert-interval-hint {
  text-align: right;
}

.alert-footer-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 0;
}

.alert-footer-row .alert-monitor-inline {
  flex: 1;
  min-width: 0;
}

.alert-footer-row .alert-create-btn {
  flex: 0 0 auto;
  min-width: 64px;
  align-self: stretch;
}

.alert-actions {
  display: flex;
  gap: 6px;
  margin: 0;
}

.alert-create-btn {
  flex: 1;
  min-height: 32px;
  padding: 6px 10px !important;
  font-size: 13px !important;
}

.alert-fields {
  margin: 0;
}

.alert-status.expired {
  background: rgba(142, 142, 147, 0.18);
  color: var(--ios-label-secondary);
}

.alert-tpsl-profit {
  flex: none;
  width: 100%;
  background: var(--ios-up-mid);
}

.alert-tpsl-loss {
  flex: none;
  width: 100%;
  background: var(--ios-down-mid);
}

.alert-tpsl-panel-target {
  background: var(--ios-up-mid);
  box-shadow: 0 0 0 1px var(--ios-up-border);
}

/* 止盈止损 — TradingView Long Position 风格 */
.alert-rr-line {
  position: absolute;
  height: 10px;
  margin-top: -5px;
  pointer-events: none;
  z-index: 3;
}

.alert-rr-line::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
  pointer-events: none;
}

.alert-rr-line-tp::after {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.alert-rr-line-sl::after {
  background: rgba(255, 255, 255, 0.55);
}

.alert-rr-line-entry {
  height: 0;
  margin-top: 0;
}

.alert-rr-line-entry::after {
  height: 0;
  border-top: 1px dashed rgba(180, 180, 185, 0.85);
  background: none;
  box-shadow: none;
}

.alert-rr-line.alert-drag-handle {
  pointer-events: auto;
  z-index: 8;
}

.alert-rr-price {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  z-index: 5;
  min-width: 52px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-align: center;
  border-radius: 2px;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.alert-rr-price-tp {
  background: var(--ios-up-solid, #34c759);
  color: #fff;
}

.alert-rr-price-sl {
  background: var(--ios-down, #ff3b30);
  color: #fff;
}

.alert-rr-price-entry {
  background: rgba(120, 120, 128, 0.92);
  color: #fff;
}

.alert-rr-entry-mark {
  position: absolute;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 6px 0 6px 9px;
  border-color: transparent transparent transparent rgba(180, 180, 185, 0.95);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
  z-index: 4;
  pointer-events: none;
}

.alert-rr-col {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  z-index: 2;
  pointer-events: none;
}

.alert-rr-profit {
  position: relative;
  background: var(--ios-up-mid);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.alert-rr-loss {
  background: var(--ios-down-mid);
}

.alert-rr-ratio {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  white-space: nowrap;
  line-height: 1.2;
  pointer-events: none;
}

.alert-zone { position: absolute; left: 0; right: 0; opacity: 0.22; }
.alert-zone-profit { background: linear-gradient(180deg, var(--ios-up-soft2), transparent); }
.alert-zone-loss { background: linear-gradient(180deg, transparent, var(--ios-down-soft2)); }

/* ── 价格提醒弹层 ── */
.alert-sheet {
  text-align: left;
  padding: 0;
  max-width: 440px;
  width: 100%;
  border-radius: 20px 20px 0 0;
  background: var(--ios-group-bg);
  overflow: hidden;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
}

.alert-sheet-handle {
  width: 36px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: var(--ios-gray-fill2);
}

.alert-sheet-head {
  padding: 12px 18px 8px;
}

.alert-sheet-body {
  padding: 4px 18px calc(20px + env(safe-area-inset-bottom, 0));
  overflow-y: auto;
  max-height: min(72vh, 620px);
}

.alert-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  margin: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.08) 0%, var(--ios-gray-fill) 100%);
  border: 1px solid rgba(0, 122, 255, 0.12);
}

.alert-context-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.alert-context-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--ios-blue);
  background: rgba(0, 122, 255, 0.12);
}

.alert-context-name {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--ios-label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-context-meta {
  margin: 0;
  font-size: 10px;
  color: var(--ios-label-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-context-price-wrap {
  flex-shrink: 0;
  text-align: right;
}

.alert-context-price-label {
  display: block;
  font-size: 9px;
  color: var(--ios-label-tertiary);
  margin-bottom: 0;
}

.alert-context-price {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ios-blue);
}

.alert-section-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ios-label-secondary);
}

.alert-type-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.alert-type-segment {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 2px;
  margin: 0;
  border-radius: 8px;
  background: var(--ios-gray-fill);
}

.alert-type-btn {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  padding: 5px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.25s var(--ease-out-expo);
}

.alert-type-btn.active {
  color: var(--ios-label);
}

.alert-type-glider {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc((100% - 4px) / 3);
  border-radius: 6px;
  background: var(--ios-group-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.32s var(--ease-out-expo);
  pointer-events: none;
}

.alert-type-segment[data-active="1"] .alert-type-glider { transform: translateX(100%); }
.alert-type-segment[data-active="2"] .alert-type-glider { transform: translateX(200%); }

.alert-tpsl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.alert-price-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.alert-price-tp {
  background: var(--ios-up-soft);
  border-color: var(--ios-up-border);
}

.alert-price-sl {
  background: var(--ios-down-soft);
  border-color: var(--ios-down-border);
}

.alert-price-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.alert-price-tp .alert-price-label { color: var(--ios-up); }
.alert-price-sl .alert-price-label { color: var(--ios-down); }

.alert-price-input {
  width: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ios-label);
}

html[data-theme="dark"] .alert-price-input,
html[data-theme="terminal"] .alert-price-input,
html[data-theme="aurora"] .alert-price-input {
  background: rgba(0, 0, 0, 0.22);
}

.alert-price-input:focus {
  outline: 2px solid rgba(0, 122, 255, 0.35);
  outline-offset: 1px;
}

.alert-field-hint {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ios-label-tertiary);
}

.alert-single-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-label-secondary);
}

.alert-single-field .ios-input {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px !important;
}

.alert-actions .ios-btn-gray {
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.alert-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-list-count {
  font-size: 11px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
}

.alert-section-label {
  margin: 12px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ios-label-tertiary);
}

.alert-section-label:first-child {
  margin-top: 4px;
}

.alert-empty {
  margin: 0;
  padding: 20px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--ios-label-tertiary);
}

.alert-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  border: 1px solid transparent;
  font-size: 12px;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}

.alert-item.selected {
  border-color: rgba(0, 122, 255, 0.45);
  background: rgba(0, 122, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(0, 122, 255, 0.08);
}

.alert-item-main {
  cursor: pointer;
}

.alert-item-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.alert-item-btn:hover {
  background: rgba(0, 122, 255, 0.06);
}

.alert-item-btn.selected {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.alert-item-btn:focus-visible {
  outline: 2px solid rgba(0, 122, 255, 0.45);
  outline-offset: 2px;
}

.alert-item.selected .alert-item-view-hint {
  color: var(--ios-label-secondary);
}

.alert-item-view-hint {
  font-size: 10px;
  font-weight: 600;
  color: var(--ios-blue);
}

.alert-item-foot-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.alert-item.triggered {
  opacity: 0.72;
  border-color: rgba(255, 149, 0, 0.35);
  background: rgba(255, 149, 0, 0.06);
}

.alert-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 650;
  color: var(--ios-label);
}

.alert-item-type {
  font-size: 10px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.12);
  color: var(--ios-blue);
}

.alert-item-meta {
  font-size: 11px;
  line-height: 1.45;
  color: var(--ios-label-secondary);
  font-variant-numeric: tabular-nums;
}

.alert-item-prices {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.alert-item-price {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.alert-item-price.tp { background: var(--ios-up-soft2); color: var(--ios-up); }
.alert-item-price.sl { background: var(--ios-down-soft2); color: var(--ios-down); }
.alert-item-price.target { background: var(--ios-up-soft2); color: var(--ios-up); }
.alert-item-price.base { background: var(--ios-gray-fill); color: var(--ios-label-secondary); }
.alert-item-price.amp { background: rgba(175, 82, 222, 0.15); color: #AF52DE; }

.alert-price-amp {
  background: rgba(175, 82, 222, 0.1);
  border-color: rgba(175, 82, 222, 0.28);
}

.alert-price-amp .alert-price-label { color: #AF52DE; }

.alert-fields-price .alert-price-card {
  background: var(--ios-up-soft);
  border-color: var(--ios-up-border);
}

.alert-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.alert-status {
  font-size: 10px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
}

.alert-status.active { background: rgba(52, 199, 89, 0.15); color: var(--ios-green); }
.alert-status.triggered { background: rgba(255, 149, 0, 0.15); color: var(--ios-orange); }

.alert-del-btn {
  border: none;
  background: transparent;
  color: var(--ios-red);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  flex-shrink: 0;
}
  border-radius: 8px;
}

.alert-del-btn:hover {
  background: rgba(255, 59, 48, 0.08);
}

.alert-error {
  color: var(--ios-red);
  font-size: 12px;
  text-align: center;
  padding: 12px;
}

.alert-settings-btn {
  border: none;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.alert-settings-btn:active { opacity: 0.7; }

.alert-item-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.alert-item-notify-btn {
  border: none;
  background: transparent;
  color: var(--ios-label-tertiary);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.alert-item-notify-btn:hover {
  background: rgba(0, 122, 255, 0.08);
  color: var(--ios-blue);
}

.alert-item-notify-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--ios-blue);
}

.alert-item-notify-tag.empty {
  background: var(--ios-gray-fill2);
  color: var(--ios-label-tertiary);
}

.alert-card-notify-menu {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 10;
  padding: 14px;
  border-radius: 14px;
  background: var(--ios-group);
  border: 0.5px solid var(--ios-separator);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.alert-card-notify-menu.hidden { display: none; }

.alert-card-notify-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ios-label);
}

.alert-card-notify-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-card-notify-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid var(--ios-separator);
  border-radius: 10px;
  background: var(--ios-gray-fill);
  font-family: var(--ios-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
  cursor: pointer;
  text-align: left;
}

.alert-card-notify-opt.active {
  border-color: rgba(0, 122, 255, 0.45);
  background: rgba(0, 122, 255, 0.08);
  color: var(--ios-blue);
}

.alert-card-notify-opt.disabled-dev {
  opacity: 0.55;
  cursor: not-allowed;
}

.alert-card-notify-opt-hint {
  font-size: 10px;
  font-weight: 600;
  color: var(--ios-label-tertiary);
}

.alert-card-notify-cancel {
  width: 100%;
  margin-top: 10px;
  border: none;
  background: transparent;
  color: var(--ios-label-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
}

#alertNotifySettingsSheet {
  z-index: 10200;
}

.alert-notify-settings-sheet {
  max-width: 420px;
  text-align: left;
}

.alert-notify-channel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px 8px;
  max-height: min(60vh, 480px);
  overflow-y: auto;
}

.alert-notify-channel-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
  border: 0.5px solid transparent;
}

.alert-notify-channel-card.available {
  cursor: pointer;
}

.alert-notify-channel-card.dev-only {
  opacity: 0.72;
  cursor: pointer;
}

.alert-notify-channel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.alert-notify-channel-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  color: var(--ios-label);
}

.alert-notify-channel-icon { font-size: 18px; line-height: 1; }

.alert-notify-channel-badge {
  font-size: 10px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.15);
  color: var(--ios-green);
}

.alert-notify-channel-badge.dev {
  background: var(--ios-gray-fill2);
  color: var(--ios-label-tertiary);
}

.alert-notify-channel-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-notify-channel-form.hidden { display: none; }

.alert-notify-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ios-label-secondary);
}

.alert-notify-field-row input[type="text"],
.alert-notify-field-row input[type="email"] {
  flex: 1;
  min-width: 0;
}

.alert-notify-settings-actions {
  padding-top: 12px;
}

.alert-notify-settings-actions .ios-btn { width: 100%; }

.alert-limit-hint {
  font-size: 11px;
  color: var(--ios-orange);
  margin: 0 0 8px;
  padding: 0 2px;
}

/* ── 可楽助手精灵 ── */
.assistant-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000;
  touch-action: none;
}

.assistant-widget.is-positioned {
  right: auto;
  bottom: auto;
}

.assistant-sprite-btn {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  cursor: grab;
  line-height: 0;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.assistant-widget.is-dragging .assistant-sprite-btn {
  cursor: grabbing;
}

.assistant-sprite {
  display: block;
  height: 132px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  object-position: bottom right;
  background: transparent;
  border-radius: 0;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.24));
  animation: assistant-float 3.2s ease-in-out infinite;
  transition: transform 0.35s var(--ease-out-expo), filter 0.35s var(--ease-out-expo);
  pointer-events: none;
}

.assistant-widget.is-dragging .assistant-sprite {
  animation: none;
  filter: drop-shadow(0 14px 28px rgba(0, 122, 255, 0.22));
}

.assistant-sprite-btn:hover .assistant-sprite {
  transform: translateY(-4px) scale(1.04);
  filter: drop-shadow(0 12px 24px rgba(0, 122, 255, 0.28));
}

.assistant-sprite-btn:active .assistant-sprite {
  transform: translateY(-1px) scale(0.97);
  transition-duration: 0.12s;
}

@keyframes assistant-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.assistant-chat {
  position: fixed;
  z-index: 9010;
  width: min(340px, calc(100vw - 32px));
  max-height: min(480px, calc(100vh - 24px));
  background: var(--ios-group-bg);
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.16),
    0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition:
    opacity 0.38s var(--ease-out-expo),
    transform 0.42s var(--ease-out-expo);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.assistant-chat[data-placement="below"] {
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
}

html[data-theme="dark"] .assistant-chat,
html[data-theme="terminal"] .assistant-chat,
html[data-theme="aurora"] .assistant-chat {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.assistant-chat.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.assistant-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.1) 0%, rgba(88, 86, 214, 0.06) 100%);
  border-bottom: 1px solid var(--ios-separator);
}

.assistant-head-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.assistant-head-avatar {
  height: 40px;
  width: auto;
  max-width: 52px;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  background: transparent;
  border-radius: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
}

.assistant-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.assistant-head-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--ios-label);
  line-height: 1.2;
}

.assistant-head-status {
  font-size: 11px;
  color: var(--ios-label-secondary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assistant-close-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.assistant-close-btn:hover {
  background: var(--ios-gray-fill2);
  color: var(--ios-label);
}

.assistant-close-btn:active {
  transform: scale(0.92);
}

.assistant-messages {
  max-height: min(320px, calc(100vh - 220px));
  overflow: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.assistant-msg {
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  max-width: 88%;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.35s var(--ease-out-expo),
    transform 0.35s var(--ease-out-expo);
}

.assistant-msg-visible {
  opacity: 1;
  transform: translateY(0);
}

.assistant-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--ios-blue), #5856d6);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.22);
}

.assistant-msg-bot {
  align-self: flex-start;
  background: var(--ios-gray-fill);
  color: var(--ios-label);
  border-bottom-left-radius: 4px;
}

.assistant-typing {
  padding: 12px 14px;
  min-width: 52px;
}

.assistant-typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 10px;
}

.assistant-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ios-label-tertiary);
  animation: assistant-dot-bounce 1.2s ease-in-out infinite;
}

.assistant-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.assistant-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes assistant-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.assistant-input-wrap {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--ios-separator);
  background: var(--ios-group-bg);
}

.assistant-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.assistant-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--ios-separator);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  background: var(--ios-gray-fill);
  color: var(--ios-label);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.assistant-input:focus {
  outline: none;
  border-color: rgba(0, 122, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.assistant-send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ios-blue), #5856d6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 3px 10px rgba(0, 122, 255, 0.28);
}

.assistant-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0, 122, 255, 0.35);
}

.assistant-send-btn:active {
  transform: scale(0.94);
}

.assistant-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.assistant-input-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.assistant-char-count {
  font-size: 10px;
  color: var(--ios-label-tertiary);
  font-variant-numeric: tabular-nums;
}

.ai-custom-model-block { margin: 10px 0; font-size: 13px; position: relative; }
.ai-custom-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ai-custom-hint { font-size: 11px; color: var(--ios-label-tertiary); }
.ai-custom-model-block.is-disabled {
  opacity: 0.58;
  pointer-events: none;
  user-select: none;
}
.ai-custom-model-block.is-disabled summary {
  text-decoration: line-through;
  text-decoration-color: rgba(255, 59, 48, 0.72);
  color: var(--ios-label-tertiary);
  cursor: not-allowed;
}
.ai-model-health-row { margin: 10px 0; }
.ai-model-health-result { font-size: 12px; margin-top: 8px; max-height: 200px; overflow: auto; }
.health-ok { color: #34c759; }
.health-fail { color: #ff3b30; font-size: 11px; }

/* ── 站点导航 / 子页面 ── */
.site-nav {
  grid-column: 2;
  justify-self: start;
  display: flex;
  gap: 4px;
  padding: 0;
  flex-shrink: 0;
  background: transparent;
}
.site-nav-link {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ios-label-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.site-nav-link:hover { color: var(--ios-label); background: var(--ios-gray-fill); }
.site-nav-link.active {
  color: var(--ios-tint, #007aff);
  background: rgba(0, 122, 255, 0.08);
  box-shadow: inset 0 -2px 0 var(--ios-tint, #007aff);
  border-radius: 8px 8px 0 0;
}
.site-nav-mega {
  position: relative;
  z-index: 1;
}
.site-nav-mega.is-open {
  z-index: 101;
}
.site-nav-trigger {
  position: relative;
  border: 0.5px solid var(--ios-separator);
  background: var(--ios-group);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 10px;
  min-height: 36px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ios-label);
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    border-radius 0.2s ease,
    transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.site-nav-trigger:hover {
  color: var(--ios-tint, #007aff);
  border-color: color-mix(in srgb, var(--ios-tint, #007aff) 35%, var(--ios-separator));
  background: color-mix(in srgb, var(--ios-tint, #007aff) 8%, var(--ios-group));
  box-shadow:
    0 2px 8px color-mix(in srgb, var(--ios-tint, #007aff) 18%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.site-nav-mega:not(.is-open) .site-nav-trigger:hover {
  transform: translateY(-1px);
}
.site-nav-trigger:active {
  transform: translateY(0);
}
.site-nav-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--ios-tint, #007aff) 12%, var(--ios-gray-fill));
  color: var(--ios-tint, #007aff);
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}
.site-nav-trigger-label {
  line-height: 1;
  white-space: nowrap;
}
/* 当前页：轻量高亮，保持圆角 pill */
.site-nav-trigger.active {
  color: var(--ios-tint, #007aff);
  border-color: color-mix(in srgb, var(--ios-tint, #007aff) 30%, var(--ios-separator));
  background: color-mix(in srgb, var(--ios-tint, #007aff) 7%, var(--ios-group));
}
.site-nav-trigger.active .site-nav-trigger-icon {
  background: color-mix(in srgb, var(--ios-tint, #007aff) 18%, var(--ios-gray-fill));
}
/* 菜单展开：才使用「与面板衔接」的样式 */
.site-nav-mega.is-open .site-nav-trigger {
  color: var(--ios-tint, #007aff);
  border-color: color-mix(in srgb, var(--ios-tint, #007aff) 50%, var(--ios-separator));
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--ios-tint, #007aff) 14%, var(--ios-group)) 0%,
    color-mix(in srgb, var(--ios-tint, #007aff) 6%, var(--ios-group)) 100%
  );
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--ios-tint, #007aff) 12%, transparent),
    0 4px 14px color-mix(in srgb, var(--ios-tint, #007aff) 20%, transparent);
  border-radius: 10px 10px 0 0;
  transform: none;
}
.site-nav-mega.is-open .site-nav-trigger .site-nav-trigger-icon {
  background: color-mix(in srgb, var(--ios-tint, #007aff) 22%, var(--ios-group));
  transform: scale(1.04);
}
.site-nav-mega.is-open .site-nav-trigger:hover {
  transform: none;
}
.site-nav-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -2px;
  opacity: 0.55;
  color: currentColor;
  transition: transform 0.22s ease, opacity 0.2s ease;
}
.site-nav-trigger:hover .site-nav-chevron,
.site-nav-trigger.active .site-nav-chevron,
.site-nav-mega.is-open .site-nav-chevron {
  opacity: 0.9;
}
.site-nav-mega.is-open .site-nav-chevron {
  transform: rotate(180deg);
}
.site-nav-mega-panel {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--site-nav-panel-top, 56px);
  z-index: 101;
  padding: 0 16px 16px;
  display: none;
  pointer-events: none;
}
.site-nav-mega.is-open .site-nav-mega-panel {
  display: block;
  pointer-events: auto;
}
.site-nav-mega-panel-inner {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 0;
  background: var(--ios-bg, #f2f2f7);
  border: 0.5px solid var(--ios-separator);
  border-top: none;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="glass"] .site-nav-mega-panel-inner {
  background: rgba(255, 255, 255, 0.97);
}
html[data-theme="dark"] .site-nav-mega-panel-inner {
  background: #1c1c1e;
}
html[data-theme="terminal"] .site-nav-mega-panel-inner,
html[data-theme="aurora"] .site-nav-mega-panel-inner {
  background: var(--ios-group);
}
.site-nav-mega-main {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 20px 8px 24px 24px;
}
.site-nav-mega-col + .site-nav-mega-col {
  border-left: 0.5px solid var(--ios-separator);
  padding-left: 24px;
}
.site-nav-mega-heading {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
  letter-spacing: 0.02em;
}
.site-nav-mega-item {
  display: block;
  padding: 10px 12px;
  margin: 0 -4px 4px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.site-nav-mega-item:hover {
  background: var(--ios-gray-fill);
}
.site-nav-mega-item.active {
  background: rgba(0, 122, 255, 0.1);
}
.site-nav-mega-item-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ios-label);
  line-height: 1.35;
}
.site-nav-mega-item-desc {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ios-label-secondary);
  line-height: 1.45;
}
.site-nav-mega-item:hover .site-nav-mega-item-title,
.site-nav-mega-item.active .site-nav-mega-item-title {
  color: var(--ios-tint, #007aff);
}
.site-nav-mega-aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px;
  background: var(--ios-gray-fill);
  border-left: 0.5px solid var(--ios-separator);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="glass"] .site-nav-mega-aside {
  background: rgba(245, 245, 250, 0.96);
}
.site-nav-mega-card {
  display: block;
  padding: 14px;
  border-radius: 10px;
  background: var(--ios-group);
  border: 0.5px solid var(--ios-separator);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="glass"] .site-nav-mega-card {
  background: rgba(255, 255, 255, 0.92);
}
.site-nav-mega-card:hover {
  border-color: rgba(0, 122, 255, 0.35);
  box-shadow: var(--ios-shadow);
  transform: translateY(-1px);
}
.site-nav-mega-card-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
}
.site-nav-mega-card-desc {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ios-label-secondary);
}
.site-nav-mega-card-cta {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ios-tint, #007aff);
}
.nav-bar,
.flow-header {
  overflow: visible;
}
@media (max-width: 720px) {
  .site-nav-mega-panel-inner {
    grid-template-columns: 1fr;
  }
  .site-nav-mega-main {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .site-nav-mega-col + .site-nav-mega-col {
    border-left: none;
    border-top: 0.5px solid var(--ios-separator);
    padding-left: 0;
    padding-top: 16px;
    margin-top: 8px;
  }
  .site-nav-mega-aside {
    border-left: none;
    border-top: 0.5px solid var(--ios-separator);
    flex-direction: row;
    overflow-x: auto;
  }
  .site-nav-mega-card {
    min-width: 180px;
    flex-shrink: 0;
  }
}
.ios-btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}
body.sub-page .content > *,
body.sub-page-shell .content > *,
body.app-ready.sub-page .content > * {
  opacity: 1;
}
.sub-page-content { padding-bottom: 32px; }
.page-tabs { margin: 12px 16px 0; }
.compact-panel { margin-bottom: 12px; }
.compact-action-row { padding: 0 12px 12px; gap: 8px; flex-wrap: wrap; }
.sub-chart-panel { margin: 0 16px 12px; }
.sub-chart-frame {
  position: relative;
  min-height: 320px;
  height: min(48vh, 420px);
}
.sub-chart-frame .chart-container { height: 100%; }
.backtest-control-group { margin: 0 16px; padding: 12px; }
.alerts-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
}
@media (max-width: 900px) {
  .alerts-layout { grid-template-columns: 1fr; }
}
.alerts-list-panel { grid-column: 1 / -1; }
.alerts-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}
.ios-btn-sm { padding: 6px 12px; font-size: 12px; min-height: auto; }
.alerts-chart-panel .chart-frame { position: relative; min-height: 280px; height: 280px; }
.alerts-form-panel { padding: 12px; }

.search-item .sub {
  font-size: 12px;
  color: var(--ios-label-secondary);
  margin-top: 2px;
}

.search-section-label {
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ios-label-tertiary);
  background: var(--ios-gray-fill);
  border-bottom: 0.5px solid var(--ios-separator);
  position: sticky;
  top: 0;
  z-index: 1;
}

.search-item-panzhu .name::before {
  content: "👤 ";
  font-size: 12px;
}

.panzhu-panel-section { margin-bottom: 12px; }
.panzhu-inline-wrap { padding-bottom: 4px; }
.panzhu-inline-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 6px;
}
.panzhu-inline-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
  flex: 1 1 auto;
  min-width: 0;
}
.panzhu-refresh-btn {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 12px;
  font-size: 12px;
}
.panzhu-inline-hint {
  font-size: 11px;
  color: var(--ios-label-tertiary);
}
.panzhu-inline-list {
  max-height: 240px;
  overflow-y: auto;
}
.panzhu-inline-summary {
  margin: 0;
  padding: 0 16px 8px;
  font-size: 13px;
  color: var(--ios-label-secondary);
  line-height: 1.45;
}
.panzhu-inline-summary strong { color: var(--ios-blue); font-weight: 700; }
.panzhu-inline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 0.5px solid var(--ios-separator);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-ios);
}
.panzhu-steam-id { color: var(--ios-blue); font-size: 11px; word-break: break-all; }
.panzhu-inline-qty {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
  min-width: 48px;
  text-align: right;
}
.panzhu-inline-row:hover { background: var(--ios-gray-fill); }
.panzhu-inline-row:first-child { border-top: none; }
.panzhu-inline-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--ios-gray-fill);
  flex: 0 0 auto;
}
.panzhu-inline-meta { flex: 1 1 auto; min-width: 0; }
.panzhu-inline-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ios-label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panzhu-inline-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ios-label-secondary);
}
.panzhu-inline-empty {
  padding: 12px 16px 14px;
  font-size: 13px;
  color: var(--ios-label-secondary);
  text-align: center;
}
.panzhu-inline-loading {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ios-label-tertiary);
  text-align: center;
}

/* ── Auth / Billing ── */
.auth-user-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 0 14px;
  height: 34px;
  border-radius: 17px;
  background: var(--ios-blue);
  color: #fff;
  transition: opacity 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.auth-user-btn:hover { opacity: 0.88; }
.auth-user-btn.is-logged-in {
  background: var(--ios-gray-fill);
  color: var(--ios-label);
  border: 1px solid var(--ios-separator);
  padding: 0 10px 0 6px;
  max-width: min(220px, 42vw);
}
.auth-user-btn.is-logged-in.is-low-balance {
  border-color: rgba(255, 149, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 149, 0, 0.15);
}
.auth-user-btn-logged {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.auth-user-avatar {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ios-tint-fill, rgba(0, 122, 255, 0.14));
  color: var(--ios-blue);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.auth-user-btn.is-low-balance .auth-user-avatar {
  background: rgba(255, 149, 0, 0.18);
  color: #ff9500;
}
.auth-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.auth-user-balance {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ios-blue);
  padding-left: 2px;
}
.auth-user-btn.is-low-balance .auth-user-balance {
  color: #ff9500;
}
.auth-user-chevron {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--ios-label-tertiary);
  margin-left: -2px;
}

.auth-reg-code-cell {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding-right: 8px !important;
}
.auth-reg-code-cell .auth-field-input {
  flex: 1;
  min-width: 0;
}
.auth-reg-send-code {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ios-blue);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 4px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.auth-reg-send-code:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.auth-reg-captcha-wrap {
  margin-top: 12px;
  padding: 10px 0 4px;
}
.auth-reg-captcha-hint,
.auth-reg-captcha-status {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ios-label-secondary);
}
.auth-reg-captcha-status.is-error { color: #ff3b30; }
.auth-reg-captcha-puzzle {
  margin: 0 auto 10px;
}
.auth-reg-captcha-refresh {
  margin-top: 8px;
  width: 100%;
  font-size: 13px;
  padding: 8px 12px;
}
.billing-balance-main {
  flex: 1;
  min-width: 0;
}

.auth-sheet-overlay {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-sheet-overlay .ios-sheet-backdrop,
.auth-sheet-overlay .ai-sheet-backdrop {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: rgba(0, 0, 0, 0.38);
}

.auth-sheet-overlay .auth-sheet {
  margin-bottom: 0;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.auth-sheet.ios-sheet,
.auth-sheet.ai-sheet {
  max-width: min(380px, 92vw);
  width: 100%;
  max-height: min(90vh, 640px);
  padding: 0;
  text-align: left;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: none !important;
  opacity: 1 !important;
}

.auth-sheet-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--ios-separator);
  flex-shrink: 0;
}

.auth-sheet-head .sheet-title {
  margin: 0;
  text-align: left;
  writing-mode: horizontal-tb;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.auth-sheet-close {
  appearance: none;
  border: none;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-sheet-body {
  padding: 16px;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.auth-sheet .auth-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px 0;
}
.auth-tab {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--ios-gray-fill);
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  cursor: pointer;
}
.auth-tab.active {
  background: var(--ios-tint-fill, rgba(0, 122, 255, 0.12));
  color: var(--ios-blue);
}

.auth-pane.hidden {
  display: none;
}

.auth-field-group {
  margin: 0;
}

.auth-field-cell {
  padding: 0 16px;
}

.auth-field-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 11px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  color: var(--emphasis-color);
  box-shadow: none;
}

.auth-field-input:focus {
  outline: none;
  box-shadow: none;
}

.auth-field-input::placeholder {
  color: var(--ios-label-tertiary);
}

.auth-terms-block {
  margin: 14px 0 0;
  padding: 0;
  border: none;
  background: transparent;
}

.auth-terms-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ios-label-secondary);
  cursor: pointer;
}

.auth-terms-check input {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--ios-blue);
}

.auth-actions {
  padding: 16px 0 0;
}

.auth-submit {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
}

.auth-submit.hidden {
  display: none;
}
.auth-main-site-hint {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ios-label-secondary);
  text-align: center;
}
.auth-main-site-hint a {
  color: var(--ios-blue);
  text-decoration: none;
  font-weight: 600;
}
.auth-main-site-hint a:hover { text-decoration: underline; }
.auth-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 59, 48, 0.12);
  color: #ff3b30;
  font-size: 12px;
}
.auth-error.hidden {
  display: none;
}
.auth-terms-check.is-warn {
  outline: 1px solid #ff3b30;
  outline-offset: 4px;
  border-radius: 6px;
}
.auth-muted {
  padding: 16px;
  text-align: center;
  color: var(--ios-label-secondary);
  font-size: 13px;
}
.auth-terms-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label);
  list-style: none;
}
.auth-terms-details summary::-webkit-details-marker { display: none; }
.auth-terms-body {
  margin-top: 10px;
  max-height: min(36vh, 280px);
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ios-label-secondary);
}
.auth-terms-section {
  margin-bottom: 10px;
}
.auth-terms-section h4 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-label);
}
.auth-terms-section p { margin: 0; }
.auth-terms-footer {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ios-label-tertiary);
  text-align: right;
}
.alert-notify-smtp-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: #ff9500;
}
.billing-sheet {
  position: relative;
  max-height: min(86vh, 680px);
  max-width: min(440px, 92vw);
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.billing-sheet-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--ios-separator);
  flex-shrink: 0;
}
.billing-sheet-head .sheet-title {
  margin: 0;
  text-align: left;
  writing-mode: horizontal-tb;
  font-size: 17px;
  font-weight: 700;
}
.billing-sheet-close {
  appearance: none;
  border: none;
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.billing-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px 0;
  flex-shrink: 0;
}
.billing-tab {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--ios-gray-fill);
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.billing-tab.active {
  background: var(--ios-tint-fill, rgba(0, 122, 255, 0.12));
  color: var(--ios-blue);
}
.billing-sheet-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 8px;
}
.billing-pane.hidden { display: none; }

.billing-balance-card {
  position: relative;
  padding: 18px 16px 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--ios-tint-fill, rgba(0, 122, 255, 0.1)) 0%, var(--ios-gray-fill) 100%);
  border: 1px solid var(--ios-separator);
  box-shadow: var(--ios-shadow);
  margin-bottom: 16px;
  transition: box-shadow 0.35s ease, border-color 0.35s ease;
}
.billing-balance-card.is-low-balance {
  background: linear-gradient(145deg, rgba(255, 149, 0, 0.12) 0%, var(--ios-gray-fill) 100%);
  border-color: rgba(255, 149, 0, 0.35);
}
.billing-balance-card.is-flash {
  animation: billing-balance-flash 0.9s ease;
}
@keyframes billing-balance-flash {
  0%, 100% { box-shadow: var(--ios-shadow); }
  40% { box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.35), var(--ios-shadow); }
}
.billing-balance-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-label-secondary);
}
.billing-balance-amount {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ios-label);
  line-height: 1.05;
}
.billing-balance-user {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--ios-label-secondary);
}
.billing-balance-estimate {
  margin: 0 0 12px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ios-label-tertiary);
}
.billing-refresh-btn {
  appearance: none;
  border: 1px solid var(--ios-separator);
  background: var(--ios-group);
  color: var(--ios-blue);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.billing-refresh-btn:hover { opacity: 0.88; }

.billing-checkin-block {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ios-gray-fill);
}
.billing-checkin-btn {
  appearance: none;
  width: 100%;
  border: none;
  background: var(--ios-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}
.billing-checkin-btn:hover:not(:disabled) { opacity: 0.92; }
.billing-checkin-btn:active:not(:disabled) { transform: scale(0.98); }
.billing-checkin-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--ios-label-tertiary);
}
.billing-checkin-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ios-label-tertiary);
  text-align: center;
}

.billing-section-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ios-label);
}
.billing-recharge { margin-bottom: 4px; }
.billing-recharge.hidden { display: none; }

.billing-packages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.billing-pkg-card {
  position: relative;
  appearance: none;
  border: 1.5px solid var(--ios-separator);
  border-radius: 12px;
  background: var(--ios-group);
  padding: 14px 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.billing-pkg-card:hover:not(:disabled) {
  border-color: var(--ios-blue);
  background: var(--ios-tint-fill, rgba(0, 122, 255, 0.08));
}
.billing-pkg-card.is-recommended {
  border-color: rgba(0, 122, 255, 0.35);
}
.billing-pkg-card.is-selected,
.billing-pkg-card:focus-visible {
  border-color: var(--ios-blue);
  background: var(--ios-tint-fill, rgba(0, 122, 255, 0.12));
  outline: none;
}
.billing-pkg-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.billing-pkg-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--ios-blue);
  color: #fff;
  line-height: 1.2;
}
.billing-pkg-amount {
  font-size: 22px;
  font-weight: 800;
  color: var(--ios-label);
  line-height: 1.1;
}
.billing-pkg-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-label-secondary);
}
.billing-pkg-est {
  font-size: 10px;
  color: var(--ios-label-tertiary);
  margin-top: 2px;
}

.billing-pay-steps {
  display: flex;
  gap: 6px;
  margin: 12px 0 8px;
  padding: 10px;
  border-radius: 10px;
  background: var(--ios-gray-fill);
}
.billing-pay-step {
  flex: 1;
  font-size: 10px;
  font-weight: 600;
  color: var(--ios-label-tertiary);
  text-align: center;
  line-height: 1.3;
}
.billing-pay-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ios-separator);
  margin: 0 auto 5px;
}
.billing-pay-step.is-active { color: var(--ios-blue); }
.billing-pay-step.is-active .billing-pay-dot { background: var(--ios-blue); }
.billing-pay-step.is-done { color: var(--ios-green, #34c759); }
.billing-pay-step.is-done .billing-pay-dot { background: var(--ios-green, #34c759); }

.billing-recharge-hint {
  margin: 8px 0 0;
  min-height: 18px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ios-label-secondary);
}
.billing-recharge-hint.is-error { color: #ff3b30; }
.billing-recharge-hint.is-success { color: #34c759; }
.billing-recharge-foot {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--ios-label-tertiary);
  text-align: center;
}

.billing-list {
  padding: 0 0 8px;
}
.billing-loading {
  padding: 24px 0 !important;
}
.billing-date-group { margin-bottom: 12px; }
.billing-date-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ios-label-secondary);
  padding: 4px 4px 8px;
}
.billing-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--ios-separator);
}
.billing-row:last-child { border-bottom: none; }
.billing-row-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 1px;
}
.billing-row-icon.is-in {
  background: rgba(52, 199, 89, 0.14);
  color: #34c759;
}
.billing-row-icon.is-out {
  background: rgba(255, 59, 48, 0.12);
  color: #ff3b30;
}
.billing-row-body { flex: 1; min-width: 0; }
.billing-row-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.billing-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ios-label);
}
.billing-amt.plus { color: #34c759; font-weight: 700; flex-shrink: 0; }
.billing-amt.minus { color: #ff3b30; font-weight: 700; flex-shrink: 0; }
.billing-row-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ios-label-secondary);
  line-height: 1.4;
}

.billing-empty {
  text-align: center;
  padding: 36px 16px 24px;
}
.billing-empty-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ios-label);
}
.billing-empty-desc {
  margin: 0;
  font-size: 12px;
  color: var(--ios-label-secondary);
  line-height: 1.5;
}

.billing-sheet-footer {
  flex-shrink: 0;
  padding: 8px 16px 16px;
  border-top: 1px solid var(--ios-separator);
  text-align: center;
}
.billing-logout-btn {
  appearance: none;
  border: none;
  background: none;
  color: var(--ios-label-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
}
.billing-logout-btn:hover { color: #ff3b30; }

.billing-toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%) translateY(8px);
  z-index: 5;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.billing-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
html[data-theme="glass"] .billing-balance-card,
html[data-theme="glass"] .billing-pkg-card,
html[data-theme="glass"] .auth-user-btn.is-logged-in {
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
html[data-theme="glass"] .billing-toast {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.segment-chip.indicator-library-btn {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.segment-chip.indicator-library-btn span {
  padding: 6px 12px;
}

.segment-chip.indicator-library-btn.is-open span {
  background: var(--ios-blue);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
  transform: scale(1.02);
}

.segment-chip.indicator-library-btn:active span {
  transform: scale(0.94);
  opacity: 0.85;
}

.segment-chip.indicator-library-btn.is-open:active span {
  transform: scale(0.98);
}

.ind-lib-overlay .ind-lib-sheet {
  max-width: min(520px, 92vw);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 0;
  text-align: left;
}

.ind-lib-body {
  overflow: auto;
  padding: 12px 16px 20px;
  flex: 1;
}

.ind-lib-hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ios-label-secondary);
  margin: 0 0 10px;
}

.ind-lib-subopts {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(120, 120, 128, 0.08);
}

.ind-lib-subopt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ios-label);
  cursor: pointer;
}

.ind-lib-hint-sm {
  font-size: 11px;
  line-height: 1.4;
  color: var(--ios-label-secondary);
  margin: 6px 0 0;
}

.ind-lib-warn {
  font-size: 12px;
  color: var(--ios-orange, #ff9500);
  margin: 0 0 12px;
}

.ind-lib-warn .linkish {
  background: none;
  border: none;
  color: var(--ios-blue, #007aff);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

.ind-lib-ok {
  font-size: 12px;
  color: var(--ios-green, #34c759);
  margin: 0 0 12px;
}

.ind-lib-group {
  margin-bottom: 14px;
}

.ind-lib-group h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ios-label);
}

.ind-lib-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ind-lib-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 16px;
  background: var(--ios-gray-fill);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.ind-lib-tag.is-locked {
  opacity: 0.55;
}

.ind-lib-tag input {
  margin: 0;
}

/* ── 七楽 MRF 悬浮窗 / 金K·形态统计 ── */
.mrf-risk-reward-label {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1200;
  width: 260px;
  padding: 0;
  border: 2px solid #00bcd4;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  user-select: none;
  overflow: hidden;
}

.mrf-risk-reward-label.hidden {
  display: none;
}

.mrf-body {
  padding: 0 15px 15px;
}

.mrf-title {
  margin: 0;
  padding: 12px 15px;
  border-bottom: 1px solid #00bcd4;
  color: #00bcd4;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: grab;
  touch-action: none;
}

.mrf-title.is-dragging {
  cursor: grabbing;
}

.mrf-kline-info,
.mrf-entry-box,
.mrf-signal-block {
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.mrf-entry-box {
  background: rgba(0, 188, 212, 0.12);
  border: 1px solid rgba(0, 188, 212, 0.35);
}

.mrf-muted { color: #aaa; font-size: 11px; margin-bottom: 4px; }
.mrf-kline-range { display: flex; justify-content: space-between; font-size: 11px; }
.mrf-up { color: #4caf50; }
.mrf-down { color: #f44336; }
.mrf-entry-label { color: #00bcd4; font-size: 11px; margin-bottom: 6px; }
.mrf-entry-row { display: flex; gap: 8px; align-items: center; }
.mrf-entry-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #00bcd4;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 12px;
}
.mrf-entry-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  background: #00bcd4;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
}
.mrf-entry-btn.is-ok { background: #4caf50; }
.mrf-range-hint { margin-top: 4px; color: #888; font-size: 10px; }
.mrf-signal-title { margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.mrf-signal-short .mrf-signal-title { color: #ff5722; }
.mrf-signal-long .mrf-signal-title { color: #2196f3; }
.mrf-signal-row { display: flex; justify-content: space-between; line-height: 1.6; font-size: 11px; }
.mrf-signal-row span:first-child { color: #aaa; }
.mrf-rr {
  margin-top: 8px;
  padding: 6px;
  border-radius: 4px;
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  text-align: center;
  font-size: 10px;
}
.mrf-rr strong { font-size: 16px; }

.qile-indicator-aux {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qile-indicator-aux.hidden { display: none; }

.qile-four-lights-panel {
  padding: 12px 14px;
  border-radius: var(--ios-radius-group, 13px);
  border: 0.5px solid var(--ios-separator);
  background: var(--ios-group);
  box-shadow: var(--ios-shadow, none);
}

.four-lights-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ios-label);
}

.four-lights-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 8px;
  font-size: 10px;
  color: var(--ios-label-secondary);
}

.four-lights-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.four-lights-star {
  font-size: 12px;
  line-height: 1;
}

.four-lights-star.is-strict {
  color: var(--ios-red);
  text-shadow: 0 0 6px rgba(255, 59, 48, 0.35);
}

.four-lights-star.is-broad {
  color: #ffc107;
  text-shadow: 0 0 6px rgba(255, 193, 7, 0.35);
}

.four-lights-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 0;
  border-top: 0.5px solid var(--ios-separator);
  border-bottom: 0.5px solid var(--ios-separator);
}

.four-light-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ios-label);
}

.four-light-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.four-light-dot.is-red {
  background: var(--ios-red);
  box-shadow: 0 0 0 1px var(--ios-down-border);
}

.four-light-dot.is-green {
  background: var(--ios-green);
  box-shadow: 0 0 0 1px var(--ios-up-border);
}

.four-light-dot.is-gray {
  background: var(--ios-gray-fill2);
  box-shadow: 0 0 0 1px var(--ios-separator);
}

.four-lights-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.four-lights-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 0.5px solid var(--ios-separator);
  background: var(--ios-gray-fill);
  color: var(--ios-label-secondary);
}

.four-lights-badge.is-count {
  color: var(--ios-label);
  font-weight: 700;
}

.four-lights-badge.is-strict {
  background: var(--ios-down-soft2);
  border-color: var(--ios-down-border);
  color: var(--ios-red);
}

.four-lights-badge.is-broad {
  background: rgba(255, 193, 7, 0.14);
  border-color: rgba(255, 193, 7, 0.32);
  color: #c69200;
}

.four-lights-badge.is-resonance {
  background: rgba(171, 71, 188, 0.14);
  border-color: rgba(171, 71, 188, 0.35);
  color: #8e24aa;
}

.resonance-mark {
  color: #ab47bc;
  font-size: 11px;
  margin-right: 2px;
}

.four-lights-badge.is-muted {
  color: var(--ios-label-tertiary);
}

.four-lights-hint {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--ios-label-tertiary);
}

html[data-theme="dark"] .four-lights-badge.is-broad {
  color: #ffd54f;
  background: rgba(255, 193, 7, 0.12);
}

html[data-theme="dark"] .four-light-dot.is-gray {
  background: var(--ios-gray-fill2);
}

html[data-theme="glass"] .qile-four-lights-panel {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(255, 255, 255, 0.45);
}

html[data-theme="glass"] .four-lights-badge {
  background: rgba(255, 255, 255, 0.55);
}

.qile-summary-panel {
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid;
  background: rgba(255, 255, 255, 0.92);
}
.qile-summary-panel.is-goldenk {
  border-color: #ffc107;
  background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
}
.qile-summary-panel.is-patterns {
  border-color: #4caf50;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}
.qile-summary-panel h4 {
  margin: 0 0 8px;
  font-size: 14px;
}
.qile-summary-total { font-size: 12px; font-weight: normal; opacity: 0.75; }
.qile-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
}
.qile-summary-table th,
.qile-summary-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  text-align: left;
}
.qile-count { color: #ff9800; font-weight: 700; }
.qile-type-buy { color: #f44336; }
.qile-type-sell { color: #4caf50; }
.qile-type-neutral { color: #ff9800; }

/* ── 指标抽量回测页 ── */
.ibt-page .ibt-grid {
  align-items: start;
}

.ibt-empty {
  padding: 24px 8px;
  color: var(--ios-label-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.ibt-empty-sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ios-label-tertiary);
}

.ibt-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 8px;
  color: var(--ios-label-secondary);
}

.ibt-loading.hidden,
.hidden {
  display: none !important;
}

.ibt-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ios-separator);
  border-top-color: var(--ios-blue);
  border-radius: 50%;
  animation: ibt-spin 0.7s linear infinite;
}

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

.ibt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--ios-label-secondary);
  margin-bottom: 10px;
}

.ibt-sample-list {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
  color: var(--ios-label-primary);
}

.ibt-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.ibt-stat-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ios-bg-secondary);
  border: 1px solid var(--ios-separator);
}

.ibt-stat-card.is-good {
  border-color: rgba(52, 199, 89, 0.35);
  background: rgba(52, 199, 89, 0.08);
}

.ibt-stat-card.is-bad {
  border-color: rgba(255, 59, 48, 0.3);
  background: rgba(255, 59, 48, 0.06);
}

.ibt-stat-card.is-mid {
  border-color: rgba(255, 149, 0, 0.3);
  background: rgba(255, 149, 0, 0.06);
}

.ibt-stat-card.is-muted {
  opacity: 0.72;
}

.ibt-stat-card.is-overview {
  grid-column: 1 / -1;
  border-width: 2px;
}

.ibt-overall-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  margin: 0 0 8px;
}

.ibt-pnl-note {
  font-size: 11px;
  color: var(--ios-label-tertiary);
  margin: -8px 0 14px;
}

.ibt-stat-label {
  display: block;
  font-size: 11px;
  color: var(--ios-label-tertiary);
}

.ibt-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.ibt-stat-sub {
  display: block;
  font-size: 10px;
  color: var(--ios-label-secondary);
  margin-top: 4px;
}

.ibt-section-title {
  font-size: 12px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--ios-label-secondary);
}

.ibt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ibt-table th,
.ibt-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--ios-separator);
}

.ibt-table th {
  color: var(--ios-label-tertiary);
  font-weight: 600;
}

.ibt-err {
  color: var(--ios-red);
  font-size: 11px;
}

.ibt-error {
  color: var(--ios-red);
  padding: 12px 0;
}

.ibt-signals-detail {
  margin-top: 16px;
  font-size: 12px;
}

.ibt-sig-block {
  margin-bottom: 10px;
}

.ibt-sig-block ul {
  margin: 4px 0 0 18px;
  padding: 0;
  color: var(--ios-label-secondary);
}

.ibt-main-col {
  min-width: 0;
}

.backtest-grid.ibt-grid {
  grid-template-columns: minmax(280px, 340px) 1fr;
}

@media (max-width: 900px) {
  .backtest-grid.ibt-grid {
    grid-template-columns: 1fr;
  }
}

.imon-card {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--ios-bg-secondary);
  border: 1px solid var(--ios-separator);
  margin-bottom: 10px;
}

.imon-card.is-paused {
  opacity: 0.72;
}

.imon-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.imon-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.12);
  color: #34c759;
}

.imon-card.is-paused .imon-badge {
  background: rgba(142, 142, 147, 0.15);
  color: var(--ios-label-secondary);
}

.imon-card-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ios-label-secondary);
}

.imon-card-meta {
  margin: 4px 0 10px;
  font-size: 11px;
  color: var(--ios-label-tertiary);
}

.imon-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.imon-card.is-scanning {
  border-color: rgba(0, 122, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 122, 255, 0.12);
}

.imon-card.is-scanning .imon-badge {
  background: rgba(0, 122, 255, 0.12);
  color: #007aff;
}

/* ── 战法选择 ── */
.stg-page .backtest-main-wrap {
  max-width: 1100px;
  padding: 0 16px 40px;
  margin: 0 auto;
}

.backtest-nav .site-nav {
  justify-self: start;
}

.stg-catalog {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

/* ── 分类 Tab（横向） ── */
.stg-cat-tabs {
  position: relative;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.stg-cat-tabs::-webkit-scrollbar {
  display: none;
}

.stg-cat-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: var(--ios-gray-fill, rgba(120, 120, 128, 0.12));
  color: var(--ios-secondary-label, #636366);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.25s var(--ease-out-expo), background 0.25s var(--ease-out-expo), transform 0.2s var(--ease-spring);
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
}

.stg-cat-tab:active {
  transform: scale(0.96);
}

.stg-cat-tab.is-active {
  color: #fff;
  background: transparent;
}

.stg-cat-tab-count {
  font-size: 11px;
  opacity: 0.75;
  font-weight: 500;
}

.stg-cat-tab-indicator {
  position: absolute;
  bottom: 2px;
  left: 0;
  height: calc(100% - 6px);
  border-radius: 999px;
  background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35);
  transition: transform 0.45s var(--ease-out-expo), width 0.45s var(--ease-out-expo);
  pointer-events: none;
  z-index: 0;
}

.stg-cat-tab-label,
.stg-cat-tab-count {
  position: relative;
  z-index: 1;
}

.stg-cat-desc-active {
  margin: 0;
  padding: 0 4px;
  font-size: 13px;
  color: var(--ios-secondary-label, #8e8e93);
  line-height: 1.45;
  animation: stg-fade-in 0.4s var(--ease-out-expo);
}

/* ── 轮播舞台 ── */
.stg-carousel-stage {
  position: relative;
  min-height: 460px;
}

.stg-carousel-panel {
  display: none;
  opacity: 0;
  transform: translateX(28px) scale(0.98);
}

.stg-carousel-panel.is-active {
  display: block;
  animation: stg-panel-slide-in 0.55s var(--ease-out-expo) forwards;
}

@keyframes stg-panel-slide-in {
  from {
    opacity: 0;
    transform: translateX(28px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes stg-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.stg-carousel-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stg-carousel-viewport {
  flex: 1;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
}

.stg-carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 12px 8vw 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.stg-carousel-track::-webkit-scrollbar {
  display: none;
}

.stg-car-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--ios-group, #fff);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  color: var(--ios-label, #3c3c43);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.stg-car-btn:hover {
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2);
  color: #007aff;
}

.stg-car-btn:active {
  transform: scale(0.9);
}

.stg-carousel-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 4px 0 8px;
}

.stg-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 280px;
}

.stg-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--ios-separator, rgba(60, 60, 67, 0.25));
  cursor: pointer;
  transition: width 0.35s var(--ease-out-expo), background 0.35s, transform 0.2s;
}

.stg-dot.is-on {
  width: 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, #007aff, #5856d6);
}

.stg-page-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-secondary-label, #8e8e93);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}

.stg-sub-group {
  display: inline-block;
  font-size: 11px;
  color: var(--ios-secondary-label, #8e8e93);
  margin-bottom: 2px;
}

.stg-slide {
  flex: 0 0 min(84vw, 360px);
  scroll-snap-align: center;
  transform: scale(0.94);
  opacity: 0.72;
  transition: transform 0.45s var(--ease-out-expo), opacity 0.45s var(--ease-out-expo), box-shadow 0.35s;
}

.stg-slide.is-center {
  transform: scale(1);
  opacity: 1;
}

.stg-card {
  padding: 18px;
  border-radius: 18px;
  background: var(--ios-group-bg, rgba(255, 255, 255, 0.82));
  border: 1px solid var(--ios-separator, rgba(60, 60, 67, 0.12));
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  transition: border-color 0.25s, box-shadow 0.35s var(--ease-out-expo);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stg-card.is-active {
  border-color: rgba(0, 122, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.stg-card.has-picks:not(.is-active) {
  border-color: rgba(52, 199, 89, 0.28);
}

.stg-card.is-applied {
  opacity: 0.92;
  border-color: rgba(52, 199, 89, 0.35);
}

.stg-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.stg-category {
  font-size: 11px;
  color: var(--ios-secondary-label, #8e8e93);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stg-card-title {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 650;
}

.stg-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.14);
  color: #248a3d;
  white-space: nowrap;
}

.stg-card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ios-secondary-label, #636366);
}

.stg-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stg-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 122, 255, 0.1);
  color: #007aff;
}

.stg-logic {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--ios-secondary-label, #636366);
}

.stg-logic li {
  margin: 2px 0;
}

.stg-details {
  font-size: 12px;
  color: var(--ios-secondary-label, #636366);
}

.stg-details summary {
  cursor: pointer;
  color: #007aff;
}

.stg-details ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.stg-pa-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: #ff9500;
}

.stg-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.stg-card-actions .ios-btn {
  flex: 1 1 auto;
  min-width: 0;
}

.stg-applied-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stg-applied-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ios-separator, rgba(60, 60, 67, 0.1));
}

.stg-applied-item:last-child {
  border-bottom: none;
}

.stg-applied-meta {
  display: block;
  font-size: 12px;
  color: var(--ios-secondary-label, #8e8e93);
  margin-top: 2px;
}

.stg-origin {
  margin: 0;
  font-size: 12px;
  color: var(--ios-tertiary-label, #aeaeb2);
  font-style: italic;
}

.stg-sub-label {
  margin: 8px 0 4px;
  font-size: 12px;
  font-weight: 600;
}

.stg-applied-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.stg-apply-sheet .stg-apply-body {
  padding: 0 4px 12px;
}

.stg-apply-label {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
}

.stg-apply-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 13px;
}

.stg-price-block {
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 149, 0, 0.08);
  border: 1px solid rgba(255, 149, 0, 0.2);
}

.stg-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.stg-symbol-fields {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stg-foot-note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ios-tertiary-label, #aeaeb2);
}

.stg-picks-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ios-separator, rgba(60, 60, 67, 0.12));
}

.stg-picks-panel {
  margin-top: 16px;
  padding: 16px 18px 18px;
  border-radius: var(--ios-radius-group, 14px);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.45s var(--ease-out-expo), transform 0.45s var(--ease-out-expo);
}

.stg-picks-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.stg-picks-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stg-picks-panel-eyebrow {
  margin: 0;
  font-size: 11px;
  color: var(--ios-secondary-label, #8e8e93);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stg-picks-panel-title {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.stg-picks-close {
  flex-shrink: 0;
  min-height: 32px !important;
  padding: 6px 14px !important;
  font-size: 13px !important;
}

.stg-picks-panel-body {
  min-height: 0;
}

.stg-picks-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 13px;
}

.stg-picks-head span {
  color: var(--ios-secondary-label, #8e8e93);
  font-size: 12px;
}

.stg-picks-scroll {
  overflow-x: auto;
  max-height: none;
  overflow-y: visible;
}

.stg-picks-rail-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 0;
}

.stg-picks-rail {
  flex: 1;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 8px 4px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.stg-picks-rail::-webkit-scrollbar {
  display: none;
}

.stg-rail-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--ios-gray-fill, rgba(120, 120, 128, 0.12));
  color: var(--ios-label-secondary, #636366);
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), background 0.2s;
}

.stg-rail-btn:active {
  transform: scale(0.9);
}

.stg-pick-card {
  flex: 0 0 min(72vw, 260px);
  scroll-snap-align: center;
  padding: 14px;
  border-radius: 14px;
  background: var(--ios-gray-fill, rgba(120, 120, 128, 0.08));
  border: 1px solid var(--ios-separator, rgba(60, 60, 67, 0.1));
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: stg-pick-in 0.5s var(--ease-out-expo) backwards;
  animation-delay: calc(var(--stg-pick-i, 0) * 0.05s);
}

@keyframes stg-pick-in {
  from {
    opacity: 0;
    transform: translateX(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.stg-pick-rank {
  font-size: 11px;
  font-weight: 700;
  color: #007aff;
}

.stg-pick-sym {
  font-size: 18px;
  font-weight: 700;
  color: #007aff;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.stg-pick-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.stg-pick-reason {
  margin: 0;
  flex: 1;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ios-secondary-label, #636366);
}

.stg-loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px;
}

.stg-loading-ring {
  width: 36px;
  height: 36px;
  border: 3px solid var(--ios-separator, rgba(60, 60, 67, 0.15));
  border-top-color: #007aff;
  border-radius: 50%;
  animation: ibt-spin 0.75s linear infinite;
}

.stg-picks-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

.stg-picks-table th,
.stg-picks-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--ios-separator, rgba(60, 60, 67, 0.08));
  vertical-align: top;
}

.stg-col-num {
  width: 36px;
  color: var(--ios-secondary-label, #8e8e93);
}

.stg-col-sym {
  width: 72px;
  white-space: nowrap;
}

.stg-col-name {
  width: 88px;
  white-space: nowrap;
}

.stg-col-act {
  width: 64px;
  white-space: nowrap;
}

.stg-picks-table th {
  font-weight: 600;
  color: var(--ios-secondary-label, #636366);
  position: sticky;
  top: 0;
  background: var(--ios-group-bg, #fff);
}

.stg-reason-cell {
  min-width: 180px;
  line-height: 1.45;
  color: var(--ios-secondary-label, #636366);
  word-break: break-word;
}

.stg-sym-link {
  color: #007aff;
  text-decoration: none;
  font-weight: 600;
}

/* ── APP 内更新弹窗 ── */
.app-update-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.app-update-overlay.hidden { display: none; }
.app-update-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.app-update-sheet {
  position: relative;
  width: min(420px, 100%);
  background: var(--ios-group, #fff);
  border-radius: 16px;
  padding: 20px 18px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}
.app-update-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}
.app-update-notes {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ios-secondary-label, #636366);
  white-space: pre-wrap;
}
.app-update-size {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--ios-tertiary-label, #8e8e93);
}
.app-update-progress {
  margin: 14px 0 4px;
}
.app-update-progress.hidden {
  display: none;
}
.app-update-progress-bar {
  height: 14px;
  border-radius: 7px;
  background: var(--ios-gray-fill, #eee);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}
.app-update-progress-bar div {
  height: 100%;
  width: 0;
  border-radius: 7px;
  background: linear-gradient(90deg, #007aff 0%, #34c759 100%);
  transition: width 0.15s ease-out;
}
.app-update-progress-text {
  margin: 10px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ios-label, #1c1c1e);
  text-align: center;
  letter-spacing: -0.01em;
}
.app-update-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.app-update-actions.hidden {
  display: none;
}
.app-update-overlay.app-update-forced .app-update-backdrop {
  pointer-events: none;
}
.app-update-confirm-full {
  width: 100%;
  flex: 1 1 100%;
}
.app-update-forced .app-update-actions {
  flex-direction: column;
}
.app-update-check-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 17px;
  background: var(--ios-gray-fill, #eee);
  color: var(--ios-blue, #007aff);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.app-update-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  z-index: 13000;
  background: rgba(20, 24, 32, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 13px;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.app-update-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.settings-nav-btn,
.app-update-check-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 17px;
  background: var(--ios-gray-fill, #eee);
  color: var(--ios-blue, #007aff);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
}

.settings-nav-btn {
  display: none;
}

html.is-native-app .settings-nav-btn {
  display: inline-flex;
}

.settings-nav-btn:active,
.app-update-check-btn:active {
  opacity: 0.75;
}

/* ── 设置页（iOS 风格）── */
.settings-body {
  background: var(--ios-bg, #f2f2f7);
}

.settings-shell {
  min-height: 100vh;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

html.is-native-app .settings-nav-bar {
  padding-top: max(var(--native-top-inset, 28px), env(safe-area-inset-top, 0px));
}

.settings-nav-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px 10px;
  background: var(--nav-bg, rgba(255, 255, 255, 0.82));
  backdrop-filter: var(--nav-blur, blur(20px));
  -webkit-backdrop-filter: var(--nav-blur, blur(20px));
  border-bottom: 0.5px solid var(--ios-separator, rgba(0, 0, 0, 0.12));
}

.settings-back-link {
  position: absolute;
  left: 12px;
  color: var(--ios-blue, #007aff);
  text-decoration: none;
  font-size: 17px;
  line-height: 1;
  padding: 6px 4px;
}

.settings-nav-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.settings-main {
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 16px 24px;
}

.settings-group-label {
  margin: 18px 8px 8px;
  font-size: 13px;
  color: var(--ios-secondary-label, #636366);
  text-transform: none;
}

.settings-group.ios-group {
  overflow: hidden;
}

.settings-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}

.settings-row + .settings-row,
.settings-row + .settings-update-panel,
.settings-update-panel + .settings-row {
  border-top: 0.5px solid var(--ios-separator, rgba(0, 0, 0, 0.12));
}

.settings-row-label {
  flex: 1;
  font-size: 16px;
}

.settings-row-value {
  font-size: 15px;
  color: var(--ios-secondary-label, #636366);
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row-chevron {
  color: var(--ios-tertiary-label, #8e8e93);
  font-size: 18px;
  line-height: 1;
}

.settings-row-static {
  cursor: default;
}

.settings-row-detail .settings-row-value {
  max-width: none;
}

.settings-row-field {
  padding-top: 0;
  cursor: default;
}

.settings-inline-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 16px;
}

.settings-footnote {
  margin: 8px 12px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ios-tertiary-label, #8e8e93);
}

.settings-update-panel {
  padding: 12px 14px 14px;
  background: var(--ios-gray-fill, rgba(120, 120, 128, 0.08));
}

.settings-update-notes {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ios-label, #000);
  white-space: pre-wrap;
}

.settings-update-size {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--ios-secondary-label, #636366);
}

.settings-update-btn {
  width: 100%;
}

.settings-page-foot {
  margin: 28px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--ios-tertiary-label, #8e8e93);
}

.settings-terms-sheet {
  max-height: min(80vh, 640px);
  overflow: auto;
}

.settings-terms-body {
  padding: 0 16px 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ios-label, #000);
}

.settings-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.settings-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-switch-ui {
  width: 51px;
  height: 31px;
  border-radius: 16px;
  background: var(--ios-separator, #e5e5ea);
  transition: background 0.2s ease;
  position: relative;
}

.settings-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.settings-switch input:checked + .settings-switch-ui {
  background: #34c759;
}

.settings-switch input:checked + .settings-switch-ui::after {
  transform: translateX(20px);
}

.stg-kline-btn {
  padding: 4px 10px !important;
  font-size: 11px !important;
  min-height: 0 !important;
}

.stg-picks-foot,
.stg-picks-empty,
.stg-picks-error,
.stg-loading {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ios-secondary-label, #8e8e93);
}

.stg-picks-error {
  color: #ff3b30;
}

[data-theme="dark"] .stg-card,
[data-theme="terminal"] .stg-card,
[data-theme="aurora"] .stg-card {
  background: rgba(44, 44, 46, 0.72);
}

[data-theme="dark"] .stg-picks-table th,
[data-theme="terminal"] .stg-picks-table th,
[data-theme="aurora"] .stg-picks-table th {
  background: rgba(44, 44, 46, 0.95);
}

[data-theme="dark"] .stg-car-btn,
[data-theme="terminal"] .stg-car-btn,
[data-theme="aurora"] .stg-car-btn {
  background: rgba(44, 44, 46, 0.9);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

@media (max-width: 520px) {
  .stg-car-btn {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .stg-carousel-track {
    padding-left: 4vw;
    padding-right: 4vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stg-carousel-panel.is-active,
  .stg-slide,
  .stg-pick-card,
  .stg-picks-panel,
  .stg-cat-tab-indicator {
    animation: none !important;
    transition: none !important;
  }

  .stg-slide {
    transform: none;
    opacity: 1;
  }
}

/* ── 原生 App 性能：减 blur、缩动画、优化触控 ── */
html.is-native-app {
  --dur-normal: 0.22s;
  --dur-fast: 0.14s;
  --dur-slow: 0.32s;
  --nav-blur: none;
  --group-backdrop: none;
  --theme-transition: none;
  --nav-bg: var(--ios-bg);
  -webkit-tap-highlight-color: transparent;
}

html.is-native-app body {
  background-attachment: scroll;
  background-image: none !important;
  transition: none;
}

html.is-native-app .nav-bar,
html.is-native-app .ios-overlay,
html.is-native-app .ios-select-menu,
html.is-native-app .ios-group,
html.is-native-app .chart-panel,
html.is-native-app dialog.ios-overlay::backdrop {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.is-native-app .ios-overlay {
  background: rgba(0, 0, 0, 0.45);
}

html.is-native-app button,
html.is-native-app a,
html.is-native-app .ios-btn,
html.is-native-app .segment-btn,
html.is-native-app .chart-view-btn,
html.is-native-app .settings-row,
html.is-native-app .rank-row,
html.is-native-app .alert-row {
  touch-action: manipulation;
}

html.is-native-app .ios-sheet,
html.is-native-app .alert-drawer-panel,
html.is-native-app .rank-drawer-panel {
  will-change: transform;
  backface-visibility: hidden;
}

html.is-native-app .list-item,
html.is-native-app .meta-item,
html.is-native-app .chart-panel.is-loaded::after,
html.is-native-app .status-dot.is-busy {
  animation: none !important;
}

html.is-native-app .chart-view-scroll,
html.is-native-app .watchlist-scroll,
html.is-native-app .segment-bar,
html.is-native-app .source-segment {
  scroll-behavior: auto;
}

html.is-native-app #chartContainer {
  contain: layout style;
}

html.is-native-app .rank-drawer-panel,
html.is-native-app .alert-drawer-panel {
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

html.is-native-app .rank-drawer-backdrop,
html.is-native-app .alert-drawer-backdrop {
  transition: opacity 0.18s ease;
}

html.is-native-app .ios-overlay,
html.is-native-app .ios-sheet {
  transition-duration: 0.22s;
}

html.is-native-app .ai-sheet-overlay .ios-sheet {
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}

html.is-native-app .theme-toggle-btn:active,
html.is-native-app .ios-btn:active,
html.is-native-app button:active {
  transform: scale(0.97);
  transition-duration: 0.08s;
}
