:root {
  --ink: #16181d;
  --muted: #61666f;
  --line: #dfe2e8;
  --accent: #1d4ed8;
  --warn-bg: #fff6e5;
  --warn-line: #e0a800;
  --bar: #61666f;
  --bar-above: green;
  --bar-maybe: #e0a800;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  color: var(--ink);
}

main { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.site-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.tagline { color: var(--muted); font-size: .85rem; }

/* Answer-key entry grid, admin side — same shape as the candidate's own answer sheet in
   TopEtc.Modules.Client.Wasm (different project, different static assets, so duplicated
   rather than shared: tap-first beats typing "AECBD..." into a text box either way). */
.sheet { list-style: none; padding: 0; margin: 0; }

.sheet-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem 0;
  border-bottom: 1px solid var(--line);
}

.item-number {
  width: 2.5rem;
  flex-shrink: 0;
  color: var(--muted);
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
}

.choices { display: flex; gap: .35rem; flex-wrap: wrap; }

.choice {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice.blank { font-weight: 400; color: var(--muted); }
.choice.blank.selected { background: var(--muted); border-color: var(--muted); color: #fff; }
.choice:disabled { opacity: .6; cursor: not-allowed; }

.admin-nav {
  padding: .6rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.admin-nav a { text-decoration: none; }
.admin-nav a:hover { text-decoration: underline; }

.account-nav { margin-left: auto; display: flex; align-items: center; gap: .9rem; font-size: .9rem; }
.account-nav form { margin: 0; }
.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.link-button:hover { text-decoration: underline; }

h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .4rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .3rem; }

/* <FocusOnNavigate Selector="h1" /> in Routes.razor moves focus to the page heading after
   every navigation, so a screen reader announces where it landed instead of leaving the
   user at the top of an unchanged document. To focus a heading at all it has to be given
   tabindex="-1", and that makes the browser paint its default focus ring around the title
   on every load — visible to everyone, useful to no one.

   :focus-visible is the browser's own answer to "did the user actually navigate here by
   keyboard?", and it is false for programmatic focus on a tabindex="-1" element. Suppressing
   the ring only in that case keeps it for real keyboard users, which a blanket
   `outline: none` would not. */
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

a { color: var(--accent); }

.lead { color: var(--muted); }
.meta { color: var(--muted); font-size: .875rem; }

section { border-top: 1px solid var(--line); padding-top: .5rem; }

.contest-list { list-style: none; padding: 0; }
.contest-list li { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.contest-list a { text-decoration: none; }
.contest-list a:hover { text-decoration: underline; }

.rules { padding-left: 1.1rem; }
.rules li { margin-bottom: .35rem; }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

/* The point estimate never appears without its interval right next to it. */
.estimate { font-size: 1.05rem; margin-bottom: .2rem; }
.estimate strong { font-size: 2rem; }
.interval { color: var(--muted); margin-left: .5rem; }

.warning {
  background: var(--warn-bg);
  border-left: 3px solid var(--warn-line);
  padding: .6rem .8rem;
  font-size: .9rem;
}

.tooltip { position: relative; cursor: help; border-bottom: 1px dotted var(--muted); }
.tooltip-text {
  visibility: hidden;
  position: absolute;
  bottom: 130%;
  left: 0;
  width: 16rem;
  max-width: 70vw;
  background: var(--ink);
  color: #fff;
  font-size: .8rem;
  line-height: 1.4;
  padding: .5rem .6rem;
  border-radius: 4px;
  z-index: 1;
}
.tooltip:hover .tooltip-text,
.tooltip:focus .tooltip-text,
.tooltip:focus-within .tooltip-text { visibility: visible; }

.histogram { list-style: none; padding: 0; font-size: .8rem; }
.histogram li { display: flex; align-items: center; gap: .5rem; margin-bottom: 2px; }
.bin-label { width: 6.5rem; text-align: right; color: var(--muted); flex-shrink: 0; }
.track { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; }
.bar { display: block; height: .75rem; background: var(--bar); min-width: 1px; }
.bar.above { background: var(--bar-above); }
.bar.maybe { background: var(--bar-maybe); }
.bin-count { color: var(--muted); margin-left: .4rem; white-space: nowrap; }

/* The visitor's own bin. Marked with a label as well as colour, so the "where am I"
   answer does not depend on distinguishing two shades. */
.histogram li.mine .bin-label { color: var(--ink); font-weight: 700; }
.histogram li.mine .bar { outline: 2px solid var(--accent); outline-offset: 1px; }
.you {
  margin-left: .45rem;
  padding: 0 .35rem;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}

.status { font-size: .8rem; padding: .05rem .4rem; border: 1px solid var(--line); border-radius: 3px; }

/* Account forms (register, login, password reset, e-mail change). */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  max-width: 24rem;
  padding: .5rem .6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}
.field.checkbox label { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; }
.field.checkbox input { margin-top: .2rem; }
.field .hint { color: var(--muted); font-size: .8rem; margin: .25rem 0 0; }

button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: .6rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button[type="submit"]:hover { opacity: .92; }

.validation-message { color: #b00020; font-size: .8rem; display: block; margin-top: .2rem; }
.validation-summary { color: #b00020; font-size: .85rem; list-style: none; padding: 0; margin: 0 0 1rem; }

.status-message { padding: .6rem .8rem; border-radius: 4px; font-size: .9rem; margin-bottom: 1rem; }
.status-message.error { background: #fdecea; border-left: 3px solid #b00020; color: #7a0015; }
.status-message.success { background: #eaf7ec; border-left: 3px solid #1e7e34; color: #14532d; }

.site-footer {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
}

@media (max-width: 480px) {
  .bin-label { width: 4.5rem; }
}
