:root {
  --bg-dark: #0A0D14;
  --bg-elevated: rgba(255, 255, 255, 0.03);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 255, 255, 0.15);
  
  --text-main: #FFFFFF;
  --text-muted: #94A3B8;
  
  --color-brand: #818CF8;
  /* 台灣台股多空配色: 紅漲綠跌 */
  --color-bull: #F87171; /* 紅色 - 多方 */
  --color-bull-glow: rgba(248, 113, 113, 0.2);
  --color-bear: #4ADE80; /* 綠色 - 空方 */
  --color-bear-glow: rgba(74, 222, 128, 0.2);

  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --blur-strong: blur(16px);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', -apple-system, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* 背景光效 */
.bg-blur {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--bg-dark);
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.15;
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  top: -100px;
  right: -100px;
  background: var(--color-brand);
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  bottom: -150px;
  left: -50px;
  background: var(--color-bull);
}

/* Layout Views */
.view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

.view.hidden {
  display: none !important;
}

#login-view {
  align-items: center;
  justify-content: center;
}

/* 玻璃擬態卡片 */
.glass-card {
  background: var(--bg-elevated);
  backdrop-filter: var(--blur-strong);
  -webkit-backdrop-filter: var(--blur-strong);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  box-shadow: var(--shadow-glass);
}

/* 登入卡片 */
.login-card {
  padding: 48px;
  text-align: center;
  width: 90%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-brand), #E0E7FF);
}

.logo h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 15px;
}

/* Buttons */
.btn {
  font-family: 'Outfit', sans-serif;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-smooth);
}

.primary-btn {
  background: #FFFFFF;
  color: #000000;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 16px;
  width: 100%;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.btn-icon {
  width: 20px;
  height: 20px;
}

.text-btn {
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.text-btn:hover {
  color: var(--text-main);
}

/* Nav */
.glass-nav {
  position: sticky;
  top: 0;
  padding: 16px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 13, 20, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  z-index: 100;
}

.small-logo h2 {
  font-size: 20px;
  font-weight: 600;
}

.small-logo .logo-icon {
  width: 24px;
  height: 24px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

#user-info {
  font-size: 14px;
  color: var(--text-muted);
}

/* 主內容區 */
.dashboard-content {
  padding: 40px 5%;
  flex-grow: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 40px;
}

.dashboard-header h1 {
  font-size: 36px;
  font-weight: 600;
  margin-bottom: 8px;
}

.dashboard-header p {
  color: var(--text-muted);
  font-size: 16px;
}

.meta-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-glass);
}

.time-text {
  color: var(--text-muted);
  font-size: 13px;
}

/* 結果卡片 Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.result-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: var(--transition-smooth);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.result-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* 台股多空邊框發光 */
.card-bull { border-bottom: 2px solid var(--color-bull); }
.card-bear { border-bottom: 2px solid var(--color-bear); }

.card-bull:hover { box-shadow: 0 12px 40px var(--color-bull-glow); }
.card-bear:hover { box-shadow: 0 12px 40px var(--color-bear-glow); }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.ticker-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ticker-id {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-main);
}

.ticker-name {
  font-size: 16px;
  color: var(--text-muted);
}

/* 主題徽章 */
.dir-badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.dir-bull {
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-bull);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.dir-bear {
  background: rgba(74, 222, 128, 0.1);
  color: var(--color-bear);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

/* 分數版區 */
.score-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border-radius: 12px;
}

.score-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-value {
  font-size: 18px;
  font-weight: 500;
}

.total-score {
  font-size: 24px;
  font-weight: 600;
  color: var(--color-brand);
}

.pattern-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ptag {
  font-size: 11px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  color: var(--text-muted);
}

/* Animations */
.fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Skeleton Loading */
.skeleton .skeleton-box {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

.title-sk { width: 120px; height: 28px; }
.badge-sk { width: 60px; height: 28px; border-radius: 8px; }
.desc-sk { width: 100%; height: 80px; border-radius: 12px; margin-top: 10px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Error message */
.error-msg {
  color: var(--color-bull) !important;
  font-size: 14px;
  min-height: 20px;
}

@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}
