@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap");

:root {
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-border: rgba(0, 0, 0, 0.05);
  --text: #1d1d1f;
  --muted: #86868b;
  --soft: #424245;
  --blue: #0071e3;
  --green: #24b24b;
  --red: #ff3b30;
  --amber: #ff9500;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.02), 0 2px 8px rgba(0, 0, 0, 0.01);
}

* { 
  box-sizing: border-box; 
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

html { 
  background: var(--bg); 
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(0, 113, 227, 0.03) 0%, transparent 35%),
    linear-gradient(180deg, #ffffff 0%, #f5f5f7 60%, #ececf1 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  padding: 24px;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; border: none; outline: none; }

/* 顶部悬浮导航气泡 */
.floating-nav {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto 28px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.main-nav {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.03);
  padding: 4px;
  border-radius: 12px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text);
}

.nav-btn.btn-active,
.nav-btn.tab-active {
  background: white;
  color: var(--blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: linear-gradient(180deg, #333336, #1d1d1f);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  font-size: 16px;
}

.brand strong { 
  display: block; 
  font-family: "Outfit", sans-serif;
  font-size: 18px; 
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand small { 
  display: block; 
  color: var(--muted); 
  font-size: 10px; 
  margin-top: 1px; 
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* 主内容容器限制 */
.main-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  flex-1: 1;
}

/* 搜索与工具 */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.02);
  color: var(--muted);
  transition: all 0.3s ease;
}

.search-box:focus-within {
  border-color: rgba(0, 113, 227, 0.3);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.03);
  background: white;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: white;
  color: var(--muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.icon-button:hover {
  background: var(--bg);
  color: var(--text);
}

.icon-button.voice-active {
  color: var(--blue);
  border-color: rgba(0, 113, 227, 0.2);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.1);
}

.status-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.status-dot.muted {
  background: #b8b8bc;
  box-shadow: none;
}

/* 核心卡片栅格 */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card,
.apple-card,
.notice-bar {
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 86px;
  padding: 16px 20px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), var(--shadow);
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-family: "Outfit", sans-serif;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
}

/* 快讯栏 */
.notice-bar {
  margin-bottom: 20px;
  padding: 10px 18px;
}

.marquee-content {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.marquee-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: white;
  color: var(--soft);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
}

.marquee-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.05);
}

/* 珍珠磨砂小卡片 */
.apple-card {
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), var(--shadow);
}

.apple-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 113, 227, 0.25);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.starred-card {
  border-color: rgba(255, 149, 0, 0.25) !important;
  background: rgba(255, 149, 0, 0.02) !important;
}

/* 免跳页全宽 K线抽屉 */
.kline-drawer {
  grid-column: 1 / -1;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.kline-drawer.open {
  max-height: 450px;
  opacity: 1;
  border-top: 1px solid rgba(0, 0, 0, 0.03);
  margin-top: 8px;
  margin-bottom: 12px;
}

/* 极简徽章 */
.apple-badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.apple-badge-blue {
  background: rgba(0, 113, 227, 0.06);
  border: 1px solid rgba(0, 113, 227, 0.12);
  color: var(--blue);
}

.apple-badge-gray {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--soft);
}

.apple-badge-amber {
  background: rgba(255, 149, 0, 0.06);
  border: 1px solid rgba(255, 149, 0, 0.12);
  color: var(--amber);
}

/* 极光红绿 */
.neon-green {
  color: var(--green) !important;
  font-weight: 700;
  font-family: ui-monospace, monospace !important;
}

.neon-red {
  color: var(--red) !important;
  font-weight: 700;
  font-family: ui-monospace, monospace !important;
}

/* 顶部选择 tab */
.apple-tab-bar {
  background: rgba(0, 0, 0, 0.03);
  padding: 4px;
  border-radius: 12px;
  display: inline-flex;
}

.apple-tab-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 8px;
  transition: all 0.25s;
  background: transparent;
}

.apple-tab-btn:hover {
  color: var(--text);
}

.apple-tab-btn.apple-active {
  background: white;
  color: var(--blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* 支撑阻力 */
.support-chart-container {
  background: white;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.support-chart {
  min-height: 580px;
  background: #fdfdfd;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--panel-border);
  cursor: zoom-in;
}

#chart-container {
  width: 100%;
  min-height: 564px;
  display: grid;
  place-items: center;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px 0;
}

.pagination-btn {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: white;
  color: var(--soft);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg);
}

.pagination-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.pagination-btn:disabled {
  opacity: 0.3;
}

/* 模态弹窗 */
.modal-card {
  width: min(500px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.08);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.modal-head strong {
  font-family: "Outfit", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid rgba(0, 0, 0, 0.03);
  border-bottom: 0;
  background: rgba(0, 0, 0, 0.01);
}

.modal-body {
  padding: 20px;
  color: var(--soft);
  font-size: 13.5px;
  line-height: 1.5;
}

.note-card textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: white;
  color: var(--text);
  padding: 12px;
  outline: 0;
}

.primary-button,
.ghost-button {
  min-height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  background: var(--blue);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.15);
}

.primary-button:hover {
  background: #0077ed;
  transform: translateY(-1px);
}

.ghost-button {
  border: 1px solid var(--panel-border);
  background: white;
  color: var(--soft);
}

.ghost-button:hover {
  background: var(--bg);
}

.close-button {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

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

/* 滚动条 */
.custom-scroll::-webkit-scrollbar { 
  width: 4px; 
  height: 4px; 
}
.custom-scroll::-webkit-scrollbar-thumb { 
  background: rgba(0, 0, 0, 0.08); 
  border-radius: 999px; 
}
.custom-scroll::-webkit-scrollbar-thumb:hover { 
  background: rgba(0, 0, 0, 0.15); 
}

/* 响应式 */
@media (max-width: 900px) {
  body { padding: 16px; }
  .floating-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
    margin-bottom: 20px;
  }
  .search-box { min-width: 0; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .support-chart { min-height: 460px; }
  #chart-container { min-height: 444px; }
}

@media (max-width: 520px) {
  body { padding: 12px; }
  .metric-grid { gap: 10px; }
  .metric-card { min-height: 76px; padding: 12px 14px; }
  .metric-card strong { font-size: 24px; }
}
