/* Halaman siswa. Kiri: identitas dan hitung mundur di atas aliran sungai. Kanan: formulir dan hasil. */
.pg {
  --gutter: clamp(16px, 4.5vw, 64px);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  min-height: var(--pg-min-h, 0);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
}
.pg *, .pg *::before, .pg *::after { box-sizing: border-box; }

/* ---------- Panel kiri ---------- */
.pg-side {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background-color: var(--side);
  background-image:
    radial-gradient(70% 45% at 88% -6%, rgba(242, 179, 61, .34), transparent 70%),
    radial-gradient(90% 60% at 0% 104%, rgba(14, 111, 108, .6), transparent 72%);
  color: var(--side-ink);
}
.pg-side .river { z-index: -1; }
.pg-side-in {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(2.5rem, 8vw, 5rem);
  height: 100%;
  min-height: 30rem;
  padding-block: clamp(24px, 4vw, 48px);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.pg-brand { display: flex; align-items: center; gap: .9rem; }
.pg-mark, .pg-logo { width: 3rem; height: 3rem; flex: none; color: var(--sun); }
.pg-logo { object-fit: contain; }
.pg-school { font: 600 1.05rem/1.25 var(--font-display); letter-spacing: -.01em; }
.pg-year { font-size: .875rem; color: rgba(232, 243, 241, .72); }

.pg-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 4.9vw, 5rem);
  line-height: .94;
  letter-spacing: -.035em;
  font-variation-settings: "wdth" 88;
}
.pg-count { display: flex; flex-wrap: wrap; gap: .75rem clamp(1rem, 2.6vw, 2rem); margin-top: clamp(1.5rem, 4vw, 2.5rem); }
.pg-unit { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.pg-num {
  font: 700 clamp(2.3rem, 5vw, 3.9rem)/1 var(--font-display);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  font-variation-settings: "wdth" 90;
}
.pg-unit span { font-size: .85rem; color: rgba(232, 243, 241, .72); }
.pg-unit:last-child .pg-num { color: var(--sun); }
.pg-when { margin-top: 1.25rem; max-width: 28rem; color: rgba(232, 243, 241, .85); }
.pg-note { margin-top: clamp(1.25rem, 3vw, 2rem); max-width: 26rem; font-size: 1.1rem; color: rgba(232, 243, 241, .88); }

/* ---------- Panel kanan ---------- */
.pg-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  min-width: 0;
  padding-block: clamp(28px, 5vw, 64px);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.pg-panel, .pg-result, .pg-foot { width: 100%; max-width: 34rem; margin-inline: auto; }
.pg-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(1.25rem, 3.5vw, 2.25rem);
}
.pg-panel h2 { font: 650 clamp(1.5rem, 3vw, 1.85rem)/1.15 var(--font-display); letter-spacing: -.02em; }
.pg-lead { margin-top: .4rem; color: var(--ink-2); }

.pg-field { display: grid; gap: .5rem; margin: 1.5rem 0 0; padding: 0; border: 0; min-width: 0; }
.pg-field label, .pg-field legend { padding: 0; font-weight: 600; font-size: .95rem; }
.pg-input {
  width: 100%;
  min-width: 0;
  padding: .85rem 1rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font: 600 1.4rem/1.2 var(--font-body);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.pg-input::placeholder { color: var(--muted); font-weight: 500; letter-spacing: 0; font-size: 1.05rem; opacity: .9; }
.pg-input:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 38%, transparent); outline-offset: 1px; border-color: var(--focus); }
.pg-input[aria-invalid="true"] { border-color: var(--bad); }
.pg-date { display: grid; grid-template-columns: 1fr 1fr 1.7fr; gap: .6rem; }
.pg-date .pg-input { text-align: center; padding-inline: .5rem; }
.pg-hint { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; color: var(--muted); }
.pg-hint span:last-child { font-variant-numeric: tabular-nums; }

.pg-error {
  margin-top: 1.1rem;
  padding: .8rem 1rem;
  border-radius: 12px;
  background: var(--bad-tint);
  color: var(--bad);
  font-weight: 500;
}

.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  min-height: 3.4rem;
  margin-top: 1.5rem;
  padding: .9rem 1.25rem;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--river);
  color: var(--on-river);
  font: 600 1.05rem/1 var(--font-body);
  cursor: pointer;
  transition: background-color .15s;
}
.pg-btn:hover { background: var(--river-2); }
.pg-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 2px; }
.pg-btn[aria-busy="true"] { cursor: progress; opacity: .85; }
.pg-btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.pg-btn-ghost:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pg-spin {
  width: 1.1em; height: 1.1em; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: pg-spin .7s linear infinite;
}
@keyframes pg-spin { to { transform: rotate(360deg); } }

/* ---------- Belum dibuka ---------- */
.pg-closed h2 { margin-top: 1.1rem; }
.pg-closed p { margin-top: .6rem; color: var(--ink-2); }
.pg-lock {
  display: grid; place-items: center;
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: var(--warn-tint); color: var(--warn);
}
.pg-lock .ikon { width: 1.6rem; height: 1.6rem; }

/* ---------- Hasil ---------- */
.pg-result {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.pg-level {
  position: absolute; inset: 0; z-index: -1;
  background: var(--ok-tint);
  transform-origin: 50% 100%;
}
.pg-result[data-lulus="0"] .pg-level { background: var(--bad-tint); }
.pg-result.is-in .pg-level { animation: pg-rise .85s cubic-bezier(.2, .7, .2, 1) backwards; }
.pg-result.is-in .pg-result-body > * { animation: pg-fade .5s ease-out backwards; }
.pg-result.is-in .pg-result-body > *:nth-child(2) { animation-delay: .08s; }
.pg-result.is-in .pg-result-body > *:nth-child(3) { animation-delay: .14s; }
.pg-result.is-in .pg-result-body > *:nth-child(4) { animation-delay: .24s; }
.pg-result.is-in .pg-result-body > *:nth-child(n+5) { animation-delay: .34s; }
@keyframes pg-rise { from { transform: scaleY(0); } }
@keyframes pg-fade { from { opacity: 0; transform: translateY(8px); } }

.pg-result-body { padding: clamp(1.5rem, 4vw, 2.5rem); display: grid; gap: .35rem; }
.pg-result-lead { font-size: .95rem; color: var(--ink-2); }
.pg-nama { font: 650 clamp(1.6rem, 4.4vw, 2.2rem)/1.12 var(--font-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.pg-nama:focus { outline: none; }
.pg-meta { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pg-status {
  display: flex; align-items: center; gap: .8rem;
  margin-top: 1.4rem;
  font: 800 clamp(2.3rem, 9vw, 3.6rem)/1 var(--font-display);
  letter-spacing: -.025em;
  font-variation-settings: "wdth" 88;
  color: var(--ok);
}
.pg-result[data-lulus="0"] .pg-status { color: var(--bad); }
.pg-status-ikon {
  display: grid; place-items: center; flex: none;
  width: 3.2rem; height: 3.2rem; border-radius: 50%;
  background: currentColor;
}
.pg-status-ikon .ikon { width: 1.7rem; height: 1.7rem; color: var(--surface); stroke-width: 2.4; }
.pg-pesan { margin-top: .9rem; color: var(--ink); max-width: 38ch; }
.pg-catatan {
  margin-top: 1.1rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
}
.pg-catatan h3 { font: 650 1rem/1.3 var(--font-display); }
.pg-catatan p { margin-top: .35rem; white-space: pre-line; overflow-wrap: anywhere; }
.pg-result .pg-btn-ghost { margin-top: 1.6rem; }
.pg-skl { margin-top: 1.5rem; text-decoration: none; }
.pg-skl:not([hidden]) + .pg-btn-ghost { margin-top: .75rem; }

.pg-foot { font-size: .875rem; color: var(--muted); }

/* ---------- Ponsel dan tablet ---------- */
@media (max-width: 860px) {
  .pg { grid-template-columns: minmax(0, 1fr); }
  .pg-title { font-size: clamp(2.7rem, 13vw, 4.6rem); }
  .pg-side-in { min-height: 0; gap: 2.5rem; padding-bottom: 3.5rem; }
  .pg-main {
    position: relative;
    z-index: 1;
    margin-top: -1.75rem;
    border-radius: 28px 28px 0 0;
    background: var(--bg);
    padding-top: 1.75rem;
    justify-content: flex-start;
  }
}
@media (max-width: 400px) {
  .pg-count { gap: .6rem .9rem; }
  .pg-input { font-size: 1.25rem; }
}
