@font-face {
  font-family: Fgbd Fraunces;
  src: url("../../assets/fraunces.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: Fgbd Source;
  src: url("../../assets/source-sans.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Fgbd Source;
  src: url("../../assets/source-sans-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

.fgbd {
  --fgbd-paper: #fff2d8;
  --fgbd-base: #17223c;
  --fgbd-stage: #1e3173;
  --fgbd-base-shadow: #0f1932;
  --fgbd-line: #6476a0;
  --fgbd-rule: #51658f;
  --fgbd-accent: #fce174;
  --fgbd-coral: #fd795e;
  --fgbd-face: "Fgbd Fraunces", var(--display);
  --fgbd-body: "Fgbd Source", system-ui, sans-serif;
  container: fgbd / inline-size;
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  overflow: clip;
  min-height: 100svh;
  margin: 0;
  background: var(--fgbd-base);
  color: var(--fgbd-paper);
  font: 400 1rem/1.35 var(--fgbd-body);
  text-align: left;
}

.fgbd *, .fgbd *::before, .fgbd *::after { box-sizing: border-box; }
.fgbd [hidden] { display: none !important; }
.fgbd h1, .fgbd h2, .fgbd h3, .fgbd p, .fgbd ol { margin: 0; }
.fgbd h1, .fgbd h2 { color: inherit; font-family: var(--fgbd-face); font-weight: 800; }
.fgbd ol { list-style: none; padding: 0; }
.fgbd button { color: inherit; font: inherit; cursor: pointer; }
.fgbd button:focus-visible { outline: 3px solid var(--fgbd-accent); outline-offset: 4px; }
.fgbd-sr { position: absolute; overflow: hidden; width: 1px; height: 1px; clip-path: inset(50%); white-space: nowrap; }

.fgbd-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 3cqi, 42px);
  min-height: 75px;
  padding: 11px clamp(15px, 4cqi, 60px);
  border-bottom: 1px solid var(--fgbd-rule);
}
.fgbd-heading { align-self: center; line-height: 1; }
.fgbd-wordmark {
  display: block;
  color: var(--fgbd-accent);
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .18em;
}
.fgbd-heading h1 {
  font-size: clamp(2.25rem, 5cqi, 4.15rem);
  letter-spacing: -.08em;
  line-height: .97;
  white-space: nowrap;
}
.fgbd-heading-dot { color: var(--fgbd-coral); }
.fgbd-table {
  display: grid;
  min-width: 0;
  gap: .14em;
  padding-inline-start: clamp(12px, 3cqi, 37px);
  border-inline-start: 1px solid var(--fgbd-rule);
}
.fgbd-title {
  overflow: hidden;
  font-size: clamp(.9rem, 2.3cqi, 1.23rem);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.fgbd-title:empty { display: none; }
.fgbd .fgbd-state {
  display: flex;
  align-items: center;
  gap: .5em;
  color: #f6dbb0;
  font-size: clamp(.77rem, 1.7cqi, .98rem);
  font-weight: 700;
}
.fgbd-state i { flex: none; width: .53em; height: .53em; border-radius: 50%; background: currentColor; }
.fgbd[data-phase="running"] .fgbd-state { color: #b7eab6; }
.fgbd[data-phase="paused"] .fgbd-state { color: var(--fgbd-accent); }
.fgbd[data-phase="ended"] .fgbd-state { color: #ffd0b6; }
.fgbd-session { display: flex; align-items: center; gap: clamp(10px, 2.5cqi, 32px); }
.fgbd-format { display: grid; justify-items: start; gap: 2px; white-space: nowrap; }
.fgbd-format span { font-size: .7rem; color: #f6dbb0; font-weight: 700; }
.fgbd-format strong {
  font-size: clamp(.86rem, 2.25cqi, 1.24rem);
  font-weight: 700;
  letter-spacing: .025em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.fgbd .fgbd-fullscreen, .fgbd .fgbd-sound {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #8c9abd;
  border-radius: 3px;
  background: transparent;
}
.fgbd .fgbd-sound { width: auto; padding-inline: .65em; font-size: .88rem; font-weight: 700; white-space: nowrap; }
.fgbd-fullscreen:hover, .fgbd-fullscreen[aria-pressed="true"], .fgbd-sound:hover, .fgbd-sound[aria-pressed="true"] { background: #304681; }
.fgbd-fullscreen span {
  display: block;
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
}
.fgbd-fullscreen span::before, .fgbd-fullscreen span::after {
  content: "";
  position: absolute;
  inset: -3px 3px;
  background: var(--fgbd-base);
}
.fgbd-fullscreen span::after { inset: 3px -3px; }
.fgbd-fullscreen:hover span::before, .fgbd-fullscreen:hover span::after,
.fgbd-fullscreen[aria-pressed="true"] span::before, .fgbd-fullscreen[aria-pressed="true"] span::after { background: #304681; }
.fgbd .fgbd-connection {
  padding: 10px clamp(15px, 4cqi, 60px);
  border-block-end: 1px solid #68584b;
  background: #392d32;
  color: #ffdeaa;
  font-weight: 700;
}

.fgbd-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .88fr);
  align-items: center;
  padding: clamp(12px, 2.2cqi, 35px) clamp(15px, 7cqi, 120px);
  gap: clamp(12px, 5cqi, 80px);
  background: radial-gradient(ellipse at 26% 53%, #3554bd, transparent 67%), var(--fgbd-stage);
  border-bottom: 1px solid var(--fgbd-rule);
}
.fgbd-machine {
  position: relative;
  isolation: isolate;
  justify-self: center;
  width: min(100%, 595px, 60dvh);
  aspect-ratio: 1;
  container-type: inline-size;
}
.fgbd-machine::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 4%;
  height: 6%;
  z-index: -1;
  border-radius: 50%;
  background: #162c72;
}
.fgbd-machine-art { display: block; width: 100%; height: 100%; object-fit: contain; }
.fgbd-drum {
  position: absolute;
  z-index: 1;
  inset: 6.2% auto auto 15.9%;
  width: 56.5%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
}
.fgbd-orbit {
  position: absolute;
  inset: 2%;
  opacity: 0;
  transition: opacity .25s ease;
}
.fgbd[data-drum="roll"] .fgbd-orbit { opacity: .94; animation: fgbd-spool 8s linear infinite; }
.fgbd-marble {
  position: absolute;
  display: block;
  width: 12%;
  aspect-ratio: 1;
  border: clamp(1px, .4cqi, 2px) solid #152141;
  border-radius: 50%;
  background: radial-gradient(circle at 37% 33%, #fff2d8 0 13%, transparent 15%), var(--fgbd-tone, var(--fgbd-accent));
  box-shadow: inset -2px -3px 0 #15214152, 1px 2px 0 #1923426e;
  opacity: .85;
}
.fgbd-marble-one { left: 21%; top: 8%; }
.fgbd-marble-two { left: 62%; top: 8%; }
.fgbd-marble-three { left: 84%; top: 44%; }
.fgbd-marble-four { left: 52%; top: 82%; }
.fgbd-marble-five { left: 4%; top: 48%; }
@keyframes fgbd-spool { to { transform: rotate(-360deg); } }

.fgbd-numberplate {
  position: absolute;
  z-index: 2;
  left: 44%;
  top: 33.5%;
  display: grid;
  place-items: center;
  width: 37%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  color: #17223c;
}
.fgbd-art-missing .fgbd-numberplate {
  border: .55cqi solid #17223c;
  border-radius: 50%;
  box-shadow: 0 0 0 2cqi #ffe38a;
  background: #fff2d8;
}
.fgbd-art-missing .fgbd-drum, .fgbd-art-missing .fgbd-machine-caption { display: none; }
.fgbd-current {
  display: grid;
  justify-items: center;
  line-height: 1;
}
.fgbd-current-letter {
  font-size: clamp(.9rem, 5.5cqi, 2rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .1em;
  margin-bottom: .08em;
  padding-left: .1em;
}
.fgbd-current-number {
  font: 700 clamp(2rem, 24cqi, 9rem)/.83 var(--fgbd-body);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.055em;
  padding-right: .055em;
  white-space: nowrap;
}
.fgbd .fgbd-machine-caption {
  position: absolute;
  z-index: 1;
  top: 82.75%;
  left: 44%;
  width: 52%;
  transform: translate(-50%, -50%);
  color: #17223c;
  font-size: clamp(.75rem, 4.4cqi, 1.58rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .085em;
  text-align: center;
  text-transform: uppercase;
}

.fgbd[data-qr="visible"] .fgbd-draw,
.fgbd[data-qr="visible"] .fgbd-history { display: none; }
.fgbd-join {
  display: grid;
  justify-items: center;
  gap: .7em;
  padding: clamp(12px, 2.6cqi, 26px);
  border: 2px solid var(--fgbd-base-shadow);
  border-radius: 7px;
  background: var(--fgbd-paper);
  color: var(--fgbd-base);
  box-shadow: 4px 5px 0 var(--fgbd-base-shadow);
  text-align: center;
}
.fgbd-join h2 {
  font-size: clamp(1.55rem, 3.7cqi, 3.2rem);
  letter-spacing: -.06em;
  line-height: 1;
}
.fgbd-join-guide, .fgbd-join-fallback { max-width: 31ch; font-size: clamp(.94rem, 1.65cqi, 1.21rem); }
.fgbd-qr {
  display: block;
  width: min(100%, clamp(220px, 52svh, 440px));
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  background: #fff;
  image-rendering: pixelated;
}
.fgbd-join-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 5px 12px;
  width: 100%;
  padding-top: .5em;
  border-top: 1px solid #a99275;
  font-size: clamp(.82rem, 1.5cqi, 1rem);
  font-weight: 700;
}
.fgbd-join-link { color: inherit; text-decoration: underline; text-underline-offset: .2em; }
.fgbd-join-link:focus-visible { outline: 3px solid var(--fgbd-stage); outline-offset: 3px; }

.fgbd-draw { position: relative; display: grid; justify-items: start; align-content: center; gap: 15px; text-align: left; min-width: 0; }
.fgbd .fgbd-draw h2 {
  font: 700 clamp(.79rem, 1.65cqi, 1.13rem)/1 var(--fgbd-body);
  color: #ffe38a;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.fgbd [data-tone="coral"] { --fgbd-tone: #ff816c; }
.fgbd [data-tone="lime"] { --fgbd-tone: #bbe277; }
.fgbd [data-tone="blue"] { --fgbd-tone: #90bcff; }
.fgbd [data-tone="yellow"] { --fgbd-tone: #fce171; }
.fgbd [data-tone="lilac"] { --fgbd-tone: #d8bbfb; }
.fgbd-next {
  display: grid;
  justify-items: start;
  gap: 4px .45em;
  min-height: 1.2em;
  color: #fff0d0;
  font: 800 clamp(1.35rem, 3.64cqi, 3.45rem)/1.04 var(--fgbd-face);
  letter-spacing: -.045em;
}
.fgbd-next strong {
  color: var(--fgbd-accent);
  font-size: .96em;
  font-variant-numeric: tabular-nums;
}
.fgbd-result {
  max-width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .7em;
  padding: .54em .63em;
  border: 1px solid #162342;
  border-radius: 4px;
  background: var(--fgbd-accent);
  color: #152342;
  font-size: clamp(.88rem, 2cqi, 1.23rem);
}
.fgbd-result strong { font: 800 1.15em/.96 var(--fgbd-face); white-space: nowrap; }
.fgbd-result span { text-align: left; overflow-wrap: anywhere; }

.fgbd-history {
  padding: clamp(12px, 2.3cqi, 28px) clamp(15px, 7cqi, 120px) clamp(18px, 3cqi, 34px);
}
.fgbd-history h2 {
  margin-bottom: .43em;
  font-size: clamp(1.05rem, 2.8cqi, 1.65rem);
  letter-spacing: -.035em;
  line-height: 1;
}
.fgbd-latest { margin-top: 4px; padding-top: 12px; width: 100%; border-top: 1px solid #7891d7; }
.fgbd-latest h3 { margin-bottom: 8px; font: 700 clamp(.81rem, 1.5cqi, 1rem)/1.1 var(--fgbd-body); color: #fff0d0; }
.fgbd-latest ol { display: flex; flex-wrap: wrap; gap: 7px; }
.fgbd-latest ol:empty { display: none; }
.fgbd-latest li {
  min-width: 42px;
  padding: .38em .56em;
  border: 1px solid #0d142c;
  border-radius: 3px;
  background: var(--fgbd-tone, var(--fgbd-accent));
  color: #152342;
  font-size: clamp(.82rem, 1.6cqi, 1.12rem);
  text-align: center;
  font-weight: 700;
  white-space: nowrap;
}
.fgbd-latest p, .fgbd-all-head span { color: #eccfa8; font-size: .9rem; }
.fgbd-all-head { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; }
.fgbd-history ol { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 3px; }
.fgbd-history li {
  display: grid;
  place-items: center;
  min-height: 19px;
  padding: 1px;
  border: 1px solid #6476a0;
  border-radius: 2px;
  color: #cbdaff;
  font-size: clamp(.54rem, 1.5cqi, .97rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.fgbd-history .fgbd-hit { background: #4272ba; color: #fff7e7; border-color: #a4c3ff; font-weight: 700; }
.fgbd-history .fgbd-last { background: var(--fgbd-accent); color: #142342; border-color: var(--fgbd-accent); font-weight: 700; }

.fgbd:fullscreen, .fgbd-focus-mode {
  width: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}
.fgbd-focus-mode { position: fixed; inset: 0; z-index: 2147483000; }
html.fgbd-lock-scroll { overflow: hidden; }

@container fgbd (690px < width <= 960px) {
  .fgbd[data-qr="visible"] .fgbd-stage { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: 4cqi; gap: 3cqi; }
}

@container fgbd (max-width: 690px) {
  .fgbd-head { grid-template-columns: 1fr auto; gap: 6px 13px; align-items: center; padding-block: 9px; }
  .fgbd-session { grid-column: 2; grid-row: 1; }
  .fgbd-table { grid-column: 1 / -1; padding: 6px 0 1px; border: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 11px; }
  .fgbd-stage { grid-template-columns: minmax(0, 1fr); padding: 14px 16px 20px; gap: 7px; }
  .fgbd-machine { width: min(100%, 335px); }
  .fgbd[data-qr="visible"] .fgbd-stage { gap: 17px; }
  .fgbd[data-qr="visible"] .fgbd-join { grid-row: 1; }
  .fgbd[data-qr="visible"] .fgbd-machine { width: min(100%, 255px); }
  .fgbd-draw { gap: 8px; }
  .fgbd-next { grid-auto-flow: column; align-items: baseline; }
  .fgbd-latest { padding-top: 9px; }
  .fgbd-history { padding-inline: 16px; }
  .fgbd-history li { min-height: 16px; font-size: clamp(.65rem, 1.7cqi, .92rem); }
}

@container fgbd (max-width: 360px) {
  .fgbd-head, .fgbd-history { padding-inline: 10px; }
  .fgbd-format strong { letter-spacing: .025em; }
  .fgbd-session { gap: 9px; }
  .fgbd-history ol { gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .fgbd[data-drum="roll"] .fgbd-orbit { animation: none; opacity: 0; }
}

@media print {
  .fgbd .fgbd-fullscreen, .fgbd .fgbd-sound { display: none; }
}
