:root {
  --lp-radius: 0.75rem;
  --lp-digit-bg: #0d6efd;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f5f7fb;
}

main {
  flex: 1 0 auto;
}

.card {
  border-radius: var(--lp-radius);
}

/* ---------- Tampilan angka hasil ---------- */
.result-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.result-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.9rem;
  padding: 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--lp-digit-bg);
  border-radius: 0.5rem;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.result-digit-lg {
  min-width: 3rem;
  height: 3.6rem;
  font-size: 1.75rem;
}

.result-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 1.05rem;
}

.result-number-sm {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(13, 110, 253, 0.08);
  border: 1px solid rgba(13, 110, 253, 0.2);
  border-radius: 0.375rem;
  padding: 0.1rem 0.45rem;
}

.result-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.25em;
  font-weight: 700;
}

/* ---------- Sistem tema per pasaran ----------
   Warna diinjeksi lewat variabel --thm-primary / --thm-accent pada elemen
   ber-class .theme-scope. Nilai bawaan dipakai bila tema tidak diset.        */
.theme-scope {
  --thm-primary: #00398f;
  --thm-accent: #e2231a;
}

.draw-panel-flag {
  font-size: 1.35rem;
  line-height: 1;
  flex: 0 0 auto;
}

/* Motif latar panel, dipilih lewat atribut data-pattern */
.draw-panel[data-pattern='dots'] .draw-panel-head {
  background-image: radial-gradient(rgba(255, 255, 255, 0.22) 1.5px, transparent 1.6px);
  background-size: 14px 14px;
}

.draw-panel[data-pattern='stripes'] .draw-panel-head {
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.12) 0 10px,
    transparent 10px 20px
  );
}

.draw-panel[data-pattern='diagonal'] .draw-panel-head {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.12) 0 8px,
    transparent 8px 16px
  );
}

.draw-panel[data-pattern='waves'] .draw-panel-head {
  background-image: radial-gradient(circle at 50% 120%, rgba(255, 255, 255, 0.2), transparent 60%);
}

.draw-panel[data-pattern='grid'] .draw-panel-head {
  background-image: linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* Aksen tema pada kartu pasaran di beranda */
.market-card.theme-scope {
  border-top: 4px solid var(--thm-primary) !important;
}

.market-card.theme-scope .result-digit {
  background: var(--thm-primary);
}

/* ---------- Panel hasil resmi (halaman pasaran) ---------- */
.draw-panel {
  border-radius: var(--lp-radius);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0.5rem 1.5rem rgba(16, 24, 40, 0.1);
}

.draw-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(135deg, var(--thm-primary) 0%, color-mix(in srgb, var(--thm-primary) 65%, #ffffff) 100%);
  color: #fff;
}

.draw-panel-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.draw-panel-title h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draw-panel-code {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: 0.3rem;
  background: var(--thm-accent);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

.draw-panel-no {
  flex: 0 0 auto;
  text-align: right;
  line-height: 1.2;
}

.draw-panel-no span {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.8;
}

.draw-panel-no strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.draw-panel-body {
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--thm-primary) 6%, #ffffff) 0%, #fff 65%);
}

.draw-panel-date {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}

.draw-balls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.draw-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--thm-primary);
  background: #fff;
  border: 3px solid var(--thm-primary);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.18), inset 0 -3px 0 rgba(15, 23, 42, 0.1);
}

.draw-ball-empty {
  color: #94a3b8;
  border-color: #cbd5e1;
  box-shadow: none;
}

.draw-panel-meta {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
}

.draw-panel-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.1rem;
  padding: 0.65rem 1.25rem;
  border-top: 1px solid #e5e9f0;
  background: #f8fafc;
  font-size: 0.8rem;
  color: #64748b;
}

.draw-panel-foot a {
  color: var(--thm-primary);
  text-decoration: none;
  margin-left: auto;
}

.draw-panel-foot a:hover {
  text-decoration: underline;
}

/* Tabel riwayat */
.draw-history thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 2px solid #e5e9f0;
}

.draw-history tbody tr:nth-child(even) {
  background: #fafcff;
}

.draw-history td {
  vertical-align: middle;
  font-size: 0.9rem;
}

.draw-history-number {
  display: inline-block;
  min-width: 5.5rem;
  padding: 0.25rem 0.6rem;
  border-radius: 0.4rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--thm-primary);
  background: color-mix(in srgb, var(--thm-primary) 8%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--thm-primary) 22%, #ffffff);
}

@media (max-width: 575.98px) {
  .draw-ball {
    width: 3rem;
    height: 3rem;
    font-size: 1.5rem;
    border-width: 2px;
  }

  .draw-panel-title h1 {
    font-size: 1rem;
  }

  .draw-history-number {
    min-width: 4.5rem;
    font-size: 0.95rem;
    letter-spacing: 0.12em;
  }
}

/* ---------- Kartu pasaran publik ---------- */
.market-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.market-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1.25rem rgba(16, 24, 40, 0.12) !important;
}

/* ---------- Empty state ---------- */
.empty-state-icon {
  font-size: 2.5rem;
  color: #b6c0d1;
}

/* ---------- Halaman login ---------- */
.auth-body {
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 60%);
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  background: #0d6efd;
}

/* ---------- Halaman error ---------- */
.error-code {
  font-size: clamp(3.5rem, 12vw, 6rem);
  font-weight: 800;
  line-height: 1;
  color: #0d6efd;
}

/* ---------- Loading state tombol ---------- */
.btn.is-loading {
  pointer-events: none;
  opacity: 0.75;
}

/* ---------- Responsif ---------- */
@media (max-width: 575.98px) {
  .result-digit {
    min-width: 2rem;
    height: 2.5rem;
    font-size: 1.15rem;
  }

  .result-digit-lg {
    min-width: 2.5rem;
    height: 3rem;
    font-size: 1.4rem;
  }
}

/* =====================================================================
   Header publik — menyesuaikan tema pasaran yang sedang dibuka
   ===================================================================== */
.pub-nav {
  --nav-bg: #16202e;
  --nav-accent: #64748b;
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--nav-bg);
  color: #fff;
  border-bottom: 3px solid var(--nav-accent);
}

.pub-nav-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.pub-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.pub-brand:hover { color: #fff; }

.pub-brand-mark,
.pub-brand-flag {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.pub-brand-text { min-width: 0; line-height: 1.25; }

.pub-brand-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pub-brand-sub {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.pub-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.pub-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.pub-link:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.pub-link-api {
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
}

.pub-link-api:hover {
  background: #fff;
  color: var(--nav-bg);
}

@media (max-width: 575.98px) {
  .pub-nav-inner { padding: 10px 12px; gap: 8px; }
  .pub-brand-name { font-size: 13.5px; }
  .pub-brand-sub { display: none; }
  .pub-brand-mark, .pub-brand-flag { width: 30px; height: 30px; font-size: 15px; }
  .pub-links { margin-left: auto; gap: 2px; }
  .pub-link { padding: 6px 10px; font-size: 11.5px; }
}

/* =====================================================================
   Rincian 2D / 3D / 4D — dipakai seluruh layout pasaran.
   Warnanya mengikuti tema lewat currentColor agar menyatu di 30 layout.
   ===================================================================== */
.dims {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
}

.dim {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.09);
  border: 1px solid rgba(127, 127, 127, 0.22);
  line-height: 1;
}

.dim-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
}

.dim-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

/* Versi ringkas pada baris riwayat */
.dims-sm {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.dims-sm span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(127, 127, 127, 0.1);
}

.dims-sm b {
  font-size: 9px;
  letter-spacing: 0.12em;
  opacity: 0.7;
}

@media (max-width: 575.98px) {
  .dims { gap: 6px; margin-top: 14px; }
  .dim { padding: 6px 10px; gap: 6px; }
  .dim-value { font-size: 14px; }
}

/* =====================================================================
   Tabel riwayat 4D / 3D / 2D — dipakai layout pasaran non-tabel.
   Warna sengaja netral & mewarisi currentColor agar menyatu di tiap tema.
   ===================================================================== */
.dimtab-wrap {
  overflow-x: auto;
  border: 1px solid rgba(127, 127, 127, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
}

.dimtab {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.dimtab thead th {
  padding: 11px 14px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(127, 127, 127, 0.12);
  border-bottom: 2px solid rgba(127, 127, 127, 0.28);
  white-space: nowrap;
}

.dimtab thead th.dimtab-date {
  text-align: left;
}

.dimtab tbody td {
  padding: 12px 14px;
  text-align: center;
  border-bottom: 1px solid rgba(127, 127, 127, 0.16);
  vertical-align: middle;
}

.dimtab tbody tr:last-child td {
  border-bottom: 0;
}

.dimtab tbody tr:nth-child(even) td {
  background: rgba(127, 127, 127, 0.05);
}

.dimtab td.dimtab-date {
  text-align: left;
  white-space: nowrap;
}

.dimtab-day {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.6;
}

.dimtab-full {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.dimtab-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.dimtab-num-4d {
  font-size: 20px;
}

@media (max-width: 575.98px) {
  .dimtab { font-size: 13px; }
  .dimtab thead th, .dimtab tbody td { padding: 10px 8px; }
  .dimtab-num { font-size: 15px; letter-spacing: 0.1em; }
  .dimtab-num-4d { font-size: 17px; }
  .dimtab-full { font-size: 12px; }
}

/* Kerangka 4D/3D/2D saat pasaran belum punya hasil */
.dims-empty .dim { opacity: 0.55; }
.dimtab-kosong td {
  text-align: center !important;
  padding: 26px 14px !important;
  font-size: 13px;
  opacity: 0.7;
}

/* Kredit foto latar (wajib untuk lisensi CC BY / CC BY-SA) */
.foto-kredit {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(127, 127, 127, 0.2);
  font-size: 11px;
  color: #8a8a8a;
}

.foto-kredit a { color: inherit; text-decoration: underline; }
