:root {
  --bg: #F5F5F5;
  --card: #ffffff;
  --soft: #f0f0f2;
  --line: #e0e0e4;
  --text: #1a1d23;
  --muted: #6b7280;
  --green: #00D925;
  --yellow: #FFC400;
  --blue: #1E5EFF;
  --red: #FF1A1A;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.landing-float-btn {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 10001;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(30, 94, 255, 0.18);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.landing-float-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(30, 94, 255, 0.4);
  box-shadow: var(--shadow-lg);
}

/* Welcome Screen */
.welcome-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  overflow: hidden;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.welcome-screen.hidden {
  opacity: 0;
  transform: scale(1.1);
  pointer-events: none;
}

.welcome-content {
  text-align: center;
  position: relative;
  z-index: 2;
  animation: fadeInUp 1s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-title {
  font-size: 3.5rem;
  font-weight: 900;
  color: #1E5EFF;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}

.welcome-subtitle {
  font-size: 1.5rem;
  color: #00D925;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: 2px;
}

.welcome-desc {
  font-size: 1.1rem;
  color: #6b7280;
  margin-bottom: 3rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.welcome-btn {
  background: #1E5EFF;
  color: white;
  border: none;
  padding: 1.2rem 3rem;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 10px 40px rgba(30, 94, 255, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.welcome-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.welcome-btn:hover::before {
  left: 100%;
}

.welcome-btn:hover {
  background: #0044CC;
  transform: translateY(-3px);
  box-shadow: 0 15px 50px rgba(30, 94, 255, 0.4);
}

.btn-arrow {
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.welcome-btn:hover .btn-arrow {
  transform: translateX(5px);
}

.welcome-decoration {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
}

.deco-circle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.1;
  animation: floatDeco 20s ease-in-out infinite;
}

.deco-1 {
  width: 300px;
  height: 300px;
  background: #1E5EFF;
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.deco-2 {
  width: 200px;
  height: 200px;
  background: #00D925;
  top: 20%;
  right: -50px;
  animation-delay: 5s;
}

.deco-3 {
  width: 250px;
  height: 250px;
  background: #FFC400;
  bottom: -80px;
  left: 10%;
  animation-delay: 10s;
}

.deco-4 {
  width: 180px;
  height: 180px;
  background: #FF1A1A;
  bottom: 20%;
  right: 15%;
  animation-delay: 15s;
}

@keyframes floatDeco {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(30px, -30px) rotate(120deg);
  }
  66% {
    transform: translate(-20px, 20px) rotate(240deg);
  }
}

@media (max-width: 768px) {
  .welcome-title {
    font-size: 2.5rem;
  }
  
  .welcome-subtitle {
    font-size: 1.2rem;
  }
  
  .welcome-desc {
    font-size: 1rem;
    padding: 0 1rem;
  }
  
  .welcome-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
  }
}

.container { max-width: 1320px; margin: 0 auto; padding: 24px 20px 60px; }

.header { text-align: center; margin-bottom: 36px; }
.logo { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; color: var(--blue); }
.subtitle { color: var(--muted); font-size: 15px; margin-top: 6px; }

.screen { display: none; }
.screen.active { display: block; }
.screen-title { font-size: 22px; font-weight: 700; margin-bottom: 24px; text-align: center; }

.screen-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.screen-header .screen-title { margin-bottom: 0; flex: 1; text-align: center; }

/* Buttons */
.btn {
  padding: 10px 20px; border-radius: 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover:not(:disabled) { background: #1550e0; }
.btn-success { background: var(--green); color: #111; }
.btn-warning { background: var(--yellow); color: #111; }
.btn-danger { background: var(--red); color: white; }
.btn-outline { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn-outline:hover { background: var(--soft); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; }

.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

/* Screen 1: Personality */
.personality-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

.personality-card {
  background: var(--card); border: 2px solid var(--line); border-radius: 16px;
  padding: 32px 24px; cursor: pointer; transition: all 0.25s; text-align: center;
  position: relative;
}
.personality-card:hover { border-color: var(--blue); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.personality-card.featured { border-color: var(--blue); }
.featured-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: white; padding: 4px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}

.personality-animal { font-size: 56px; margin-bottom: 16px; }
.personality-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.personality-type { font-size: 13px; color: var(--blue); font-weight: 600; margin-bottom: 8px; }
.personality-desc { font-size: 14px; color: var(--muted); margin-bottom: 16px; }

.alloc-preview { text-align: left; border-top: 1px solid var(--line); padding-top: 12px; }
.alloc-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: var(--muted); }
.alloc-row span:last-child { font-weight: 600; color: var(--text); }

/* Screen 2: Allocation */
.budget-display { text-align: right; }
.budget-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.budget-amount { font-size: 20px; font-weight: 700; color: var(--blue); }

.alloc-actions { display: flex; gap: 8px; margin-bottom: 16px; justify-content: center; }

.remaining-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 16px; font-size: 14px;
}
.warning-text { color: var(--red); font-weight: 600; font-size: 13px; }
.hidden { display: none !important; }

.sector-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.sector-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.sector-card-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.sector-pct {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

.sector-pct.locked {
  color: var(--muted);
}

.sector-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.etf-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.etf-choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.etf-choice:hover {
  border-color: var(--primary);
  background: rgba(30, 94, 255, 0.05);
}

.etf-choice.selected {
  border-color: var(--primary);
  background: rgba(30, 94, 255, 0.1);
}

.etf-choice input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.etf-choice-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.etf-choice .etf-code {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.etf-choice .etf-name {
  font-size: 0.8rem;
  color: var(--muted);
}
.sector-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sector-card-header h3 { font-size: 16px; font-weight: 600; }
.sector-pct { font-size: 13px; color: var(--muted); font-weight: 500; }

.etf-inputs { display: grid; gap: 10px; }
.etf-input-row { display: grid; grid-template-columns: 1fr 160px; align-items: center; gap: 12px; }
.etf-input-info { display: flex; flex-direction: column; gap: 2px; }
.etf-code { font-size: 13px; font-weight: 600; color: var(--blue); }
.etf-name { font-size: 12px; color: var(--muted); }
.etf-input-field { display: flex; align-items: center; gap: 4px; }
.input-prefix { font-size: 14px; color: var(--muted); font-weight: 600; }
.etf-amount-input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: var(--card); color: var(--text); outline: none;
  transition: border-color 0.15s;
}
.etf-amount-input:focus { border-color: var(--blue); }

.action-bar { display: flex; justify-content: center; margin-top: 24px; }

/* Screen 3: Simulation */
.sim-header {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 8px;
}
.sim-date-block { display: flex; flex-direction: column; gap: 2px; min-width: 120px; }
.sim-date { font-size: 18px; font-weight: 700; }
.sim-day-count { font-size: 12px; color: var(--muted); }

.sim-stats { display: flex; gap: 12px; flex: 1; justify-content: center; flex-wrap: wrap; }
.stat-pill {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 16px;
  background: var(--soft); border-radius: 8px; min-width: 90px; text-align: center;
}
.stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 15px; font-weight: 700; }

.sim-controls { display: flex; gap: 6px; flex-wrap: wrap; }

.sim-progress-bar { height: 3px; background: var(--soft); border-radius: 2px; margin-bottom: 16px; overflow: hidden; }
.sim-progress-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width 0.3s ease; }

.sim-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }

.chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.chart-card-header { margin-bottom: 12px; }
.chart-card-header h3 { font-size: 15px; font-weight: 600; }
.chart-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }

.chart-wrap { position: relative; }
.chart-lg { height: 300px; }
.chart-xl { height: 360px; }
.chart-sm { height: 140px; }

.sector-charts-section { margin-top: 16px; }
.sector-charts-section > h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.sector-charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }

.sector-chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
.sector-chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.sector-return { font-size: 12px; font-weight: 700; }

/* Trade Panel */
.trade-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; position: sticky; top: 16px;
}
.trade-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.trade-tab {
  padding: 12px; text-align: center; font-size: 14px; font-weight: 600;
  cursor: pointer; background: var(--soft); border: none; color: var(--muted); transition: all 0.15s;
}
.trade-tab.active { background: var(--card); color: var(--text); border-bottom: 2px solid var(--blue); }

.trade-content { padding: 16px; }
.field-label { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 4px; margin-top: 10px; }
.field-label:first-child { margin-top: 0; }
.field-select, .field-input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: var(--card); color: var(--text); outline: none;
}
.field-select:focus, .field-input:focus { border-color: var(--blue); }

.quick-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; }
.quick-btn {
  padding: 5px; font-size: 11px; font-weight: 600; border: 1px solid var(--line);
  border-radius: 6px; background: var(--soft); cursor: pointer; color: var(--text); transition: all 0.15s;
}
.quick-btn:hover { background: var(--line); }

.trade-info { margin-top: 10px; padding: 10px; background: var(--soft); border-radius: 8px; font-size: 12px; }
.info-row { display: flex; justify-content: space-between; padding: 3px 0; }
.info-row span:first-child { color: var(--muted); }
.info-row span:last-child { font-weight: 600; }
.info-warn span:last-child { color: var(--red); }
.info-lock { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }

.positions-summary, .trade-log-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-top: 12px;
}
.positions-summary h4, .trade-log-panel h4 { font-size: 13px; font-weight: 600; margin-bottom: 10px; }

.holdings-list { display: grid; gap: 6px; }
.holding-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; background: var(--soft); border-radius: 6px; font-size: 13px;
}

.positions-list { display: grid; gap: 8px; max-height: 400px; overflow-y: auto; }
.position-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--card); }
.position-card.locked { opacity: 0.6; background: var(--soft); }
.pos-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.pos-header strong { font-size: 13px; }
.pos-header small { font-size: 11px; color: var(--muted); }
.lock-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: #fef3c7; color: #92400e; font-weight: 600; }
.lock-badge.unlocked { background: #d1fae5; color: #065f46; }
.pos-details { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; font-size: 11px; color: var(--muted); }

.trade-log { max-height: 180px; overflow-y: auto; }
.log-entry { display: grid; grid-template-columns: 70px 36px 1fr auto; gap: 6px; align-items: center; font-size: 11px; padding: 5px 0; border-bottom: 1px solid var(--soft); }
.log-entry:last-child { border-bottom: none; }
.log-date { color: var(--muted); }
.log-action { font-weight: 700; }
.log-entry.buy .log-action { color: var(--blue); }
.log-entry.sell .log-action { color: var(--red); }
.log-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-amount { font-weight: 600; text-align: right; }

.empty-state { text-align: center; color: var(--muted); font-size: 13px; padding: 16px; }

/* Screen 4: Results */
.achievement-section { margin-bottom: 24px; }
.achievement-card {
  display: flex; align-items: center; gap: 20px; padding: 24px;
  background: var(--card); border: 2px solid var(--line); border-radius: 16px;
  animation: achievementSlideIn 0.6s ease-out;
}
.achievement-card.tier-3 { border-color: var(--blue); box-shadow: 0 0 20px rgba(30,94,255,0.15); }
.achievement-card.tier-4 { border-color: var(--yellow); box-shadow: 0 0 24px rgba(255,196,0,0.2); }
.achievement-card.tier-5 { border-color: var(--green); box-shadow: 0 0 32px rgba(0,217,37,0.25); animation: achievementPulse 2s infinite; }

@keyframes achievementSlideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes achievementPulse { 0%, 100% { box-shadow: 0 0 32px rgba(0,217,37,0.25); } 50% { box-shadow: 0 0 48px rgba(0,217,37,0.4); } }

.achievement-icon { font-size: 56px; }
.achievement-info h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.achievement-info p { font-size: 14px; color: var(--muted); }
.achievement-return { font-size: 16px; font-weight: 700; margin-top: 8px; }

.result-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 24px; }
.result-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; text-align: center;
}
.result-card span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; }
.result-card strong { font-size: 16px; font-weight: 700; }

.analysis-section { margin-bottom: 24px; }
.analysis-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; font-size: 15px; line-height: 1.8;
}
.analysis-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.analysis-card p { margin-bottom: 8px; }
.analysis-highlight { margin-top: 16px; padding: 12px; background: var(--soft); border-radius: 8px; font-weight: 600; }

.final-trade-log { overflow-x: auto; }
.trade-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.trade-table th { text-align: left; padding: 10px 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; border-bottom: 1px solid var(--line); }
.trade-table td { padding: 8px; border-bottom: 1px solid var(--soft); }
.action-buy { color: var(--blue); font-weight: 600; }
.action-sell { color: var(--red); font-weight: 600; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--card); border-radius: 16px; padding: 28px; max-width: 500px;
  width: 100%; box-shadow: var(--shadow-lg); animation: modalSlideIn 0.3s ease-out;
}
@keyframes modalSlideIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.modal-footer { margin-top: 20px; text-align: center; }

.snapshot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.snapshot-item { padding: 12px; background: var(--soft); border-radius: 8px; }
.snapshot-item span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.snapshot-item strong { font-size: 16px; font-weight: 700; }

.pause-holdings { margin-top: 16px; }
.pause-holdings h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.pause-holding { display: flex; justify-content: space-between; padding: 8px 10px; background: var(--soft); border-radius: 6px; font-size: 13px; margin-bottom: 4px; }

/* Responsive */
@media (max-width: 1024px) {
  .sim-layout { grid-template-columns: 1fr; }
  .trade-panel { position: static; }
}
@media (max-width: 768px) {
  .personality-grid { grid-template-columns: 1fr; }
  .etf-input-row { grid-template-columns: 1fr; }
  .sim-header { flex-direction: column; align-items: stretch; }
  .sim-controls { justify-content: center; }
  .result-summary { grid-template-columns: repeat(2, 1fr); }
  .snapshot-grid { grid-template-columns: 1fr; }
}
