@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1e3a8a;
    --primary-dark: #1e40af;
    --primary-light: #60a5fa;
    --border: #e2e8f0;
    --text: #1a1a1a;
    --muted: #64748b;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Plus Jakarta Sans', sans-serif; }

body {
    min-height: 100dvh;
    color: var(--text);
    background: radial-gradient(at top left, #eff6ff 0%, #ffffff 50%, #f1f5f9 100%) fixed;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Layar & kartu ---------- */
.screen.center { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.card {
    width: 100%; max-width: 480px; padding: 2.5rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid var(--border); border-radius: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,.05), 0 10px 10px -5px rgba(0,0,0,.02);
    text-align: center; animation: fadeIn .6s ease-out;
}
.class-card { max-width: 560px; }

.badge {
    display: inline-block; margin-bottom: 1rem; padding: .35rem .9rem;
    background: #eff6ff; color: var(--primary); border-radius: 999px;
    font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.title { font-size: 2.8rem; font-weight: 800; color: #1e293b; letter-spacing: -.02em; }
.title span { color: var(--primary); }
.title.small { font-size: 1.7rem; }
.subtitle { margin: .6rem 0 1.75rem; color: var(--muted); font-size: .95rem; line-height: 1.6; }
.subtitle strong { color: #1e293b; }
.footer-note { margin-top: 1.75rem; color: #94a3b8; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

/* ---------- Tata tertib ---------- */
.rules { list-style: none; margin-bottom: 1.75rem; text-align: left; display: grid; gap: .7rem; }
.rules li { display: flex; gap: .8rem; align-items: flex-start; font-size: .88rem; font-weight: 500; color: #475569; line-height: 1.5; }
.rules li span {
    flex: none; width: 1.55rem; height: 1.55rem; display: grid; place-items: center;
    background: var(--primary); color: #fff; border-radius: 50%; font-size: .75rem; font-weight: 800;
}

/* ---------- Pilih kelas ---------- */
.class-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.class-btn {
    padding: 1.75rem .5rem; display: flex; flex-direction: column; gap: .35rem; align-items: center;
    background: #f8fafc; border: 1.5px solid var(--border); border-radius: 1.25rem; cursor: pointer;
    transition: all .25s ease;
}
.class-btn strong { font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.class-btn span { font-size: .8rem; font-weight: 700; color: var(--muted); }
.class-btn:hover, .class-btn:focus-visible {
    background: #fff; border-color: var(--primary); transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(30, 58, 138, .15); outline: none;
}

/* ---------- Form ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; text-align: left; }
.form input, .form select {
    width: 100%; padding: 1.05rem 1.3rem; border: 1.5px solid var(--border); border-radius: 1rem;
    background: #f8fafc; color: var(--text); font-size: .95rem; font-weight: 600; outline: none;
    transition: all .25s ease; user-select: text; -webkit-user-select: text;
}
.form input:focus, .form select:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .1); }
.helper { font-size: .72rem; font-weight: 600; color: var(--muted); line-height: 1.5; }
.helper strong { color: var(--primary); }

.btn-primary {
    width: 100%; padding: 1.15rem; border: none; border-radius: 1rem; cursor: pointer;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; font-size: 1rem; font-weight: 800; transition: all .25s ease;
    box-shadow: 0 10px 15px rgba(37, 99, 235, .2);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn-link { margin-top: 1.25rem; background: none; border: none; color: var(--muted); font-size: .85rem; font-weight: 700; cursor: pointer; }
.btn-link:hover { color: var(--primary); }

/* ---------- Ujian ---------- */
.exam-layout { height: 100dvh; display: flex; flex-direction: column; background: linear-gradient(180deg, #f8fafc, #eef4ff); }
.progress { height: 6px; flex: none; background: rgba(148, 163, 184, .18); }
#progressBar { height: 100%; width: 0; background: linear-gradient(90deg, #ef4444, #f97316); transition: width .6s ease; }

.exam-header {
    position: relative; height: 72px; flex: none; padding: 0 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(135deg, #020817, #0f172a 45%, #111827); color: #fff;
}
.brand { font-size: 1.3rem; font-weight: 900; letter-spacing: .12em; }
.brand span { color: var(--primary-light); }
.timer {
    position: absolute; left: 50%; transform: translateX(-50%); padding: .5rem 1.1rem;
    border: 1px solid rgba(148, 163, 184, .32); border-radius: .9rem; background: rgba(15, 23, 42, .7);
    font-family: monospace; font-size: 1.5rem; font-weight: 800; letter-spacing: .12em;
}
.btn-finish {
    padding: .7rem 1.2rem; border: none; border-radius: .8rem; cursor: pointer;
    background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff;
    font-size: .85rem; font-weight: 800; letter-spacing: .06em; transition: .25s;
}
.btn-finish:hover { filter: brightness(1.12); }

.pdf-toolbar {
    flex: none; padding: .6rem 1.2rem; display: flex; flex-wrap: wrap; gap: .75rem;
    align-items: center; justify-content: space-between;
    background: linear-gradient(180deg, #f8fafc, #eef2ff); border-bottom: 1px solid var(--border);
}
.pdf-group { display: flex; align-items: center; gap: .5rem; }
.pdf-btn {
    padding: .55rem .85rem; border: 1px solid #dbe3f0; border-radius: .75rem; background: #fff;
    color: #475569; font-size: .8rem; font-weight: 700; cursor: pointer;
}
.pdf-btn:hover { border-color: var(--primary); color: var(--primary); }
.pdf-info { min-width: 100px; text-align: center; color: #475569; font-size: .82rem; font-weight: 700; }

.exam-body { flex: 1; min-height: 0; width: min(1280px, 100%); margin: 0 auto; overflow: hidden; background: #fff; }
#formEmbed { width: 100%; height: 100%; border: none; display: block; transform-origin: top left; }
.exam-footer { flex: none; padding: .6rem; background: #000; color: #eff6ff; text-align: center; font-size: .72rem; }

/* ---------- Dialog ---------- */
.overlay {
    position: fixed; inset: 0; z-index: 9999; padding: 2rem; display: flex; align-items: center; justify-content: center;
    background: rgba(15, 23, 42, .8); backdrop-filter: blur(12px); animation: fadeIn .3s ease-out;
}
.dialog { width: min(90vw, 420px); padding: 1.5rem 1.25rem; border-radius: 1.25rem; background: #fff; text-align: center; box-shadow: 0 25px 50px -12px rgba(0,0,0,.35); }
.dialog-title { margin-bottom: .75rem; color: #111827; font-size: 1.2rem; font-weight: 800; }
.dialog-text { margin-bottom: 1.25rem; color: #475569; font-size: .95rem; line-height: 1.6; white-space: pre-line; }
.dialog-actions { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; }
.dialog-btn { min-width: 110px; padding: .8rem 1.2rem; border: none; border-radius: .8rem; font-weight: 800; cursor: pointer; }
.dialog-btn.yes { background: var(--primary); color: #fff; }
.dialog-btn.no { background: #e2e8f0; color: #0f172a; }

/* ---------- HP ---------- */
@media (max-width: 600px) {
    .card { padding: 1.75rem 1.25rem; border-radius: 1.5rem; }
    .title { font-size: 2.2rem; }
    .class-grid { gap: .6rem; }
    .class-btn { padding: 1.25rem .25rem; }
    .class-btn strong { font-size: 1.7rem; }
    .exam-header { height: 60px; padding: 0 .8rem; }
    .brand { display: none; }
    .timer { position: static; transform: none; font-size: 1.15rem; padding: .35rem .7rem; }
    .btn-finish { padding: .55rem .8rem; font-size: .75rem; }
    .pdf-toolbar { padding: .5rem .6rem; }
    .pdf-btn { padding: .5rem .6rem; font-size: .72rem; }
    .pdf-info { min-width: 70px; }
}
