:root {
  --neon-green: #39ff88;
  --neon-orange: #ff8a1e;
  --neon-pink: #ff2fd0;
  --neon-cyan: #00e5ff;
  --neon-gold: #ffcf40;
  --neon-red: #ff4d4d;
  --neon-gray: #aab3c5;
  --glass-bg: rgba(16, 18, 26, 0.55);
  --glass-bg-strong: rgba(8, 9, 14, 0.78);
  --glass-border: rgba(255, 255, 255, 0.10);
  --text-main: #eef2ff;
  --text-dim: #9aa5c0;
  --topbar-height: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 18%, rgba(57, 255, 136, 0.10), transparent 40%),
    radial-gradient(circle at 88% 22%, rgba(0, 229, 255, 0.10), transparent 40%),
    radial-gradient(circle at 50% 92%, rgba(255, 47, 208, 0.09), transparent 45%),
    #050609;
  color: var(--text-main);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: inherit; }
.hidden { display: none !important; }
body.modal-open { overflow: hidden; }

/* ---- Topbar (mirrors tournament/blog convention) ---- */
.judge-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--topbar-height);
  padding: 8px 16px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
}
.brand { text-decoration: none; font-weight: 800; letter-spacing: 1px; font-size: 20px; }
.brand-bx { color: var(--neon-cyan); }
.brand-arena { color: var(--neon-pink); margin-left: 3px; }
.judge-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.judge-nav a {
  text-decoration: none;
  color: var(--text-main);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
}
.judge-nav a:hover, .judge-nav a:focus-visible { border-color: var(--neon-cyan); }
.judge-nav a[aria-current="page"] { color: var(--neon-cyan); border-color: var(--neon-cyan); }

/* ---- Layout ---- */
.judge-main { max-width: 980px; margin: 0 auto; padding: 22px 16px 48px; }
.judge-hero { padding: 10px 0 18px; }
.judge-hero h1 { margin: 4px 0 8px; font-size: 30px; }
.judge-lead { margin: 0; color: var(--text-dim); font-size: 15px; max-width: 62ch; }
.eyebrow { color: var(--neon-cyan); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }

.panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 18px;
  backdrop-filter: blur(10px);
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 10px; font-size: 19px; }
.panel h3 { margin: 18px 0 8px; font-size: 15px; color: var(--neon-cyan); }
.panel p { color: #dbe4f5; line-height: 1.6; font-size: 14px; }
.panel ul, .panel ol { color: #dbe4f5; line-height: 1.6; font-size: 14px; padding-left: 20px; }

/* ---- Steps ---- */
.judge-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 14px 0; }
.judge-step {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 14px;
}
.judge-step .step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--neon-cyan); color: #02181c; font-weight: 900; font-size: 13px; margin-bottom: 8px;
}
.judge-step h3 { margin: 0 0 6px; font-size: 14px; color: var(--text-main); }
.judge-step p { margin: 0; font-size: 12.5px; color: var(--text-dim); }

/* ---- Source links / disclaimer ---- */
.source-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.source-link {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--neon-cyan-soft, rgba(0,229,255,0.4));
  border-radius: 8px; padding: 8px 12px; font-size: 13px; text-decoration: none;
  color: var(--neon-cyan);
}
.source-link:hover { background: rgba(0, 229, 255, 0.1); }
.disclaimer-banner {
  border: 1px solid var(--neon-gold);
  background: rgba(255, 207, 64, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: #ffe9ab;
  line-height: 1.55;
  margin: 12px 0 18px;
}
.disclaimer-banner strong { color: var(--neon-gold); }

/* ---- Buttons ---- */
.btn {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-main);
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.05s ease, border-color 0.15s ease;
}
.btn:hover { border-color: var(--neon-cyan); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-cyan { border-color: var(--neon-cyan); color: var(--neon-cyan); }
.btn-green { border-color: var(--neon-green); color: var(--neon-green); }
.btn-pink { border-color: var(--neon-pink); color: var(--neon-pink); }
.btn-block { display: block; width: 100%; text-align: center; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---- Table of Contents ---- */
.toc { list-style: none; margin: 10px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px; }
.toc li a {
  display: block; text-decoration: none; color: var(--text-dim);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--glass-border);
  border-radius: 7px; padding: 8px 10px; font-size: 13px;
}
.toc li a:hover { color: var(--neon-cyan); border-color: var(--neon-cyan); }

.rule-table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 13px; }
.rule-table th, .rule-table td { border: 1px solid var(--glass-border); padding: 8px 10px; text-align: left; color: #dbe4f5; }
.rule-table th { color: var(--neon-cyan); background: rgba(0, 229, 255, 0.08); }
.figure-caption { color: var(--text-dim); font-size: 12.5px; font-style: italic; margin: 6px 0 14px; padding-left: 10px; border-left: 2px solid var(--glass-border); }

/* ---- Exam: payment gate (rendered as a true modal - see #gate-backdrop) ---- */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.field input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-main);
  padding: 9px 11px;
  font-size: 16px; /* >=16px prevents iOS Safari auto-zoom-on-focus */
}
.field input:focus { outline: none; border-color: var(--neon-cyan); }
#paypal-button-container { margin-top: 12px; max-width: 320px; }
.pay-note { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.gate-status { min-height: 20px; font-size: 13px; color: var(--neon-orange); margin-top: 8px; }

/* Full-page modal backdrop: blocks interaction with the rest of the page. No close
   button exists anywhere in this markup - completing payment is the only way out
   (enforced in examApp.js, which never renders a way to dismiss it). */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
  background: rgba(2, 3, 6, 0.82);
  backdrop-filter: blur(6px);
}
.modal-dialog {
  width: 100%; max-width: 440px; margin: auto;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.25), 0 20px 60px rgba(0, 0, 0, 0.55);
}

/* ---- Exam price: 50%-off discount badge. Always populated from the live
   get-pricing endpoint (judge/priceDisplay.js) - never a hardcoded amount, so
   it can never drift from the real PayPal charge. ---- */
.price-discount {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin: 6px 0 14px; padding: 10px 16px;
  border: 1px solid var(--neon-gold); border-radius: 10px;
  background: rgba(255, 207, 64, 0.08);
}
.price-discount.price-loaded { animation: price-pop 0.35s ease; }
@keyframes price-pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.price-badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--neon-red); color: #fff; font-size: 11px; font-weight: 900;
  letter-spacing: 0.5px; text-transform: uppercase;
  animation: price-badge-pulse 1.6s ease-in-out infinite;
}
@keyframes price-badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.55); }
  50% { box-shadow: 0 0 0 7px rgba(255, 77, 77, 0); }
}
.price-original { color: var(--text-dim); text-decoration: line-through; font-size: 15px; }
.price-discounted { color: var(--neon-green); font-size: 22px; font-weight: 900; }
@media (prefers-reduced-motion: reduce) {
  .price-discount.price-loaded, .price-badge { animation: none; }
}

/* ---- Exam: timer + progress ---- */
.exam-header {
  position: sticky; top: var(--topbar-height); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; backdrop-filter: blur(10px);
  flex-wrap: wrap;
}
.exam-timer { font-size: 20px; font-weight: 900; color: var(--neon-cyan); font-variant-numeric: tabular-nums; }
.exam-timer.low-time { color: var(--neon-red); }
.exam-progress { font-size: 13px; color: var(--text-dim); }

/* ---- Judge's Pledge acceptance gate (blocks payment until checked) ---- */
.pledge-accept {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 16px 0; padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--glass-border); border-radius: 8px;
  font-size: 13.5px; font-style: normal; color: var(--text-main); cursor: pointer;
}
.pledge-accept input { margin-top: 3px; flex: 0 0 auto; }

.exam-question {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  user-select: none;
}
.exam-question .q-number { color: var(--neon-cyan); font-weight: 800; font-size: 12px; }
.exam-question .q-text { margin: 6px 0 10px; font-size: 14.5px; color: var(--text-main); }
.exam-options { display: flex; flex-direction: column; gap: 6px; }
.exam-option {
  display: flex; align-items: flex-start; gap: 8px;
  background: rgba(0, 0, 0, 0.2); border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 8px 10px; font-size: 13.5px; cursor: pointer;
}
.exam-option:hover { border-color: var(--neon-cyan); }
.exam-option input { margin-top: 3px; }
.exam-option.selected { border-color: var(--neon-green); background: rgba(57, 255, 136, 0.08); }
.exam-submit-row { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, #050609 40%); }

/* ---- Anti-cheat: visually hidden but present in the DOM/accessible tree ---- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Results ---- */
.result-card { text-align: center; padding: 26px 18px; }
.result-score { font-size: 46px; font-weight: 900; margin: 6px 0; }
.result-score.pass { color: var(--neon-green); }
.result-score.fail { color: var(--neon-red); }
.result-status { font-size: 16px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; }

/* ---- Certificate ---- */
.certificate-card {
  position: relative;
  border: 2px solid var(--neon-gold);
  border-radius: 10px;
  padding: 10px;
  background: radial-gradient(circle at 50% 0%, rgba(255, 207, 64, 0.12), transparent 60%), rgba(6, 8, 14, 0.9);
}
.cert-frame {
  position: relative;
  border: 1px solid rgba(255, 207, 64, 0.55);
  border-radius: 6px;
  padding: 40px 32px 28px;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  overflow: hidden;
}
/* Corner flourishes, purely decorative, to read as an official document rather than a UI card */
.cert-frame::before, .cert-frame::after {
  content: "";
  position: absolute;
  width: 34px; height: 34px;
  border: 2px solid var(--neon-gold);
  opacity: 0.8;
}
.cert-frame::before { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.cert-frame::after { bottom: 8px; right: 8px; border-left: none; border-top: none; }

.cert-seal { margin-bottom: 6px; }
.cert-seal img.cert-logo {
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid var(--neon-gold);
  padding: 6px;
  background: rgba(255, 207, 64, 0.08);
}
.certificate-card .cert-kicker { color: var(--neon-gold); letter-spacing: 3px; font-size: 11px; font-weight: 800; text-transform: uppercase; font-family: "Segoe UI", Roboto, Arial, sans-serif; }
.cert-title { font-size: 30px; font-weight: 700; margin: 10px 0 2px; letter-spacing: 1px; color: var(--text-main); }
.cert-presented-to { margin: 10px 0 2px; font-size: 13px; font-style: italic; color: var(--text-dim); }
.certificate-card .cert-name {
  font-size: 34px; font-weight: 700; color: var(--neon-cyan);
  margin: 4px 0 10px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 207, 64, 0.4);
  display: inline-block;
}
.certificate-card .cert-headline { font-size: 16px; font-weight: 700; color: var(--neon-green); margin: 4px 0 10px; font-family: "Segoe UI", Roboto, Arial, sans-serif; }
.cert-body { color: #dbe4f5; font-size: 13.5px; line-height: 1.6; max-width: 56ch; margin: 0 auto; }
.cert-divider { height: 1px; margin: 22px auto 18px; width: 70%; background: linear-gradient(90deg, transparent, rgba(255, 207, 64, 0.6), transparent); }

.cert-footer-row { display: flex; justify-content: center; gap: 34px; flex-wrap: wrap; font-family: "Segoe UI", Roboto, Arial, sans-serif; }
.cert-footer-block { min-width: 120px; }
.cert-footer-value { font-size: 15px; font-weight: 700; color: var(--text-main); border-top: 1px solid var(--glass-border); padding-top: 6px; }
.cert-footer-value.cert-signature { font-family: Georgia, "Times New Roman", serif; font-style: italic; color: var(--neon-gold); font-size: 18px; }
.cert-footer-label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim); margin-top: 3px; }
.cert-serial { margin: 22px 0 0; font-size: 10.5px; color: var(--text-dim); letter-spacing: 0.5px; font-family: "Segoe UI", Roboto, Arial, sans-serif; }
.cert-pledge { margin: 14px auto 0; max-width: 48ch; font-size: 11.5px; font-style: italic; line-height: 1.6; color: var(--text-dim); }

@media print {
  @page { margin: 0.4in; }
  .judge-topbar, .judge-manifesto, #cert-print-row, .judge-footer { display: none !important; }
  body, .judge-main { background: #fff !important; }
  .certificate-card { border-color: #b8860b; background: #fff !important; }
  .cert-frame { border-color: #b8860b; }
  .cert-frame::before, .cert-frame::after { border-color: #b8860b; }
  .certificate-card .cert-name, .cert-title, .cert-body, .cert-footer-value, .cert-pledge { color: #111 !important; }
  .certificate-card .cert-kicker, .cert-footer-value.cert-signature, .cert-divider { color: #b8860b; }
}

.judge-manifesto { border-color: var(--neon-gold); background: rgba(255, 207, 64, 0.06); }
.judge-manifesto h2 { color: var(--neon-gold); }
.judge-manifesto p { font-style: italic; line-height: 1.75; color: #f4ecd8; }
.print-hint { margin-top: 8px; font-size: 11.5px; color: var(--text-dim); text-align: center; max-width: 46ch; }

/* ---- Footer (privacy/terms links, present on every judge/ page) ---- */
.judge-footer {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px;
  max-width: 980px; margin: 0 auto; padding: 16px 16px 28px; text-align: center;
  font-size: 11.5px; color: var(--text-dim);
}
.judge-footer a { color: var(--neon-cyan); text-decoration: none; }
.judge-footer a:hover, .judge-footer a:focus-visible { text-decoration: underline; }


@media (max-width: 700px) {
  .judge-hero h1 { font-size: 24px; }
  .exam-header { position: static; }
}
