:root {
  --biru: #0b4fad;
  --biru-tua: #072f66;
  --emas: #e2b340;
  --latar: #f4f7fb;
  --teks: #16324f;
  --muted: #5c7190;
  --garis: #d5e0ee;
  --bahaya: #9d1230;
  --ok: #0f6b3c;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", "DejaVu Sans", sans-serif;
  color: var(--teks);
  background: var(--latar);
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img { max-width: 100%; }

a { color: var(--biru); }

.spanduk {
  position: relative;
  width: 100%;
  background: #0a4ea2;
  line-height: 0;
}

.spanduk img,
.gambar-spanduk {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.identitas {
  position: absolute;
  z-index: 3;
  top: clamp(8px, 1.8vh, 20px);
  left: clamp(12px, 2vw, 32px);
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 16px);
  max-width: min(720px, 78%);
  line-height: 1.15;
  pointer-events: none;
}

.logo-kilat {
  position: relative;
  flex: 0 0 auto;
  line-height: 0;
}

.logo-kilat img {
  width: auto;
  height: clamp(48px, 9vh, 86px);
  max-width: none;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 20, 60, .45));
}

.logo-kilat::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, .92) 50%, transparent 68%);
  background-size: 240% 100%;
  animation: sapu 2.8s ease-in-out infinite;
  mix-blend-mode: screen;
  pointer-events: none;
}

.logo-kilat::before {
  content: "✦";
  position: absolute;
  top: -2px;
  right: -4px;
  z-index: 2;
  color: #fff6c8;
  font-size: 13px;
  line-height: 1;
  text-shadow: 0 0 6px #ffe38a, 0 0 2px #fff;
  animation: kedip 1.7s ease-in-out infinite;
}

.nama-lembaga {
  margin: 0;
  font-size: clamp(13px, 1.7vw, 22px);
  font-weight: 800;
  letter-spacing: .045em;
  text-transform: uppercase;
  background: linear-gradient(100deg, #ffffff 0%, #ffffff 36%, #fff1b0 50%, #ffffff 64%, #ffffff 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 3px rgba(0, 25, 70, .7));
  animation: geser 3s linear infinite;
}

body.beranda {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: #0a4ea2;
}

body.beranda .spanduk {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background: #0a4ea2;
}

body.beranda .spanduk .gambar-spanduk {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: fill;
  object-position: center center;
}

body.beranda .spanduk .identitas img {
  width: auto;
  height: clamp(46px, 8.5vh, 82px);
  max-width: none;
  max-height: none;
  object-fit: contain;
}

body.beranda .bungkus {
  flex: 0 0 auto;
  width: 100%;
  margin-top: 0;
  position: relative;
  z-index: 2;
  padding: 10px clamp(16px, 3.5vw, 56px) calc(14px + env(safe-area-inset-bottom));
  background: var(--latar);
}

body.beranda .label { margin-bottom: 6px; }

body.beranda .daftar { gap: 6px clamp(14px, 2vw, 28px); }

body.beranda .ikon-bungkus { width: min(84px, 12vh); }
body.beranda .ikon-bungkus::before { border-radius: 24px; }
body.beranda .kartu img,
body.beranda .huruf { border-radius: 20px; }

body.beranda .kartu > .ikon-bungkus + span { margin-top: 6px; }

body.beranda .kaki {
  flex: 0 0 auto;
  width: 100%;
  margin-top: 0;
  position: relative;
  z-index: 2;
  padding-top: 6px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: var(--latar);
}

.cadangan {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 280px;
  padding: 36px 48px;
  color: #fff;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .18), transparent 28%),
    linear-gradient(180deg, #2f92ea 0%, #0b4fad 72%, #083e8c 100%);
}

.cadangan img { width: 92px; height: auto; }

.cadangan p { margin: 0; letter-spacing: .08em; font-size: 14px; }

.cadangan h1 { margin: 8px 0 0; font-size: 56px; line-height: .95; }

.cadangan h1 span { display: block; color: var(--emas); }

.cadangan small { display: inline-block; margin-top: 16px; padding: 8px 16px; border-radius: 999px; background: #fff; color: var(--biru-tua); font-weight: 700; }

.bungkus {
  flex: 1;
  width: 100%;
  padding: clamp(22px, 3vw, 42px) clamp(16px, 4vw, 64px) clamp(28px, 4vw, 64px);
}

.label {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--biru);
}

.daftar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 156px));
  justify-content: start;
  align-items: start;
  gap: clamp(18px, 2.4vw, 32px) clamp(16px, 2.6vw, 36px);
  width: 100%;
}

.kartu {
  width: 100%;
  min-height: 44px;
  text-align: center;
  text-decoration: none;
  color: var(--biru-tua);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
}

.ikon-bungkus {
  position: relative;
  display: block;
  width: min(112px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  transition: transform .15s ease;
}

.ikon-bungkus::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 28px;
  background: conic-gradient(from var(--sudut), #3ec6ff, #ffe27a, #c084fc, #34d399, #fb7185, #3ec6ff);
  animation: putar 4s linear infinite;
  filter: drop-shadow(0 0 7px rgba(255, 214, 120, .55));
}

.ikon-bungkus::after {
  content: "✦";
  position: absolute;
  top: -7px;
  right: -2px;
  z-index: 3;
  color: #fff8dc;
  font-size: 15px;
  line-height: 1;
  text-shadow: 0 0 8px #ffe38a, 0 0 2px #fff;
  animation: kedip 1.5s ease-in-out infinite;
  pointer-events: none;
}

.kartu img, .huruf {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(10, 50, 110, .14);
  object-fit: contain;
}

.kartu img { display: block; padding: 6px; transition: transform .15s ease; }

.huruf {
  display: grid;
  place-items: center;
  font-size: 32px;
  color: var(--biru);
}

.kartu > .ikon-bungkus + span { display: block; margin-top: 10px; }

.kartu:hover .ikon-bungkus, .kartu:focus-visible .ikon-bungkus { transform: translateY(-3px); }

.kartu:focus-visible { outline: 3px solid var(--emas); outline-offset: 4px; border-radius: 8px; }

.kaki {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin-top: auto;
  padding: 16px clamp(16px, 4vw, 64px) calc(18px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 13px;
}

.kaki a { color: var(--muted); }

.kosong { margin: 0; color: var(--muted); }

.panel {
  width: min(1040px, calc(100% - 28px));
  margin: clamp(16px, 3vw, 28px) auto clamp(28px, 5vw, 48px);
}

.masuk-badan {
  flex: 1;
  width: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .16), transparent 26%),
    linear-gradient(180deg, #1d74d6, #0b4fad 70%);
}

.kartu-masuk {
  width: min(420px, calc(100% - 28px));
  padding: 28px 26px 22px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(5, 25, 60, .25);
}

.logo-pusat {
  position: relative;
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin: 0 auto 2px;
}

.logo-pusat::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: conic-gradient(from var(--sudut), transparent 0 55%, rgba(255, 226, 122, .15) 70%, #fff6c2 82%, rgba(255, 226, 122, .2) 90%, transparent 100%);
  opacity: 0;
  filter: blur(.4px);
}

.kartu-masuk .logo {
  position: relative;
  z-index: 1;
  width: 84px;
  height: auto;
  transition: transform .7s ease, filter .7s ease;
}

.logo-pusat:hover::before,
.kartu-masuk:hover .logo-pusat::before {
  opacity: 1;
  animation: putar 1.15s linear infinite;
}

.logo-pusat:hover .logo,
.kartu-masuk:hover .logo-pusat .logo {
  transform: rotate(360deg);
  filter: drop-shadow(0 0 8px rgba(255, 214, 90, .95)) drop-shadow(0 0 2px #fff);
}

.kode-gambar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.kode-gambar img {
  width: 168px;
  height: 52px;
  border: 1px solid var(--garis);
  border-radius: 8px;
  background: #f4f7fb;
}

.kode-gambar a { font-size: 13px; font-weight: 700; }

.kartu-masuk h1 { margin: 4px 0 4px; font-size: 24px; color: var(--biru-tua); text-align: center; }

.kartu-masuk .sub { margin: 0 0 18px; color: var(--muted); text-align: center; }

.kepala-admin {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  color: #fff;
  background: linear-gradient(90deg, #083e8c, #0b4fad);
}

.kepala-admin h1 { margin: 0; font-size: 22px; }

.kepala-admin p { margin: 4px 0 0; color: rgba(255, 255, 255, .8); font-size: 13px; }

.kepala-admin a, .kepala-admin button.link {
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  padding: 8px 14px;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.blok {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--garis);
  border-radius: 16px;
  background: #fff;
}

.blok h2 { margin: 0 0 12px; font-size: 18px; }

.bantuan { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

.pesan { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #e8f7ee; color: var(--ok); }

.pesan.galat, .galat { background: #fdecef; color: var(--bahaya); }

.galat { margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; }

label { display: block; margin: 12px 0 6px; font-weight: 700; font-size: 14px; }

input[type="text"], input[type="password"], input[type="url"], input[type="number"], input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c5d3e6;
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

input:focus { outline: 3px solid rgba(226, 179, 64, .55); border-color: var(--biru); }

.centang { display: flex; align-items: center; gap: 8px; margin: 14px 0; font-weight: 600; }

.centang input { width: auto; }

.aksi { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

button, .tombol {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--biru);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button.kedua, .tombol.kedua { background: #e8eef8; color: var(--biru-tua); }

button.bahaya { background: var(--bahaya); }

.tabel-bungkus { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td { padding: 10px 8px; border-bottom: 1px solid var(--garis); text-align: left; vertical-align: middle; }

th { font-size: 13px; color: var(--muted); }

td img { width: 48px; height: 48px; object-fit: contain; border-radius: 12px; background: #f4f7fb; }

.tautan { word-break: break-all; font-size: 13px; }

.pratinjau { display: block; max-width: 100%; max-height: 180px; margin-bottom: 12px; border-radius: 12px; }

.pratinjau.logo-kecil { width: 84px; height: auto; background: #e8eef8; padding: 8px; }

.baris-aksi { display: flex; gap: 8px; align-items: center; }

.baris-aksi form { margin: 0; }

@property --sudut {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes sapu {
  0% { background-position: 140% 0; }
  100% { background-position: -40% 0; }
}

@keyframes geser {
  0% { background-position: 120% 0; }
  100% { background-position: -20% 0; }
}

@keyframes putar {
  to { --sudut: 360deg; }
}

@keyframes kedip {
  0%, 100% { opacity: .15; transform: scale(.55); }
  50% { opacity: 1; transform: scale(1); }
}

@media (max-height: 760px) and (min-width: 761px) {
  body.beranda .bungkus { padding-top: 8px; padding-bottom: 2px; }
  body.beranda .label { margin-bottom: 4px; }
  body.beranda .ikon-bungkus { width: min(72px, 10vh); }
  body.beranda .kartu img,
  body.beranda .huruf { border-radius: 18px; }
  body.beranda .kartu { font-size: 13px; }
  body.beranda .kaki { padding-top: 4px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
}

@media (max-width: 760px) {
  body.beranda {
    height: auto;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
  }
  body.beranda .spanduk {
    position: static;
    inset: auto;
    flex: 0 0 auto;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  body.beranda .spanduk .gambar-spanduk {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
  }
  body.beranda .identitas { top: 8px; left: 10px; }
  body.beranda .spanduk .identitas img { height: 48px; }
  body.beranda .bungkus { margin-top: 0; padding: 16px 16px 8px; }
  body.beranda .daftar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: start;
    gap: 16px 12px;
  }
  body.beranda .ikon-bungkus { width: min(96px, 28vw); }
  .cadangan { min-height: 0; gap: 14px; padding: 22px 16px; }
  .cadangan img { width: 64px; }
  .cadangan h1 { font-size: clamp(30px, 9vw, 40px); }
  .cadangan p, .cadangan small { font-size: 12px; }
  .bungkus { padding: 20px 14px 32px; }
  .daftar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .kartu { font-size: 13.5px; }
  .ikon-bungkus { width: min(104px, 34vw); }
  .kartu img, .huruf { border-radius: 24px; }
  .kaki { flex-direction: column; align-items: flex-start; }
  .kepala-admin { align-items: flex-start; flex-direction: column; padding: 16px; }
  .kepala-admin .aksi { width: 100%; }
  .kepala-admin .aksi a,
  .kepala-admin .aksi button,
  .kepala-admin .aksi form { flex: 1; text-align: center; }
  .kepala-admin .aksi form { display: flex; }
  .kepala-admin .aksi button { width: 100%; min-height: 44px; }
  .kartu-masuk { width: min(420px, calc(100% - 20px)); padding: 22px 16px 18px; }
  .panel { width: min(1040px, calc(100% - 16px)); }
  .blok { padding: 14px; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  tbody tr {
    margin: 0 0 12px;
    padding: 8px 10px;
    border: 1px solid var(--garis);
    border-radius: 14px;
  }
  td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 0;
    padding: 8px 2px;
  }
  td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  td.baris-aksi { justify-content: flex-end; }
  input[type="file"] { font-size: 14px; }
}

@media (min-width: 1100px) {
  .daftar { grid-template-columns: repeat(auto-fill, minmax(150px, 180px)); }
  .kartu { font-size: 16px; }
  .ikon-bungkus { width: 124px; }
  .ikon-bungkus::before { border-radius: 32px; }
  .kartu img, .huruf { border-radius: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .kartu img, .kartu:hover .ikon-bungkus { transition: none; transform: none; }
  .logo-kilat::before, .logo-kilat::after, .nama-lembaga, .ikon-bungkus::before, .ikon-bungkus::after,
  .logo-pusat::before, .logo-pusat .logo { animation: none; transition: none; transform: none; }
}
