/* EdgeBench portal stylesheet — design system ported from edge-bench.org
   (EdgeBench-page/styles-curve.css). Keep tokens and component idioms in
   sync with that site when it evolves. */

@font-face {
  font-family: "EB Serif";
  src: url("/assets/fonts/ss4-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Serif";
  src: url("/assets/fonts/ss4-400i.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "EB Serif";
  src: url("/assets/fonts/ss4-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Sans";
  src: url("/assets/fonts/inter-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Sans";
  src: url("/assets/fonts/inter-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Sans";
  src: url("/assets/fonts/inter-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Sans";
  src: url("/assets/fonts/inter-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --ink: #15161a;
  --ink-2: #3a3d44;
  --muted: #6b6f78;
  --faint: #9a9ea7;
  --line: #e4e4e6;
  --line-strong: #c9cacd;
  --paper: #ffffff;
  --wash: #fafafa;
  --accent: #b33a3a;
  --fam-science: #0e9384;
  --fam-systems: #2563eb;
  --fam-optimization: #5b5bd6;
  --fam-knowledge: #1f9d55;
  --fam-formal: #8b5cf6;
  --fam-games: #c9357f;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --serif: "EB Serif", "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", ui-serif, serif;
  --sans: "EB Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
main a { color: var(--ink-2); border-bottom: 1px solid var(--line-strong); }
main a:hover { color: var(--ink); border-bottom-color: var(--ink); }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
code {
  font-size: 0.88em;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05em 0.35em;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 26px;
  flex-wrap: wrap;
  min-height: 64px;
  padding: 8px 32px;
  background: color-mix(in srgb, #ffffff 86%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}
.brand small {
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.navlinks { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.navlinks a {
  display: inline-flex;
  align-items: center;
  padding: 6px 0;
  color: var(--faint);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.navlinks a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.navlinks a.is-current { color: var(--ink); border-bottom-color: var(--ink); }
.nav-session { display: inline-flex; align-items: center; gap: 14px; }

.usermenu { position: relative; }
.usermenu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1;
  transition: color 0.18s ease;
}
.usermenu-toggle:hover { background: none; }
.usermenu:hover .usermenu-toggle,
.usermenu.is-open .usermenu-toggle,
.usermenu:focus-within .usermenu-toggle { color: var(--ink); }
.usermenu .chev { font-size: 9px; color: var(--faint); transition: transform 0.18s ease; }
.usermenu:hover .chev,
.usermenu.is-open .chev,
.usermenu:focus-within .chev { transform: rotate(180deg); }
.usermenu .menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  min-width: 210px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: 0 10px 28px rgba(21, 22, 26, 0.1);
}
/* invisible bridge so the pointer can travel from the toggle to the menu */
.usermenu .menu::before {
  content: "";
  position: absolute;
  top: -12px; left: 0; right: 0;
  height: 12px;
}
.usermenu:hover .menu,
.usermenu.is-open .menu,
.usermenu:focus-within .menu { display: block; }
.usermenu .menu-head {
  display: block;
  padding: 8px 12px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}
.usermenu .menu-head b { color: var(--ink-2); font-weight: 500; overflow-wrap: anywhere; }
.usermenu .menu a {
  display: block;
  padding: 7px 12px;
  border-radius: var(--radius-s);
  border-bottom: 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}
.usermenu .menu a:hover { background: var(--wash); color: var(--ink); }
.usermenu .menu a.menu-danger { color: var(--accent); }
.usermenu .menu a.menu-danger:hover { background: #fdf3f3; }

/* ---------- Page scaffold ---------- */

main {
  flex: 1;
  width: min(100% - 48px, 1080px);
  margin: 0 auto;
  padding: 44px 0 24px;
}
main.narrow { width: min(100% - 48px, 460px); }

.eyebrow {
  margin: 0 0 14px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(30px, 4.2vw, 40px);
  line-height: 1.12;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
}

h2 {
  margin: 40px 0 12px;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h2 small { color: var(--faint); font-family: var(--sans); font-size: 13.5px; font-weight: 500; letter-spacing: 0; }

.lede {
  max-width: 72ch;
  margin: 0 0 26px;
  color: var(--ink-2);
  font-size: 16.5px;
  line-height: 1.7;
}
.lede b, .lede strong { font-weight: 600; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 0.3rem 0 0; }
.hint a { border-bottom-color: var(--line); }

/* ---------- Tables ---------- */

.overflow { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
}
th {
  padding: 0 10px 9px;
  text-align: left;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
}
td {
  padding: 9px 10px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}
tr:hover > td { background: var(--wash); }
td.num, th.num { text-align: right; }
td .score { font-weight: 650; font-size: 14.5px; }
.rank { color: var(--faint); font-size: 13px; }
tr.top-1 .rank, tr.top-1 td .score { color: var(--ink); }

/* ---------- Status pills ---------- */

.status {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status.awaiting_approval { background: #fdf2f8; color: #9d174d; border-color: #f5d0e3; }
.status.pending   { background: #fefce8; color: #854d0e; border-color: #f1e4a6; }
.status.rejected  { background: #fef2f2; color: #7f1d1d; border-color: #f3caca; }
.status.running   { background: #eff6ff; color: #1e40af; border-color: #c8dcf8; }
.status.succeeded { background: #f0fdf4; color: #166534; border-color: #c7ecd1; }
.status.failed    { background: #fef2f2; color: #991b1b; border-color: #f3caca; }
.status.cancelled { background: #f4f4f5; color: #52525b; border-color: #e0e0e3; }

/* ---------- Category chips ---------- */

.cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.cat::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}
.cat.science::before      { background: var(--fam-science); }
.cat.systems::before      { background: var(--fam-systems); }
.cat.optimization::before { background: var(--fam-optimization); }
.cat.knowledge::before    { background: var(--fam-knowledge); }
.cat.formal::before       { background: var(--fam-formal); }
.cat.games::before        { background: var(--fam-games); }

/* ---------- Segmented tabs (leaderboard boards) ---------- */

.segments {
  display: flex;
  gap: 22px;
  margin: 6px 0 26px;
  border-bottom: 1px solid var(--line);
}
.segment {
  position: relative;
  flex: 0 0 auto;
  padding: 2px 1px 9px;
  cursor: pointer;
  color: var(--faint);
  background: none;
  border: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.085em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 170ms ease;
}
a.segment { border-bottom: 0; }
.segment::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--ink);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 200ms ease, opacity 200ms ease;
}
.segment:hover { color: var(--ink-2); }
.segment:hover::after { opacity: 0.4; transform: scaleX(1); }
.segment.is-active { color: var(--ink); }
.segment.is-active::after { opacity: 1; transform: scaleX(1); }

/* ---------- Forms ---------- */

label { display: block; margin: 18px 0 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
label .muted { font-weight: 400; }

input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  font-size: 14.5px;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent);
}
input::placeholder { color: var(--faint); }
select { width: auto; max-width: 100%; }

.choice-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0; }
.choice {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.choice:hover { border-color: var(--ink) }
.choice:has(input:checked) {
  border-color: var(--ink);
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.choice input { accent-color: var(--ink); margin: 0; align-self: center; }
.choice .sub { color: var(--faint); font-size: 12.5px; font-weight: 400; }

/* ---------- Buttons ---------- */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 22px;
  cursor: pointer;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-s);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
button:hover, .btn:hover { background: var(--ink-2); border-color: var(--ink-2); }
button.small { padding: 3px 12px; font-size: 12.5px; }
button.ghost, button.small {
  color: var(--ink-2);
  background: var(--paper);
  border-color: var(--line-strong);
}
button.ghost:hover, button.small:hover { color: var(--ink); background: var(--wash); border-color: var(--ink); }
button.approve { color: #fff; background: #1f9d55; border-color: #1f9d55; }
button.approve:hover { background: #178247; border-color: #178247; }
button.reject { color: #fff; background: var(--accent); border-color: var(--accent); }
button.reject:hover { background: #9c3131; border-color: #9c3131; }
form.inline { display: inline; }

/* ---------- Cards & notices ---------- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 22px 26px;
}
.card > label:first-child, .card > h1:first-child { margin-top: 0; }

.notice { padding: 10px 14px; border-radius: var(--radius-s); font-size: 14px; margin: 0 0 18px; }
.notice.error { background: #fef2f2; color: #991b1b; border: 1px solid #f3caca; }
.notice.ok { background: #f0fdf4; color: #166534; border: 1px solid #c7ecd1; }

/* ---------- Task picker ---------- */

.set-row { display: flex; gap: 8px; margin: 14px 0 18px; flex-wrap: wrap; }
.task-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 16px 20px 14px;
  margin-bottom: 12px;
}
.task-group > .cat { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.task-group > .cat::before { width: 9px; height: 9px; }
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 2px 18px;
  margin-top: 8px;
}
.tasks-grid label {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 2px 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-2);
  cursor: pointer;
}
.tasks-grid label:hover { color: var(--ink); }
.tasks-grid input { accent-color: var(--ink); align-self: center; }

/* ---------- Footer ---------- */

.site-footer {
  width: min(100% - 48px, 1080px);
  margin: 56px auto 0;
  padding: 28px 0 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 14px;
}
.site-footer a { color: var(--muted); border-bottom: 1px solid transparent; }
.site-footer a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.footer-links { display: inline-flex; align-items: center; gap: 8px; }
.footer-resource { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; line-height: 1; }
.footer-icon { display: block; flex: 0 0 auto; width: 15px; height: 15px; }
.footer-icon-arxiv { width: 11px; height: 15px; }
.footer-icon-github { fill: currentColor; }
.footer-icon-hf {
  width: 17px;
  height: 17px;
  background: currentColor;
  mask: url("/assets/huggingface.svg") center / contain no-repeat;
  -webkit-mask: url("/assets/huggingface.svg") center / contain no-repeat;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .topbar { padding: 10px 18px; row-gap: 0; }
  /* Keep the nav right-aligned when it wraps under the brand. */
  .navlinks { margin-left: auto; gap: 14px; }
  .navlinks a, .usermenu-toggle { font-size: 13.5px; }
  .nav-session { gap: 12px; }
  main { width: min(100% - 32px, 1080px); padding-top: 30px; }
  /* overflow-x:auto forces computed overflow-y to auto, so the 1px the
     active underline (::after, bottom:-1px) hangs below the row would make
     the tab row itself a vertically draggable scroller that rubber-bands on
     touch. Keep the underline inside the box and pin the y axis shut. */
  .segments { gap: 16px; overflow-x: auto; overflow-y: hidden; }
  .segment::after { bottom: 0; }
}

@media (max-width: 520px) {
  .brand small { display: none; }
  /* One-line topbar: the register entry stays reachable from the login page
     ("No account? Sign up"), so the link can yield its width here. */
  .nav-session a[href="/register"] { display: none; }
}
