/* ============================================================
 * Base / Reset
 * ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

#app {
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(59, 130, 246, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(139, 92, 246, 0.05), transparent 60%),
    var(--bg-base);
}

/* Numeric / monospace */
.font-mono,
.num,
.tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3a4663;
}

/* Selection */
::selection {
  background: rgba(59, 130, 246, 0.35);
  color: #fff;
}

/* Links */
a {
  color: var(--brand-bright);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input,
textarea {
  font-family: inherit;
}

/* Utility: up / down text color with glow */
.text-up {
  color: var(--up);
  text-shadow: 0 0 12px var(--up-glow);
}
.text-down {
  color: var(--down);
  text-shadow: 0 0 12px var(--down-glow);
}

/* Flash animation classes (toggled by JS) */
.flash-up {
  animation: flashUp 600ms ease-out;
}
.flash-down {
  animation: flashDown 600ms ease-out;
}

/* Page title */
.page-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Card */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i {
  color: var(--brand);
}
.card-body {
  padding: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  transition: all 0.15s var(--ease-out);
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-btn-brand);
}
.btn-primary:hover {
  background: var(--brand-bright);
}
.btn-secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--brand);
}
.btn-ghost {
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 18px;
  border-radius: var(--radius-btn);
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.tag-up {
  background: var(--up-soft);
  color: var(--up);
  border-color: rgba(239, 68, 68, 0.25);
}
.tag-down {
  background: var(--down-soft);
  color: var(--down);
  border-color: rgba(34, 197, 94, 0.25);
}
.tag-brand {
  background: var(--brand-soft);
  color: var(--brand-bright);
  border-color: rgba(59, 130, 246, 0.3);
}
.tag-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.3);
}
.tag-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: rgba(139, 92, 246, 0.3);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* Page enter animation */
.page-enter {
  animation: pageEnter 0.28s var(--ease-out);
}

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