:root {
  --void: #0a0a0a;
  --paper: #e9e9e7;
  --dim: #6e6e6e;
  --line: #242424;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --sector-1: #fa0303;
  --sector-2: #04b1e1;
  --sector-3: #fdd601;
  --sector-4: #14c74f;
  --ptb: var(--sector-3);
  --index-w: 240px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--void);
  color: var(--paper);
  font-family: 'Titillium Web', sans-serif;
  font-variant-numeric: tabular-nums;
}

button,
a {
  font: inherit;
}

.mark {
  position: fixed;
  z-index: 5;
  top: 22px;
  left: 24px;
  margin: 0;
  color: var(--paper);
  font-size: 20px;
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}

.stage {
  display: grid;
  grid-template-columns: var(--index-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.index {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 64px 20px 0px;
  text-align: left;
  overscroll-behavior: contain;
}

.index-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 15px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s var(--ease);
}

.index-item:hover,
.index-item:focus-visible {
  color: var(--paper);
  outline: none;
}

.index-item.active {
  color: var(--paper);
  font-weight: 700;
}

.index-item .name-wrap {
  position: relative;
  min-width: 0;
  overflow: visible;
  flex: 0 1 auto;
  width: max-content;
  max-width: none;
}

.index-item .item-name {
  display: block;
  overflow: visible;
  white-space: nowrap;
}

.index-item .tick {
  position: absolute;
  right: 0;
  bottom: -2px;
  left: 0;
  height: 2px;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

.index-item.active .tick {
  opacity: 1;
}

.index-item .ptb-tag {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 0;
  border-bottom: 1px dashed var(--ptb);
  color: var(--ptb);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
}

.frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.frame.dragging {
  cursor: grabbing;
}

svg#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}

.route-group .hitareas path {
  fill: transparent;
  stroke: transparent;
  stroke-width: 12;
  pointer-events: all;
  cursor: pointer;
}

.route-group .visible-layer {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}

.route-group.active .visible-layer {
  opacity: 1;
}

#Track > path {
  transition: opacity 0.35s var(--ease);
}

svg#map.dimmed #Track > path {
  opacity: 0.2;
}

.strip {
  position: fixed;
  right: 0;
  bottom: 0;
  left: var(--index-w);
  z-index: 10;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--void);
  padding: 20px 25px;
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.35s var(--ease),
    opacity 0.35s var(--ease);
}

.strip.active {
  transform: translateY(0);
  opacity: 1;
}

.who-name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  min-width: 0;
}

.who-name .route-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
}

.who-name .ptb-tag {
  flex: 0 0 auto;
  border-bottom: 1px dashed var(--ptb);
  color: var(--ptb);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}

.data-grid {
  display: grid;
  grid-template-columns: 13ch repeat(var(--n-cols), minmax(84px, max-content)) minmax(84px, max-content);
  width: max-content;
  min-width: 100%;
  justify-content: start;
  column-gap: 20px;
  row-gap: 10px;
  align-items: start;
}

.data-grid .cell {
  min-width: 0;
}

.data-grid .row-label {
  display: flex;
  align-items: center;
  height: 100%;
  font-size: 12px;
  white-space: nowrap;
}

.data-grid .row-label a,
.strip a {
  color: var(--dim);
  text-decoration: none;
  border-bottom: 1px dotted var(--dim);
  transition:
    color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

.data-grid .row-label a:hover,
.data-grid .row-label a:focus-visible,
.strip a:hover,
.strip a:focus-visible {
  color: var(--paper);
  border-bottom-style: solid;
  border-color: var(--paper);
  outline: none;
}

.data-grid .col-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--c, var(--paper));
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.split-tick {
  flex: 0 0 auto;
  width: 20px;
  height: 4px;
  background: var(--c, var(--dim));
}

.overall-tick {
  flex: 0 0 auto;
  width: 20px;
  height: 4px;
  background: conic-gradient(#fff 25%, #000 0 50%, #fff 0 75%, #000 0) 0 / 4px 4px;
}

.data-grid .time {
  color: var(--c, var(--paper));
  font-size: 20px;
  font-weight: 700;
}

.data-grid .time.total {
  color: var(--paper);
}

.data-grid .time .car {
  display: block;
  margin-top: 2px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 400;
  white-space: normal;
}

.data-grid .no-data,
.no-times {
  color: var(--dim);
}

.data-grid .no-data {
  font-size: 14px;
}

.no-times {
  font-size: 13px;
}

.strip-note {
  margin: 10px 0 -10px;
  color: var(--dim);
  font-size: 11px;
  pointer-events: none;
  user-select: none;
}

@media (max-width: 780px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .index {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 56px 20px 14px;
    text-align: left;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    touch-action: pan-y;
  }

  .index::-webkit-scrollbar {
    display: none;
  }

  .index.dragging {
    cursor: grabbing;
    user-select: none;
  }

  .index-item {
    width: max-content;
    min-width: max-content;
    flex: 0 0 auto;
    padding: 4px 16px 4px 8px;
  }

  .index-item .name-wrap {
    width: max-content;
    max-width: none;
  }

  .index-item .ptb-tag {
    margin-left: 10px;
  }

  .canvas {
    padding: 20px;
  }

  .strip {
    left: 0;
  }

  .data-grid {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }
}
