:root {
  --bg: #000000;
  --card: #121316;
  --tile: #1e2025;
  --ink: #f4f3ef;
  --soft: rgba(244, 243, 239, 0.6);
  --faint: rgba(244, 243, 239, 0.26);
  --line: rgba(244, 243, 239, 0.1);
  --accent: #ff6a3d;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 10px 12px;
}

.tc { position: relative; width: min(324px, 100%); padding: 14px; border-radius: 26px; background: linear-gradient(180deg, #191a1e, var(--card)); box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07); }

.tc__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px; }
.tc__name { min-width: 0; display: grid; }
.tc__name b { font-size: 16px; line-height: 21px; font-weight: 740; font-stretch: 108%; letter-spacing: -0.012em; white-space: nowrap; }
.tc__name span { font-size: 11.500px; line-height: 15px; font-weight: 540; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc__free { flex: none; display: grid; justify-items: end; font-variant-numeric: tabular-nums; }
.tc__free b { display: block; height: 24px; overflow: hidden; font-size: 24px; line-height: 24px; font-weight: 770; letter-spacing: -0.02em; }
.tc__free b span { display: block; }
.tc__freeword { display: block; height: 15px; overflow: hidden; font-size: 11.500px; line-height: 15px; font-weight: 560; color: var(--soft); white-space: nowrap; }
.tc__freeword span { display: block; }

/* the train is longer than the card: it slides so the chosen coach sits in the middle, and fades at both ends */
.tc__rail { position: relative; height: 78px; margin: 12px -14px 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent); mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent); }
.tc__train { position: absolute; left: 0; top: 10px; display: flex; align-items: flex-end; gap: 7px; will-change: transform; }
.tc__nose { flex: none; width: 34px; height: 46px; border-radius: 26px 8px 8px 12px; background: var(--tile); box-shadow: inset 0 0 0 1px var(--line); }
.tc__coach { position: relative; flex: none; width: 82px; height: 46px; border: 0; border-radius: 11px; background: var(--tile); color: var(--soft); font: inherit; text-align: left; cursor: pointer; outline: none; box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.06); transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* the coupling between one coach and the next */
.tc__coach::before { content: ""; position: absolute; left: -7px; top: 30px; width: 7px; height: 2px; background: var(--faint); }
.tc__coach b { position: absolute; left: 9px; top: 6px; font-size: 13px; line-height: 16px; font-weight: 760; }
.tc__win { position: absolute; right: 8px; top: 8px; display: flex; gap: 3px; }
.tc__win i { display: block; width: 12px; height: 11px; border-radius: 3.500px; box-shadow: inset 0 0 0 1.200px var(--faint); transition: box-shadow 0.3s ease, background-color 0.3s ease; }
/* how full the coach is */
.tc__load { position: absolute; left: 9px; right: 9px; bottom: 8px; height: 4px; border-radius: 2px; background: rgba(244, 243, 239, 0.1); overflow: hidden; }
.tc__load i { display: block; height: 100%; border-radius: 2px; background: var(--soft); transition: background-color 0.3s ease; }
.tc__coach[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--tile)); color: var(--ink); box-shadow: inset 0 0 0 1.500px var(--accent), 0 12px 18px -10px color-mix(in srgb, var(--accent) 70%, #000000); }
.tc__coach[aria-pressed="true"] .tc__win i { box-shadow: inset 0 0 0 1.200px color-mix(in srgb, var(--accent) 70%, transparent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.tc__coach[aria-pressed="true"] .tc__load i { background: var(--accent); }
.tc__coach:focus-visible, .tc__step:focus-visible, .tc__go:focus-visible { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
@media (hover: hover) { .tc__coach[aria-pressed="false"]:hover { background: #272a30; color: var(--ink); } }
.tc__track { position: absolute; left: 0; right: 0; bottom: 9px; height: 7px; background: linear-gradient(var(--faint), var(--faint)) 0 0 / 100% 1.500px no-repeat, repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 13px) 0 100% / 100% 4px no-repeat; }

.tc__info { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.tc__step { flex: none; width: 34px; height: 34px; border: 0; border-radius: 11px; background: rgba(244, 243, 239, 0.07); color: var(--ink); cursor: pointer; outline: none; box-shadow: inset 0 0 0 1px var(--line); transition: opacity 0.25s ease, background-color 0.2s ease; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.tc__step svg { display: block; width: 16px; height: 16px; margin: 0 auto; fill: none; stroke: currentColor; stroke-width: 1.800; stroke-linecap: round; stroke-linejoin: round; }
.tc__step:disabled { opacity: 0.3; cursor: default; }
@media (hover: hover) { .tc__step:not(:disabled):hover { background: rgba(244, 243, 239, 0.14); } }
.tc__what { flex: 1 1 auto; min-width: 0; display: grid; text-align: center; }
.tc__roll { display: block; height: 19px; overflow: hidden; font-size: 14.500px; line-height: 19px; font-weight: 720; white-space: nowrap; }
.tc__roll span { display: block; overflow: hidden; text-overflow: ellipsis; }
.tc__roll--sub { height: 15px; font-size: 11.500px; line-height: 15px; font-weight: 540; color: var(--soft); }

.tc__go { display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; margin-top: 11px; border: 0; border-radius: 14px; background: var(--accent); color: #2b0e03; font: inherit; font-size: 13.500px; font-weight: 720; cursor: pointer; outline: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 14px 22px -14px color-mix(in srgb, var(--accent) 80%, transparent); transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.tc__go:disabled { background: #22242a; color: var(--soft); box-shadow: inset 0 0 0 1px var(--line); cursor: default; }
.tc__go.is-done { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.500px color-mix(in srgb, var(--accent) 55%, transparent); }
.tc__go svg { flex: none; width: 0; height: 16px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: width 0.3s ease, margin 0.3s ease; }
.tc__go svg path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.35s ease 0.15s; }
.tc__go.is-done svg { width: 16px; margin-right: 7px; }
.tc__go.is-done svg path { stroke-dashoffset: 0; }
.tc__gotext { display: block; height: 20px; line-height: 20px; overflow: hidden; }
.tc__gotext span { display: block; white-space: nowrap; }
@media (hover: hover) { .tc__go:not(:disabled):not(.is-done):hover { background: color-mix(in srgb, var(--accent) 88%, #ffffff); } }

.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; transform-origin: 20% 15%; pointer-events: none; opacity: 0; fill: #f4f3ef; stroke: #000000; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); z-index: 6; }
