/* 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-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;
  --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);
}

.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 {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 20px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.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: 13px;
  font-weight: 400;
  color: var(--ios-label-secondary);
  margin-bottom: 2px;
}

.nav-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--title-color);
  transition: color 0.4s var(--ease-ios);
}

.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;
  margin-bottom: 4px;
  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; }

.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-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; }

.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%;
  border: none;
  background: transparent;
  font-family: var(--ios-font);
  font-size: 17px;
  font-weight: 400;
  color: var(--ios-label);
  padding: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: var(--select-color-scheme);
  transition: color var(--dur-fast) var(--ease-ios);
}

.ios-input:focus,
.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 {
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 0 center;
  padding-right: 18px;
  cursor: pointer;
}

.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-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;
}

.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-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) {
  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);
}

.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 {
  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 {
  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 {
  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 {
  display: block;
}

.chart-panel.is-fullscreen .overlay-style-inner,
.chart-panel:fullscreen .overlay-style-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 {
  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);
}

.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 {
  position: absolute;
  bottom: 36px;
  left: 12px;
  z-index: 10;
  pointer-events: none;
  opacity: 0.85;
}

.custom-watermark img {
  height: 40px;
  width: auto;
  display: block;
}

.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;
}

.chart-export-watermark-note {
  font-size: 12px;
  color: var(--ios-label-secondary);
  margin: 4px 0 0;
  padding-left: 24px;
}

.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;
}

.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);
}

.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);
}

.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: 24px; }
  .nav-bar-inner { padding: 10px 16px 12px; flex-wrap: wrap; }
  .nav-actions { margin-left: auto; }
  .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; }
  .custom-watermark { bottom: 28px; left: 8px; }
  .custom-watermark img { height: 28px; }
  .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;
  --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;
  --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: #ffffff; }
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;
}
