/* ================= Bilik Suara ================= */
body.kiosk { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
body.kiosk input { user-select: text; -webkit-user-select: text; }

.screen { min-height: 100vh; padding: clamp(16px, 2.4vw, 32px); }
.center-screen { display: grid; place-items: center; align-content: center; gap: 1rem; }

.loader-orb {
  width: 64px; height: 64px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--cyan), var(--blue), var(--violet), var(--cyan));
  -webkit-mask: radial-gradient(farthest-side, transparent 62%, #000 64%); mask: radial-gradient(farthest-side, transparent 62%, #000 64%);
  animation: spin 1s linear infinite;
}

.logo-xl { width: clamp(96px, 11vw, 140px); filter: drop-shadow(0 16px 30px rgba(0,0,0,.45)); }
.logo-md { width: 62px; filter: drop-shadow(0 8px 16px rgba(0,0,0,.4)); }

/* ---- Layar ditutup ---- */
.closed-card { padding: 3rem 2.5rem; text-align: center; width: min(620px, 100%); display: grid; justify-items: center; gap: .6rem; }
.closed-card h1 { font-size: clamp(1.4rem, 2.6vw, 2rem); margin-top: .6rem; }
.closed-pill {
  margin-top: 1rem; display: inline-flex; gap: .6rem; align-items: center; padding: .7rem 1.2rem; border-radius: 999px;
  background: rgba(255,207,74,.13); border: 1px solid rgba(255,207,74,.4); color: #ffe39a; font-weight: 700;
}
.closed-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---- Layar awal ---- */
.start-grid {
  min-height: calc(100vh - 2 * clamp(16px, 2.4vw, 32px));
  display: grid; grid-template-columns: 1.1fr minmax(360px, 460px); gap: clamp(24px, 4vw, 64px);
  align-items: center; max-width: 1240px; margin: 0 auto;
}
.start-hero { display: grid; gap: .9rem; justify-items: start; }
.eyebrow { text-transform: uppercase; letter-spacing: .22em; font-size: .78rem; font-weight: 700; color: var(--cyan); margin-top: .6rem; }
.hero-title {
  font-size: clamp(2rem, 4.2vw, 3.4rem); line-height: 1.06; font-weight: 800;
  background: linear-gradient(180deg, #fff 30%, #b9cfff); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-wrap: balance;
}
.hero-sub { font-size: clamp(1rem, 1.5vw, 1.2rem); color: var(--muted); margin: 0; }
.hero-meta { display: flex; gap: .5rem; }
.steps-hint { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .55rem; }
.steps-hint li { display: flex; align-items: center; gap: .75rem; color: var(--muted); }
.steps-hint b {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-size: .85rem; color: #fff;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
}

.id-card { padding: 2rem; }
.id-card h2 { font-size: 1.3rem; text-align: center; }
.id-types { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin: .8rem 0 1.2rem; }
.id-types span { font-size: .78rem; color: var(--muted); padding: .3rem .65rem; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); }
.id-types b { color: var(--text); }
.id-input { font-size: 1.7rem; font-weight: 700; text-align: center; padding: 1rem; border-radius: 18px; letter-spacing: .08em; }
.id-msg { min-height: 1.6rem; margin: .55rem 0 .4rem; text-align: center; font-weight: 600; font-size: .92rem; }
.id-msg.err { color: #ffadb8; }
.id-msg.ok { color: #8ff5cf; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: 1.1rem; }
.keypad button {
  font: inherit; font-size: 1.45rem; font-weight: 700; color: var(--text); height: 62px; border-radius: 18px; cursor: pointer;
  background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .1s, background .2s;
}
.keypad button:active { transform: scale(.94); background: rgba(255,255,255,.25); }
.keypad .k-fn { font-size: 1rem; color: var(--muted); }

/* ---- Surat suara ---- */
#screen-ballot { padding-bottom: 120px; max-width: 1500px; margin: 0 auto; }
.ballot-head { display: flex; align-items: center; gap: 1.1rem; padding: 1rem 1.4rem; border-radius: 22px; }
.ballot-title { flex: 1; min-width: 0; }
.ballot-title h1 { font-size: clamp(1.1rem, 2vw, 1.55rem); font-weight: 800; }
.ballot-title p { margin: .2rem 0 0; font-size: .9rem; }

.stepper { display: flex; align-items: center; gap: .5rem; }
.step { display: flex; align-items: center; gap: .45rem; color: var(--faint); font-weight: 700; font-size: .85rem; }
.step b {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06);
}
.step.active { color: var(--text); }
.step.active b { background: linear-gradient(135deg, #3b7bff, #26c6ea); border-color: transparent; box-shadow: 0 0 18px rgba(47,212,240,.55); }
.step.done b { background: var(--green); color: #003322; border-color: transparent; }
.step-line { width: 36px; height: 2px; background: rgba(255,255,255,.2); border-radius: 2px; }

.voter-strip { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; padding: .9rem 1.3rem; border-radius: 20px; }
.voter-avatar {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: 1.3rem;
  background: linear-gradient(135deg, var(--violet), var(--blue)); box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}
.voter-info { flex: 1; min-width: 0; }
.voter-name { font-size: 1.25rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voter-note { max-width: 300px; text-align: right; }

.section-title { display: flex; align-items: center; gap: .8rem; margin: 1.6rem .3rem 1rem; }
.section-title h2 { font-size: clamp(1.2rem, 2.2vw, 1.7rem); font-weight: 800; }

.cand-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.cand-grid.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cand-grid.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.cand {
  display: flex; flex-direction: column; padding: 1.1rem; border-radius: 26px; gap: .8rem;
  transition: transform .25s cubic-bezier(.2,.9,.3,1.2), box-shadow .3s, border-color .3s;
  animation: rise .5s both;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.cand.selected {
  border-color: rgba(255,207,74,.9);
  box-shadow: 0 0 0 3px rgba(255,207,74,.35), 0 0 50px -6px rgba(255,207,74,.55), inset 0 1px 0 var(--glass-hi), var(--shadow);
  transform: translateY(-4px);
}
.cand.dimmed { opacity: .62; }
.cand-top { display: flex; align-items: center; justify-content: space-between; }
.cand-no {
  display: flex; align-items: baseline; gap: .35rem; font-weight: 800; color: var(--muted); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
}
.cand-no b {
  font-size: 2.1rem; line-height: 1; letter-spacing: 0;
  background: linear-gradient(180deg, #fff, #9fbcff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cand.selected .cand-no b { background: linear-gradient(180deg, #fff3c4, var(--gold)); -webkit-background-clip: text; background-clip: text; }
.check-badge {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #2a1600;
  background: var(--gold); box-shadow: 0 0 18px rgba(255,207,74,.8); transform: scale(0); transition: transform .3s cubic-bezier(.2,.9,.3,1.5);
}
.cand.selected .check-badge { transform: scale(1); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.person { text-align: center; }
.person img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 18px; display: block;
  border: 1px solid rgba(255,255,255,.25); box-shadow: 0 10px 24px -10px rgba(0,0,0,.6); background: #dfe8f7;
}
.person .role { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-top: .5rem; font-weight: 700; }
.person .name { font-weight: 800; font-size: .95rem; line-height: 1.25; margin-top: .15rem; }

.vm { background: rgba(5,15,45,.28); border: 1px solid rgba(255,255,255,.1); border-radius: 18px; padding: .8rem .9rem; font-size: .85rem; line-height: 1.5; flex: 1; }
.vm h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--cyan); margin: 0 0 .25rem; }
.vm p { margin: 0 0 .6rem; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vm ol { margin: 0; padding-left: 1.1rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.vm-more { background: none; border: 0; color: var(--cyan); font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer; padding: .3rem 0 0; }

.btn-pilih { width: 100%; padding: 1rem; font-size: 1.1rem; letter-spacing: .12em; }
.cand.selected .btn-pilih { background: linear-gradient(135deg, #ffd65c, #ff9f3d); color: #2a1600; }

.action-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50;
  width: min(1460px, calc(100% - 32px)); display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; border-radius: 999px;
  background: linear-gradient(145deg, rgba(30,55,130,.65), rgba(10,20,60,.72));
}
.selection-summary { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.selection-summary b { color: var(--gold); }
.action-right { display: flex; gap: .6rem; }

/* ---- Modal detail & konfirmasi ---- */
.confirm-list { display: grid; gap: .8rem; margin-top: .6rem; }
.confirm-item { display: flex; gap: .9rem; align-items: center; padding: .8rem; border-radius: 18px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); }
.confirm-item img { width: 46px; height: 58px; object-fit: cover; border-radius: 10px; }
.confirm-item .no { font-size: 1.8rem; font-weight: 800; color: var(--gold); min-width: 2.2rem; text-align: center; }
.confirm-item .t { color: var(--text); font-weight: 700; line-height: 1.3; }
.detail-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1rem; }
.detail-pair img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 16px; }
.detail-text { color: var(--text); white-space: pre-line; }

/* ---- Terima kasih ---- */
.thanks-overlay { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; background: rgba(3,8,25,.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.thanks-card { padding: 2.6rem 3rem; text-align: center; width: min(520px, calc(100% - 32px)); animation: rise .45s cubic-bezier(.2,.9,.3,1.2); }
.thanks-card h2 { font-size: 2rem; margin-top: 1rem; }
.thanks-card p { font-size: 1.1rem; margin: .5rem 0; }
.check { width: 110px; height: 110px; }
.check circle { fill: rgba(47,224,160,.15); stroke: var(--green); stroke-width: 3; stroke-dasharray: 230; stroke-dashoffset: 230; animation: draw .6s forwards; }
.check path { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .4s .5s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- Responsif ---- */
@media (max-width: 1180px) { .cand-grid.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .start-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .start-hero { justify-items: center; }
  .steps-hint { display: none; }
  .id-card { width: min(460px, 100%); }
  .cand-grid.n3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .voter-note { display: none; }
}
@media (max-width: 640px) {
  .cand-grid.n3, .cand-grid.n4 { grid-template-columns: 1fr; }
  .stepper span { display: none; }
  .action-bar { border-radius: 24px; flex-wrap: wrap; }
  .selection-summary { order: -1; flex-basis: 100%; }
  .action-right { flex: 1; justify-content: flex-end; }
  .ballot-head .logo-md { width: 44px; }
}
