/* ===== 超级买点 · 轻快淡蓝白主题 ===== */
:root {
  --bg: #eef5ff;
  --bg2: #f7faff;
  --card: #ffffff;
  --border: rgba(62, 142, 247, .22);
  --blue: #3e8ef7;
  --blue-deep: #1f6fe0;
  --green: #12b76a;
  --red: #e5484d;
  --amber: #f59e0b;
  --text: #1c2b3a;
  --dim: #6b7f96;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 111, 224, .08);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  background: linear-gradient(180deg, #e8f1ff 0%, #f7faff 40%, #ffffff 100%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100%;
}

/* hidden 属性优先级修正：防止 display 规则覆盖 hidden 导致弹窗常驻 */
[hidden] { display: none !important; }

.bg-grid {
  position: fixed; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(62,142,247,.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(62,142,247,.05) 1px, transparent 1px);
  background-size: 36px 36px;
}
.bg-grid::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% -10%, rgba(62,142,247,.10), transparent 60%);
}

/* 顶栏 */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 8px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  font-size: 20px; width: 40px; height: 40px; display: grid; place-items: center;
  background: linear-gradient(135deg, #3e8ef7, #6cb6ff); color: #fff;
  border-radius: 12px; box-shadow: 0 3px 10px rgba(62,142,247,.35);
}
.logo h1 { font-size: 19px; letter-spacing: 1px; color: var(--blue-deep); font-weight: 800; }
.subtitle { font-size: 11px; color: var(--dim); letter-spacing: 1px; }
.btn-ghost {
  background: #fff; border: 1px solid var(--border); color: var(--blue-deep);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; cursor: pointer; transition: .2s; box-shadow: var(--shadow);
}
.btn-ghost:active { background: #e8f1ff; }
.btn-ghost.danger { color: var(--red); border-color: rgba(229,72,77,.3); }

/* 风格切换 */
.style-tabs { display: flex; gap: 8px; padding: 10px 16px; align-items: center; overflow-x: auto; }
.tab {
  background: #fff; border: 1px solid var(--border); color: var(--dim);
  border-radius: 20px; padding: 7px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; transition: .2s; box-shadow: var(--shadow);
}
.tab.active { color: #fff; background: var(--blue); border-color: var(--blue); font-weight: 600; }
.btn-scan {
  margin-left: auto; background: linear-gradient(135deg, #12b76a, #31d488); border: none; color: #fff;
  font-weight: 700; border-radius: 20px; padding: 7px 14px; font-size: 13px; cursor: pointer;
  box-shadow: 0 3px 12px rgba(18,183,106,.35); white-space: nowrap;
}
.btn-scan:disabled { opacity: .5; }

/* 状态条 */
.statusbar { display: flex; justify-content: space-between; padding: 4px 20px; font-size: 12px; color: var(--dim); }
.statusbar .ok { color: var(--green); }

/* 市况温度计 */
.temp-bar { display: flex; align-items: center; gap: 10px; padding: 8px 20px 2px; font-size: 12px; }
.temp-title { color: var(--blue-deep); white-space: nowrap; font-weight: 600; }
.temp-track { flex: 1; height: 8px; border-radius: 6px; background: rgba(62,142,247,.15); overflow: hidden; }
.temp-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #e5484d, #f59e0b, #12b76a); transition: width .6s; }
.temp-text { color: var(--dim); white-space: nowrap; }

/* 雷达动画 */
.radar-wrap { display: flex; justify-content: center; padding: 18px 0 6px; }
.radar { position: relative; width: 150px; height: 150px; }
.radar-ring { position: absolute; inset: 0; border: 1px solid rgba(62,142,247,.4); border-radius: 50%; animation: pulse 3s ease-out infinite; }
.radar-ring.r2 { animation-delay: 1s; }
.radar-ring.r3 { animation-delay: 2s; }
.radar-core {
  position: absolute; inset: 30%; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; color: var(--blue-deep); background: radial-gradient(circle, rgba(62,142,247,.18), rgba(62,142,247,.05));
  border: 1px solid var(--blue); box-shadow: 0 0 20px rgba(62,142,247,.35); font-size: 15px;
}
.radar-sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(62,142,247,.3), transparent 70deg); animation: sweep 3s linear infinite; }
@keyframes pulse { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(1.15); opacity: 0; } }
@keyframes sweep { to { transform: rotate(360deg); } }

/* 信号卡片 */
.signal-list { padding: 14px 16px 90px; display: grid; gap: 12px; max-width: 640px; margin: 0 auto; }
.signal-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); animation: rise .4s ease both; position: relative; overflow: hidden;
}
.signal-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--green), var(--blue)); }
.signal-card.near::before { background: linear-gradient(var(--amber), var(--blue)); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.card-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card-head .name { font-size: 17px; font-weight: 700; }
.card-head .code { font-size: 12px; color: var(--dim); }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 12px; white-space: nowrap; }
.badge.growth { background: rgba(229,72,77,.08); color: var(--red); border: 1px solid rgba(229,72,77,.25); }
.badge.steady { background: rgba(62,142,247,.08); color: var(--blue-deep); border: 1px solid var(--border); }
.badge.bull { background: rgba(18,183,106,.1); color: var(--green); border: 1px solid rgba(18,183,106,.3); font-weight: 600; }
.badge.near { background: rgba(245,158,11,.1); color: var(--amber); border: 1px solid rgba(245,158,11,.35); }
.card-nums { display: flex; gap: 16px; margin: 10px 0; font-size: 13px; flex-wrap: wrap; }
.card-nums b { font-size: 16px; }
.price b { color: var(--red); }
.dev b { color: var(--amber); }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11px; padding: 3px 8px; border-radius: 8px; background: rgba(18,183,106,.08); color: var(--green); border: 1px solid rgba(18,183,106,.2); }
.chip.warn { background: rgba(229,72,77,.07); color: var(--red); border: 1px solid rgba(229,72,77,.25); }
.chip.dim { background: rgba(107,127,150,.08); color: var(--dim); border-color: rgba(107,127,150,.2); }
.card-actions { margin-top: 10px; display: flex; gap: 8px; }
.card-actions button {
  flex: 1; padding: 9px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(62,142,247,.07); color: var(--blue-deep); font-size: 13px; font-weight: 600; cursor: pointer;
}
.card-actions button.added { background: rgba(18,183,106,.1); color: var(--green); border-color: rgba(18,183,106,.3); }

.empty { text-align: center; padding: 40px 20px; color: var(--text); }
.empty .dim { color: var(--dim); font-size: 12px; margin-top: 8px; }

/* 设置 / 自选面板 */
.panel { padding: 10px 20px 90px; max-width: 640px; margin: 0 auto; }
.panel h2 { font-size: 15px; margin: 14px 0; color: var(--blue-deep); }
.field { margin-bottom: 18px; }
.field label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text); margin-bottom: 6px; }
.field b { color: var(--amber); }
input[type=range] { width: 100%; accent-color: var(--blue); }

/* 自选股 */
.watch-head { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.search-row { position: relative; margin: 10px 0; }
#searchInput {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border);
  font-size: 14px; background: #fff; color: var(--text); outline: none; box-shadow: var(--shadow);
}
#searchInput:focus { border-color: var(--blue); }
.search-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 20px rgba(31,111,224,.15); overflow: hidden;
}
.search-results div { padding: 10px 14px; font-size: 14px; cursor: pointer; border-bottom: 1px solid rgba(62,142,247,.08); }
.search-results div:active { background: #e8f1ff; }
.search-results .dim { font-size: 12px; color: var(--dim); }
.btn-primary-line {
  width: 100%; padding: 11px; border-radius: 12px; border: 1px dashed var(--blue);
  background: rgba(62,142,247,.06); color: var(--blue-deep); font-size: 14px; font-weight: 600; cursor: pointer; margin: 6px 0 14px;
}
.watch-list { display: grid; gap: 10px; }
.watch-card {
  position: relative;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); animation: rise .3s ease both;
}
.watch-card .w-name { font-weight: 700; font-size: 15px; }
.watch-card .w-code { font-size: 12px; color: var(--dim); }
.watch-card .w-info { margin-left: auto; text-align: right; font-size: 12px; color: var(--dim); line-height: 1.7; }
.watch-card .w-info b { color: var(--text); }
.w-remove { background: none; border: none; color: var(--red); font-size: 16px; cursor: pointer; padding: 6px; }
.watch-empty { text-align: center; color: var(--dim); padding: 30px 10px; font-size: 13px; }
.vol-tag { font-size: 11px; padding: 2px 7px; border-radius: 8px; }
.vol-tag.ok { background: rgba(18,183,106,.1); color: var(--green); }
.vol-tag.bad { background: rgba(229,72,77,.08); color: var(--red); }

/* 底部导航 */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: rgba(255,255,255,.94); border-top: 1px solid var(--border);
  backdrop-filter: blur(10px); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(31,111,224,.06);
}
.nav-item { flex: 1; padding: 12px; background: none; border: none; color: var(--dim); font-size: 13px; cursor: pointer; }
.nav-item.active { color: var(--blue-deep); font-weight: 700; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(28,43,58,.55); display: grid; place-items: center; z-index: 50; padding: 14px; }
.modal-box { width: 100%; max-width: 640px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: 0 8px 40px rgba(31,111,224,.25); }
.modal-box header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#chart { height: 320px; }
.chart-meta { font-size: 12px; color: var(--dim); margin-top: 8px; line-height: 1.8; }

/* Toast */
.toast {
  position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%);
  background: rgba(31,111,224,.92); color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: 13px; z-index: 99; box-shadow: 0 4px 14px rgba(31,111,224,.4);
}

.dim { color: var(--dim); }

/* ---------- AI 深度分析 ---------- */
.field input[type=text], .field input[type=password] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #f6faff; color: var(--text); font-size: 14px; outline: none;
}
.field input[type=text]:focus, .field input[type=password]:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(62,142,247,.15); }
.btn-ai {
  width: 100%; margin-top: 12px; padding: 11px; border: none; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, var(--blue), #6aa9ff); color: #fff; font-size: 14px; font-weight: 600;
}
.btn-ai:active { opacity: .85; }
.ai-box { max-height: 80vh; display: flex; flex-direction: column; }
.ai-body { overflow-y: auto; font-size: 14px; line-height: 1.75; color: var(--text); padding: 2px 4px; }
.ai-body h2 { font-size: 15px; color: var(--blue); margin: 14px 0 6px; padding-left: 8px; border-left: 3px solid var(--blue); }
.ai-body h2:first-child { margin-top: 0; }
.ai-body ul { margin: 4px 0 8px 18px; padding: 0; }
.ai-body li { margin: 3px 0; }
.ai-body strong { color: #0f3d80; }
.ai-body .ai-loading { text-align: center; padding: 40px 10px; color: var(--dim); }
.ai-body .ai-loading .spin { display: inline-block; width: 34px; height: 34px; border: 3px solid rgba(62,142,247,.2); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin-bottom: 12px; }
.ai-body .ai-err { background: #fff3f3; border: 1px solid #f3c2c2; color: #b42318; padding: 12px; border-radius: 10px; font-size: 13px; }
.ai-body .ai-disc { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 11px; color: var(--dim); }
.ai-verdict { display: inline-block; margin: 2px 0 8px; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.ai-verdict.bull { background: rgba(18,183,106,.12); color: #0e9f5c; }
.ai-verdict.neutral { background: rgba(240,180,41,.14); color: #b7791f; }
.ai-verdict.cautious { background: rgba(229,72,77,.12); color: #c92a2f; }
@keyframes spin { to { transform: rotate(360deg); } }
.w-ai {
  position: absolute; right: 40px; bottom: 10px; width: 34px; height: 30px;
  border: 1px solid var(--border); border-radius: 8px; background: #f6faff;
  cursor: pointer; font-size: 14px; line-height: 1;
}

/* ===== 开机动画（与图标同构图） ===== */
.splash {
  position: fixed; inset: 0; z-index: 999;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #e8f1ff 0%, #f7faff 45%, #ffffff 100%);
  transition: opacity .55s ease, visibility .55s;
}
.splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-card { display: grid; justify-items: center; gap: 20px; animation: spIn .6s ease both; }
.splash-art {
  width: min(60vw, 52vh, 330px); height: auto;
  filter: drop-shadow(0 12px 28px rgba(31, 111, 224, .16));
}
.sp-grid { opacity: 0; animation: spFade 1.1s .15s ease both; }
.sp-area { opacity: 0; animation: spFade 1.2s 1.75s ease both; }
.sp-curve {
  stroke-dasharray: 280; stroke-dashoffset: 280;
  animation: spDraw 1.35s .5s cubic-bezier(.4, 0, .2, 1) both;
}
.sp-c {
  transform-box: fill-box; transform-origin: center bottom;
  transform: scaleY(0);
  animation: spGrow .7s cubic-bezier(.34, 1.56, .64, 1) both;
}
.sp-c1 { animation-delay: .8s; }
.sp-c2 { animation-delay: 1.15s; }
.sp-c3 { animation-delay: 1.5s; }
.sp-dot {
  opacity: 0; animation: spFade .6s 2.05s ease both;
  transform-box: fill-box; transform-origin: center;
}
.sp-glow {
  transform-box: fill-box; transform-origin: center;
  animation: spPulse 2.4s 2.35s ease-in-out infinite;
}
.sp-label {
  opacity: 0; animation: spFade .9s 1.7s ease both;
  fill: #1f6fe0; font: 800 21px "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 1px;
}
.sp-word { text-align: center; opacity: 0; animation: spFade 1s 2.35s ease both; }
.sp-word h1 { font-size: 30px; letter-spacing: 3px; color: #1c2b3a; font-weight: 800; }
.sp-word p { margin-top: 7px; font-size: 13px; color: #6b7f96; letter-spacing: 1.5px; }
@keyframes spIn { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes spDraw { to { stroke-dashoffset: 0; } }
@keyframes spGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes spFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spPulse {
  0%, 100% { transform: scale(1); opacity: .95; }
  50% { transform: scale(1.35); opacity: .45; }
}
@media (prefers-reduced-motion: reduce) {
  .splash { display: none; }
}
