/* BioBlitz. Palette taken from an H&E-stained slide: haematoxylin violet, eosin pink, on slide glass. */
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Bioblitz Serif"; src: url("/fonts/BioblitzSerif-Regular.woff") format("woff"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Bioblitz Serif"; src: url("/fonts/BioblitzSerif-Italic.woff") format("woff"); font-weight: 400 700; font-style: italic; font-display: swap; }

:root {
  --glass: #F3F1F9;
  --card: #FFFFFF;
  --ink: #24194D;
  --muted: #625B82;
  --line: #DCD6EC;
  --violet: #5B3FB5;
  --violet-deep: #45308F;
  --violet-soft: #ECE7FA;
  --eosin: #E5578C;
  --eosin-soft: #FBDCE8;
  --gfp: #1F8A5B;
  --gfp-soft: #DDF3E8;
  --grey: #8E89A6;
  --bad: #A8243C;
  --serif: "Bioblitz Serif", Georgia, "Times New Roman", serif;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--glass);
  color: var(--ink);
  font: 400 1rem/1.55 var(--sans);
  min-height: 100vh;
  min-height: 100dvh;
}
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font: 600 clamp(1.9rem, 4vw, 2.6rem)/1.15 var(--serif); letter-spacing: -0.01em; }
h2 { font: 600 1.3rem/1.25 var(--serif); }
h3 { font: 500 1rem/1.3 var(--sans); }
a { color: var(--violet-deep); }
small { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 400; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.noscript { padding: 2rem; text-align: center; }

/* ---------- frame ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 56rem; margin: 0 auto; padding: 1.1rem 1.25rem 0.5rem;
}
.wordmark { font: italic 600 1.7rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.page { max-width: 56rem; margin: 0 auto; padding: 0.75rem 1.25rem 4rem; display: grid; gap: 1.1rem; }
.stack { display: grid; gap: 1.1rem; }
.date { color: var(--muted); }
.title-row { display: grid; gap: 0.15rem; padding-top: 0.5rem; }
.foot { max-width: 56rem; margin: 0 auto; padding: 1rem 1.25rem 2rem; font-size: 0.9rem; }

.menu { position: relative; }
.menu-button { border: 0; background: none; padding: 2px; border-radius: 50%; cursor: pointer; display: flex; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 5; min-width: 15rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0.5rem;
  box-shadow: 0 12px 32px rgba(36, 25, 77, 0.16);
}
.menu-who { padding: 0.5rem 0.75rem 0.6rem; display: grid; border-bottom: 1px solid var(--line); margin-bottom: 0.35rem; }
.menu-who span { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 0.55rem 0.75rem; border: 0; background: none;
  border-radius: 10px; cursor: pointer; text-decoration: none; color: var(--ink);
}
.menu-item:hover { background: var(--violet-soft); }
.menu-item.danger, .btn.danger { color: var(--bad); }

.avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; object-fit: cover; flex: none; background: var(--violet-soft); }
.avatar-letter { display: inline-grid; place-items: center; font-weight: 500; color: var(--violet-deep); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.15rem; border-radius: 999px; border: 1.5px solid var(--ink);
  background: var(--card); color: var(--ink); font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--violet-soft); }
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.primary:hover { background: var(--violet-deep); border-color: var(--violet-deep); }
.btn.quiet { border-color: transparent; background: none; text-decoration: underline; text-underline-offset: 3px; padding-inline: 0.6rem; }
.btn.big { padding: 0.85rem 1.6rem; font-size: 1.08rem; }
.btn.small { padding: 0.25rem 0.5rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.input {
  width: 100%; min-width: 0; padding: 0.65rem 0.9rem; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--card);
}
.input:focus { outline: 3px solid var(--violet); outline-offset: 0; border-color: var(--violet); }
.code-input { text-transform: uppercase; letter-spacing: 0.18em; font-weight: 500; max-width: 11rem; }
.code-input::placeholder { letter-spacing: 0; font-weight: 400; text-transform: none; }
.inline-form { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.end-actions { text-align: right; }

.notice { padding: 0.6rem 0.85rem; border-radius: 12px; }
.notice.bad { background: #FBE4E9; color: #7A1228; }
.notice.good { background: var(--gfp-soft); color: #0F5637; }
.badge { font-size: 0.8rem; font-weight: 500; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--eosin-soft); color: #8A1F4B; white-space: nowrap; }
.badge-active { background: var(--gfp-soft); color: #0F5637; }
.badge-ended { background: var(--violet-soft); color: var(--violet-deep); }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 0.7rem 1.1rem; border-radius: 12px; max-width: min(90vw, 28rem);
  transition: opacity 0.2s, transform 0.2s; z-index: 20; overflow-wrap: anywhere;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 1.75rem; }
.card.slim { padding: 1.35rem 1.5rem; display: grid; gap: 0.6rem; }
.card.slim > .btn { justify-self: start; }
.card.narrow { max-width: 34rem; display: grid; gap: 1rem; justify-items: start; margin-top: 1.5rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.two-up { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem 2.5rem; }
.prose { display: grid; gap: 0.6rem; max-width: 42rem; }
.prose h2 { margin-top: 0.8rem; }

.rows { display: grid; }
.rows > li { border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }
.row-link, .rows > li.person { display: flex; align-items: center; gap: 0.5rem 0.9rem; flex-wrap: wrap; padding: 0.7rem 0; }
.row-link { text-decoration: none; color: var(--ink); border-radius: 8px; }
.row-link:hover .row-main { text-decoration: underline; text-underline-offset: 3px; }
.row-main { font-weight: 500; flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.versus-score { font-variant-numeric: tabular-nums; }
.person { display: inline-flex; align-items: center; gap: 0.7rem; }

.more > summary { cursor: pointer; color: var(--muted); width: fit-content; padding: 0.25rem 0.1rem; border-radius: 6px; }
.more > summary:hover { color: var(--ink); }
.more[open] > summary { margin-bottom: 0.75rem; }

/* ---------- landing ---------- */
.landing { overflow: hidden; min-height: 100dvh; display: flex; flex-direction: column; }
.landing .top, .landing .foot { width: 100%; max-width: 72rem; }
.hero {
  flex: 1; width: 100%; max-width: 72rem; margin: 0 auto; padding: 1rem 1.25rem 2rem;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 2rem;
}
.hero-copy { display: grid; gap: 1.4rem; justify-items: start; max-width: 33rem; }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.5rem); line-height: 1.1; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 30rem; }
.hero-art { margin-right: -9rem; }
.field { display: block; width: 100%; height: auto; }
.field-rim { fill: none; stroke: var(--ink); stroke-width: 12; }
.cell-pink { fill: #F29BBB; fill-opacity: 0.78; }
.cell-deep { fill: #E5578C; fill-opacity: 0.6; }
.cell-green { fill: #5FBF95; fill-opacity: 0.7; }
.nucleus { fill: var(--violet); fill-opacity: 0.88; }
.cell { animation: drift-a 17s ease-in-out infinite alternate; }
.drift-2 { animation-name: drift-b; animation-duration: 21s; }
.drift-3 { animation-duration: 25s; animation-delay: -6s; }
.drift-4 { animation-name: drift-b; animation-duration: 15s; animation-delay: -9s; }
@keyframes drift-a { from { transform: translate(-5px, 3px) rotate(-4deg); } to { transform: translate(6px, -5px) rotate(5deg); } }
@keyframes drift-b { from { transform: translate(4px, 5px) rotate(5deg); } to { transform: translate(-6px, -3px) rotate(-6deg); } }

.points-key { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.92rem; color: var(--muted); }
.points-key li { display: inline-flex; align-items: center; gap: 0.4rem; }
.points-key strong { color: var(--ink); font-weight: 500; }

.dot { width: 0.8rem; height: 0.8rem; border-radius: 50%; flex: none; display: inline-block; }
.dot-common { background: var(--eosin); }
.dot-uncommon { background: var(--violet); }
.dot-rare { background: var(--gfp); box-shadow: 0 0 0 3px var(--gfp-soft); }
.dot-incorrect, .dot-unmarked { border: 2px solid var(--grey); }
.dot-duplicate { border: 2px dashed var(--grey); }

/* ---------- today ---------- */
.today { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 2rem; align-items: start; }
.today-body { display: grid; gap: 0.9rem; justify-items: start; min-width: 0; }
.today-body > .answers, .today-body > .notice { justify-self: stretch; }
.today h2 { font: 500 1rem/1.3 var(--sans); color: var(--muted); }
.today-art { width: 11rem; }
.sealed { font: 500 clamp(1.4rem, 3vw, 1.9rem)/1.2 var(--serif); max-width: 22rem; }
.question { font: 500 clamp(1.35rem, 2.8vw, 1.8rem)/1.25 var(--serif); letter-spacing: -0.005em; }
.score { font-size: 1.1rem; color: var(--muted); }
.score strong { font: 600 3.6rem/1 var(--serif); color: var(--ink); margin-right: 0.2rem; }
.working { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--muted); }
.pulse { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--violet); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.25; transform: scale(0.8); } to { opacity: 1; transform: scale(1.1); } }

.answers { display: grid; border-top: 1px solid var(--line); }
.answer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 3rem; align-items: baseline; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.answer .dot { align-self: center; }
.answer-text { font-weight: 500; overflow-wrap: anywhere; }
.answer-kind { font-size: 0.85rem; color: var(--muted); }
.answer-points { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.answer-incorrect .answer-text, .answer-duplicate .answer-text, .answer-unmarked .answer-text { font-weight: 400; color: var(--muted); }
.answer-incorrect .answer-points { color: var(--bad); }

.today-line strong { font: 600 1.6rem/1 var(--serif); margin-right: 0.15rem; }

.wells { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.3rem; }
.well { display: grid; justify-items: center; gap: 0.25rem; }
.well-score {
  width: 3.3rem; height: 3.3rem; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line); font-variant-numeric: tabular-nums; font-weight: 500; font-size: 0.95rem; color: var(--muted);
}
.well-played .well-score { background: var(--eosin-soft); border-color: #F2A9C5; color: var(--ink); }
.well-today .well-score { border-color: var(--ink); }
.well-day { font-size: 0.78rem; color: var(--muted); }

/* ---------- petri dish ---------- */
.dish { display: block; width: 100%; height: auto; }
.dish-glass { fill: #fff; stroke: var(--line); stroke-width: 5; }
.dish-agar { stroke: #EAD796; stroke-width: 1; }
.dish-ring { fill: none; stroke: var(--violet); stroke-width: 5; stroke-linecap: round; }
.hurry .dish-ring { stroke: var(--eosin); }
.colony { stroke-width: 1.6; }
.colony-pending { fill: var(--violet); fill-opacity: 0.6; }
.colony-common { fill: var(--eosin); }
.colony-uncommon { fill: var(--violet); }
.colony-rare { fill: var(--gfp); stroke: #BDEBD4; stroke-width: 3; }
.colony-incorrect, .colony-unmarked { fill: none; stroke: var(--grey); }
.colony-duplicate { fill: none; stroke: var(--grey); stroke-dasharray: 3 2.5; }
.colony-new { animation: grow 0.3s cubic-bezier(0.2, 1.6, 0.4, 1); transform-box: fill-box; transform-origin: center; }
@keyframes grow { from { transform: scale(0); } to { transform: scale(1); } }

/* ---------- playing ---------- */
.play {
  max-width: 58rem; margin: 0 auto; padding: clamp(1rem, 6vh, 4rem) 1.25rem 2rem;
  display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.5rem; align-items: start;
}
.clock { display: grid; gap: 0.6rem; justify-items: center; position: sticky; top: 1.5rem; }
.clock-read { display: grid; justify-items: center; line-height: 1; }
.clock-seconds { font: 600 4rem/1 var(--serif); font-variant-numeric: tabular-nums; }
.clock-unit { color: var(--muted); font-size: 0.9rem; }
.hurry .clock-seconds { color: var(--eosin); }
.play-main { display: grid; gap: 1rem; }
.play .question { font-size: clamp(1.5rem, 3.4vw, 2.3rem); }
.answer-form { display: flex; gap: 0.6rem; }
.answer-input { font-size: 1.25rem; padding: 0.85rem 1.1rem; border-radius: 16px; border-color: var(--ink); }
.play-meta { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 0.92rem; }
.count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.4rem 0.5rem 0.4rem 0.95rem; min-height: 2.4rem;
  border-radius: 999px; background: var(--violet-soft); font-weight: 500; overflow-wrap: anywhere;
}
.chip-remove {
  border: 0; background: none; cursor: pointer; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  font-size: 1.15rem; line-height: 1; color: var(--muted); flex: none;
}
.chip-remove:hover { background: #fff; color: var(--ink); }

/* ---------- class page ---------- */
.invite { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem 2rem; }
.invite-code { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.code { font: 600 1.9rem/1 var(--serif); letter-spacing: 0.16em; padding: 0.55rem 0.9rem; border: 2px dashed var(--violet); border-radius: 14px; color: var(--violet-deep); }

.board { width: 100%; border-collapse: collapse; }
.board th, .board td { text-align: left; padding: 0.6rem 0.5rem 0.6rem 0; border-top: 1px solid var(--line); vertical-align: middle; font-weight: 400; }
.board thead th { border-top: 0; font-size: 0.85rem; color: var(--muted); font-weight: 400; padding-top: 0; }
.board tbody th { font-weight: 500; }
.board .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.board .nowrap { white-space: nowrap; padding-right: 1.25rem; color: var(--muted); }

.challenge-form { display: grid; gap: 0.9rem; justify-items: start; border-top: 1px solid var(--line); padding-top: 1.1rem; margin-top: 0.4rem; }
.challenge-form label { display: grid; gap: 0.25rem; font-weight: 500; align-content: start; }
.field-row { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; }
.challenge-form .input { margin-top: 0.2rem; max-width: 13rem; }

/* ---------- challenge page ---------- */
.versus { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 1rem 1.5rem; align-items: center; }
.total { display: grid; gap: 0.3rem; }
.total-b { text-align: right; justify-items: end; }
.total-name { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 500; overflow-wrap: anywhere; }
.total-score { font: 600 clamp(2.6rem, 8vw, 4.2rem)/1 var(--serif); font-variant-numeric: tabular-nums; color: var(--muted); }
.leading .total-score { color: var(--ink); }
.versus-mid { font: italic 500 1.3rem var(--serif); color: var(--muted); }
.verdict { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 0.9rem; font-weight: 500; }
.swatch { width: 0.85rem; height: 0.85rem; border-radius: 3px; display: inline-block; flex: none; }
.swatch-a { background: var(--violet); }
.swatch-b { background: var(--eosin); }

.days { display: grid; }
.day { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--line); align-items: center; }
.day:first-child { border-top: 0; }
.day-name { color: var(--muted); font-size: 0.92rem; }
.day-bars { display: grid; gap: 0.3rem; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) 3rem 6.2rem; gap: 0.6rem; align-items: center; }
.bar-track { display: block; height: 0.6rem; }
.bar-fill { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; font-size: 0.92rem; }
.bar-note { font-size: 0.8rem; white-space: nowrap; }
.small-print { font-size: 0.85rem; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 0.5rem; }
  .hero-art { margin: 0 -5rem -11rem 3rem; }
  .landing .foot { position: relative; }
  .card { padding: 1.3rem; border-radius: 18px; }
  .card.slim { padding: 1.1rem 1.15rem; }
  .today { grid-template-columns: 1fr; }
  .today-art { display: none; }
  .invite { grid-template-columns: 1fr; }
  .play { grid-template-columns: 1fr; gap: 1rem; padding-top: 0.75rem; }
  .clock { grid-template-columns: 4.6rem auto; justify-content: start; align-items: center; gap: 0.9rem; position: static; }
  .clock-read { grid-auto-flow: column; align-items: baseline; gap: 0.4rem; }
  .clock-seconds { font-size: 2.6rem; }
  .answer-input { font-size: 1.1rem; }
  .day { grid-template-columns: 1fr; gap: 0.35rem; }
  .bar { grid-template-columns: minmax(0, 1fr) 2.8rem 5.6rem; }
  .answer { grid-template-columns: auto minmax(0, 1fr) 2.6rem; }
  .answer-kind { display: none; }
  .inline-form { flex-wrap: wrap; }
  .versus { gap: 0.6rem 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cell, .pulse, .colony-new { animation: none; }
  .toast { transition: none; }
}
