:root {
  --bg-primary: #0b0e14;
  --bg-card: #121824;
  --bg-card-hover: #161e2e;
  --bg-input: #1a2233;
  --border-color: #212c3d;
  --border-highlight: #2e3d54;

  --binance-yellow: #F0B90B;
  --binance-yellow-hover: #FCD535;
  --profit-green: #0ECB81;
  --profit-green-glow: rgba(14, 203, 129, 0.25);
  --loss-red: #F6465D;
  --loss-red-glow: rgba(246, 70, 93, 0.25);
  --text-primary: #eaecef;
  --text-secondary: #848e9c;
  --text-muted: #5d697e;

  --font-mono: "SF Mono", "Roboto Mono", Menlo, Consolas, Monaco, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ================= Top Marquee ================= */
.marquee-container {
  background: linear-gradient(90deg, #1b1604, #2d141b, #1b1604);
  border-bottom: 1px solid #4a3410;
  overflow: hidden;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 7px 0;
}

.marquee-content {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 38s linear infinite;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  margin-right: 48px;
  color: #f7d358;
}

.marquee-item.danger {
  color: #ff7888;
}

.marquee-item.warning {
  color: #f0b90b;
}

.marquee-item.zen {
  color: #0ecb81;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ================= Navigation Header ================= */
.header-bar {
  background: rgba(18, 24, 36, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: linear-gradient(135deg, #f0b90b, #e59c00);
  color: #000;
  font-weight: 900;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(240, 185, 11, 0.35);
  letter-spacing: 0.5px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

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

.btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
}

.btn-primary {
  background: var(--binance-yellow);
  color: #000;
  border-color: var(--binance-yellow);
}

.btn-primary:hover {
  background: var(--binance-yellow-hover);
  box-shadow: 0 0 10px rgba(240, 185, 11, 0.4);
}

.btn-danger-outline {
  color: var(--loss-red);
  border-color: rgba(246, 70, 93, 0.4);
}

.btn-danger-outline:hover {
  background: rgba(246, 70, 93, 0.1);
  border-color: var(--loss-red);
}

/* ================= Main Container ================= */
.main-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ================= Euphoria / Mindset Alert Box ================= */
.alert-sober-banner {
  background: radial-gradient(circle at 10% 20%, rgba(246, 70, 93, 0.15) 0%, rgba(18, 24, 36, 0.95) 90%);
  border: 1px solid rgba(246, 70, 93, 0.45);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(246, 70, 93, 0.12);
}

.alert-icon {
  font-size: 28px;
  line-height: 1;
}

.alert-content h3 {
  font-size: 15px;
  color: #ff7888;
  font-weight: 700;
  margin-bottom: 4px;
}

.alert-content p {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.6;
}

/* ================= Euphoria Gauge & Reality Buster Grid ================= */
.duo-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 24px;
}

@media (max-width: 960px) {
  .duo-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Euphoria Gauge Widget */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
}

.gauge-meter {
  position: relative;
  width: 200px;
  height: 100px;
  overflow: hidden;
}

.gauge-arc {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 18px solid var(--bg-input);
  border-top-color: var(--loss-red);
  border-right-color: var(--binance-yellow);
  border-left-color: var(--profit-green);
  transform: rotate(-45deg);
  box-sizing: border-box;
}

.gauge-score {
  font-size: 38px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #fff;
  margin-top: -15px;
  text-shadow: 0 0 16px rgba(246, 70, 93, 0.6);
}

.gauge-badge {
  background: rgba(246, 70, 93, 0.2);
  color: #ff7888;
  border: 1px solid rgba(246, 70, 93, 0.4);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}

.gauge-breakdown {
  width: 100%;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
}

.breakdown-label {
  color: var(--text-secondary);
}

.breakdown-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Simulator Widget */
.sim-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.sim-input-group label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.sim-input-group input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.sim-results-banner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.fantasy-box {
  background: linear-gradient(135deg, rgba(240, 185, 11, 0.12), rgba(240, 185, 11, 0.02));
  border: 1px dashed rgba(240, 185, 11, 0.4);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.reality-box {
  background: linear-gradient(135deg, rgba(246, 70, 93, 0.15), rgba(246, 70, 93, 0.02));
  border: 1px solid rgba(246, 70, 93, 0.45);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.box-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.fantasy-box .box-tag { color: var(--binance-yellow); }
.reality-box .box-tag { color: #ff7888; }

.box-val {
  font-size: 20px;
  font-weight: 900;
  font-family: var(--font-mono);
}

.fantasy-box .box-val { color: var(--binance-yellow); }
.reality-box .box-val { color: var(--loss-red); }

.box-note {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sim-canvas-container {
  width: 100%;
  height: 220px;
  position: relative;
  background: #0d1117;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.sim-canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sim-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.sim-stat-text {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ================= KPI Stats Grid ================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
  letter-spacing: -0.5px;
}

.kpi-value.green {
  color: var(--profit-green);
  text-shadow: 0 0 10px var(--profit-green-glow);
}

.kpi-value.yellow {
  color: var(--binance-yellow);
}

.kpi-value.red {
  color: var(--loss-red);
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ================= Charts Grid ================= */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

@media (max-width: 1000px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  height: 330px;
  display: flex;
  flex-direction: column;
}

.chart-box {
  flex: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.chart-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ================= Table Section ================= */
.table-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.filters-group {
  display: flex;
  gap: 8px;
}

.filter-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active, .filter-btn:hover {
  background: #232d40;
  color: #fff;
  border-color: var(--binance-yellow);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

th {
  background: #141b26;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.tag-long {
  background: rgba(14, 203, 129, 0.15);
  color: var(--profit-green);
  border: 1px solid rgba(14, 203, 129, 0.3);
}

.tag-short {
  background: rgba(246, 70, 93, 0.15);
  color: var(--loss-red);
  border: 1px solid rgba(246, 70, 93, 0.3);
}

.tag-cross {
  background: rgba(240, 185, 11, 0.15);
  color: var(--binance-yellow);
  border: 1px solid rgba(240, 185, 11, 0.3);
}

.pnl-cell {
  font-family: var(--font-mono);
  font-weight: 700;
}

.pnl-cell.positive {
  color: var(--profit-green);
}

.pnl-cell.negative {
  color: var(--loss-red);
}

/* ================= Philosophy Section ================= */
.philosophy-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .philosophy-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .philosophy-grid {
    grid-template-columns: 1fr;
  }
}

.philo-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
}

.philo-num {
  color: var(--binance-yellow);
  font-weight: 900;
  font-size: 14px;
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.philo-item h4 {
  font-size: 13px;
  color: #fff;
  margin-bottom: 6px;
}

.philo-item p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ================= Modals ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  padding: 24px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 32px 20px;
  text-align: center;
  margin: 16px 0;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.01);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--binance-yellow);
  background: rgba(240, 185, 11, 0.05);
}

.drop-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.preview-box {
  background: var(--bg-input);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  margin-bottom: 16px;
  display: none;
}

/* ================= Footer ================= */
footer {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
}

/* ================= Trade Journal & Review Styles ================= */
.journal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(240, 185, 11, 0.1);
  border: 1px solid rgba(240, 185, 11, 0.35);
  color: var(--binance-yellow);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.journal-badge:hover {
  background: rgba(240, 185, 11, 0.22);
  border-color: var(--binance-yellow);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(240, 185, 11, 0.2);
}

.journal-badge.empty {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-color);
  color: var(--text-muted);
}

.journal-badge.empty:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.emotion-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.emotion-死扛, .emotion-侥幸死扛, .emotion-被动死扛 {
  background: rgba(246, 70, 93, 0.2);
  color: #ff7888;
  border: 1px solid rgba(246, 70, 93, 0.4);
}

.emotion-顺风大意, .emotion-不服再摸, .emotion-执迷做空 {
  background: rgba(240, 185, 11, 0.2);
  color: #f7d358;
  border: 1px solid rgba(240, 185, 11, 0.4);
}

.emotion-理性执行, .emotion-顺势追涨 {
  background: rgba(14, 203, 129, 0.2);
  color: #0ecb81;
  border: 1px solid rgba(14, 203, 129, 0.4);
}

.emotion-左侧摸顶, .emotion-极度危险摸顶, .emotion-贪婪上头 {
  background: rgba(147, 83, 211, 0.2);
  color: #c084fc;
  border: 1px solid rgba(147, 83, 211, 0.4);
}

.emotion-恐慌超短, .emotion-耐心耗尽, .emotion-犹豫徘徊, .emotion-跨界尝试 {
  background: rgba(56, 136, 255, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(56, 136, 255, 0.4);
}

/* Journal Modal Grid */
.journal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.journal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.journal-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.journal-input, .journal-textarea, .journal-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  padding: 8px 12px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.journal-textarea {
  min-height: 64px;
  resize: vertical;
  line-height: 1.5;
}

.journal-input:focus, .journal-textarea:focus, .journal-select:focus {
  outline: none;
  border-color: var(--binance-yellow);
}

.journal-summary-bar {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.star-rating {
  display: flex;
  gap: 4px;
  cursor: pointer;
  font-size: 18px;
  color: var(--border-highlight);
}

.star-rating .star.filled {
  color: var(--binance-yellow);
}
