.cw-stack-count {
  margin: 0 0 8px 2px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.cw-stack {
  --stack-paper: #f5f5f5;
  --stack-ink: #262626;
  --stack-muted: #646464;
  --stack-line: #c5c5c5;
  --stack-gold: #656565;
  background: #e9e9e9;
  color: var(--stack-ink);
  border: 1px solid #dbdbdb;
  border-radius: 20px;
  margin-bottom: 12px;
}

.cw-stack [hidden] { display: none; }
.cw-stack-scene { overflow: clip; border-radius: 20px 20px 0 0; }
.cw-stack-stage {
  --stack-card-width: 136px;
  --stack-card-height: 170px;
  position: relative;
  height: calc(var(--stack-card-height) + 96px);
  perspective: 1050px;
  perspective-origin: 50% 34%;
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
}

.cw-stack-stage:active { cursor: grabbing; }
.cw-stack-tile {
  position: absolute;
  top: 37px;
  left: calc((100% - var(--stack-card-width)) / 2);
  width: var(--stack-card-width);
  height: var(--stack-card-height);
  border-radius: 7px;
  transform-style: preserve-3d;
}

.cw-stack-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 7px;
  background: #aaaaaa;
  transform: translateZ(-3px);
  pointer-events: none;
}

.cw-stack-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 0;
  border: 1px solid #bfbfbf;
  border-radius: 7px;
  background: var(--stack-paper);
  color: var(--stack-ink);
  box-shadow: 0 10px 22px #27272724;
  text-align: left;
  overflow: hidden;
}

.cw-stack-card > .press-face {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-row: 1 / -1;
}

.cw-stack-tile[data-current='true'] .cw-stack-card { border-color: var(--stack-gold); }
.cw-stack-avatar {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  color: #575757;
  background: linear-gradient(145deg, #eeeeee, #d1d1d1);
}

.cw-stack-avatar svg { width: 42%; height: 42%; fill: none; stroke: currentColor; stroke-width: 1.3; }
.cw-stack-card-copy { display: grid; gap: 3px; padding: 9px 10px; }
.cw-stack-card-copy strong { font-size: 13px; overflow-wrap: anywhere; }
.cw-stack-card-copy small { color: var(--stack-muted); font-size: 10px; }

.cw-stack-control {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.cw-stack-control[data-single] { grid-template-columns: 1fr; padding-bottom: 14px; }
.cw-stack-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--stack-line);
  border-radius: 50%;
  background: var(--stack-paper);
  color: var(--stack-ink);
}

.cw-stack-arrow svg, .cw-stack-range-caption svg { width: 15px; height: 15px; }
.cw-stack-arrow[data-stack-prev] svg { transform: rotate(180deg); }
.cw-stack-arrow:disabled { opacity: .45; cursor: default; }
.cw-stack-current { min-height: 50px; color: var(--stack-ink); text-align: center; }
.cw-stack-current strong { display: block; font-size: 18px; font-weight: 650; }
.cw-stack-current > .press-face > span { display: block; margin-top: 5px; font-size: 11px; color: var(--stack-muted); }
.cw-stack-current [data-stack-status]::before { content: ' · '; }

.cw-stack-ruler { padding: 4px 18px 8px; }
.cw-stack-rail { position: relative; height: 44px; }
.cw-stack-rail::before {
  content: '';
  position: absolute;
  inset: 16px 0 auto;
  height: 12px;
  background: repeating-linear-gradient(90deg, #8f8f8f 0 1px, transparent 1px 9px);
  pointer-events: none;
}

.cw-stack-marker {
  position: absolute;
  top: 12px;
  left: 0;
  width: 3px;
  height: 20px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: var(--stack-gold);
  pointer-events: none;
}

.cw-stack-rail input {
  appearance: none;
  position: absolute;
  inset: 0 -10px;
  width: calc(100% + 20px);
  height: 44px;
  margin: 0;
  padding: 0;
  background: transparent;
  touch-action: pan-y;
  cursor: ew-resize;
}

.cw-stack-rail input::-webkit-slider-thumb { appearance: none; width: 20px; height: 44px; background: transparent; }
.cw-stack-rail input::-moz-range-thumb { width: 20px; height: 44px; border: 0; background: transparent; }
.cw-stack-range-caption { display: flex; align-items: center; justify-content: space-between; color: var(--stack-muted); font-size: 11px; }
.cw-stack-range-caption [data-stack-position] { font-variant-numeric: tabular-nums; }
.cw-stack-range-caption button { display: flex; gap: 3px; align-items: center; min-height: 44px; font-size: 12px; color: var(--stack-ink); }

.cw-stack-profile { display: flex; align-items: center; gap: 13px; margin: 6px 0 18px; font-size: 13px; }
.cw-stack-profile .cw-stack-avatar { flex: none; width: 60px; height: 60px; border-radius: 12px; }
.cw-stack-profile p { margin-top: 4px; color: var(--muted); }
.cw-athlete-overview { display: grid; gap: 20px; }
.cw-athlete-overview .section-heading { min-height: 40px; margin: 0 0 4px; }
.cw-athlete-overview .section-heading button { min-height: 40px; }
.cw-athlete-overview .empty { padding: 15px 16px; text-align: left; }
.cw-athlete-overview .empty p:empty { display: none; }
.cw-athlete-overview .view-all { margin: 0 0 6px; }
[data-athlete-overview="results"] { min-width: 0; }
.cw-result-event { display: block; margin-bottom: 10px; }
.cw-result-history-title { font-size: 15px; margin: 15px 0 8px; }
.cw-result-history { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.cw-result-history th { padding: 10px 12px; font-size: 12px; font-weight: 550; color: var(--muted); background: #f6f6f6; }
.cw-result-history tbody tr { position: relative; border-top: 1px solid var(--line); }
.cw-result-history td { height: 46px; padding: 0 12px; }
.cw-result-history td strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.cw-result-history-open { min-height: 44px; padding: 0; color: var(--ink); }
.cw-result-history-open::after { content: ""; position: absolute; inset: 0; }
.cw-result-history-timing { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 12px; color: var(--muted); }
.cw-result-history-timing svg { width: 12px; height: 12px; }
.cw-result-history tr.is-selected { background: var(--cw-tone-bg); }
.cw-result-history tr.is-selected td:first-child { box-shadow: inset 2px 0 var(--cw-tone); }
.cw-result-history tr.is-selected td strong { color: var(--cw-tone); }
.cw-overview-more summary { padding: 12px 4px; min-height: 40px; color: var(--muted); font-size: 12px; cursor: pointer; }
[data-stack-choose][aria-current='true'] { background: #e9e9e9; border-radius: 12px; }
