/* Capture the Swag — Zscaler-themed styles */

:root {
  --zs-blue: #2160e1;
  --zs-blue-dark: #1848b4;
  --zs-cyan: #00a3e0;
  --zs-navy: #0a1a3a;
  --zs-navy-2: #12285a;
  --zs-green: #18a957;
  --zs-amber: #f5a524;
  --zs-red: #e5484d;

  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --text: #0f1b33;
  --muted: #5b6b86;
  --border: #dde4f0;
  --ring: rgba(33, 96, 225, 0.35);
  --shadow: 0 1px 2px rgba(10, 26, 58, 0.06), 0 8px 24px rgba(10, 26, 58, 0.06);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070f22;
    --surface: #0f1c38;
    --surface-2: #132449;
    --text: #e8eefb;
    --muted: #9aabcb;
    --border: #22365f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--zs-blue); }
@media (prefers-color-scheme: dark) { a { color: #6f9bff; } }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
[hidden] { display: none !important; }

/* ── Header / hero ─────────────────────────────────────────────────────── */
.site-header {
  background: radial-gradient(1200px 400px at 85% -60%, rgba(0, 163, 224, 0.45), transparent 60%),
              linear-gradient(135deg, var(--zs-navy) 0%, var(--zs-navy-2) 55%, var(--zs-blue-dark) 100%);
  color: #fff;
  padding: 18px 16px 72px;
}
.site-header .bar {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { height: 28px; width: auto; display: block; }
.brand .divider { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.35); }
.brand .tag { font-weight: 600; letter-spacing: 0.02em; font-size: 0.95rem; opacity: 0.9; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; }
.user-chip .who { opacity: 0.85; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero { max-width: 960px; margin: 36px auto 0; }
.hero .eyebrow {
  display: inline-block;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: #9fd8ff; background: rgba(0, 163, 224, 0.15);
  border: 1px solid rgba(0, 163, 224, 0.35);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 12px;
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.25rem); font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.hero h1 .accent {
  background: linear-gradient(90deg, #5fd0ff, #8fb1ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: rgba(255, 255, 255, 0.8); max-width: 560px; margin-top: 10px; }

main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: -48px auto 0;
  padding: 0 16px 48px;
}
.site-footer {
  text-align: center; color: var(--muted); font-size: 0.8rem; padding: 24px 16px 32px;
}

/* ── Cards, buttons, forms ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card, .card + section, section + .card { margin-top: 20px; }
.stack > * + * { margin-top: 14px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.8rem; margin: 14px 0 0; }

.btn {
  font: inherit; font-weight: 600; font-size: 0.95rem;
  border-radius: 10px; border: 1px solid transparent;
  padding: 10px 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none; box-shadow: 0 0 0 4px var(--ring);
}
.btn-primary { background: var(--zs-blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--zs-blue-dark); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--zs-red); border-color: var(--zs-red); }
.btn-danger:hover { background: rgba(229, 72, 77, 0.08); }
.btn-light { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255, 255, 255, 0.25); padding: 6px 12px; font-size: 0.85rem; }
.btn-light:hover { background: rgba(255, 255, 255, 0.2); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }

.field { display: block; }
.field > span { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.field small { color: var(--muted); font-weight: 400; }
input, textarea, select {
  font: inherit; color: var(--text);
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { min-height: 96px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.form-msg { min-height: 1.25em; margin: 8px 0 0; font-size: 0.9rem; }
.form-msg.error { color: var(--zs-red); }
.form-msg.ok { color: var(--zs-green); }

/* ── Sign-in ───────────────────────────────────────────────────────────── */
.signin { max-width: 440px; margin: 0 auto; }
.signin.sent { text-align: center; }
.sent-icon { font-size: 2.5rem; margin-bottom: 8px; }

/* ── Progress track ────────────────────────────────────────────────────── */
.progress-card h2 { font-size: 1.05rem; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.progress-head .count { font-size: 0.9rem; color: var(--muted); }
.track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); position: relative; }
.track::before {
  content: ""; position: absolute; left: 8.33%; right: 8.33%; top: 21px; height: 4px;
  background: var(--border); border-radius: 4px;
}
.track .fill {
  position: absolute; left: 8.33%; top: 21px; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--zs-blue), var(--zs-cyan));
  transition: width 0.6s ease;
}
.step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.step .dot {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800;
  background: var(--surface); border: 3px solid var(--border); color: var(--muted);
  position: relative; z-index: 1;
}
.step.done .dot { background: var(--zs-blue); border-color: var(--zs-blue); color: #fff; }
.step.current .dot {
  border-color: var(--zs-cyan); color: var(--zs-blue);
  box-shadow: 0 0 0 6px rgba(0, 163, 224, 0.18);
  animation: pulse 2s infinite;
}
.step .label { font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.step.done .label, .step.current .label { color: var(--text); }
button.step { background: none; border: 0; font: inherit; padding: 0; cursor: pointer; color: inherit; }
button.step:focus-visible .dot { box-shadow: 0 0 0 4px var(--ring); }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(0, 163, 224, 0.06); } }
@media (max-width: 520px) {
  .step .dot { width: 36px; height: 36px; font-size: 0.85rem; }
  .track::before, .track .fill { top: 16px; }
  .step .label { font-size: 0.65rem; }
}

/* ── Challenge ─────────────────────────────────────────────────────────── */
.challenge-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.stage-num { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--zs-blue); }
@media (prefers-color-scheme: dark) { .stage-num { color: #6f9bff; } }
.pill {
  font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.pill.d1, .pill.d2 { color: var(--zs-green); border-color: rgba(24, 169, 87, 0.4); background: rgba(24, 169, 87, 0.08); }
.pill.d3, .pill.d4 { color: #b7791f; border-color: rgba(245, 165, 36, 0.5); background: rgba(245, 165, 36, 0.1); }
.pill.d5, .pill.d6 { color: var(--zs-red); border-color: rgba(229, 72, 77, 0.4); background: rgba(229, 72, 77, 0.08); }
.challenge h2 { font-size: 1.6rem; }
.challenge .body { margin: 12px 0 16px; }
.challenge .body p:last-child { margin-bottom: 0; }
.challenge img.art { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); margin: 4px 0 12px; }
details.hint {
  background: var(--surface-2); border: 1px dashed var(--border);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 18px;
}
details.hint summary { cursor: pointer; font-weight: 600; }
details.hint[open] summary { margin-bottom: 8px; }
.flag-form { display: flex; gap: 10px; }
.flag-form input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.03em; }
@media (max-width: 520px) { .flag-form { flex-direction: column; } }
.shake { animation: shake 0.4s; }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ── Completed list ────────────────────────────────────────────────────── */
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--border); }
.history li:first-child { border-top: 0; padding-top: 0; }
.history .badge {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--zs-blue), var(--zs-cyan));
}
.history .meta { font-size: 0.8rem; color: var(--muted); }
.history .prize { margin-top: 4px; font-size: 0.9rem; }
.history .prize b { color: var(--zs-green); }
.empty { color: var(--muted); font-size: 0.95rem; }

/* ── Celebration / modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 12, 30, 0.6);
  display: grid; place-items: center; padding: 16px; z-index: 50;
  animation: fade 0.2s;
}
.modal {
  background: var(--surface); color: var(--text);
  border-radius: 18px; max-width: 460px; width: 100%;
  padding: 28px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  animation: pop 0.25s ease-out;
  max-height: calc(100vh - 32px); overflow: auto;
}
.modal.left { text-align: left; }
.modal .trophy { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.modal .prize-box {
  margin: 16px 0; padding: 14px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(33, 96, 225, 0.08), rgba(0, 163, 224, 0.1));
  border: 1px solid rgba(33, 96, 225, 0.25);
}
.modal .prize-box .label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.modal .prize-box .prize { font-size: 1.2rem; font-weight: 800; }
.modal .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.modal.left .actions { justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.champion { text-align: center; }
.champion .trophy { font-size: 3.5rem; }

/* ── Toasts ────────────────────────────────────────────────────────────── */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast {
  background: var(--zs-navy); color: #fff; padding: 12px 16px; border-radius: 10px;
  box-shadow: var(--shadow); font-size: 0.9rem; transition: opacity 0.4s, transform 0.4s;
}
.toast-error { background: var(--zs-red); }
.toast-ok { background: var(--zs-green); }
.toast.out { opacity: 0; transform: translateY(8px); }

.loading { text-align: center; padding: 48px 0; color: var(--muted); }
.spinner {
  width: 32px; height: 32px; border-radius: 50%; margin: 0 auto 12px;
  border: 3px solid var(--border); border-top-color: var(--zs-blue);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Admin ─────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); margin-bottom: 20px; overflow-x: auto; }
.tab { flex: 1; white-space: nowrap; background: none; border: 0; font: inherit; font-weight: 600; color: var(--muted); padding: 10px 14px; border-radius: 8px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--zs-blue); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.stat .num { font-size: 1.8rem; font-weight: 800; }
.stat .lbl { font-size: 0.8rem; color: var(--muted); }
.dist { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 110px; margin-top: 8px; }
.dist .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 0.72rem; color: var(--muted); }
.dist .bar { width: 100%; max-width: 44px; background: linear-gradient(180deg, var(--zs-cyan), var(--zs-blue)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.dist .n { color: var(--text); font-weight: 700; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input { flex: 1; min-width: 180px; }
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
tr.row { cursor: pointer; }
tr.row:hover td { background: var(--surface-2); }
.lvl { display: inline-flex; gap: 3px; }
.lvl i { width: 10px; height: 10px; border-radius: 3px; background: var(--border); }
.lvl i.on { background: var(--zs-blue); }
.stage-editor + .stage-editor { margin-top: 20px; }
.stage-editor summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
.stage-editor summary::-webkit-details-marker { display: none; }
.stage-editor summary h3 { margin: 0; flex: 1; font-size: 1.05rem; }
.stage-editor[open] summary { margin-bottom: 18px; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.section-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 6px 0 -4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.9rem; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; padding: 2px 6px; border-radius: 999px; }
.chip button:hover { background: rgba(229, 72, 77, 0.12); color: var(--zs-red); }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { width: auto; }
.claims { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.claims label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.claims input { width: auto; }
.claims label.locked { opacity: 0.5; }

/* SMS opt-in */
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 0.85rem; color: var(--muted); cursor: pointer; }
.consent input { width: auto; margin-top: 3px; flex: none; }

/* ── Phone tweaks ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .brand .divider, .brand .tag, .user-chip .who { display: none; }
  .user-chip { gap: 6px; }
  .hero { margin-top: 24px; }
  .card { padding: 20px; }
  .table-wrap { margin: 0 -20px; padding: 0 20px; }
  .step .label { display: none; }
  .modal .actions .btn { flex: 1; }
}
body { overflow-x: hidden; }
