/* =====================================================================
   VARIABEL 4 TEMA CABANG IPA (FISIKA, BIOLOGI, KIMIA, BUMI & ENERGI)
   ===================================================================== */
:root, [data-theme="fisika"] {
  --accent: #06b6d4;
  --accent-strong: #0284c7;
  --accent-soft: rgba(6, 182, 212, 0.14);
  --accent-border: rgba(6, 182, 212, 0.35);
  --accent-glow: rgba(6, 182, 212, 0.28);
  --svg-stroke: #0891b2;
}
[data-theme="biologi"] {
  --accent: #10b981;
  --accent-strong: #059669;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-border: rgba(16, 185, 129, 0.35);
  --accent-glow: rgba(16, 185, 129, 0.28);
  --svg-stroke: #059669;
}
[data-theme="kimia"] {
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --accent-border: rgba(139, 92, 246, 0.35);
  --accent-glow: rgba(139, 92, 246, 0.28);
  --svg-stroke: #7c3aed;
}
[data-theme="bumi"] {
  --accent: #f59e0b;
  --accent-strong: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.15);
  --accent-border: rgba(245, 158, 11, 0.38);
  --accent-glow: rgba(245, 158, 11, 0.28);
  --svg-stroke: #d97706;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  overflow-x: hidden;
}

.bg-accent-gradient { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); }
.bg-accent-soft { background-color: var(--accent-soft); }
.text-accent { color: var(--accent); }
.border-accent { border-color: var(--accent-border); }
.shadow-accent { box-shadow: 0 10px 28px -6px var(--accent-glow); }

.glass-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(148, 163, 184, 0.22);
}
.dark .glass-card {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

#dynamic-island {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 9999;
  transform: translate(-50%, -140%) scale(0.84);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.52s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.32s ease;
}
#dynamic-island.show {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(2deg); }
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.svg-float { animation: floatSlow 10s ease-in-out infinite; }
.svg-spin { transform-origin: center; animation: spinSlow 45s linear infinite; }

/* 3D Flip Memory Card */
.memory-card { perspective: 900px; }
.memory-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
}
.memory-card.flipped .memory-inner,
.memory-card.matched .memory-inner { transform: rotateY(180deg); }
.memory-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.memory-back { transform: rotateY(180deg); }

/* Grid 18 Kolom untuk Tabel Periodik Utuh */
.periodic-grid-18 {
  display: grid;
  grid-template-columns: repeat(18, minmax(46px, 1fr));
  gap: 4px;
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.55); }

/* Mode Cetak / Print-to-PDF Rapor */
@media print {
  .no-print { display: none !important; }
  #app-content-wrapper { padding-left: 0 !important; padding-bottom: 0 !important; }
  body { background: #ffffff !important; color: #0f172a !important; }
  .glass-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }
}

/* Transisi Ringan GPU-Accelerated (Hanya Opacity & Transform) */
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes drawerSlideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.view-enter {
  animation: viewFadeIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#confirm-modal:not(.hidden) > div,
#photo-modal:not(.hidden) > div {
  animation: modalPopIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#mobile-drawer-overlay:not(.hidden) > aside {
  animation: drawerSlideIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .view-enter,
  #confirm-modal:not(.hidden) > div,
  #photo-modal:not(.hidden) > div,
  #mobile-drawer-overlay:not(.hidden) > aside {
    animation: none !important;
  }
}

/* Responsif Mode Miring (Landscape) di HP */
@media (max-height: 540px) and (orientation: landscape) {
  header.sticky {
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
  }
  #main-content {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  #game-stage canvas:not(#tetris-next) {
    max-height: calc(100vh - 185px);
    width: auto !important;
    max-width: 100%;
  }
  #fusi-board {
    width: min(260px, calc(100vh - 175px)) !important;
    height: min(260px, calc(100vh - 175px)) !important;
  }
}
