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

:root {
  --gold: #8a6a12;
  --gold-light: #c9a227;
  --gold-glow: rgba(120, 90, 10, 0.18);
  --bg: #f5ede0;
  --bg2: #fffdf6;
  --card: #faf5e8;
  --text: #1c1208;
  --text-dim: #6b5740;
  --border: rgba(180, 130, 20, 0.22);
  --border-h: rgba(120, 88, 10, 0.55);
  --nav-scrolled: rgba(245, 237, 224, 0.93);
}

html[data-theme="dark"] {
  --gold: #c9a227;
  --gold-light: #f5d87a;
  --gold-glow: rgba(201, 162, 39, 0.25);
  --bg: #080810;
  --bg2: #0d0d1a;
  --card: #10101c;
  --text: #e4d8c8;
  --text-dim: #7a7060;
  --border: rgba(201, 162, 39, 0.18);
  --border-h: rgba(201, 162, 39, 0.5);
  --nav-scrolled: rgba(8, 8, 16, 0.92);
}

html { scroll-behavior: auto; overflow-x: hidden; } /* Lenis handles smooth scroll; clip horizontal overflow from decorative elements */

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", "Segoe UI", sans-serif;
  overflow-x: hidden;
  max-width: 100%;
}

/* ---- NAV ---- */
.l-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 52px;
  transition: background 0.35s, border-bottom 0.35s;
}

.l-nav.scrolled {
  background: var(--nav-scrolled);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.l-nav-logo {
  display: flex; align-items: center; gap: 11px;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 22px; font-weight: 700;
  letter-spacing: 0.06em; user-select: none; text-decoration: none;
}
.logo-astro { color: var(--gold); }
.logo-numera { color: var(--text); }
.l-nav-emblem {
  width: 34px; height: 34px; object-fit: contain;
  flex-shrink: 0;
}
.l-nav-name {
  font-family: "Cinzel", "Georgia", serif;
  font-size: 18px; font-weight: 700; letter-spacing: 1px; color: var(--text);
}

.l-nav-right {
  display: flex;
  align-items: center;
  gap: 32px;
}
.l-nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.l-nav-controls::before {
  content: '';
  display: block;
  width: 1px;
  height: 18px;
  background: var(--border-h);
  margin-right: 4px;
}
@media (max-width: 768px) {
  .l-nav-controls::before { display: none; }
}

.l-nav-link {
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.l-nav-link:hover { color: var(--gold); }
.l-nav-link.active { color: var(--gold); }

.l-lang-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c9a227'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 9px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 28px 7px 14px;
  border-radius: 100px;
  cursor: pointer;
  letter-spacing: 0.08em;
  outline: none;
  transition: border-color 0.2s, color 0.2s;
}
.l-lang-select:hover { border-color: var(--gold); color: var(--gold); }
.l-lang-select option { background: #0d0d1a; color: #e4d8c8; }

/* ---- HERO ---- */
.l-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: 120px 24px 100px;
}

/* DOM number particles */
.l-num-particle {
  position: absolute;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
  z-index: 1;
  animation: numFloat linear infinite;
  text-shadow: 0 0 14px var(--gold-glow), 0 0 28px var(--gold-glow);
  will-change: transform;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
  color: var(--text);
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--border-h); }

@keyframes numFloat {
  0%   { transform: translateY(0px)   translateX(0px)   rotate(0deg); }
  20%  { transform: translateY(-22px) translateX(14px)  rotate(6deg); }
  40%  { transform: translateY(-10px) translateX(-18px) rotate(-4deg); }
  60%  { transform: translateY(-36px) translateX(8px)   rotate(9deg); }
  80%  { transform: translateY(-18px) translateX(-12px) rotate(-6deg); }
  100% { transform: translateY(0px)   translateX(0px)   rotate(0deg); }
}

.l-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 35%, rgba(201,162,39,0.09) 0%, transparent 70%),
    radial-gradient(ellipse 45% 50% at 15% 85%, rgba(208,0,0,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 15%, rgba(201,162,39,0.06) 0%, transparent 60%);
  animation: bgPulse 12s ease-in-out infinite alternate;
}
@keyframes bgPulse { from { opacity: 0.5; } to { opacity: 1; } }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  animation: orbFloat 14s ease-in-out infinite;
}
.orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(201,162,39,0.1), transparent 70%);
  top: -10%; left: -15%;
}
.orb2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(208,0,0,0.09), transparent 70%);
  top: 15%; right: -10%;
  animation-delay: -5s;
}
.orb3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(201,162,39,0.07), transparent 70%);
  bottom: -5%; left: 25%;
  animation-delay: -9s;
}
@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-28px) scale(1.04); }
}

.l-hero-content {
  position: relative;
  z-index: 2;
  max-width: 740px;
}

.l-hero-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--border);
  padding: 9px 22px;
  border-radius: 100px;
  margin-bottom: 36px;
}

.l-hero-title {
  font-family: "Cinzel", "Georgia", serif;
  font-size: clamp(42px, 8vw, 84px);
  font-weight: 700;
  line-height: 1.08;
  margin-bottom: 28px;
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 55%, #9a7310 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.l-hero-sub {
  font-size: clamp(15px, 2vw, 19px);
  color: var(--text-dim);
  margin-bottom: 52px;
  line-height: 1.65;
}

.l-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), #9a7310);
  color: #0a0808;
  font-weight: 700;
  font-size: 15px;
  padding: 16px 40px;
  border-radius: 100px;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 28px rgba(201,162,39,0.35);
}
.l-cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 40px rgba(201,162,39,0.5);
}
.l-cta-btn:active { transform: translateY(0); }

.l-hero-scroll {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: scrollBounce 2.4s ease-in-out infinite;
  z-index: 2;
}
.l-scroll-line {
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, var(--gold), transparent);
}
@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(8px); }
}

/* ---- FEATURES ---- */
.l-features {
  background: var(--bg2);
  padding: 110px 24px;
  position: relative;
}
.l-features::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-h), transparent);
}

.l-inner { max-width: 1100px; margin: 0 auto; }

.l-section-title {
  font-family: "Cinzel", "Georgia", serif;
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 700;
  text-align: center;
  color: var(--gold);
  margin-bottom: 16px;
}

.l-section-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 64px;
}

.l-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.l-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 28px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.l-card:hover {
  border-color: var(--border-h);
  box-shadow: 0 16px 48px rgba(201,162,39,0.1);
}

.l-card-icon {
  font-size: 36px;
  color: var(--gold);
  margin-bottom: 20px;
  line-height: 1;
}

.l-card-title {
  font-family: "Cinzel", "Georgia", serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.l-card-desc {
  font-size: 16px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ---- BOTTOM CTA ---- */
.l-cta-section {
  background: var(--bg);
  padding: 130px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.l-cta-orb {
  position: absolute;
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,162,39,0.07), transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.l-cta-inner { position: relative; }

.l-cta-title {
  font-family: "Cinzel", "Georgia", serif;
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}
.l-cta-sub {
  color: var(--text-dim);
  font-size: 16px;
  margin-bottom: 52px;
  letter-spacing: 0.06em;
}
.l-cta-btn-lg { font-size: 17px; padding: 20px 56px; }

/* ---- FOOTER ---- */
.l-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 28px 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
}
.l-footer-links { display: flex; gap: 28px; }
.l-footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.l-footer-links a:hover { color: var(--gold); }

/* ---- Rich site footer (About / Bazi / Zodiac / Tibetan — mirrors the homepage footer,
   using this site's shared --gold/--text-dim/--border vars for automatic light/dark theming) ---- */
.sf-footer {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 56px 24px 26px;
}
.sf-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 34px;
  max-width: 1080px;
  margin: 0 auto;
}
.sf-brand .l-nav-logo { margin-bottom: 16px; }
.sf-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0 0 18px;
  max-width: 260px;
}
.sf-socials { display: flex; gap: 12px; }
.sf-socials a {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: color 0.18s, border-color 0.18s;
}
.sf-socials a:hover { color: var(--gold); border-color: var(--gold); }
.sf-col h4 {
  font-family: "Cinzel", "Georgia", serif;
  font-size: 13px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 16px;
}
.sf-col ul { list-style: none; padding: 0; margin: 0; }
.sf-col li { margin-bottom: 10px; }
.sf-col a, .sf-col span {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.16s;
}
.sf-col a:hover { color: var(--gold); }
.sf-bottom {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin: 40px auto 0;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  max-width: 1080px;
}

@media (max-width: 940px) {
  .sf-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
}
@media (max-width: 560px) {
  .sf-grid { grid-template-columns: 1fr; }
  .sf-footer { padding: 44px 20px 22px; }
}

/* ---- AUTH BUTTON ---- */
.l-auth-btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 18px;
  border-radius: 100px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  transition: background 0.2s, color 0.2s;
}
.l-auth-btn:hover {
  background: var(--gold);
  color: var(--bg);
}
.l-auth-btn--user {
  border-color: var(--border);
  color: var(--text-dim);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.l-auth-btn--user:hover {
  background: rgba(201, 162, 39, 0.1);
  border-color: var(--border-h);
  color: var(--text);
}
.l-auth-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5d87a, #c9a227, #9a7310);
  color: #0a0808;
  font-weight: 700;
  font-size: 15px;
  font-family: "Cinzel", "Georgia", serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(201, 162, 39, 0.4);
  transition: box-shadow 0.2s, transform 0.15s;
  text-decoration: none;
}
.l-auth-avatar:hover {
  box-shadow: 0 4px 18px rgba(201, 162, 39, 0.65);
  transform: scale(1.07);
}

/* ---- AUTH DROPDOWN ---- */
.l-auth-dropdown {
  position: fixed;
  z-index: 9999;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  min-width: 190px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.l-auth-dropdown-header {
  padding: 10px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.l-auth-dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.l-auth-dropdown-email {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.l-auth-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.l-auth-dropdown-item:hover {
  background: rgba(201, 162, 39, 0.1);
  color: var(--gold);
}
.l-auth-dropdown-item.danger:hover {
  background: rgba(220, 60, 60, 0.1);
  color: #e05050;
}

/* ---- TOKEN MODAL (UI shell — license/quota system not built yet) ---- */
.token-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(4, 4, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.token-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  /* Solid, hardcoded (not var(--card)) so it stays fully opaque even on pages using the
     "galaxy" glass theme (body.g-dark in galaxy.css redefines --card as translucent). */
  background: #10101c;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 32px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
html:not([data-theme="dark"]) .token-modal { background: #faf5e8; }

.modal-x-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.modal-x-close:hover { background: rgba(201, 162, 39, 0.08); border-color: var(--gold); color: var(--gold); }
.token-modal-icon {
  font-size: 40px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(201, 162, 39, 0.4));
}
.token-modal-title {
  font-family: "Cinzel", "Georgia", serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.token-modal-sub {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 22px;
}
.token-modal-label {
  display: block;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.token-modal-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  margin-bottom: 18px;
  box-sizing: border-box;
}
.token-modal-input:focus { border-color: var(--gold); }
.token-modal-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), #9a7310);
  color: #0a0808;
  font-weight: 700;
  font-size: 15px;
  padding: 14px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px var(--gold-glow);
}
.token-modal-submit:hover { transform: translateY(-2px); box-shadow: 0 8px 32px var(--gold-glow); }
.token-modal-submit:active { transform: translateY(0); }
.token-modal-status {
  font-size: 13px;
  min-height: 1.4em;
  margin-top: 14px;
  line-height: 1.6;
}
.token-modal-status.error { color: #e05050; }
.token-modal-status.info { color: var(--gold); }

/* ---- RIWAYAT (calculation history) MODAL ---- */
.riwayat-modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  /* Solid, hardcoded (not var(--card)) so it stays fully opaque even on pages using the
     "galaxy" glass theme (body.g-dark in galaxy.css redefines --card as translucent). */
  background: #10101c;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
html:not([data-theme="dark"]) .riwayat-modal { background: #faf5e8; }
.riwayat-modal-title {
  font-family: "Cinzel", "Georgia", serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 24px;
}
.riwayat-modal-loading,
.riwayat-modal-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 24px 0;
}
.riwayat-modal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
  overflow-y: auto;
  min-height: 0;
}
.riwayat-modal-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.riwayat-modal-item-main { min-width: 0; }
.riwayat-modal-item-name {
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.riwayat-modal-item-date { color: var(--gold); font-size: 14px; font-weight: 600; }
.riwayat-modal-item-time { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.riwayat-modal-item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.riwayat-modal-view-btn {
  background: linear-gradient(135deg, var(--gold-light), var(--gold), #9a7310);
  color: #0a0808;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 100px;
  text-decoration: none;
  white-space: nowrap;
}
.riwayat-modal-delete-btn {
  background: transparent;
  border: 1px solid rgba(224, 80, 80, 0.3);
  color: #e05050;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.riwayat-modal-delete-btn:hover { background: rgba(224, 80, 80, 0.1); border-color: rgba(224, 80, 80, 0.55); }
.riwayat-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.riwayat-modal-delete-all {
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
  background: none;
  border: 1px solid rgba(224, 80, 80, 0.3);
  color: #e05050;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s;
}
.riwayat-modal-delete-all:hover { background: rgba(224, 80, 80, 0.08); border-color: rgba(224, 80, 80, 0.55); }
.riwayat-modal-delete-all:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 480px) {
  .riwayat-modal { padding: 28px 20px; }
  .riwayat-modal-item { padding: 14px 16px; }
  .riwayat-modal-actions { flex-direction: column; }
}

/* ---- BURGER / MOBILE MENU ---- */
.l-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.l-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.l-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.l-burger.open span:nth-child(2) { opacity: 0; }
.l-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.l-mobile-menu {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--nav-scrolled);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.l-mobile-menu.open { max-height: 420px; }

.l-mobile-link {
  display: block;
  padding: 16px 20px;
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
  width: 100%;
  text-align: left;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
}
.l-mobile-link:last-child { border-bottom: none; }
.l-mobile-link.active, .l-mobile-link:hover { color: var(--gold); }
.l-mobile-link-danger { color: #e05050 !important; }
.l-mobile-link-danger:hover { color: #e05050 !important; }

/* ---- AI CHATBOX ---- */
.chat-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), #9a7310);
  color: #0a0808;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(201,162,39,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-float-btn:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(201,162,39,0.65); }
.chat-float-btn.active { background: linear-gradient(135deg, #9a7310, var(--gold)); }

.chat-panel {
  position: fixed;
  bottom: 92px;
  right: 28px;
  z-index: 200;
  width: 340px;
  max-height: 480px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
}
.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-panel-title {
  font-family: "Cinzel", "Georgia", serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.04em;
}
.chat-panel-star { font-size: 12px; }
.chat-panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.chat-panel-close:hover { color: var(--text); background: rgba(201,162,39,0.1); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.chat-msg {
  max-width: 88%;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 9px 13px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg-user {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #0a0808;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg-bot {
  background: rgba(201,162,39,0.08);
  border: 1px solid var(--border);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
/* ---- Rendered markdown inside bot bubbles ---- */
.chat-msg-bot .chat-md-h { font-weight: 700; margin: 8px 0 3px; }
.chat-msg-bot .chat-md-h:first-child { margin-top: 0; }
.chat-msg-bot .chat-md-gap { height: 6px; }
.chat-msg-bot ul, .chat-msg-bot ol { margin: 4px 0; padding-left: 18px; }
.chat-msg-bot li { margin: 2px 0; }
.chat-msg-bot strong { font-weight: 700; }
.chat-msg-bot em { font-style: italic; }
.chat-msg-bot code {
  background: rgba(201,162,39,0.16);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.chat-msg-loading {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}
.chat-msg-loading span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: chatDot 1.2s ease-in-out infinite;
}
.chat-msg-loading span:nth-child(2) { animation-delay: 0.2s; }
.chat-msg-loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatDot {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}
/* ---- Message action buttons (chatbox widget) ---- */
.chat-msg-wrap { display: flex; flex-direction: column; }
.chat-msg-wrap-user { align-self: flex-end; align-items: flex-end; }
.chat-msg-actions {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  padding-left: 2px;
  opacity: 0;
  transition: opacity 0.18s;
}
.chat-msg-actions-user { justify-content: flex-end; padding-left: 0; padding-right: 2px; }
.chat-msg-wrap:hover .chat-msg-actions { opacity: 1; }
/* User-message copy/edit stay fully visible (no hover needed) */
.chat-msg-wrap-user .chat-msg-actions { opacity: 1; }
@media (hover: none) { .chat-msg-actions { opacity: 1; } }
.chat-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  padding: 3px 5px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.chat-action-btn:hover { color: var(--gold); background: rgba(201,162,39,0.08); }
[data-theme="dark"] .chat-action-btn { color: #3d7a68; }
[data-theme="dark"] .chat-action-btn:hover { color: #7dd4be; background: rgba(125,212,190,0.1); }

.chat-input-area {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input-wrap {
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px 8px;
  transition: border-color 0.2s;
}
.chat-input-wrap:focus-within { border-color: var(--gold); }
.chat-input {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 0;
  outline: none;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  resize: none;
  overflow-y: auto;
  max-height: 160px;
  line-height: 1.5;
  display: block;
  box-sizing: border-box;
}
.chat-input-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.chat-tool-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.chat-tool-btn:hover { color: var(--text); background: rgba(255,255,255,0.07); }
.chat-tool-btn.active { color: #e05050; }
@keyframes micPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.chat-tool-btn.active svg { animation: micPulse 1s ease-in-out infinite; }
.chat-send-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #0a0808;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.chat-send-btn:hover { transform: scale(1.08); }
/* ---- Chatbox attach button ---- */
.chat-attach-btn {
  background: none;
  border: 1.5px solid #666;
  border-radius: 50%;
  cursor: pointer;
  color: #888;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.chat-attach-btn:hover { color: var(--text); border-color: var(--text); }
[data-theme="dark"] .chat-attach-btn { border-color: #3d7a68; color: #3d7a68; }
[data-theme="dark"] .chat-attach-btn:hover { color: #7dd4be; border-color: #7dd4be; }
/* ---- Image preview in chatbox input ---- */
.chat-img-preview {
  flex-direction: row; align-items: center; gap: 8px;
  padding-bottom: 8px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.chat-img-wrap-inner { position: relative; display: inline-flex; }
.chat-img-thumb { width: 48px; height: 48px; border-radius: 7px; object-fit: cover; border: 1px solid var(--border); }
.chat-img-remove {
  position: absolute; top: -5px; right: -5px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(20,20,20,0.85); border: 1px solid rgba(255,255,255,0.15);
  color: #fff; font-size: 9px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0; line-height: 1;
}
/* ---- Image in chat message bubbles ---- */
.chat-msg-img { max-width: 180px; max-height: 150px; border-radius: 9px; object-fit: contain; display: block; margin-bottom: 4px; }
/* ---- Mic toast (permission / error hints) ---- */
.chat-mic-toast {
  position: absolute; bottom: 78px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: rgba(20,20,20,0.92); color: #fff; font-size: 12px;
  padding: 8px 13px; border-radius: 9px; max-width: 86%; text-align: center;
  z-index: 20; pointer-events: none; opacity: 0;
  transition: opacity 0.25s, transform 0.25s; box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.chat-mic-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 600px) {
  .chat-panel { width: calc(100vw - 24px); right: 12px; bottom: 86px; overflow: hidden; }
  .chat-float-btn { right: 16px; bottom: 20px; }
  .chat-input { font-size: 16px; } /* prevents iOS auto-zoom on focus */
  .chat-input-area { padding: 6px 10px 8px; }
}

[data-theme="dark"] .chat-panel {
  background: #050f0d;
  border-color: #0f3028;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
}
[data-theme="dark"] .chat-panel-header {
  background: #091915;
  border-bottom-color: #0f3028;
}
[data-theme="dark"] .chat-panel-close:hover { background: rgba(15,96,80,0.2); }
[data-theme="dark"] .chat-messages { scrollbar-color: #0f3028 transparent; }
[data-theme="dark"] .chat-msg-bot {
  background: #0a2420;
  border-color: #0f4035;
  color: #7dd4be;
}
[data-theme="dark"] .chat-input-area {
  background: #091915;
  border-top-color: #0f3028;
}
[data-theme="dark"] .chat-input-wrap {
  background: #0f2e28;
  border-color: #0f4035;
}
[data-theme="dark"] .chat-input-wrap:focus-within { border-color: #1a6050; }
[data-theme="dark"] .chat-input { color: #9fe8d0; }
[data-theme="dark"] .chat-input::placeholder { color: #3d7a68; }
[data-theme="dark"] .chat-tool-btn { color: #3d7a68; }
[data-theme="dark"] .chat-tool-btn:hover { color: #7dd4be; background: rgba(125,212,190,0.1); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .l-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .l-nav { padding: 16px 20px; }
  .l-nav-right { gap: 14px; }
  .l-hero { padding: 100px 20px 80px; }
  .l-features { padding: 72px 20px; }
  .l-grid { grid-template-columns: 1fr; }
  .l-cta-section { padding: 80px 20px; }
  .l-footer { padding: 24px 20px; flex-direction: column; gap: 14px; text-align: center; }
  .orb1 { width: 260px; height: 260px; }
  .orb2 { width: 180px; height: 180px; }
  .orb3 { width: 220px; height: 220px; }
  .l-hide-mobile { display: none !important; }
  .l-burger { display: flex; }
  .l-mobile-menu { display: flex; }
}
