/* AB Tracker - Professional Colorful Light Theme */
/* Font: Poppins + Nunito */

:root {
  --primary: #4F46E5;
  --primary-light: #EEF2FF;
  --primary-dark: #3730A3;
  --secondary: #06B6D4;
  --in-color: #2563EB;
  --in-light: #DBEAFE;
  --out-color: #DC2626;
  --out-light: #FEE2E2;
  --green: #16A34A;
  --green-light: #DCFCE7;
  --orange: #EA580C;
  --orange-light: #FEF3C7;
  --purple: #7C3AED;
  --purple-light: #EDE9FE;
  --bg: #F0F4FF;
  --card-bg: #FFFFFF;
  --text: #1E1B4B;
  --text-light: #6B7280;
  --border: #E5E7EB;
  --shadow: 0 4px 24px rgba(79,70,229,0.10);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --nav-height: 68px;
  --header-height: 58px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 12px);
  padding-top: var(--header-height);
}

/* ======================== HEADER ======================== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 2px solid var(--primary-light);
  z-index: 100;
  box-shadow: 0 2px 12px rgba(79,70,229,0.08);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 16px;
  max-width: 640px;
  margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-icon { font-size: 24px; }
.logo-text { font-family: 'Poppins', sans-serif; font-size: 18px; font-weight: 800; color: var(--text); }
.logo-accent { color: var(--primary); }
.header-right { display: flex; align-items: center; gap: 10px; }
.session-badge { font-size: 11px; font-weight: 700; font-family: 'Poppins', sans-serif; padding: 3px 10px; border-radius: 20px; }
.session-badge.live { background: #DCFCE7; color: #16A34A; border: 1.5px solid #16A34A; }
.pulse { animation: pulseBadge 1.5s infinite; }
@keyframes pulseBadge { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
.icon-btn { font-size: 20px; background: none; border: none; cursor: pointer; padding: 4px; text-decoration: none; }

/* ======================== MAIN ======================== */
.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

/* ======================== BOTTOM NAV ======================== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--card-bg);
  border-top: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -2px 16px rgba(79,70,229,0.08);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-light);
  flex: 1;
  padding: 6px 0;
  transition: all 0.2s;
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
}
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-icon { transform: scale(1.2); }
.nav-icon { font-size: 22px; transition: transform 0.2s; }
.nav-label { font-size: 10px; font-weight: 600; }

/* ======================== SECTIONS ======================== */
.section { margin-bottom: 20px; }
.section-title {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.section-title small { font-size: 12px; font-weight: 400; color: var(--text-light); }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-header .section-title { margin-bottom: 0; }

/* ======================== STATS CARDS ======================== */
.stats-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid transparent;
}
.stat-card.stat-blue { border-color: var(--in-color); background: linear-gradient(135deg, #EFF6FF 0%, #fff 100%); }
.stat-card.stat-red { border-color: var(--out-color); background: linear-gradient(135deg, #FEF2F2 0%, #fff 100%); }
.stat-card.stat-green { border-color: var(--green); background: linear-gradient(135deg, #F0FDF4 0%, #fff 100%); }
.stat-card.stat-purple { border-color: var(--primary); background: linear-gradient(135deg, #EEF2FF 0%, #fff 100%); }
.stat-num { font-family: 'Poppins', sans-serif; font-size: 26px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-light); margin-top: 2px; }
.stat-pct { font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 700; color: var(--primary); margin-top: 2px; }

/* ======================== HOME PAGE ======================== */
.active-banner {
  background: linear-gradient(135deg, #DCFCE7, #D1FAE5);
  border: 2px solid #16A34A;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.active-banner-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.active-title { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 14px; color: #16A34A; }
.active-sub { font-size: 12px; color: #166534; margin-top: 2px; }

.home-hero {
  text-align: center;
  padding: 28px 16px 24px;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #06B6D4 100%);
  border-radius: var(--radius);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.hero-emoji-bg {
  position: absolute;
  font-size: 120px;
  opacity: 0.08;
  top: -20px; right: -20px;
  pointer-events: none;
}
.hero-title {
  font-family: 'Poppins', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 8px;
  position: relative;
}
.gradient-text { color: #FDE68A; }
.hero-sub { font-size: 13px; color: rgba(255,255,255,0.85); margin-bottom: 24px; position: relative; }

.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: var(--primary);
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  text-decoration: none;
  transition: all 0.2s;
  position: relative;
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,0.2); }
.btn-start:active { transform: scale(0.97); }
.btn-start-icon { font-size: 18px; }
.btn-resume { background: #FDE68A; color: #92400E; }

/* HOT/COLD */
.hot-cold-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hot-cold-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
  position: relative;
}
.hot-cold-card.hottest { border-color: #F97316; background: linear-gradient(135deg, #FFF7ED, #fff); }
.hot-cold-card.coldest { border-color: #38BDF8; background: linear-gradient(135deg, #F0F9FF, #fff); }
.hc-badge { font-size: 16px; }
.hc-card-name { font-family: 'Poppins', sans-serif; font-size: 20px; font-weight: 800; color: var(--text); }
.hc-count { font-size: 11px; color: var(--text-light); }
.hc-bar { height: 6px; background: var(--out-light); border-radius: 3px; margin: 4px 0; overflow: hidden; }
.hc-in { height: 100%; background: var(--in-color); border-radius: 3px; transition: width 0.5s; }
.hc-pct { font-size: 11px; font-weight: 700; color: var(--in-color); }

/* LAST SESSION */
.last-session-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}
.ls-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.ls-date { font-size: 13px; font-weight: 600; color: var(--text); }
.ls-rounds { font-size: 12px; color: var(--text-light); background: var(--primary-light); padding: 3px 10px; border-radius: 20px; }
.ls-bars { display: flex; flex-direction: column; gap: 8px; }
.ls-bar-row { display: flex; align-items: center; gap: 10px; }
.ls-in-label, .ls-out-label { font-size: 12px; font-weight: 700; min-width: 50px; }
.ls-in-label { color: var(--in-color); }
.ls-out-label { color: var(--out-color); }
.ls-bar-track { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.ls-bar-fill { height: 100%; border-radius: 5px; transition: width 0.6s; }
.in-fill { background: linear-gradient(90deg, var(--in-color), #60A5FA); }
.out-fill { background: linear-gradient(90deg, var(--out-color), #F87171); }
.ls-pct { font-size: 12px; font-weight: 700; min-width: 36px; text-align: right; }
.ls-link { display: block; text-align: right; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; }

/* QUICK LINKS */
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-card:active { transform: scale(0.97); }
.qc-purple { background: linear-gradient(135deg, #4F46E5, #7C3AED); }
.qc-blue { background: linear-gradient(135deg, #2563EB, #06B6D4); }
.qc-green { background: linear-gradient(135deg, #16A34A, #059669); }
.qc-orange { background: linear-gradient(135deg, #EA580C, #D97706); }
.qc-icon { font-size: 28px; }
.qc-label { font-size: 13px; }

/* ======================== TRACKER PAGE ======================== */
.no-session-box {
  text-align: center;
  padding: 48px 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.no-session-emoji { font-size: 64px; margin-bottom: 16px; }
.no-session-box h2 { font-family: 'Poppins', sans-serif; font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.no-session-box p { color: var(--text-light); margin-bottom: 20px; }

/* TRACKER STATS BAR */
.tracker-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
  border: 1.5px solid var(--border);
}
.tsb-item {
  text-align: center;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
}
.tsb-item:last-child { border-right: none; }
.tsb-item.tsb-in { background: linear-gradient(180deg, #EFF6FF, #fff); }
.tsb-item.tsb-out { background: linear-gradient(180deg, #FEF2F2, #fff); }
.tsb-item.tsb-pct { background: linear-gradient(180deg, var(--primary-light), #fff); }
.tsb-num { font-family: 'Poppins', sans-serif; font-size: 22px; font-weight: 800; }
.tsb-label { font-size: 10px; font-weight: 600; color: var(--text-light); }

/* STREAK ALERT */
.streak-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  animation: slideIn 0.3s ease;
}
.streak-alert.streak-in { background: var(--in-light); color: var(--in-color); border: 1.5px solid var(--in-color); }
.streak-alert.streak-out { background: var(--out-light); color: var(--out-color); border: 1.5px solid var(--out-color); }
.streak-warn { margin-left: auto; font-size: 13px; }
@keyframes slideIn { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ROUNDS HISTORY */
.rounds-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  min-height: 60px;
  border: 1.5px solid var(--border);
}
.rounds-empty { color: var(--text-light); font-size: 13px; margin: auto; width: 100%; text-align: center; }
.round-ball {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  cursor: default;
  transition: transform 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  animation: popIn 0.3s ease;
}
@keyframes popIn { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.round-ball:hover { transform: scale(1.1); }
.ball-in { background: linear-gradient(135deg, #2563EB, #3B82F6); }
.ball-out { background: linear-gradient(135deg, #DC2626, #EF4444); }
.ball-card { font-family: 'Poppins', sans-serif; font-size: 11px; font-weight: 700; color: #fff; line-height: 1; }
.ball-result { font-size: 8px; font-weight: 600; color: rgba(255,255,255,0.85); line-height: 1; }

/* CARD SELECTOR */
.card-selector {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.card-btn {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 4px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  display: block;
}
.card-btn:hover, .card-btn.active, .card-btn.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}

/* INPUT PANEL */
.input-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
  margin-bottom: 16px;
}
.selected-card-display {
  text-align: center;
  margin-bottom: 14px;
}
.scd-label { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.scd-card {
  font-family: 'Poppins', sans-serif;
  font-size: 40px;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  display: inline-block;
  min-width: 70px;
  transition: all 0.2s;
}
.note-row { margin-bottom: 14px; }
.note-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}
.note-input:focus { border-color: var(--primary); background: #fff; }

.result-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.btn-in, .btn-out {
  padding: 18px 10px;
  border-radius: var(--radius);
  border: none;
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.btn-in {
  background: linear-gradient(135deg, #2563EB, #3B82F6);
  color: #fff;
}
.btn-out {
  background: linear-gradient(135deg, #DC2626, #EF4444);
  color: #fff;
}
.btn-in:disabled, .btn-out:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn-in:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(37,99,235,0.4); }
.btn-out:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(220,38,38,0.4); }
.btn-in:active, .btn-out:active { transform: scale(0.97); }

/* UNDO BTN */
.btn-undo {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
}
.btn-undo:hover { background: var(--out-light); border-color: var(--out-color); color: var(--out-color); }

/* PREDICTION BOX */
.prediction-box {
  background: linear-gradient(135deg, #FAFBFF, #F5F3FF);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(79,70,229,0.12);
}
.pred-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pred-title { font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 700; color: var(--primary); }
.pred-card-name { font-family: 'Poppins', sans-serif; font-size: 18px; font-weight: 800; color: var(--text); background: var(--primary-light); padding: 3px 12px; border-radius: 20px; }
.pred-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pred-section-header .section-title { margin-bottom: 0; }

.pred-bars { display: flex; flex-direction: column; gap: 10px; }
.pred-row { display: flex; align-items: center; gap: 10px; }
.pred-in-label, .pred-out-label { font-size: 13px; font-weight: 700; min-width: 52px; }
.pred-in-label { color: var(--in-color); }
.pred-out-label { color: var(--out-color); }
.pred-track { flex: 1; height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.pred-fill { height: 100%; border-radius: 7px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.pred-in-fill { background: linear-gradient(90deg, #2563EB, #60A5FA); }
.pred-out-fill { background: linear-gradient(90deg, #DC2626, #F87171); }
.pred-pct { font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 700; min-width: 42px; text-align: right; }

.pred-winner {
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 800;
  margin-top: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.pred-winner.winner-in { background: var(--in-light); color: var(--in-color); }
.pred-winner.winner-out { background: var(--out-light); color: var(--out-color); }
.pred-reason { font-size: 13px; color: var(--text-light); margin-top: 8px; text-align: center; font-style: italic; }

.pred-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--primary);
}
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pred-idle { text-align: center; color: var(--text-light); font-size: 13px; padding: 12px; }

/* PATTERN ALERT */
.pattern-alert {
  background: #FFFBEB;
  border: 2px solid #F59E0B;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #92400E;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease;
}

/* END SESSION BTN */
.btn-end-session {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #991B1B, #DC2626);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(220,38,38,0.3);
  transition: all 0.2s;
}
.btn-end-session:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(220,38,38,0.4); }

/* ======================== CARD DETAIL ======================== */
.card-detail-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  color: #fff;
}
.cdh-card {
  font-family: 'Poppins', sans-serif;
  font-size: 52px;
  font-weight: 900;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cdh-title { font-family: 'Poppins', sans-serif; font-size: 20px; font-weight: 700; }
.cdh-total, .cdh-streak { font-size: 13px; opacity: 0.85; margin-top: 3px; }

/* BREAKDOWN */
.breakdown-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.breakdown-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
  text-align: center;
}
.bd-label { font-family: 'Poppins', sans-serif; font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.bd-total { font-size: 11px; color: var(--text-light); margin-bottom: 6px; }
.bd-bar { height: 8px; background: var(--out-light); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.bd-in { height: 100%; background: var(--in-color); border-radius: 4px; transition: width 0.5s; display: inline-block; float: left; }
.bd-out { height: 100%; background: var(--out-color); border-radius: 4px; transition: width 0.5s; display: inline-block; float: right; }
.bd-stats { display: flex; justify-content: space-between; overflow: hidden; }
.bd-in-txt { font-size: 10px; font-weight: 700; color: var(--in-color); }
.bd-out-txt { font-size: 10px; font-weight: 700; color: var(--out-color); }

/* CHART */
.chart-container { height: 220px; background: var(--card-bg); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.chart-container-sm { height: 200px; background: var(--card-bg); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); max-width: 280px; margin: 0 auto; }

/* ROUND HISTORY LIST */
.round-history-list { display: flex; flex-direction: column; gap: 6px; }
.rhl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card-bg);
  border-radius: var(--radius-xs);
  border-left: 4px solid transparent;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.rhl-item.rhl-in { border-left-color: var(--in-color); background: #F0F7FF; }
.rhl-item.rhl-out { border-left-color: var(--out-color); background: #FFF5F5; }
.rhl-num { font-family: 'Poppins', sans-serif; font-size: 11px; font-weight: 700; color: var(--text-light); min-width: 28px; }
.rhl-joker { font-weight: 700; }
.ball-in-sm { background: var(--in-color); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 12px; }
.ball-out-sm { background: var(--out-color); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 12px; }
.rhl-note { font-size: 12px; color: var(--text-light); flex: 1; }
.rhl-time { font-size: 11px; color: var(--text-light); margin-left: auto; }

/* ======================== STATISTICS PAGE ======================== */
.records-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.record-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  border: 1.5px solid var(--border);
}
.rc-icon { font-size: 24px; margin-bottom: 4px; }
.rc-label { font-size: 11px; color: var(--text-light); font-weight: 600; margin-bottom: 4px; }
.rc-value { font-family: 'Poppins', sans-serif; font-size: 16px; font-weight: 800; color: var(--primary); }

/* CARDS TABLE */
.cards-table {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}
.ct-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 2fr;
  gap: 8px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 700;
}
.ct-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 2fr;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
  transition: background 0.15s;
}
.ct-row:hover { background: var(--bg); }
.ct-row.ct-empty { opacity: 0.4; }
.ct-row:last-child { border-bottom: none; }
.ct-card a { font-family: 'Poppins', sans-serif; font-weight: 700; color: var(--primary); text-decoration: none; font-size: 16px; }
.ct-in { color: var(--in-color); font-weight: 600; }
.ct-out { color: var(--out-color); font-weight: 600; }
.ct-pct { display: flex; align-items: center; gap: 6px; }
.mini-bar { flex: 1; height: 6px; background: var(--out-light); border-radius: 3px; overflow: hidden; }
.mini-in { height: 100%; background: var(--in-color); border-radius: 3px; }
.mini-label { font-size: 11px; font-weight: 700; color: var(--in-color); min-width: 32px; }

/* PREDICTION HISTORY */
.pred-history-list { display: flex; flex-direction: column; gap: 6px; }
.phl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card-bg);
  border-radius: var(--radius-xs);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}
.phl-card { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 15px; min-width: 28px; }
.phl-pred { font-family: 'Poppins', sans-serif; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 12px; }
.phl-in { background: var(--in-light); color: var(--in-color); }
.phl-out { background: var(--out-light); color: var(--out-color); }
.phl-conf { font-size: 11px; color: var(--text-light); flex: 1; }
.phl-correct { color: var(--green); font-weight: 700; }
.phl-wrong { color: var(--out-color); font-weight: 700; }
.phl-pending { color: var(--text-light); }

/* ======================== HISTORY PAGE ======================== */
.sessions-list { display: flex; flex-direction: column; gap: 10px; }
.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
  transition: all 0.2s;
}
.session-item:hover { transform: translateX(4px); box-shadow: var(--shadow); border-color: var(--primary); }
.session-item.si-active { border-color: #16A34A; background: linear-gradient(135deg, #F0FDF4, #fff); }
.si-left { flex: 1; }
.si-date { font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 700; color: var(--text); }
.si-time { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.si-mid { text-align: center; }
.si-rounds { display: block; font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 700; color: var(--primary); }
.si-ratio { display: flex; align-items: center; gap: 4px; font-size: 13px; margin-top: 2px; justify-content: center; }
.si-in { color: var(--in-color); font-weight: 700; }
.si-out { color: var(--out-color); font-weight: 700; }
.si-sep { color: var(--text-light); }
.si-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.badge-live { background: #DCFCE7; color: #16A34A; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 12px; font-family: 'Poppins', sans-serif; }
.badge-ended { background: var(--primary-light); color: var(--primary); font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 12px; }
.si-arrow { color: var(--text-light); font-size: 16px; }

/* SESSION DETAIL */
.session-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}
.sdh-date { font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 700; }
.sdh-time { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.status-active { background: #DCFCE7; color: #16A34A; padding: 4px 12px; border-radius: 20px; font-family: 'Poppins', sans-serif; font-size: 12px; font-weight: 700; }
.status-ended { background: var(--primary-light); color: var(--primary); padding: 4px 12px; border-radius: 20px; font-family: 'Poppins', sans-serif; font-size: 12px; font-weight: 700; }

.export-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ======================== SETTINGS PAGE ======================== */
.settings-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}
.sc-desc { font-size: 13px; color: var(--text-light); margin-bottom: 16px; line-height: 1.6; }
.sc-note { font-size: 12px; color: var(--text-light); margin-top: 12px; }
.sc-note a { color: var(--primary); }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.key-input-row { display: flex; gap: 8px; }
.form-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg);
}
.form-input:focus { border-color: var(--primary); background: #fff; }
.key-saved { font-size: 12px; color: var(--green); margin-top: 6px; font-weight: 600; }

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row span:first-child { color: var(--text-light); font-weight: 600; }
.info-row span:last-child { font-weight: 700; }

.danger-title { color: #DC2626 !important; }
.danger-card { border-color: #FCA5A5 !important; background: #FFF5F5 !important; }

/* ======================== BUTTONS ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-gray { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-purple { background: linear-gradient(135deg, var(--primary), var(--purple)); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.btn-green { background: linear-gradient(135deg, var(--green), #059669); color: #fff; }
.btn-blue { background: linear-gradient(135deg, var(--in-color), #3B82F6); color: #fff; }
.btn-red { background: linear-gradient(135deg, #991B1B, #DC2626); color: #fff; }
.btn-glow { background: rgba(255,255,255,0.25); color: #fff; border: 2px solid rgba(255,255,255,0.6); backdrop-filter: blur(4px); padding: 8px 16px; font-size: 13px; flex-shrink: 0; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 20px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-emoji { font-size: 48px; margin-bottom: 12px; }
.modal-box h3 { font-family: 'Poppins', sans-serif; font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal-box p { font-size: 14px; color: var(--text-light); margin-bottom: 20px; }
.modal-btns { display: flex; gap: 12px; justify-content: center; }

/* TOAST */
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  animation: slideIn 0.3s ease;
}
.toast-success { background: var(--green-light); color: var(--green); border: 1.5px solid var(--green); }
.toast-warning { background: #FEF3C7; color: #92400E; border: 1.5px solid #F59E0B; }

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

/* DESKTOP */
@media (min-width: 640px) {
  .app-main { padding: 20px; }
  .hero-title { font-size: 36px; }
  .hot-cold-grid { grid-template-columns: repeat(6, 1fr); }
  .card-selector { grid-template-columns: repeat(13, 1fr); }
  .result-btns { gap: 20px; }
  .btn-in, .btn-out { font-size: 22px; padding: 22px 10px; }
  .modal-box { border-radius: var(--radius); }
  .modal-overlay { align-items: center; }
}
