:root, [data-theme="dark"] {
  --bg: #04102e;
  --bg-pattern:
    radial-gradient(circle at 50% 0%, rgba(29, 78, 216, 0.35), transparent 60%),
    repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(-60deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 28px);
  --poster-bg: linear-gradient(180deg, #061336 0%, #0b2666 55%, #1545a3 100%);
  --surface: #081c4a;
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(251, 191, 36, 0.38);
  --border-soft: rgba(255, 255, 255, 0.16);
  --text-main: #ffffff;
  --text-muted: #bfdbfe;
  --gold: #f59e0b;
  --gold-bright: #fcd34d;
  --gold-soft: rgba(245, 158, 11, 0.16);
  --shadow: 0 22px 50px rgba(2, 8, 26, 0.65);
}

[data-theme="light"] {
  --bg: #eff6ff;
  --bg-pattern:
    radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.14), transparent 60%),
    repeating-linear-gradient(60deg, rgba(30, 64, 175, 0.03) 0 1px, transparent 1px 28px);
  --poster-bg: linear-gradient(180deg, #081a4b 0%, #0f3282 55%, #1d4ed8 100%);
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: rgba(217, 119, 6, 0.35);
  --border-soft: rgba(15, 23, 42, 0.10);
  --text-main: #0f172a;
  --text-muted: #475569;
  --gold: #d97706;
  --gold-bright: #f59e0b;
  --gold-soft: rgba(217, 119, 6, 0.12);
  --shadow: 0 16px 36px rgba(15, 23, 42, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-pattern);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
#app-loader.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.ram-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--border-soft); border-top-color: var(--gold-bright);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ram-shell { max-width: 1120px; margin: 0 auto; padding: 18px 16px 44px; }
.ram-shell.centered { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.ram-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.ram-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ram-logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255,255,255,0.10); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; padding: 5px; flex-shrink: 0;
}
.ram-logo img { width: 100%; height: 100%; object-fit: contain; }
.ram-title { font-size: 1.02rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ram-sub { font-size: 0.76rem; color: var(--text-muted); }

.ram-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ram-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 9999px;
  background: var(--gold-soft); border: 1px solid var(--border);
  color: var(--gold-bright); font-size: 0.72rem; font-weight: 800;
}
.ctrl-btn {
  height: 36px; min-width: 36px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--text-main);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.ctrl-btn:hover { border-color: var(--gold-bright); color: var(--gold-bright); }

.ram-grid { display: grid; grid-template-columns: 1.06fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .ram-grid { grid-template-columns: 1fr; } }
.ram-col { display: flex; flex-direction: column; gap: 18px; }

/* Midnight Royal Blue Ramadhan Poster Card */
.poster-card {
  position: relative;
  background: var(--poster-bg);
  border: 1.5px solid rgba(251, 191, 36, 0.45);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  color: #ffffff;
}
.poster-lattice {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.14;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.22) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.22) 0 1px, transparent 1px 24px);
}
.poster-lanterns {
  position: relative; z-index: 2;
  width: 100%; height: 118px; display: block;
}
.lantern-sway-left {
  transform-origin: 48px 0px;
  animation: lanternSway 3.6s ease-in-out infinite;
}
.lantern-sway-right {
  transform-origin: 452px 0px;
  animation: lanternSway 3.6s ease-in-out infinite reverse;
}
.star-sway-left {
  transform-origin: 88px 0px;
  animation: lanternSway 4.2s ease-in-out infinite 0.5s;
}
.star-sway-right {
  transform-origin: 412px 0px;
  animation: lanternSway 4.2s ease-in-out infinite reverse 0.5s;
}
@keyframes lanternSway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}
.poster-head {
  position: relative; z-index: 2;
  text-align: center;
  padding: 0 22px;
  margin-top: -42px;
}
.poster-title-gold {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.05rem;
  font-weight: 800;
  line-height: 1.05;
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 65%, #d97706 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.4));
}
.poster-title-sub {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 2px;
}
.poster-ribbon {
  display: inline-block;
  margin: 12px auto 14px;
  padding: 6px 22px;
  background: linear-gradient(90deg, #d97706, #f59e0b, #d97706);
  color: #1c1917;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  clip-path: polygon(10px 0%, calc(100% - 10px) 0%, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0% 50%);
}
.poster-info-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  max-width: 390px; margin: 0 auto 16px;
}
.poster-info-box {
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(6, 19, 54, 0.45);
  text-align: center;
}
.poster-info-lbl { font-size: 0.68rem; color: #dbeafe; }
.poster-info-val { font-size: 0.94rem; font-weight: 800; color: #fde68a; font-family: ui-monospace, monospace; }

.poster-form-wrap {
  position: relative; z-index: 3;
  padding: 0 22px 10px;
}
.poster-mosque-bottom {
  position: relative; z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  margin-top: 4px;
}

.ram-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
}

/* Prayer Board */
.board-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border-soft);
}
.led-clock { font-family: ui-monospace, monospace; font-size: 1.4rem; font-weight: 800; color: var(--gold-bright); }
.prayer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
@media (max-width: 480px) { .prayer-grid { grid-template-columns: repeat(2, 1fr); } }
.prayer-tile {
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 9px 10px; text-align: center;
}
.prayer-name { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.prayer-val { font-family: ui-monospace, monospace; font-size: 0.92rem; font-weight: 800; margin-top: 2px; }

/* Auth inside Poster */
.ram-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: rgba(255, 255, 255, 0.10); border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 5px; border-radius: 14px; margin-bottom: 14px;
}
.ram-tab-btn {
  border: none; background: transparent; color: #dbeafe;
  padding: 8px 6px; border-radius: 10px; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.ram-tab-btn.active {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #1c1917;
}

.ram-field { margin-bottom: 12px; }
.ram-label { display: block; font-size: 0.78rem; font-weight: 600; color: #dbeafe; margin-bottom: 5px; }
.ram-input-wrap { position: relative; display: flex; align-items: center; }
.ram-input-icon { position: absolute; left: 14px; color: #fcd34d; font-size: 0.9rem; pointer-events: none; }
.ram-input {
  width: 100%; background: rgba(4, 16, 46, 0.65); border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff; border-radius: 12px; padding: 11px 14px 11px 40px;
  font-size: 0.9rem; outline: none;
}
.ram-input::placeholder { color: rgba(219, 234, 254, 0.55); }
.ram-input:focus { border-color: #fcd34d; }
.ram-eye-btn { position: absolute; right: 10px; background: none; border: none; color: #dbeafe; cursor: pointer; padding: 6px; }

.btn-ram-gold {
  width: 100%; border: none; border-radius: 12px; padding: 12px 16px;
  background: linear-gradient(135deg, #fde68a, #f59e0b); color: #1c1917;
  font-size: 0.92rem; font-weight: 800; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
}
.btn-ram-outline {
  width: 100%; border: 1px solid rgba(251, 191, 36, 0.45); border-radius: 12px; padding: 10px 14px;
  background: rgba(245, 158, 11, 0.14); color: var(--gold-bright); font-size: 0.86rem; font-weight: 700;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
[data-theme="light"] .ram-card .btn-ram-outline { color: var(--gold); }
.btn-ram-danger {
  width: 100%; border: 1px solid rgba(239,68,68,0.35); border-radius: 12px; padding: 12px 16px;
  background: rgba(239,68,68,0.14); color: #f87171; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}

.ram-error {
  display: flex; align-items: center; gap: 10px;
  background: rgba(239,68,68,0.18); border: 1px solid rgba(248,113,113,0.45);
  color: #fecaca; padding: 10px 12px; border-radius: 12px; font-size: 0.82rem; margin-bottom: 12px;
}
.ram-divider { display: flex; align-items: center; gap: 10px; color: #bfdbfe; font-size: 0.7rem; font-weight: 700; margin: 12px 0; }
.ram-divider::before, .ram-divider::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,0.2); }

.ram-scanner { text-align: center; padding: 16px; background: rgba(4,16,46,0.55); border: 1px dashed rgba(251,191,36,0.45); border-radius: 14px; margin-bottom: 12px; }
.ram-viewfinder { width: 104px; height: 104px; margin: 0 auto 10px; border: 2px solid #fcd34d; border-radius: 14px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.ram-laser { position: absolute; left: 0; right: 0; height: 2px; background: #fcd34d; animation: scanline 2s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { top: 12%; } 50% { top: 88%; } }

.ram-meta-box { margin-top: 12px; background: rgba(4, 16, 46, 0.50); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 12px; padding: 8px 12px; }
.ram-meta-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 0.78rem; color: #bfdbfe; }
.ram-meta-row + .ram-meta-row { border-top: 1px solid rgba(255, 255, 255, 0.12); }
.ram-meta-row strong { color: #ffffff; font-family: ui-monospace, monospace; }

.ram-pkg-grid { display: grid; gap: 10px; }
.ram-pkg-card {
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 14px; padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; transition: border-color 0.2s;
}
.ram-pkg-card:hover { border-color: var(--gold-bright); }
.ram-pkg-badge { display: inline-block; font-size: 0.66rem; font-weight: 800; padding: 2px 8px; border-radius: 9999px; background: var(--gold-soft); color: var(--gold-bright); margin-bottom: 4px; }
[data-theme="light"] .ram-pkg-badge { color: var(--gold); }

.quote-box {
  background: var(--surface-2); border-left: 3px solid var(--gold-bright);
  border-radius: 12px; padding: 12px 14px; font-size: 0.84rem; font-style: italic;
}

.faq-item { border: 1px solid var(--border-soft); border-radius: 12px; margin-bottom: 8px; overflow: hidden; background: var(--surface-2); }
.faq-btn { width: 100%; background: none; border: none; color: var(--text-main); padding: 12px 14px; text-align: left; font-size: 0.84rem; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.faq-ans { display: none; padding: 0 14px 12px; font-size: 0.8rem; color: var(--text-muted); }
.faq-item.open .faq-ans { display: block; }

.ram-footer { text-align: center; font-size: 0.78rem; color: var(--text-muted); margin-top: 24px; }
.wa-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: #25d366; color: #ffffff; font-size: 1.55rem;
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.35); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(2, 8, 26, 0.76); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-ram {
  width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 20px; text-align: center; box-shadow: var(--shadow);
}
.qris-white { background: #ffffff; padding: 12px; border-radius: 14px; display: inline-block; margin: 14px 0; }
.qris-white img { width: 190px; height: 190px; object-fit: contain; display: block; }
