/* Love All: one dark "blue hour" theme, to sit over the floodlit scene. */

:root {
  --night: #0b0f2a;
  --ink: #070a1d;
  --glass: rgba(14, 18, 44, 0.74);
  --glass-strong: rgba(12, 15, 38, 0.92);
  --line: rgba(190, 200, 255, 0.12);
  --line-strong: rgba(190, 200, 255, 0.22);
  --chalk: #f4f1e6;
  --muted: #a3acd9;
  --faint: #6d76a8;
  --felt: #dff54d;
  --felt-ink: #1d2400;
  --felt-soft: rgba(223, 245, 77, 0.14);
  --clay: #e0784a;
  --grass: #5fbf72;
  --win: #dff54d;
  --loss: #ff8b7e;
  --radius: 20px;
  --radius-sm: 12px;
  --panel-w: 400px;
  --top: 76px;
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-cond: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
  color: var(--chalk);
  font-family: var(--font);
  font-optical-sizing: auto;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--felt); outline-offset: 2px; border-radius: 6px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}
body.is-hovering #scene { cursor: pointer; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line);
}

/* --- top bar -------------------------------------------------------------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) 18px 10px;
  pointer-events: none;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(7, 10, 29, 0.72), rgba(7, 10, 29, 0));
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex: 1 1 0;
  min-width: 0;
}
.brand__ball {
  width: 38px; height: 38px; flex: none;
  filter: drop-shadow(0 0 14px rgba(223, 245, 77, 0.45));
  transition: transform 0.6s cubic-bezier(.3,1.6,.5,1);
}
.brand:hover .brand__ball { transform: rotate(160deg) scale(1.06); }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__word {
  font-weight: 800;
  font-size: 23px;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variation-settings: "opsz" 96;
}
.brand__sub {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.switch {
  position: relative;
  display: flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  flex: none;
}
.switch__thumb {
  position: absolute;
  top: 4px; bottom: 4px;
  border-radius: 999px;
  background: var(--felt);
  box-shadow: 0 0 24px rgba(223, 245, 77, 0.35);
  transition: left 0.45s cubic-bezier(.5,1.4,.4,1), width 0.45s cubic-bezier(.5,1.4,.4,1);
}
.switch button {
  position: relative;
  border: 0;
  background: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.3s;
  white-space: nowrap;
}
.switch button[aria-pressed="true"] { color: var(--felt-ink); }
.switch button .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
}

.search {
  position: relative;
  flex: 1 1 0;
  display: flex;
  justify-content: flex-end;
}
.search input {
  width: min(240px, 100%);
  padding: 9px 14px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  outline: none;
  transition: width 0.3s, border-color 0.2s;
}
.search input:focus { border-color: var(--felt); width: min(300px, 100%); }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(0.6); }
.search__icon {
  position: absolute;
  width: 16px; height: 16px;
  right: calc(min(240px, 100%) - 28px);
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  transition: right 0.3s;
}
.search:focus-within .search__icon { right: calc(min(300px, 100%) - 28px); }
.search__results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 6px;
  border-radius: 16px;
  background: var(--glass-strong);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.search__results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.search__results li[aria-selected="true"], .search__results li:hover { background: rgba(255, 255, 255, 0.07); }
.search__results .where { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.search__results mark { background: none; color: var(--felt); }
.search__results .none { color: var(--muted); cursor: default; }

/* --- group chips ---------------------------------------------------------------- */

.chips {
  position: fixed;
  top: var(--top);
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 15;
  padding: 4px;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  scrollbar-width: none;
}
body.has-panel .chips { max-width: calc(100vw - var(--panel-w) - 48px); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.2s;
}
.chip:hover { color: var(--chalk); border-color: var(--line-strong); }
.chip[aria-current="true"] { color: var(--felt); border-color: rgba(223, 245, 77, 0.55); background: rgba(223, 245, 77, 0.1); }
.chip .n { font-family: var(--font-cond); font-weight: 600; color: var(--faint); margin-left: 5px; font-size: 13px; }

/* --- panel -------------------------------------------------------------------- */

.panel {
  position: fixed;
  z-index: 18;
  top: var(--top);
  right: 12px;
  bottom: 52px;
  width: var(--panel-w);
  border-radius: 24px;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.55s cubic-bezier(.2,.9,.2,1);
}
body.has-panel .panel { transform: none; }
.panel__grip { display: none; }
.panel__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 22px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.panel__body > * { animation: rise 0.45s cubic-bezier(.2,.9,.2,1) both; }
.panel__body > *:nth-child(2) { animation-delay: 0.04s; }
.panel__body > *:nth-child(3) { animation-delay: 0.08s; }
.panel__body > *:nth-child(4) { animation-delay: 0.12s; }
.panel__body > *:nth-child(n+5) { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--chalk); }
.crumbs .sep { opacity: 0.45; }
.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  margin-right: 4px;
  text-decoration: none;
}
.back:hover { color: var(--chalk); border-color: var(--line-strong); }

.h1 {
  font-size: 30px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  font-variation-settings: "opsz" 96;
}
.h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--muted);
  margin: 26px 0 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.h2 .count { color: var(--faint); font-family: var(--font-cond); font-size: 14px; letter-spacing: 0.02em; }
.lede { color: var(--muted); margin: 0 0 4px; }
.lede b { color: var(--chalk); font-weight: 650; }

.progress { margin-top: 16px; }
.progress__bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.progress__bar span {
  position: absolute; inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #b7d02c, var(--felt));
  box-shadow: 0 0 18px rgba(223, 245, 77, 0.5);
  transition: width 1.2s cubic-bezier(.2,.9,.2,1);
}
.progress__meta {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--muted); margin-top: 7px;
}
.progress__meta b { color: var(--chalk); font-weight: 650; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 8px 9px;
  text-align: center;
  background: rgba(255, 255, 255, 0.025);
}
.stat__n {
  font-family: var(--font-cond);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat__l { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.2; }
.stat--felt .stat__n { color: var(--felt); }

.new-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--felt-soft);
  border: 1px solid rgba(223, 245, 77, 0.35);
  color: var(--felt);
  font-weight: 600;
  font-size: 14px;
}
.new-note .pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--felt);
  box-shadow: 0 0 0 0 rgba(223, 245, 77, 0.7);
  animation: pulse 1.8s infinite;
  flex: none;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(223, 245, 77, 0); } 100% { box-shadow: 0 0 0 0 rgba(223, 245, 77, 0); } }

/* results list */
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  cursor: pointer;
}
.result:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line-strong); transform: translateX(-2px); }
.result.is-new { border-color: rgba(223, 245, 77, 0.45); }
.result__names { min-width: 0; font-size: 14px; line-height: 1.3; }
.result__names .w { font-weight: 700; }
.result__names .l { color: var(--muted); }
.result__names .bt { color: var(--faint); font-size: 12px; margin: 0 4px; }
.result__score {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  align-self: center;
  grid-row: span 2;
  font-variant-numeric: tabular-nums;
}
.result__meta { font-size: 12px; color: var(--faint); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  letter-spacing: 0.02em;
}
.tag--felt { background: var(--felt); color: var(--felt-ink); }
.tag--win { background: rgba(223, 245, 77, 0.16); color: var(--felt); }
.tag--loss { background: rgba(255, 139, 126, 0.14); color: var(--loss); }

/* group cards on the overview */
.groups { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gcard {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 16px;
  padding: 12px 13px;
  transition: all 0.2s;
}
.gcard:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.06); }
.gcard__name { font-weight: 750; font-size: 16px; }
.gcard__lead { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard__lead b { color: var(--chalk); font-weight: 600; }
.gcard .mini { height: 5px; margin-top: 10px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; }
.gcard .mini span { display: block; height: 100%; background: var(--felt); border-radius: inherit; }
.gcard__meta { font-size: 11.5px; color: var(--faint); margin-top: 6px; }

/* standings */
.standings { width: 100%; border-collapse: collapse; font-size: 14px; }
.standings th {
  font-size: 11px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  text-align: right; padding: 0 5px 8px;
}
.standings th:nth-child(2) { text-align: left; }
.standings td {
  padding: 8px 5px;
  border-top: 1px solid var(--line);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.standings td.num { font-family: var(--font-cond); font-size: 17px; font-weight: 600; color: var(--muted); }
.standings td.pts { font-family: var(--font-cond); font-size: 19px; font-weight: 700; color: var(--chalk); }
.standings td.rank { font-family: var(--font-cond); font-size: 17px; font-weight: 700; color: var(--faint); width: 26px; }
.standings td.who { text-align: left; }
.standings tr { cursor: pointer; transition: background 0.2s; }
.standings tbody tr:hover { background: rgba(255, 255, 255, 0.05); }
.standings tr.is-me td { background: rgba(223, 245, 77, 0.08); }
.standings tr.top .rank { color: var(--felt); }
.who__name { font-weight: 600; line-height: 1.25; }
.who__name small { display: block; font-weight: 450; color: var(--muted); font-size: 12.5px; }
.form { display: inline-flex; gap: 3px; margin-top: 4px; }
.form i { width: 7px; height: 7px; border-radius: 50%; background: var(--felt); }
.form i.L { background: var(--loss); opacity: 0.8; }

/* player card */
.player-head { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%;
  flex: none;
  display: grid; place-items: center;
  font-family: var(--font-cond);
  font-weight: 800;
  font-size: 22px;
  color: var(--felt-ink);
  background: radial-gradient(circle at 35% 30%, #f4ff9a, var(--felt) 55%, #9fb81f);
  box-shadow: 0 0 30px rgba(223, 245, 77, 0.35), inset -4px -6px 12px rgba(0,0,0,0.18);
  position: relative;
}
.avatar::after {
  content: "";
  position: absolute; inset: 4px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.75);
  border-left-color: transparent; border-right-color: transparent;
  transform: rotate(25deg);
}
.avatar--pair { width: 44px; height: 44px; font-size: 17px; }
.pair { display: flex; }
.pair .avatar + .avatar { margin-left: -12px; }
.entries { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.entry-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.025);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
}
.entry-card.is-active { border-color: rgba(223, 245, 77, 0.4); background: var(--felt-soft); }
.entry-card__title { font-weight: 700; }
.entry-card__sub { font-size: 12.5px; color: var(--muted); }
.entry-card__pts { font-family: var(--font-cond); font-size: 30px; font-weight: 700; line-height: 1; text-align: right; grid-row: span 2; }
.entry-card__pts small { display: block; font-size: 11px; color: var(--muted); font-family: var(--font); font-weight: 500; }
.entry-card button, .linkbtn {
  border: 0; background: none; color: var(--felt); font-weight: 600; padding: 0; font-size: 13px; text-align: left;
}
.linkbtn:hover { text-decoration: underline; }

.todo { display: flex; flex-wrap: wrap; gap: 6px; }
.todo a {
  border: 1px dashed rgba(223, 245, 77, 0.4);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
  color: var(--chalk);
  text-decoration: none;
}
.todo a:hover { background: var(--felt-soft); }

/* match scoreboard */
.board {
  margin-top: 14px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, #16402f, #0f2f23);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.board--clay { background: linear-gradient(180deg, #5a2a17, #43200f); }
.board__row {
  display: grid;
  grid-template-columns: 1fr repeat(var(--sets), 44px);
  align-items: center;
  padding: 12px 12px 12px 16px;
  gap: 6px;
}
.board__row + .board__row { border-top: 1px solid rgba(255,255,255,0.1); }
.board__name { font-weight: 650; line-height: 1.25; min-width: 0; }
.board__name small { display: block; font-weight: 450; font-size: 12.5px; color: rgba(244,241,230,0.65); }
.board__row.won .board__name::before {
  content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--felt); margin-right: 8px; vertical-align: 1px;
  box-shadow: 0 0 10px rgba(223,245,77,0.8);
}
.board__cell {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 26px;
  text-align: center;
  line-height: 1;
  padding: 7px 0;
  border-radius: 8px;
  background: rgba(0,0,0,0.25);
  color: rgba(244,241,230,0.62);
  position: relative;
}
.board__cell.won { color: var(--chalk); background: rgba(0,0,0,0.38); }
.board__cell sup { font-size: 12px; position: absolute; top: 3px; right: 4px; color: var(--felt); }
.board__head {
  display: grid;
  grid-template-columns: 1fr repeat(var(--sets), 44px);
  gap: 6px;
  padding: 8px 12px 0 16px;
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(244,241,230,0.5);
  text-align: center;
}
.board__head span:first-child { text-align: left; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.fact {
  font-size: 13px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.fact b { color: var(--chalk); }
.fact--fun { border-color: rgba(224, 164, 90, 0.5); color: #f3c68b; }

.explain {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 13px;
  color: var(--muted);
}
.explain summary { cursor: pointer; font-weight: 650; color: var(--chalk); list-style: none; }
.explain summary::-webkit-details-marker { display: none; }
.explain summary::after { content: " +"; color: var(--faint); }
.explain[open] summary::after { content: " −"; }
.explain svg { width: 100%; height: auto; margin: 12px 0 6px; }
.explain p { margin: 8px 0; }
.explain b { color: var(--chalk); font-weight: 600; }

.source { margin-top: 22px; font-size: 12px; color: var(--faint); }
.source a { color: var(--muted); }

/* --- tooltip and hints ------------------------------------------------------------- */

.tip {
  position: fixed;
  z-index: 25;
  pointer-events: none;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: 280px;
  transform: translate(-50%, calc(-100% - 16px));
  transition: opacity 0.15s;
}
.tip__names { font-weight: 650; line-height: 1.3; }
.tip__names .w { color: var(--felt); }
.tip__score { font-family: var(--font-cond); font-weight: 700; font-size: 20px; letter-spacing: 0.02em; }
.tip__meta { color: var(--muted); font-size: 12px; }

.hint {
  position: fixed;
  left: 16px;
  bottom: 52px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 13px;
  border-radius: 14px;
  background: rgba(10, 13, 34, 0.55);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}
.hint b { color: var(--chalk); font-weight: 600; }

.statusbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 16;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px max(10px, env(safe-area-inset-bottom));
  font-size: 12.5px;
  color: var(--faint);
  pointer-events: none;
}
.statusbar > * { pointer-events: auto; }
.statusbar__sync { display: inline-flex; align-items: center; gap: 6px; }
.statusbar__tools { display: inline-flex; gap: 4px; }
body.has-panel .statusbar__tools { margin-right: calc(var(--panel-w) + 4px); }
.iconbtn {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 13, 34, 0.5);
  color: var(--muted);
  padding: 0;
  transition: all 0.2s;
}
.iconbtn svg { width: 14px; height: 14px; }
.iconbtn:hover { color: var(--felt); border-color: rgba(223, 245, 77, 0.5); }
.iconbtn.is-busy svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.textbtn {
  border: 0;
  background: none;
  color: var(--faint);
  padding: 4px 8px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12.5px;
}
.textbtn:hover { color: var(--chalk); background: rgba(255,255,255,0.05); }
.textbtn[aria-pressed="true"] { color: var(--felt); }

/* --- loader and intro ---------------------------------------------------------------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: radial-gradient(ellipse at 50% 60%, #1a1f4f, var(--ink) 70%);
  transition: opacity 0.8s, visibility 0.8s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__ball { height: 90px; width: 40px; position: relative; }
.loader__ball span {
  position: absolute;
  left: 4px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4ff9a, var(--felt) 55%, #9fb81f);
  box-shadow: 0 0 24px rgba(223, 245, 77, 0.5);
  animation: bounce 0.9s cubic-bezier(.5,0,.5,1) infinite alternate;
}
.loader__ball::after {
  content: "";
  position: absolute; bottom: -4px; left: 6px;
  width: 28px; height: 6px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  animation: shadow 0.9s cubic-bezier(.5,0,.5,1) infinite alternate;
}
@keyframes bounce { from { top: 0; } to { top: 56px; transform: scale(1.1, 0.88); } }
@keyframes shadow { from { transform: scale(0.5); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }
.loader__text { color: var(--muted); margin: 0; font-size: 14px; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: end start;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  padding: 0 6vw 11vh;
  background: linear-gradient(to top, rgba(7, 10, 29, 0.7), rgba(7, 10, 29, 0) 45%);
}
.intro.is-on { opacity: 1; }
.intro.is-off { opacity: 0; transition: opacity 0.9s; }
.intro__word {
  margin: 0;
  font-size: clamp(64px, 14vw, 190px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.9;
  font-variation-settings: "opsz" 96;
  text-shadow: 0 10px 60px rgba(0, 0, 0, 0.55);
}
.intro__word span {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em) rotate(6deg);
}
.intro.is-on .intro__word span {
  animation: letter 0.9s cubic-bezier(.2,1.4,.4,1) forwards;
}
.intro__word span:nth-child(2) { animation-delay: 0.06s !important; color: var(--felt); }
.intro__word span:nth-child(3) { animation-delay: 0.12s !important; }
.intro__word span:nth-child(4) { animation-delay: 0.18s !important; }
.intro__word span:nth-child(6) { animation-delay: 0.3s !important; }
.intro__word span:nth-child(7) { animation-delay: 0.36s !important; }
.intro__word span:nth-child(8) { animation-delay: 0.42s !important; }
.intro__word .gap { width: 0.22em; }
@keyframes letter { to { opacity: 1; transform: none; } }
.intro__line {
  margin: 18px 0 0;
  max-width: 34em;
  font-size: clamp(15px, 1.6vw, 19px);
  color: var(--chalk);
  opacity: 0;
  text-shadow: 0 2px 20px rgba(0,0,0,0.8);
}
.intro.is-on .intro__line { animation: fade 0.8s 0.6s forwards; }
.intro__skip { font-size: 12px; color: var(--muted); opacity: 0; margin-top: 26px; }
.intro.is-on .intro__skip { animation: fade 0.8s 1.4s forwards; }
@keyframes fade { to { opacity: 1; } }

/* --- table view ------------------------------------------------------------------ */

.tableview {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  background: var(--ink);
  padding: 24px max(20px, calc((100vw - 1100px) / 2)) 60px;
}
.tableview__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.tableview h1 { font-size: 34px; margin: 0; letter-spacing: -0.02em; }
.tableview h2 { font-size: 24px; margin: 36px 0 4px; }
.tableview .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-top: 14px; }
.tableview .card { border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: rgba(255,255,255,0.02); }
.tableview .card h3 { margin: 0 0 10px; font-size: 17px; }
.tableview .results { margin-top: 12px; }
.tableview .result { cursor: default; }
.tableview .result:hover { transform: none; }

/* --- dialog, toast, banner ------------------------------------------------------------ */

.dialog {
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--glass-strong);
  color: var(--chalk);
  padding: 0;
  width: min(400px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(4, 6, 20, 0.6); backdrop-filter: blur(4px); }
.dialog__form { padding: 24px; }
.dialog h2 { margin: 0 0 4px; font-size: 22px; }
.dialog__lede { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(0,0,0,0.25);
  outline: none;
  font-size: 15px;
}
.field input:focus { border-color: var(--felt); }
.dialog__msg { min-height: 20px; font-size: 13.5px; margin: 12px 0 0; color: var(--muted); }
.dialog__msg.is-error { color: var(--loss); }
.dialog__msg.is-ok { color: var(--felt); }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.btn {
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 650;
  border: 1px solid var(--line-strong);
  background: none;
}
.btn--felt { background: var(--felt); color: var(--felt-ink); border-color: var(--felt); }
.btn--felt:disabled { opacity: 0.6; cursor: progress; }
.btn--ghost:hover { background: rgba(255,255,255,0.05); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  z-index: 45;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--felt);
  color: var(--felt-ink);
  font-weight: 650;
  box-shadow: 0 10px 40px rgba(223, 245, 77, 0.3);
  animation: toast 0.5s cubic-bezier(.2,1.4,.4,1);
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.is-error { background: var(--loss); color: #2a0600; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 20px); } }

.banner {
  position: fixed;
  top: calc(var(--top) + 44px);
  left: 16px;
  z-index: 14;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  background: #ff8b7e;
  color: #2a0600;
}

.noscript { position: fixed; inset: auto 20px 20px; z-index: 60; color: var(--chalk); }

/* --- phones -------------------------------------------------------------------------- */

@media (max-width: 760px) {
  :root { --top: 118px; }
  html, body { font-size: 14.5px; }
  .topbar { flex-wrap: wrap; gap: 10px 10px; padding: max(10px, env(safe-area-inset-top)) 12px 8px; }
  .brand { flex: 1 1 auto; }
  .brand__ball { width: 32px; height: 32px; }
  .brand__word { font-size: 20px; }
  .brand__sub { font-size: 11.5px; }
  .search { flex: 0 0 auto; }
  .search input { width: 44px; padding: 9px 0 9px 36px; cursor: pointer; }
  .search input::placeholder { color: transparent; }
  .search input:focus { width: calc(100vw - 24px - 0px); position: fixed; left: 12px; right: 12px; top: max(10px, env(safe-area-inset-top)); z-index: 30; padding-left: 14px; }
  .search:focus-within .search__icon { display: none; }
  .search__icon { right: 14px; }
  .search__results { position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 50px); left: 12px; right: 12px; width: auto; z-index: 30; }
  .switch { order: 3; width: 100%; }
  .switch button { flex: 1; padding: 8px 10px; }
  .chips { top: var(--top); left: 0 !important; transform: none; padding: 4px 12px; max-width: 100vw; }

  .panel {
    top: auto;
    left: 0; right: 0; bottom: 0;
    width: auto;
    height: 86vh;
    height: 86dvh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    border-bottom: 0;
    transition: transform 0.5s cubic-bezier(.2,.9,.2,1);
  }
  body.has-panel .panel { transform: translateY(calc(100% - var(--sheet, 42vh))); }
  body.sheet-full .panel { transform: none; }
  body.sheet-min .panel { transform: translateY(calc(100% - 70px)); }
  .panel__grip {
    display: grid;
    place-items: center;
    height: 26px;
    border: 0;
    background: none;
    flex: none;
    touch-action: none;
  }
  .panel__grip span { width: 42px; height: 5px; border-radius: 9px; background: rgba(255,255,255,0.25); }
  .panel__body { padding: 4px 18px calc(28px + env(safe-area-inset-bottom)); }
  .h1 { font-size: 25px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .statusbar { display: none; }
  body.has-panel .statusbar__tools { margin-right: 0; }
  .hint { display: none !important; }
  .tip { display: none !important; }
  .toast { bottom: calc(44vh + 12px); }
  .banner { top: calc(var(--top) + 40px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- during the intro ------------------------------------------------------------------ */

.topbar, .chips, .statusbar, .hint { transition: opacity 0.8s; }
body.is-intro .topbar,
body.is-intro .chips,
body.is-intro .statusbar,
body.is-intro .hint { opacity: 0; pointer-events: none; }
body.is-intro #scene { cursor: pointer; }
