* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #2a6cff;
  --blue-dark: #1b55d6;
  --blue-soft: #eaf1ff;
  --ink: #0a0a0a;
  --bg: #ffffff;
  --soft: #f5f6f8;
  --line: #e7e9ee;
  --text: #14161a;
  --muted: #6b7280;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --gold: #c27c00;
  --gold-soft: #fff4d6;
  --font: "Unbounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html { background: #eceef2; }

body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* Selalu tampil seperti layar HP, juga di desktop */
.app {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
@media (min-width: 480px) {
  .app { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(15, 23, 42, 0.12); }
}

/* ---------- header ---------- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.logo {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  font-size: 0.95rem;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

i.ph, i.ph-bold, i.ph-fill { vertical-align: -0.15em; }
.card-title i, .hint i, .feedback i, .juri-bar i, .meta i, .detail i { margin-right: 4px; }

main { padding: 4px 14px calc(40px + env(safe-area-inset-bottom, 0px)); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 22px 20px 24px;
  min-height: 168px;
  margin-bottom: 14px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.85) 0 9%, transparent 10%),
    radial-gradient(circle at 24% 30%, rgba(255,255,255,0.75) 0 12%, transparent 13%),
    radial-gradient(circle at 78% 82%, rgba(255,255,255,0.8) 0 14%, transparent 15%),
    radial-gradient(circle at 62% 94%, rgba(255,255,255,0.7) 0 12%, transparent 13%),
    radial-gradient(circle at 96% 20%, rgba(255,255,255,0.55) 0 14%, transparent 15%),
    linear-gradient(160deg, #8bbcff 0%, #c9defc 55%, #eef4ff 100%);
}
.hero-icon {
  position: absolute;
  right: -2px;
  top: 14px;
  font-size: 5.4rem;
  color: #fff;
  transform: rotate(10deg);
  filter: drop-shadow(0 10px 14px rgba(42, 108, 255, 0.35));
}
.hero-eyebrow { position: relative; font-size: 0.62rem; font-weight: 400; margin-bottom: 10px; }
.hero h2 {
  position: relative;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.03em;
}
.hero-sub {
  position: relative;
  margin-top: 12px;
  font-size: 0.6rem;
  font-weight: 300;
  line-height: 1.6;
  max-width: 62%;
}

/* ---------- juri & tab ---------- */

.juri-bar {
  margin-bottom: 12px;
  padding: 11px 16px;
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--blue-dark);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 999px;
  background: var(--soft);
}
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 4px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.62rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab.active { background: var(--ink); color: #fff; }

.tabview { display: none; }
.tabview.active { display: block; }

/* ---------- card & form ---------- */

.card {
  background: var(--soft);
  border-radius: 24px;
  padding: 18px;
  margin-top: 12px;
}
#loginView .card { margin-top: 0; }

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.card label, .modal-card label {
  display: block;
  font-size: 0.62rem;
  font-weight: 400;
  color: var(--muted);
  margin: 12px 0 6px;
}

input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
}
input:focus-visible, button:focus-visible, .plist li:focus-visible {
  outline: 3px solid rgba(42, 108, 255, 0.45);
  outline-offset: 2px;
}

/* ---------- tombol ---------- */

.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.actions.first { margin-top: 0; }

button.primary, button.secondary {
  flex: 1;
  min-width: 130px;
  padding: 15px 14px;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 500;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
button.primary { background: var(--blue); color: #fff; }
button.primary:disabled { opacity: 0.5; }
button.secondary { background: var(--ink); color: #fff; }
button.small { min-width: 0; font-size: 0.6rem; padding: 11px 16px; flex: 0 0 auto; }

/* ---------- feedback ---------- */

.feedback {
  margin-top: 14px;
  padding: 16px;
  border-radius: 20px;
  font-size: 0.72rem;
  line-height: 1.6;
}
.feedback.ok { background: #e8f8ee; color: #0f5a2c; }
.feedback.warn { background: #fff4e0; color: #8a4b04; }
.feedback.err { background: #fdeceb; color: #9b1c1c; }

.hint { font-size: 0.62rem; color: var(--muted); margin-top: 12px; line-height: 1.7; font-weight: 300; }
.hint.first { margin-top: 0; margin-bottom: 12px; }
.hint code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }
.hint-inline { font-size: 0.56rem; margin-left: 4px; }

/* ---------- daftar peserta ---------- */

.plist, .hlist { list-style: none; }

.plist li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  background: var(--soft);
  border-radius: 20px;
  border-left: 5px solid var(--line);
  padding: 14px 14px 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.15s;
}
.plist li:active { transform: scale(0.98); }
.plist li.done { border-left-color: var(--ok); }
.plist li .no { grid-column: 1; font-size: 0.6rem; font-weight: 600; color: var(--blue); }
.plist li .nama { grid-column: 1; font-size: 0.75rem; font-weight: 500; line-height: 1.4; }
.plist li .meta { grid-column: 1; font-size: 0.56rem; font-weight: 300; color: var(--muted); }
.plist li.done .meta i.ph-check-circle { color: var(--ok); }
.plist .chev {
  grid-column: 2;
  grid-row: 1 / 4;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 0.95rem;
}

/* ---------- form nilai ---------- */

.score-row { margin-top: 16px; }
.card .score-row label { font-size: 0.68rem; font-weight: 500; color: var(--text); margin: 0 0 8px; }
.score-row .maks { color: var(--muted); font-size: 0.56rem; font-weight: 300; }
.score-ctl { display: flex; gap: 12px; align-items: center; }
.score-ctl input[type="range"] {
  flex: 1;
  padding: 0;
  border: none;
  background: transparent;
  accent-color: var(--blue);
}
.score-ctl input[type="number"] { width: 92px; text-align: center; padding: 12px 8px; }

/* ---------- hasil ---------- */

.hlist li {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "rank total"
    "nama total"
    "detail detail";
  gap: 4px 10px;
  align-items: center;
  background: var(--soft);
  border-left: 5px solid var(--line);
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.hlist li.top1 { background: var(--gold-soft); border-left-color: #f5b301; }
.hlist li.top23 { background: var(--blue-soft); border-left-color: var(--blue); }
.hlist li .rank { grid-area: rank; font-size: 0.66rem; font-weight: 600; white-space: nowrap; }
.hlist li.top1 .rank { color: var(--gold); }
.hlist li.top23 .rank { color: var(--blue-dark); }
.hlist li .nama { grid-area: nama; font-size: 0.72rem; font-weight: 500; line-height: 1.4; }
.hlist li .total { grid-area: total; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.hlist li.top1 .total { color: var(--gold); }
.hlist li .detail {
  grid-area: detail;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 300;
}
.hlist li .detail b { color: var(--text); font-weight: 600; }

/* ---------- modal (tetap selebar layar HP) ---------- */

.modal {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  background: rgba(10, 10, 10, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-card {
  background: #fff;
  border-radius: 28px 28px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  width: 100%;
}
.modal-card .card-title { font-size: 0.9rem; margin-bottom: 6px; }

.hidden { display: none !important; }

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