:root {
  --se-navy: #0A1A5C;
  --se-blue: #3D6BF2;
  --se-blue-light: #E8EEFF;
  --se-teal: #2BC4A0;
  --bg: #FFFFFF;
  --muted: #5B6478;
  --line: #D9DFEE;
  --font: "Inter", Arial, sans-serif;
  --w-body: 400; --w-label: 500; --w-emph: 600; --w-head: 700;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(10, 26, 92, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); font-weight: var(--w-body); color: var(--se-navy);
  background: var(--bg); min-height: 100vh; position: relative; overflow-x: hidden;
}
/* floating, centred wave behind everything; edges faded so it hovers rather than sits in a box */
body::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  left: 50%; top: 50%; width: min(1200px, 130vw); aspect-ratio: 1127 / 634;
  background: url("/bg-wave.png") center / 100% 100% no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 58% 58% at 50% 50%, #000 70%, transparent 100%);
  mask-image: radial-gradient(ellipse 58% 58% at 50% 50%, #000 70%, transparent 100%);
  transform: translate(-50%, -50%); animation: float 14s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0) rotate(0deg); }
  50% { transform: translate(-50%, -50%) translateY(-18px) rotate(-.6deg); }
}
h1, h2, h3 { font-weight: var(--w-head); margin: 0; }
button, textarea, select { font: inherit; color: inherit; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; background: var(--se-blue-light); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.lucide { stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; width: 16px; height: 16px; flex: none; }

header.bar { background: var(--se-navy); color: #fff; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header.bar h1 { font-size: 1rem; }
.tag { font-size: .75rem; font-weight: var(--w-emph); border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }

main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
main.wide { max-width: 1200px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.muted { color: var(--muted); }
.sub { color: var(--muted); margin: 6px 0 20px; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--se-blue); background: var(--se-blue); color: #fff; font-weight: var(--w-emph); padding: 10px 18px; border-radius: 10px; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: #fff; color: var(--se-blue); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .opt:focus-visible, .chip:focus-visible { outline: 3px solid var(--se-teal); outline-offset: 2px; }

/* name picker */
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.name { display: flex; align-items: center; gap: 10px; padding: 16px; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: var(--w-emph); box-shadow: var(--shadow); }
.name:hover { border-color: var(--se-blue); }

/* survey */
.topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; font-size: .875rem; color: var(--muted); }
.link { background: none; border: 0; color: var(--se-blue); cursor: pointer; font-weight: var(--w-emph); padding: 0; }
.progress { height: 8px; background: var(--se-blue-light); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--se-blue); transition: width .25s; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: .8125rem; font-weight: var(--w-label); white-space: nowrap; cursor: pointer; color: var(--se-navy); }
.chip.on { background: var(--se-navy); color: #fff; border-color: var(--se-navy); }
.qcard { margin-top: 16px; }
.qsec { font-size: .8125rem; font-weight: var(--w-emph); color: var(--se-blue); text-transform: uppercase; letter-spacing: .04em; }
.qtext { font-size: 1.25rem; margin: 6px 0 18px; line-height: 1.35; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; font-weight: var(--w-label); }
.opt:hover { border-color: var(--se-blue); }
.opt.on { border-color: var(--se-blue); background: var(--se-blue-light); }
.badge { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--se-blue-light); color: var(--se-blue); font-weight: var(--w-head); font-size: .8125rem; }
.opt.on .badge { background: var(--se-blue); color: #fff; }
.opt span:last-child { overflow-wrap: anywhere; }
textarea { width: 100%; min-height: 96px; border: 2px solid var(--line); border-radius: 10px; padding: 12px; resize: vertical; margin-top: 10px; }
textarea:focus { outline: none; border-color: var(--se-blue); }
.nav { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; gap: 12px; }
.saved { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--muted); min-height: 20px; }
.saved.ok { color: #12806a; }
.saved.err { color: #B42318; }

/* summary */
.sumrow { padding: 12px 0; border-top: 1px solid var(--line); }
.sumrow:first-child { border-top: 0; }
.sumrow b { font-weight: var(--w-emph); }
.sumrow .ans { margin-top: 4px; overflow-wrap: anywhere; white-space: pre-wrap; }
.sumrow .ans.none { color: var(--muted); font-style: italic; }
.done { display: flex; gap: 10px; align-items: center; background: #E6F8F3; border: 1px solid var(--se-teal); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-weight: var(--w-emph); }

/* results */
.pills { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.pill { display: flex; align-items: center; gap: 8px; background: #fff; box-shadow: var(--shadow); border-radius: 999px; padding: 8px 14px; font-weight: var(--w-emph); }
.pill small { font-weight: var(--w-label); padding: 2px 10px; border-radius: 999px; background: var(--se-blue-light); color: var(--se-blue); }
.pill.submitted small { background: var(--se-teal); color: #fff; }
.pill.not_started small { background: #EEF0F5; color: var(--muted); }
.rhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.agg { margin-bottom: 14px; }
.agg h3 { font-size: 1rem; margin-bottom: 10px; }
.bar-row { display: grid; grid-template-columns: 28px 1fr 28px; gap: 10px; align-items: center; margin: 6px 0; }
.bar-row .track { background: var(--se-blue-light); border-radius: 6px; padding: 6px 10px; position: relative; overflow: hidden; overflow-wrap: anywhere; }
.bar-row .fill { position: absolute; inset: 0 auto 0 0; background: rgba(61,107,242,.22); }
.bar-row .track span { position: relative; }
.bar-row .n { font-weight: var(--w-head); text-align: right; }
.others { margin-top: 10px; display: grid; gap: 6px; }
.others div { background: #F6F8FD; border-left: 3px solid var(--se-teal); padding: 6px 10px; border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.others b { font-weight: var(--w-emph); }
.matrix-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--se-navy); color: #fff; font-weight: var(--w-emph); position: sticky; top: 0; }
td.q { min-width: 260px; font-weight: var(--w-label); }
td.q .id { color: var(--se-blue); font-weight: var(--w-head); margin-right: 6px; }
tr.sec td { background: var(--se-blue-light); font-weight: var(--w-head); }
td.cell { min-width: 120px; overflow-wrap: anywhere; }
td.cell.empty { color: #B3B9C9; }
h2.section { margin: 32px 0 14px; font-size: 1.25rem; }

/* skeleton */
.skeleton { background: linear-gradient(90deg, #EEF1F8 25%, #F8F9FD 50%, #EEF1F8 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton, body::before { animation: none; } .progress > i { transition: none; } }

@media (max-width: 520px) {
  header.bar h1 { font-size: .875rem; }
  .qtext { font-size: 1.0625rem; }
  .nav .btn { padding: 10px 14px; }
}

/* landing */
.hero { text-align: center; padding: 28px 0 8px; }
.hero h2 { font-size: 1.75rem; }
.hero .sub { max-width: 520px; margin: 8px auto 0; }
.names.landing { margin-top: 20px; }
.done.warn { flex-wrap: wrap; background: #FFF4E5; border-color: #F5A524; margin: 12px 0 0; }
.crown { color: #F5A524; margin-left: 6px; vertical-align: -2px; width: 16px; height: 16px; }
th .crown { color: #FFD166; }
