:root {
  --bg: #0a1628;
  --bg2: #112240;
  --bg3: #1a3358;
  --text: #ccd6e0;
  --text-bright: #e6f1ff;
  --accent: #1a73e8;
  --accent2: #4dabf7;
  --green: #00c853;
  --yellow: #ffd600;
  --red: #ff5252;
  --orange: #ff9100;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* --- NAV --- */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--bg3);
  display: flex; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; text-align: center; padding: 10px 4px 8px;
  color: var(--text); text-decoration: none; font-size: 11px;
  transition: color .2s;
}
.nav-item.active { color: var(--accent2); }
.nav-item svg { display: block; margin: 0 auto 2px; width: 24px; height: 24px; }

/* --- PAGES --- */
.page { display: none; padding: 16px 16px 80px; max-width: 600px; margin: 0 auto; }
.page.active { display: block; }

/* --- HEADER --- */
.page-header {
  font-size: 22px; font-weight: 700; color: var(--text-bright);
  margin-bottom: 16px; padding-top: 8px;
}
.page-header small { font-size: 13px; color: var(--text); font-weight: 400; display: block; margin-top: 2px; }

/* --- CARDS --- */
.card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 14px; font-weight: 600; color: var(--text-bright);
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.card-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 14px;
}
.card-row + .card-row { border-top: 1px solid var(--bg3); }
.card-label { color: var(--text); }
.card-value { color: var(--text-bright); font-weight: 500; }

/* --- SPECIES RANKING --- */
.species-rank {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--bg2); border-radius: var(--radius);
  margin-bottom: 8px; box-shadow: var(--shadow);
}
.rank-num {
  font-size: 18px; font-weight: 700; color: var(--accent2);
  min-width: 28px; text-align: center;
}
.rank-info { flex: 1; }
.rank-species { font-size: 15px; font-weight: 600; color: var(--text-bright); }
.rank-meta { font-size: 12px; color: var(--text); margin-top: 2px; }
.rank-prob {
  font-size: 18px; font-weight: 700; text-align: right;
}
.rank-driver {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  display: inline-block; margin-top: 2px;
}
.driver-seasonal { background: #1a3358; color: var(--accent2); }
.driver-conditions { background: #1a3820; color: var(--green); }
.driver-mixed { background: #3a2f10; color: var(--yellow); }

.rank-warning {
  font-size: 11px; color: var(--orange); margin-top: 4px;
}

/* --- FORMS --- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 13px; color: var(--text);
  margin-bottom: 4px; font-weight: 500;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; font-size: 15px;
  background: var(--bg3); color: var(--text-bright);
  border: 1px solid transparent; border-radius: 8px;
  outline: none; transition: border .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.btn {
  display: inline-block; padding: 12px 24px; font-size: 15px; font-weight: 600;
  border: none; border-radius: 8px; cursor: pointer; text-align: center;
  transition: opacity .2s; width: 100%;
}
.btn:active { opacity: .8; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text-bright); }
.btn-danger { background: var(--red); color: #fff; }

/* --- CATCH LOG --- */
.catch-item {
  background: var(--bg2); border-radius: var(--radius);
  padding: 14px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.catch-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.catch-species { font-size: 16px; font-weight: 600; color: var(--text-bright); }
.catch-date { font-size: 12px; color: var(--text); }
.catch-details { font-size: 13px; color: var(--text); }
.catch-details span { margin-right: 12px; }

/* --- STATS BAR --- */
.stat-bar {
  height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden;
  margin-top: 4px;
}
.stat-fill { height: 100%; border-radius: 3px; transition: width .5s; }
.stat-fill.green { background: var(--green); }
.stat-fill.yellow { background: var(--yellow); }
.stat-fill.blue { background: var(--accent2); }

/* --- LOGIN --- */
.login-page {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100dvh; padding: 24px;
}
.login-box {
  background: var(--bg2); border-radius: var(--radius); padding: 32px;
  width: 100%; max-width: 360px; box-shadow: var(--shadow);
}
.login-title {
  font-size: 24px; font-weight: 700; color: var(--text-bright);
  text-align: center; margin-bottom: 4px;
}
.login-sub {
  font-size: 13px; color: var(--text); text-align: center; margin-bottom: 24px;
}

/* --- TOAST --- */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: var(--bg2); color: var(--text-bright);
  padding: 12px 20px; border-radius: 8px; box-shadow: var(--shadow);
  font-size: 14px; z-index: 200; opacity: 0; transition: opacity .3s;
  border-left: 4px solid var(--green);
}
.toast.error { border-left-color: var(--red); }
.toast.show { opacity: 1; }

/* --- LOADING --- */
.loading { text-align: center; padding: 40px; color: var(--text); }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--bg3);
  border-top-color: var(--accent2); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- EMPTY STATE --- */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; margin-top: 8px; }
