/* ============================================
   PREDIKSI 4D PRO - Responsive Polish v2
   Strategy: clamp() base font + rem units
   Safe for all Android screen sizes 320px–480px+
============================================ */

/* ── BASE RESPONSIVE FONT SCALE ── */
html {
  /* 320px → 13px | 390px → 14.7px | 480px → 16px */
  font-size: clamp(13px, 3.5vw, 16px);
}

:root {
  --bg: #0b0f19;
  --surface: #131b2c;
  --surface2: #1e293b;
  --border: #2a3b59;
  --accent: #3b82f6;
  --accent2: #0ea5e9;
  --accent3: #f43f5e;
  --accent4: #8b5cf6;
  --gold: #f0c040;
  --text: #f8fafc;
  --muted: #64748b;
  --strong: #ffffff;

  /* ── SPACING SCALE ── */
  --space-xs: 0.5rem;
  --space-sm: 0.625rem;
  --space-md: 1rem;
  --space-lg: 1.25rem;
  --space-xl: 1.75rem;

  /* ── RADIUS SCALE ── */
  --radius-sm: 0.625rem;
  --radius-md: 0.875rem;
  --radius-lg: 1rem;
  --radius-pill: 999px;

  /* ── TRANSITION ── */
  --transition: 0.2s ease;
}

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

body {
  background:
    radial-gradient(circle at top right, rgba(14,165,233,0.10), transparent 30%),
    radial-gradient(circle at bottom left, rgba(59,130,246,0.08), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 calc(80px + env(safe-area-inset-bottom));
}

/* ── HEADER ── */
.header {
  padding: var(--space-lg);
  padding-top: calc(var(--space-lg) + env(safe-area-inset-top));
  background: rgba(11, 15, 25, 0.90);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(42,59,89,0.82);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: nowrap;   /* JANGAN wrap — kunci 1 baris */
  min-width: 0;        /* izinkan shrink */
  margin-bottom: 0.375rem;
}

.logo {
  font-size: clamp(0.9rem, 4.5vw, 1.125rem); /* shrink di layar kecil */
  font-weight: 800;
  color: var(--strong);
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;      /* logo boleh mengecil */
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo span { color: var(--accent2); }

.badge {
  font-size: clamp(0.5rem, 2vw, 0.5625rem);
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  padding: 0.3125rem 0.625rem;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
  box-shadow: 0 8px 20px rgba(59,130,246,0.22);
  white-space: nowrap;
  flex-shrink: 0;      /* badge TIDAK boleh mengecil */
}

.subtitle {
  font-size: clamp(0.6rem, 2.8vw, 0.75rem);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── SEARCH ── */
.search-wrap { padding: var(--space-md) var(--space-lg); }
.search-wrap-inner { position: relative; }

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.search-box {
  width: 100%;
  background: rgba(19,27,44,0.92);
  border: 1px solid rgba(42,59,89,0.9);
  border-radius: var(--radius-md);
  padding: 0.9375rem 1rem 0.9375rem 2.75rem;
  color: #fff;
  outline: none;
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.75rem, 3.2vw, 0.8125rem);
  transition: all var(--transition);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 12px 28px rgba(0,0,0,0.14);
}

.search-box:focus {
  border-color: var(--accent2);
  background: var(--surface2);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.10);
}

/* ── STATS ROW ── */
.stats-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0 var(--space-lg) 0.625rem;
  font-size: clamp(0.575rem, 2.5vw, 0.625rem);
  color: var(--muted);
  flex-wrap: wrap;
}

.sync-btn {
  margin-left: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent2);
  border-radius: var(--radius-pill);
  padding: 0.375rem 0.625rem;
  font-size: clamp(0.5rem, 2vw, 0.5625rem);
  font-weight: 800;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.sync-btn:disabled { opacity: 0.55; cursor: wait; }
.sync-btn:active { transform: scale(0.96); }

/* ── MARKET CARDS ── */
.market-list {
  padding: 0 var(--space-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}

.market-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: clamp(0.75rem, 3vw, 0.875rem);
  border: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
  transition: all var(--transition);
  animation: marketFade 0.34s ease both;
  min-width: 0;        /* penting! cegah overflow */
  overflow: hidden;
}

.market-card:active {
  transform: scale(0.98);
  background: var(--surface2);
  border-color: var(--border);
}

.market-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  min-width: 0;
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.market-name {
  font-size: clamp(0.575rem, 2.8vw, 0.6875rem);
  font-weight: 700;
  color: var(--strong);
  line-height: 1.3;
  text-transform: uppercase;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-result {
  font-size: clamp(0.875rem, 3.8vw, 0.9375rem);
  font-weight: 800;
  color: var(--accent2);
  letter-spacing: 2px;
  padding-left: 1rem;
  line-height: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-meta {
  font-size: clamp(0.45rem, 2vw, 0.5rem);
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.6px;
  padding-left: 1rem;
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── PANELS (Result & History) ── */
.result-panel,
.history-page {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 150;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

.history-page { z-index: 180; }
.result-panel.show,
.history-page.show { display: block; }

.result-header {
  padding: 1rem var(--space-lg);
  padding-top: calc(1rem + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  background: rgba(11, 15, 25, 0.95);
  z-index: 20;
  backdrop-filter: blur(16px);
  min-width: 0;
}

.back-btn {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--strong);
  flex-shrink: 0;
}

.result-title {
  font-size: clamp(0.8rem, 3.5vw, 0.875rem);
  font-weight: 800;
  color: var(--strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-subtitle {
  font-size: clamp(0.5rem, 2.2vw, 0.625rem);
  color: var(--muted);
  letter-spacing: 1px;
  font-weight: 800;
  margin-top: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-body,
.history-page-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: 100vw;
  animation: slideIn 0.3s ease;
}

.history-page-body { max-width: 480px; margin: 0 auto; }

.history-page-summary {
  background: rgba(14,165,233,0.08);
  border: 1px solid rgba(14,165,233,0.18);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  font-size: clamp(0.625rem, 2.8vw, 0.6875rem);
  line-height: 1.45;
  color: var(--muted);
}

/* ── EVAL CARDS ── */
.eval-card,
.next-poltar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 14px 32px rgba(0,0,0,0.18);
}

.eval-card { border-color: rgba(14,165,233,0.28); }
.muted-eval { border-color: var(--border); opacity: 0.88; }

.eval-title {
  font-size: clamp(0.65rem, 3vw, 0.75rem);
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--strong);
  margin-bottom: 0.375rem;
}

.eval-subtitle,
.eval-note {
  font-size: clamp(0.6rem, 2.8vw, 0.6875rem);
  line-height: 1.45;
  color: var(--muted);
}

.eval-subtitle strong { color: var(--gold); letter-spacing: 1px; }

.eval-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.eval-grid.compact { margin: 0.625rem 0; }

.eval-pill {
  border-radius: var(--radius-md);
  padding: 0.625rem;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.eval-pill span {
  display: block;
  font-size: clamp(0.45rem, 2vw, 0.5rem);
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.eval-pill strong {
  font-size: clamp(0.75rem, 3.5vw, 0.875rem);
  font-weight: 900;
  letter-spacing: 0.8px;
}

.eval-pill.good strong { color: #22c55e; }
.eval-pill.bad strong { color: var(--accent3); }

/* ── RANK GRID ── */
.rank-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: var(--radius-sm);
  padding: 0.5625rem 0.625rem;
}

.rank-item span {
  font-size: clamp(0.5rem, 2vw, 0.5625rem);
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.8px;
}

.rank-item strong {
  font-size: clamp(0.7rem, 3.2vw, 0.8125rem);
  color: var(--accent2);
  font-weight: 900;
}

/* ── HISTORY TOGGLE ── */
.history-toggle {
  width: 100%;
  border: 1px solid rgba(14,165,233,0.28);
  background: linear-gradient(135deg, rgba(14,165,233,0.12), rgba(59,130,246,0.08));
  color: var(--accent2);
  border-radius: var(--radius-md);
  padding: 0.8125rem 0.875rem;
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  font-weight: 900;
  letter-spacing: 1.2px;
  cursor: pointer;
}

.history-toggle:disabled { opacity: 0.45; cursor: not-allowed; }
.history-toggle:active:not(:disabled) { transform: scale(0.985); }

.history-panel {
  display: none;
  flex-direction: column;
  gap: 0.625rem;
  background: rgba(19,27,44,0.45);
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
}

.history-panel.show { display: flex; }
.history-panel.page-mode { display: flex; }

.history-panel-title {
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  font-weight: 900;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 0.125rem;
}

.history-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.history-title {
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.8px;
}

.history-empty {
  font-size: clamp(0.6rem, 2.8vw, 0.6875rem);
  color: var(--muted);
  line-height: 1.4;
  padding: 0.5rem 0.125rem;
}

/* ── PERFORMANCE CARD ── */
.performance-card {
  background: linear-gradient(135deg, rgba(19,27,44,0.98), rgba(14,165,233,0.06));
  border: 1px solid rgba(14,165,233,0.18);
  border-radius: var(--radius-lg);
  padding: 0.9375rem;
  box-shadow: 0 14px 32px rgba(0,0,0,0.16);
}

.performance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  min-width: 0;
}

.performance-title {
  font-size: clamp(0.65rem, 3vw, 0.75rem);
  font-weight: 900;
  color: var(--strong);
  letter-spacing: 0.8px;
}

.performance-note {
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  color: var(--muted);
  margin-top: 0.25rem;
  line-height: 1.35;
}

.performance-badge {
  background: rgba(240,192,64,0.14);
  border: 1px solid rgba(240,192,64,0.28);
  color: var(--gold);
  border-radius: var(--radius-pill);
  padding: 0.375rem 0.5625rem;
  font-size: clamp(0.45rem, 2vw, 0.5rem);
  font-weight: 900;
  letter-spacing: 0.8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.performance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.perf-metric {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 0.625rem;
}

.perf-metric span {
  display: block;
  font-size: clamp(0.45rem, 2vw, 0.5rem);
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.8px;
  margin-bottom: 0.3125rem;
}

.perf-metric strong {
  font-size: clamp(0.8rem, 3.8vw, 0.9375rem);
  font-weight: 900;
  color: var(--strong);
}

.perf-metric em {
  float: right;
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  font-style: normal;
  font-weight: 900;
  color: var(--accent2);
  margin-top: 0.1875rem;
}

.perf-metric.gold em { color: var(--gold); }
.empty-performance { opacity: 0.85; }

/* ── NEXT POLTAR CARD ── */
.next-poltar-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-color: rgba(240,192,64,0.22);
}

.top-line-card {
  border-color: rgba(240,192,64,0.30);
  background: linear-gradient(135deg, rgba(19,27,44,0.98), rgba(240,192,64,0.055));
}

.top-line-output {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.065);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  color: var(--strong);
  font-size: clamp(0.75rem, 3.2vw, 0.8125rem);
  font-weight: 900;
  line-height: 1.65;
  letter-spacing: 1px;
  word-break: break-word;
  user-select: text;
}

.top-line-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  min-width: 0;
}

.top-line-count {
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 1px;
}

.top-line-copy {
  border: 1px solid rgba(14,165,233,0.36);
  background: rgba(14,165,233,0.12);
  color: var(--accent2);
  border-radius: var(--radius-pill);
  padding: 0.5625rem 0.875rem;
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.top-line-copy:disabled { opacity: 0.45; cursor: not-allowed; }
.top-line-copy:active:not(:disabled) { transform: scale(0.96); }

.next-row {
  display: grid;
  grid-template-columns: clamp(50px, 16vw, 62px) 1fr;
  align-items: center;
  gap: 0.625rem;
}

.next-label {
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.8px;
}

/* ── DIGIT BOXES ── */
.next-digits {
  display: flex;
  gap: 0.3125rem;
  flex-wrap: wrap;
}

.next-digit {
  width: clamp(24px, 7vw, 28px);
  height: clamp(24px, 7vw, 28px);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid rgba(240,192,64,0.18);
  color: var(--strong);
  font-size: clamp(0.7rem, 3.2vw, 0.8125rem);
  font-weight: 900;
}

/* ── MODE STRIP ── */
.mode-strip {
  background: linear-gradient(135deg, rgba(14,165,233,0.12), rgba(139,92,246,0.10));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  min-width: 0;
}

.mode-chip {
  font-size: clamp(0.5rem, 2.2vw, 0.5625rem);
  font-weight: 900;
  color: #fff;
  background: var(--accent3);
  border-radius: var(--radius-pill);
  padding: 0.375rem 0.625rem;
  letter-spacing: 0.8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.mode-text {
  font-size: clamp(0.5rem, 2.2vw, 0.5625rem);
  color: var(--muted);
  font-weight: 800;
  text-align: right;
  letter-spacing: 0.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── CHART ── */
.chart-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.chart-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  border: 1px solid var(--border);
  min-width: 0;
  overflow: hidden;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.625rem;
  gap: 0.5rem;
  min-width: 0;
}

.pos-label {
  font-size: clamp(0.55rem, 2.8vw, 0.625rem);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

.chart-hint {
  font-size: clamp(0.4rem, 1.8vw, 0.5rem); /* minimum 6.4px~, kecil tapi bukan 7px hardcode */
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: clamp(60px, 20vw, 80px);
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.bar-wrapper {
  width: clamp(5px, 1.8vw, 8px);
  height: clamp(36px, 12vw, 50px);
  background: var(--surface2);
  border-radius: 2px;
  display: flex;
  align-items: flex-end;
}

.bar-fill {
  width: 100%;
  border-radius: 2px;
  transition: height 0.6s ease;
}

.bar-label {
  font-size: clamp(0.45rem, 2vw, 0.5rem);
  color: var(--muted);
  margin-top: 0.25rem;
  font-weight: 700;
}

/* ── SUMMARY SECTION ── */
.section-title {
  font-size: clamp(0.8rem, 3.5vw, 0.875rem);
  font-weight: 800;
  color: var(--strong);
  margin-top: 0.3125rem;
  margin-bottom: -0.3125rem;
  letter-spacing: 0.5px;
}

.bonus-title { color: var(--strong); }

.advisory-text {
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  color: var(--muted);
  font-style: italic;
  margin-top: 1.25rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
}

.divider { border-top: 1px dashed var(--border); margin: 0.3125rem 0; }

.summary-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  border: 1px solid var(--border);
}

.bonus-section {
  opacity: 1;
  border-color: rgba(240,192,64,0.22);
  background: linear-gradient(135deg, rgba(19,27,44,0.98), rgba(240,192,64,0.035));
}

.row-label {
  font-size: clamp(0.6rem, 3vw, 0.6875rem);
  font-weight: 800;
  color: var(--strong);
  margin-bottom: 0.625rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
}

.row-label span {
  color: var(--muted);
  font-size: clamp(0.45rem, 2vw, 0.5rem);
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ── DIGIT SCROLL — pakai grid, anti magic number ── */
.digit-scroll {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: clamp(2px, 1vw, 4px);
}

.digit-box {
  aspect-ratio: 1;
  background: var(--surface2);
  border-radius: clamp(4px, 1.5vw, 6px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.6rem, 3.2vw, 0.8125rem);
  font-weight: 800;
  border: 1px solid var(--border);
  color: var(--text);
  min-width: 0;
}

.digit-box.rank-1 {
  background: linear-gradient(135deg, #f0c040, #f59e0b);
  color: #03050a;
  border-color: rgba(255,255,255,0.35);
  box-shadow: 0 0 18px rgba(240,192,64,0.22);
}

.digit-box.rank-top {
  border-color: var(--accent2);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(14,165,233,0.25);
}

.digit-box.rank-low { opacity: 0.55; }
.digit-box.bonus-box { opacity: 1; }

.wr-tag {
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  font-weight: 700;
  color: var(--accent2);
  margin-top: 0.5rem;
}

/* ── WARNING CARD ── */
.data-warning-card {
  min-height: clamp(300px, 55vh, 500px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: clamp(14px, 4vw, 18px);
  padding: var(--space-xl);
}

.warning-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(244,63,94,0.15);
  color: var(--accent3);
  border: 1px solid rgba(244,63,94,0.35);
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 0.875rem;
}

.warning-title {
  font-size: clamp(0.8rem, 3.8vw, 0.9375rem);
  font-weight: 900;
  color: var(--strong);
  letter-spacing: 0.7px;
  margin-bottom: 0.5rem;
}

.warning-text {
  font-size: clamp(0.65rem, 3vw, 0.75rem);
  color: var(--muted);
  margin-bottom: 0.625rem;
}

.warning-count {
  font-size: clamp(0.55rem, 2.5vw, 0.625rem);
  color: var(--accent2);
  font-weight: 900;
  letter-spacing: 1px;
  margin-bottom: 1.125rem;
}

.warning-sync {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--strong);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: clamp(0.6rem, 3vw, 0.6875rem);
  font-weight: 900;
  letter-spacing: 1px;
}

/* ── LOADING SCREEN ── */
.loading-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.95);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-lg);
}

.loading-screen.show { display: flex; }

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--surface2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s infinite linear;
}

.loading-text {
  font-size: clamp(0.65rem, 3vw, 0.75rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

/* ── EMPTY STATE ── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.75rem var(--space-lg);
  color: var(--muted);
  font-size: clamp(0.65rem, 3vw, 0.75rem);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── DESKTOP ── */
@media (min-width: 768px) {
  body {
    background:
      radial-gradient(circle at top center, rgba(14,165,233,0.16), transparent 26%),
      radial-gradient(circle at bottom center, rgba(240,192,64,0.08), transparent 34%),
      var(--bg);
  }

  .app {
    width: 430px;
    min-height: 100vh;
    border-left: 1px solid rgba(255,255,255,0.06);
    border-right: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 0 70px rgba(14,165,233,0.13), 0 0 140px rgba(0,0,0,0.35);
  }

  .result-panel,
  .history-page {
    width: 430px;
    max-width: 430px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    box-shadow: 0 0 70px rgba(14,165,233,0.13), 0 0 140px rgba(0,0,0,0.35);
    border-left: 1px solid rgba(255,255,255,0.06);
    border-right: 1px solid rgba(255,255,255,0.06);
  }

  .history-page-body { max-width: 430px; }
}

/* ── ANIMATIONS ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes marketFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
