:root {
  --bg: #080d1a;
  --card: #0f1730;
  --card-2: #151f3d;
  --biru: #4c8dff;
  --biru-tua: #2554c7;
  --kuning: #ffc83d;
  --kuning-tua: #e0a800;
  --text: #e8edf8;
  --muted: #8f9cb8;
  --border: rgba(120, 150, 220, 0.18);
  --err: #ff7b72;
}

* { box-sizing: border-box; }
html { height: 100%; }
body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.6;
}

/* Cahaya latar: biru di kanan atas, kuning di kiri bawah */
.bg-decoration {
  position: fixed;
  top: -15%;
  right: -10%;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, rgba(76, 141, 255, 0.28) 0%, transparent 68%);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

.bg-decoration::after {
  content: '';
  position: fixed;
  bottom: -18%;
  left: -12%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 200, 61, 0.14) 0%, transparent 68%);
  border-radius: 50%;
  pointer-events: none;
}

@keyframes fadeUpIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.kertas {
  background: rgba(15, 23, 48, 0.82);
  width: 100%;
  max-width: 900px;
  border-radius: 24px;
  padding: 48px 40px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--kuning);
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 1;
  animation: fadeUpIn 0.7s ease-out;
}

section { display: none; }
section.aktif { display: block; animation: fadeUpIn 0.5s ease-out; }

h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 400;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1.2;
}

h1 span {
  display: block;
  font-size: 0.6em;
  color: var(--kuning);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  letter-spacing: 2px;
  margin-top: 4px;
}

.subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin: 12px 0 32px;
  font-weight: 500;
}

input {
  display: block;
  width: 100%;
  max-width: 380px;
  margin: 0 auto 14px;
  padding: 14px 18px;
  font: inherit;
  font-size: max(16px, 1rem);
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  transition: border-color .25s, box-shadow .25s;
}

input::placeholder { color: #5d6b88; }

input:focus-visible {
  outline: none;
  border-color: var(--biru);
  box-shadow: 0 0 0 4px rgba(76, 141, 255, 0.18);
}

select {
  display: block;
  width: 100%;
  max-width: 380px;
  margin: 0 auto 18px;
  min-height: 56px;
  padding: 14px 48px 14px 18px;
  font: inherit;
  font-size: max(16px, 1rem);
  touch-action: manipulation;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffc83d' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 16px center;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color .25s, box-shadow .25s, opacity .25s;
}

select:focus-visible {
  outline: none;
  border-color: var(--biru);
  box-shadow: 0 0 0 4px rgba(76, 141, 255, 0.18);
}

select:disabled { opacity: .45; cursor: not-allowed; }
select option { background: var(--card); color: var(--text); }

.label {
  max-width: 380px;
  margin: 0 auto 8px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.95rem;
}

.next {
  margin: 20px auto 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  background: var(--kuning);
  color: #1a1400;
  cursor: pointer;
  transition: transform .3s, box-shadow .3s, background .3s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(255, 200, 61, 0.28);
}

.next:hover {
  background: #ffd45e;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(255, 200, 61, 0.4);
}

.next:focus-visible, .kandidat:focus-visible, .modal-buttons button:focus-visible {
  outline: 3px solid var(--biru);
  outline-offset: 3px;
}

.next:disabled { opacity: 0.5; cursor: wait; }

.galeri {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  margin: 32px 0;
}

.kandidat {
  width: 220px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform .3s, border-color .3s, box-shadow .3s;
}

.kandidat:hover {
  border-color: var(--kuning);
  transform: translateY(-6px);
  box-shadow: 0 14px 34px rgba(255, 200, 61, 0.16), 0 0 0 1px var(--kuning);
}

.kandidat:disabled { opacity: 0.6; cursor: wait; }

.kandidat img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
  background: var(--bg);
  border-radius: 12px;
}

.kandidat span {
  display: block;
  margin-top: 14px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.err {
  color: var(--err);
  min-height: 1.4em;
  margin: 8px 0 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: var(--kuning);
  color: #1a1400;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  font-weight: 800;
  margin: 0 auto 20px;
  box-shadow: 0 0 0 10px rgba(255, 200, 61, 0.12);
  animation: fadeUpIn 0.6s ease-out 0.2s backwards;
}

.terima {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 400;
  margin: 0 0 12px;
  color: var(--text);
}

.sub {
  font-size: 1.1rem;
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

/* Modal konfirmasi */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 16, 0.72);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease-out;
}

.modal.aktif { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content {
  background: var(--card);
  border-radius: 20px;
  padding: 36px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  border-top: 3px solid var(--biru);
  animation: modalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header { text-align: center; }

.modal-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin: 0 0 8px;
  color: var(--text);
}

.nama-calon {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--kuning);
  margin: 12px 0 8px;
}

.confirm-text { color: var(--muted); margin: 0; font-weight: 500; }

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 28px;
}

.modal-buttons button {
  flex: 1;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid;
  border-radius: 12px;
  cursor: pointer;
  transition: all .25s;
  font-family: inherit;
}

.btn-tidak {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-tidak:hover {
  background: var(--card-2);
  border-color: var(--biru);
}

.btn-ya {
  background: var(--kuning);
  color: #1a1400;
  border-color: var(--kuning);
}

.btn-ya:hover {
  background: #ffd45e;
  box-shadow: 0 8px 22px rgba(255, 200, 61, 0.3);
}

.btn-tidak:active, .btn-ya:active { transform: scale(0.98); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Layar sentuh dan layar kecil (HP / tablet) */
.kandidat, .next, .modal-buttons button { touch-action: manipulation; }

@media (pointer: coarse) {
  select { min-height: 60px; font-size: 1.1rem; }
  .label { font-size: 1.05rem; margin-bottom: 10px; }
  .next { width: 72px; height: 72px; margin-top: 28px; }
  .modal-buttons button { min-height: 56px; font-size: 1.05rem; }
  .kandidat:hover { transform: none; }
  .kandidat:active { border-color: var(--kuning); transform: scale(0.98); }
}

@media (max-width: 640px) {
  body { padding: 12px; align-items: flex-start; }
  .kertas { margin: auto 0; padding: 32px 18px; border-radius: 20px; }
  select { max-width: none; }
  .label { max-width: none; }
  .galeri { gap: 14px; margin: 24px 0 8px; }
  .kandidat { width: calc(50% - 7px); padding: 10px; }
  .kandidat span { font-size: .95rem; }
  .modal-content { padding: 28px 20px; }
  .modal-buttons { flex-direction: column-reverse; }
}

@media (min-width: 641px) and (max-width: 1024px) and (pointer: coarse) {
  .kertas { max-width: 720px; }
  select { max-width: 460px; }
  .kandidat { width: 240px; }
}

/* Dropdown ala Google Forms */
.label { color: var(--text); font-weight: 700; }
.req { color: var(--err); margin-left: 4px; }

.dd { position: relative; max-width: 380px; margin: 0 auto 22px; text-align: left; }

.dd-btn {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 12px 18px;
  background: var(--bg);
  color: var(--muted);
  border: 2px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: max(16px, 1rem);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color .2s, box-shadow .2s, opacity .2s;
}

.dd.terisi .dd-btn { color: var(--text); }
.dd-btn:hover:not(:disabled) { border-color: rgba(120, 150, 220, 0.45); }
.dd-btn:focus-visible, .dd.buka .dd-btn {
  outline: none;
  border-color: var(--biru);
  box-shadow: 0 0 0 4px rgba(76, 141, 255, 0.18);
}
.dd-btn:disabled { opacity: .45; cursor: not-allowed; }
.dd-btn svg { flex: none; color: var(--kuning); transition: transform .2s; }
.dd.buka .dd-btn svg { transform: rotate(180deg); }

.dd-list {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.dd.buka .dd-list { display: block; animation: ddIn .16s ease-out; }
@keyframes ddIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.dd-list li {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: var(--text);
  font-size: max(16px, 1rem);
  cursor: pointer;
  touch-action: manipulation;
}

.dd-list li.aktif { background: rgba(76, 141, 255, 0.16); }
.dd-list li.dipilih { font-weight: 700; box-shadow: inset 3px 0 0 var(--kuning); }

@media (pointer: coarse) { .dd-btn { min-height: 60px; } .dd-list li { min-height: 56px; } }
@media (max-width: 640px) { .dd { max-width: none; } }

/* Logo sekolah dan rgm di pojok kanan bawah */
.bottom-right-logo {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 180px;
  height: 190px;
  z-index: 2;
  opacity: .92;
  pointer-events: none;
  user-select: none;
}

@media (max-width: 640px) {
  body { padding-bottom: 84px; }
  .bottom-right-logo { right: 12px; bottom: 12px; width: 78px; }
}

/* Logo berputar di belakang kertas */
.bg-swirl {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(85vmin, 720px);
  opacity: 0.55;
  transform: translate(-50%, -50%);
  animation: swirl 60s linear infinite;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

@keyframes swirl {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Tombol Visi Misi */
.btn-visimisi {
  display: block;
  margin: 0 auto;
  padding: 12px 26px;
  background: transparent;
  color: var(--kuning);
  border: 2px solid var(--kuning);
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .25s, color .25s, box-shadow .25s;
}

.btn-visimisi:hover {
  background: var(--kuning);
  color: #1a1400;
  box-shadow: 0 8px 22px rgba(255, 200, 61, 0.3);
}

.btn-visimisi:focus-visible {
  outline: 3px solid var(--biru);
  outline-offset: 3px;
}

/* Modal Visi Misi */
.vm-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 7, 16, 0.72);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease-out;
}

.vm-overlay[hidden] { display: none; }

.vm-box {
  position: relative;
  width: min(780px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--biru);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  text-align: left;
  animation: modalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.vm-box > h2 {
  margin: 0 0 22px;
  text-align: center;
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  font-weight: 400;
}

.vm-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 44px;
  height: 44px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.vm-close:hover { color: var(--text); }

.vm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.vm-card {
  padding: 18px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.vm-no { font-size: .85rem; font-weight: 800; color: var(--kuning); }
.vm-card h3 { margin: 2px 0 10px; font-size: 1.05rem; }

.vm-card h4 {
  margin: 14px 0 4px;
  font-size: .8rem;
  color: var(--kuning);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.vm-card p, .vm-card li { margin: 0; font-size: .95rem; line-height: 1.55; color: var(--text); }
.vm-card ol { margin: 0; padding-left: 18px; }

@media (max-width: 640px) {
  .bg-swirl { width: 110vmin; }
  .btn-visimisi { width: 100%; }
  .vm-box { padding: 28px 18px; }
  .vm-grid { grid-template-columns: 1fr; }
}

/* Fade out saat Visi Misi ditutup */
.vm-overlay.menutup {
  animation: fadeOut 0.25s ease-in forwards;
}

.vm-overlay.menutup .vm-box {
  animation: modalOut 0.25s ease-in forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modalOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-20px) scale(0.97); }
}
