/* ==========================================================================
   JOBLESS — registro delle ore perse
   Terminal editorial / soft paper. No gradients, no glow, no noise.
   ========================================================================== */

@font-face {
  font-family: "Cutive";
  src: url("/static/Cutive-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fbf1c7;
  --surface: #fdf6e3;
  --ink: #3c3836;
  --ink-2: #504945;
  --muted: #665c54;
  --faint: #928374;
  --line: #e3d5af;
  --line-strong: #bdae93;
  --accent: #cc241d;
  --on-accent: #fbf1c7;
  --hover: #f1e7c0;
  --me-bg: #f3e8c6;
  --voted-bg: #fdf6e3;
  --unvoted-bg: #fff2c2;
  --error-bg: #f6d6cf;
  --error-text: #9d0000;
  --error-accent: #cc241d;
  --bar-bg: #3c3836;
  --bar-ink: #fbf1c7;
  --backdrop: rgba(60, 56, 54, .48);
  --highlight: #fabd2f;
  --highlight-2: #8ec07c;
  --on-highlight: #3c3836;
  --on-highlight-2: #3c3836;
  --cta-bg: #9d0000;
  --cta-ink: #fbf1c7;
  --edge: #282828;
  --shadow: #282828;
  --radius: 2px;
  --mono: "Iosevka", "JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", "Cascadia Mono", "Liberation Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --sans: "Avenir Next", "Segoe UI", "Open Sans", "Helvetica Neue", Arial, sans-serif;
  --cutive: "Cutive", "Courier New", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1d2021;
    --surface: #282828;
    --ink: #ebdbb2;
    --ink-2: #d5c4a1;
    --muted: #bdae93;
    --faint: #928374;
    --line: #45403d;
    --line-strong: #665c54;
    --accent: #d13426;
    --on-accent: #fbf1c7;
    --hover: #3c3836;
    --me-bg: #45403d;
    --voted-bg: #282828;
    --unvoted-bg: #403a25;
    --error-bg: #5c3434;
    --error-text: #f2cbb5;
    --error-accent: #fb4934;
    --bar-bg: #282828;
    --bar-ink: #ebdbb2;
    --backdrop: rgba(0, 0, 0, .72);
    --highlight: #d79921;
    --highlight-2: #83a598;
    --on-highlight: #1d2021;
    --on-highlight-2: #1d2021;
    --cta-bg: #9d0000;
    --cta-ink: #fbf1c7;
    --edge: #665c54;
    --shadow: #3c3836;
  }

  .button-danger {
    background: #3b2220;
    border-color: #ea6962;
    color: #fca59b;
  }
  .button-danger:hover {
    background: var(--accent);
    color: var(--on-accent);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  color-scheme: light dark;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main { display: block; flex: 1 0 auto; }

.leaderboard,
.hero,
.composer-section,
.joblist,
.entry { scroll-margin-top: 72px; }

h1, h2, h3, p { margin-top: 0; }

a { color: inherit; }

button { font-family: inherit; }

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 18px;
}

.sep { color: var(--line-strong); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 10px;
  top: -50px;
  z-index: 200;
  padding: 5px 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper);
}
@media (min-width: 701px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
  }
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 56px;
}

.wordmark {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 2px 7px;
  border: 2px solid var(--edge);
  background: var(--highlight);
  box-shadow: 3px 3px 0 var(--edge);
  color: var(--on-highlight);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease;
}
.wordmark:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--edge);
}

.site-nav {
  display: flex;
  align-items: center;
  font-size: 12px;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.site-nav a + a::before {
  content: "/";
  margin: 0 8px;
  color: var(--line-strong);
}

.header-account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.account {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  text-decoration: none;
}
.account:hover .account-name { text-decoration: underline; }
.account-name { color: var(--ink); font-weight: 700; }
.account-points { color: var(--muted); }

.avatar {
  display: inline-block;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background-color: transparent;
  background-image: none;
  color: var(--muted);
  object-fit: cover;
  vertical-align: middle;
}
.avatar-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-image: none;
  background-color: var(--surface);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}
.avatar-censored {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-image: none;
  background-color: var(--hover);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.avatar-sm {
  width: 19px;
  height: 19px;
  font-size: 9px;
}
.avatar-xl {
  width: 72px;
  height: 72px;
  border-width: 1px;
  font-size: 26px;
}
.member-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
}

.header-login {
  color: var(--ink);
}
.header-login:hover { color: var(--ink); }

.inline-form { display: inline-flex; margin: 0; }

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: inherit;
  cursor: pointer;
}
.link-button:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---------- buttons ---------- */

.button {
  display: inline-block;
  padding: 6px 11px;
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  background: var(--accent);
  box-shadow: 3px 3px 0 var(--edge);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.button:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--edge);
}
.button:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--edge);
}
.button-outline {
  background: var(--surface);
  color: var(--ink);
}
.button-outline:hover {
  background: var(--highlight);
  color: var(--ink);
}
.button-danger {
  background: var(--surface);
  color: var(--accent);
}
.button-danger:hover {
  background: var(--accent);
  color: var(--on-accent);
}
.button-small {
  padding: 3px 8px;
  box-shadow: 2px 2px 0 var(--edge);
  font-size: 10.5px;
}
.button-small:hover { box-shadow: 1px 1px 0 var(--edge); }
.button-full { width: 100%; margin-top: 4px; }

/* ---------- section headings ---------- */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 3px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--edge);
}
.popout-dropdown { position: relative; display: inline-block; }
.period-toggle,
.sort-toggle {
  width: auto;
  min-width: 86px;
  min-height: 28px;
  padding: 0 7px;
  gap: 5px;
  box-shadow: 2px 2px 0 var(--edge);
  font-family: var(--mono);
  font-size: 10.5px;
  touch-action: manipulation;
}
.period-toggle { min-width: 88px; }
.sort-toggle { min-width: 116px; }
.period-toggle .material-symbols-rounded,
.sort-toggle .material-symbols-rounded { font-size: 16px; }
.section-title {
  display: flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--highlight);
  box-shadow: 2px 2px 0 var(--edge);
  color: var(--on-highlight);
}
.section-head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------- leaderboard ---------- */

.leaderboard { padding-top: 18px; }
.leaderboard .section-head { border-bottom: 0; }

.table-scroll { overflow-x: auto; }

.leaderboard .table-scroll {
  border: 2px solid var(--edge);
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--shadow);
}
.panel .table-scroll {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.rank-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.rank-table th,
.data-table th {
  padding: 7px 6px;
  border-bottom: 1px solid var(--edge);
  background: var(--highlight-2);
  color: var(--on-highlight-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.rank-table td,
.data-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.rank-table tbody tr:last-child td,
.data-table tbody tr:last-child td { border-bottom: 0; }

.rank-table tbody tr:not(.rank-first):hover,
.data-table tbody tr:hover { background: var(--hover); }

.rank-table .num,
.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rank-col {
  width: 30px;
  color: var(--faint);
}
.rank-first {
  background: var(--highlight);
  color: var(--on-highlight);
}
.rank-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}
.rank-first .rank-first-chip {
  background: var(--accent);
  border-color: var(--edge);
  color: var(--on-accent);
}
.rank-first .rank-col {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}
.points { font-weight: 700; }
.member-name { font-weight: 600; }
.you {
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
}
.rank-first .you { color: var(--on-highlight); }

.rank-table tr.is-me { background: var(--me-bg); }
.rank-table tr.is-me.rank-first { background: var(--highlight); }
.rank-table tr.is-me td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

.formula {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.empty-line {
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- hero ---------- */

.hero { padding: 22px 0 26px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.hero-card {
  padding: 15px 18px 16px;
  border: 2px solid var(--edge);
  background: var(--highlight);
  box-shadow: 6px 6px 0 var(--shadow);
}

.hero-title {
  margin: 12px 0 10px;
  color: var(--on-highlight);
  font-family: var(--mono);
  font-size: clamp(4rem, 9vw, 8rem);
  font-weight: 700;
  letter-spacing: -.07em;
  line-height: .88;
}
.hero-note {
  margin: 0;
  color: var(--on-highlight);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hero-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 11px;
}
.hero-tape {
  position: relative;
  width: min(100%, 66ch);
  min-height: 3.6em;
  overflow: hidden;
  border-top: 1px solid var(--ink-2);
  padding-top: 8px;
  pointer-events: all;
    &::after {  
      content: '';
      position: absolute;
      bottom: 0;
      pointer-events: all;
      left: 0;
      right: 0;
      height: 1.3lh;
      background: linear-gradient(to bottom, transparent, var(--highlight));
    }
}
.hero-tape-item {
  position: absolute;
  inset: 8px 0 auto;
  display: -webkit-box;
  max-width: 100%;
  color: #1f1f1f;
  font-family: var(--cutive);
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  display: -webkit-box;
  overflow: hidden;
  text-decoration: none;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  white-space: normal;
  transform: translateX(-115%);
  transition: transform 1.2s ease, opacity 1.2s ease;
}
.hero-tape-item.is-active { opacity: 1; transform: translateX(0); }
.hero-tape-item.is-exiting { opacity: 0; transform: translateX(115%); }
.hero-tape-item.is-active::after { opacity: .6; }
/* ---------- composer ---------- */

.composer-section {
  padding: 22px 0;
}

.write-form { margin-top: 8px; }

.write-form textarea {
  width: 100%;
  min-height: 84px;
  padding: 9px 11px;
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.6;
  resize: vertical;
}
.write-form textarea::placeholder { color: var(--faint); }
.write-form textarea:focus {
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.write-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.char-count {
  color: var(--muted);
  font-size: 10.5px;
}
.char-count.is-over { color: var(--accent); }

.signin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dotted var(--line-strong);
}
.signin-row p {
  margin: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
}

/* ---------- registro ---------- */

.joblist { padding: 22px 0 0; }

.ledger { border-top: 0; }

.entry {
  position: relative;
  padding: 14px 8px 13px 48px;
  background: var(--voted-bg);
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}
.entry.is-unvoted {
  background: var(--unvoted-bg);
  border-left-color: var(--highlight);
}
.entry.is-voted { border-left-color: var(--highlight-2); }
.entry:hover {
  border-left-color: var(--accent);
}

.entry-id {
  position: absolute;
  left: 0;
  top: 13px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1;
}

.entry-meta {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--muted);
  font-size: 10.5px;
}
.entry-author {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.entry-author:hover { text-decoration: underline; }
.entry-author-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.entry-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.entry-body {
  margin: 6px 0 10px;
  color: var(--ink);
  font-family: var(--cutive);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.entry-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
}

.entry-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.entry-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}

.entry-score {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.entry-score b {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
}

.side-note {
  color: var(--muted);
  font-size: 10.5px;
}

.vote-form {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  margin: 0;
}

.vote-label {
  color: var(--muted);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vote-scale {
  display: flex;
  grid-column: 2;
  min-width: 0;
  width: 100%;
  flex: 0 1 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.entry-author.is-censored {
  color: var(--faint);
  font-style: italic;
  cursor: default;
}

.joblist-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
}
.toggle-link {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.toggle-link:hover {
  color: var(--accent);
}
.filter-dropdown {
  position: relative;
  display: inline-block;
}
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  cursor: pointer;
}
.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga";
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}
.icon-popout {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--edge);
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--edge);
  color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, color .12s ease;
}
.period-toggle,
.sort-toggle {
  width: auto;
  min-width: 86px;
  min-height: 28px;
  padding: 0 7px;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
}
.sort-toggle { min-width: 116px; }
.period-toggle .material-symbols-rounded,
.sort-toggle .material-symbols-rounded { font-size: 16px; }
.icon-popout:focus { outline: none; }
.icon-popout:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-popout:hover {
  border-color: var(--edge);
  background: var(--highlight);
  color: var(--ink);
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--edge);
}
.icon-popout:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--edge);
}
.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--hover);
  color: var(--accent);
}
.filter-toggle:hover {
  border-color: var(--ink);
}
.filter-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 110px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--edge);
  padding: 3px 0;
}
.popout-dropdown .filter-menu[hidden] { display: none; }
.popout-dropdown .filter-menu:not([hidden]) { display: block; }
.filter-item {
  display: block;
  padding: 4px 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 11px;
  cursor: pointer;
}
.filter-item:hover {
  background: var(--hover);
  color: var(--accent);
}
.filter-item.is-active {
  background: var(--me-bg);
  font-weight: 700;
}

.vote-badge {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 600;
}
.vote-badge.is-voted {
  border-color: var(--highlight-2);
  background: var(--surface);
  color: var(--highlight-2);
}
.vote-badge.is-unvoted {
  border-color: var(--line-strong);
  background: var(--me-bg);
  color: var(--muted);
}
.vote-badge.is-mine {
  border-color: var(--line);
  color: var(--faint);
  font-style: italic;
}
.vote-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 2px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  vertical-align: middle;
}
.vote-dot.is-full { background: var(--accent); }
.vote-dot.is-empty { background: transparent; }
.unvoted-flag {
  color: var(--muted);
  font-style: italic;
}

.divider {
  margin: 18px 0;
  border: 0;
  border-top: 1px dashed var(--line-strong);
}
.field-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.field-row input {
  flex: 1;
}

.vote-button {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 24px;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.vote-button:last-child { border-right: 0; }
.vote-button:hover {
  background: var(--accent);
  color: var(--on-accent);
}
.vote-button.is-selected {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.vote-form.htmx-request .vote-scale {
  opacity: .45;
  pointer-events: none;
}

.vote-status {
  color: var(--muted);
  font-size: 10.5px;
}
.vote-status b { color: var(--ink); }

.comments-toggle { flex: 0 0 auto; }
.comments-count {
  position: absolute;
  min-width: 10px;
  height: 10px;
  margin: -18px -18px 0 0;
  padding: 0 2px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--highlight);
  color: var(--on-highlight);
  font-size: 8px;
  line-height: 9px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.comments-dialog {
  width: min(92vw, 480px);
  max-height: min(80vh, 620px);
  margin: auto;
  padding: 0;
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--shadow);
}
.comments-dialog[open] { z-index: 30; }
.comments-dialog::backdrop { background: var(--backdrop); }
.comments-body { padding: 14px; }
.comments-list { display: grid; gap: 10px; max-height: 36vh; overflow-y: auto; }
.comment { padding-bottom: 9px; border-bottom: 1px dotted var(--line-strong); }
.comment:last-child { border-bottom: 0; }
.comment-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; }
.comment-meta b { color: var(--ink); }
.comment-delete-form { margin: 0; }
.comment-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}
.comment-delete:hover {
  border-color: var(--accent);
  background: var(--error-bg);
  color: var(--accent);
}
.comment-delete .material-symbols-rounded { font-size: 15px; }
.comment p { margin: 3px 0 0; font-family: var(--sans); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.comments-empty { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.comment-form { display: grid; gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px dotted var(--line-strong); }
.comment-form textarea { width: 100%; padding: 7px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-family: var(--sans); font-size: 13px; resize: vertical; }
.comment-form .button { justify-self: start; }

@media (min-width: 701px) {
  .comments-dialog {
    width: auto;
    max-height: none;
    margin: 12px 0 0;
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: none;
  }
  .comments-dialog[open] {
    position: static;
    display: block;
  }
  .comments-dialog .dialog-head {
    padding: 5px 0;
    background: transparent;
    color: var(--muted);
  }
  .comments-dialog .dialog-head h2 { font-size: 10px; }
  .comments-dialog .close-button { color: var(--muted); }
  .comments-dialog .comments-body { padding: 8px 0 0; }
  .comments-dialog .comments-list { max-height: 230px; }
}

.text-link {
  color: var(--ink);
  font-size: 11.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.text-link:hover { color: var(--accent); }

.entry-foot > .text-link { margin-left: auto; }

/* ---------- login dialog ---------- */

.login-dialog {
  width: min(92vw, 390px);
  margin: auto;
  padding: 0;
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--shadow);
  overflow: hidden;
}
.login-dialog[open] {
  position: fixed;
  inset: 0;
  z-index: 100;
  height: max-content;
}
.login-dialog::backdrop { background: var(--backdrop); }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bar-bg);
  color: var(--bar-ink);
}
.dialog-head h2 {
  margin: 0;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.close-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bar-ink);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
}
.close-button:hover { text-decoration: underline; }

.dialog-body { padding: 16px; }

.dialog-intro {
  margin: 0 0 14px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
}

.login-form { display: grid; gap: 3px; }

label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
}
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
  border-color: var(--ink);
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.form-error {
  margin: 0 0 10px;
  padding: 7px 9px;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--error-bg);
  color: var(--error-text);
  font-family: var(--sans);
  font-size: 12px;
}

.dialog-foot {
  margin: 14px 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.55;
}

/* ---------- admin ---------- */

.page-head {
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  margin: 0 0 6px;
  font-family: var(--sans);
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1;
}
.page-lede {
  max-width: 72ch;
  margin: 0 0 8px;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.65;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.panel {
  margin-top: 18px;
  padding: 14px 16px;
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--shadow);
}
.admin-grid .panel { margin-top: 0; }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.panel-head .section-note { font-size: 10.5px; }

.stack { display: grid; gap: 3px; }
.stack .button {
  justify-self: start;
  margin-top: 7px;
}

.field-hint {
  margin: 9px 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.5;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.check-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.file-input { padding: 6px 8px; }
.file-input::file-selector-button {
  margin-right: 9px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  cursor: pointer;
}
.file-input::file-selector-button:hover { border-color: var(--ink); }

.role-cell {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}
.role-cell form { margin: 0; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}
.profile-grid .panel { margin-top: 0; }

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dotted var(--line-strong);
}
.profile-avatar { flex: 0 0 auto; }
.profile-identity { min-width: 0; }
.profile-name {
  margin: 0 0 3px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.profile-meta {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
}
.profile-copy {
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.65;
}
.profile-copy p { margin: 0 0 10px; }
.profile-note { color: var(--muted); font-size: 12px; }
.profile-back { margin: 14px 0 0; }

.badge {
  display: inline-block;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-admin {
  border-color: var(--accent);
  color: var(--accent);
}

.date-cell {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.admin-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.admin-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px dotted var(--line-strong);
}
.admin-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.admin-item { min-width: 0; }
.admin-phrase {
  margin: 0 0 3px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.admin-meta {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
}

/* ---------- error ---------- */

.error-page {
  max-width: 560px;
  padding: 64px 0;
}
.error-page h1 {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.05;
}
.error-page p:not(.eyebrow) {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.6;
}

/* ---------- flash / toast ---------- */

.flash,
.toast {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 150;
  max-width: min(92vw, 460px);
  padding: 8px 11px;
  border: 1px solid var(--bar-bg);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bar-bg);
  color: var(--bar-ink);
  font-size: 11.5px;
  line-height: 1.45;
}
.flash-error,
.toast-error { border-left-color: var(--error-accent); }

.toast-zone {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 160;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: min(92vw, 460px);
  pointer-events: none;
}
.toast {
  position: static;
  max-width: 100%;
  pointer-events: auto;
}

.is-hiding { opacity: 0; }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 26px;
  border-top: 1px solid var(--line);
}
.footer-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 12px 0 18px;
  color: var(--muted);
  font-size: 11.5px;
}
.footer-inner p { margin: 0; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- responsive (mobile-first) ---------- */

.optional { display: none; }

.header-inner {
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 7px 18px 6px;
  row-gap: 4px;
}

.site-nav {
  order: 3;
  width: 100%;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
}
.site-nav a + a::before { margin: 0 7px; }

.header-account { font-size: 11px; }

.hero { padding: 20px 0 24px; }
.hero-card {
  padding: 13px 14px 14px;
  box-shadow: 4px 4px 0 var(--shadow);
}
.hero-title {
  margin: 12px 0 4px;
  font-size: clamp(2.6rem, 13vw, 3.5rem);
  line-height: .9;
}
.hero-foot {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
}

.composer-section,
.joblist,
.leaderboard { padding-top: 18px; }

.section-head {
  flex-wrap: wrap;
  gap: 2px 10px;
}
.section-note { white-space: normal; }

.entry { padding-left: 30px; }
.entry-id {
  top: 12px;
  font-size: 15px;
}
.entry-body { font-size: 16.5px; }

.entry-foot {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.entry-foot > .text-link { margin-left: 0; }
.vote-form {
  justify-content: flex-start;
  width: 100%;
}
.vote-button {
  width: 30px;
  height: 28px;
  font-size: 11.5px;
}

.signin-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.admin-grid,
.profile-grid { grid-template-columns: 1fr; }

.page-head h1 { font-size: 1.9rem; }

.rank-table,
.data-table { font-size: 11px; }
.rank-table th,
.data-table th,
.rank-table td,
.data-table td { padding: 4px 5px; }
.rank-col { width: 28px; }

@media (min-width: 701px) {
  .shell { padding: 0 18px; }

  .header-inner {
    flex-wrap: nowrap;
    gap: 18px;
    padding: 0 18px;
    min-height: 56px;
  }
  .site-nav {
    order: 0;
    width: auto;
    padding-top: 0;
    border-top: 0;
    font-size: 12px;
  }
  .site-nav a + a::before { margin: 0 8px; }
  .header-account { font-size: 12px; }

  .hero { padding: 24px 0 30px; }
  .hero-card {
    padding: 18px 20px 20px;
    box-shadow: 6px 6px 0 var(--shadow);
  }
  .hero-title {
    margin: 14px 0 5px;
    font-size: clamp(4rem, 9vw, 8rem);
    line-height: .88;
  }
  .hero-note { text-align: right; }
  .hero-foot {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 0;
  }
  .hero-tape { min-height: 3.2em; }

  .composer-section,
  .joblist,
  .leaderboard { padding-top: 24px; }

  .section-head {
    flex-wrap: nowrap;
    gap: 14px;
  }
  .section-note { white-space: nowrap; }

  .optional { display: table-cell; }

  .entry { padding-left: 46px; }
  .entry-id {
    top: 13px;
    font-size: 20px;
  }
  .entry-body { font-size: 17px; }

  .entry-foot {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }
  .entry-actions { order: 2; margin-left: auto; }
  .entry-score { order: 1; }
  .entry-foot > .text-link { margin-left: auto; }
  .vote-form {
    justify-content: flex-end;
    width: auto;
  }
  .vote-button {
    width: 26px;
    height: 24px;
    font-size: 11px;
  }

  .signin-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .admin-grid,
  .profile-grid { grid-template-columns: 1fr 1fr; }

  .page-head h1 { font-size: 2.3rem; }

  .rank-table,
  .data-table { font-size: 12.5px; }
  .rank-table th,
  .data-table th,
  .rank-table td,
  .data-table td { padding: 6px 6px; }
  .rank-col { width: 34px; }
}
