.drt-timeline {
  --drt-background: #0c1016;
  --drt-foreground: #f7f8fb;
  --drt-muted: #586171;
  --drt-copy: #9ba4b3;
  --drt-line: #333b48;
  --drt-accent: #8075ff;
  position: relative;
  isolation: isolate;
  width: min(100%, 1280px);
  min-height: clamp(430px, 55vw, 680px);
  margin-inline: auto;
  overflow: hidden;
  color: var(--drt-foreground);
  background: var(--drt-background);
  border-radius: 16px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

.drt-timeline,
.drt-timeline * {
  box-sizing: border-box;
}

.drt-timeline--fullscreen {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 480px;
  margin-block: 0;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  border-radius: 0;
}

body.admin-bar .drt-timeline--fullscreen {
  height: calc(100svh - 32px);
  height: calc(100dvh - 32px);
}

.drt-arc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.drt-arc path {
  fill: none;
  stroke: var(--drt-line);
  stroke-width: 1.3;
  stroke-dasharray: 0.55 0.9;
  vector-effect: non-scaling-stroke;
}

.drt-years {
  position: absolute;
  inset: 0;
}

.drt-timeline .drt-year {
  position: absolute;
  left: var(--drt-x, 50%);
  top: var(--drt-y, 20%);
  z-index: 2;
  min-width: 64px;
  margin: 0;
  padding: 10px 8px;
  border: 0 !important;
  border-radius: 8px;
  color: var(--drt-muted);
  background: transparent !important;
  box-shadow: none !important;
  appearance: none;
  font: inherit;
  font-size: clamp(0.92rem, 1.6vw, 1.25rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
  text-decoration: none !important;
  text-transform: none !important;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.78;
  transform: translate(-50%, -50%) rotate(var(--drt-rotate, 0deg));
  transition:
    left 650ms cubic-bezier(0.22, 1, 0.36, 1),
    top 650ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 650ms cubic-bezier(0.22, 1, 0.36, 1),
    color 300ms ease,
    font-size 300ms ease,
    opacity 300ms ease;
}

.drt-timeline .drt-year:hover,
.drt-timeline .drt-year:focus-visible {
  border-color: transparent !important;
  color: var(--drt-foreground) !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 1;
}

.drt-year:focus-visible,
.drt-control:focus-visible {
  outline: 2px solid var(--drt-accent);
  outline-offset: 3px;
}

.drt-timeline .drt-year.is-active {
  color: var(--drt-foreground) !important;
  background: transparent !important;
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 600;
  opacity: 1;
}

.drt-year.is-active::after {
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--drt-accent);
  box-shadow: 0 0 0 5px rgb(128 117 255 / 8%);
  content: "";
  transform: translateX(-50%);
}

.drt-year[data-visible="false"] {
  pointer-events: none;
  opacity: 0;
}

.drt-detail {
  position: absolute;
  top: 35%;
  left: 50%;
  z-index: 1;
  width: min(680px, calc(100% - 48px));
  color: var(--drt-copy);
  text-align: center;
  transform: translateX(-50%);
}

.drt-detail::before {
  display: block;
  width: 1px;
  height: clamp(38px, 5vw, 58px);
  margin: 0 auto clamp(18px, 2.4vw, 28px);
  background: var(--drt-line);
  content: "";
}

.drt-copy {
  min-height: 3em;
  margin: 0;
  font-size: clamp(0.94rem, 1.45vw, 1.08rem);
  font-weight: 400;
  line-height: 1.65;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.drt-controls {
  position: absolute;
  right: 24px;
  bottom: 22px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
}

.drt-timeline .drt-control {
  display: grid;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 1px solid var(--drt-line) !important;
  border-radius: 50%;
  color: var(--drt-foreground) !important;
  background: rgb(255 255 255 / 3%) !important;
  box-shadow: none !important;
  appearance: none;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, opacity 180ms ease;
}

.drt-timeline .drt-control:hover:not(:disabled) {
  border-color: var(--drt-accent) !important;
  color: var(--drt-foreground) !important;
  background: rgb(128 117 255 / 10%) !important;
  box-shadow: none !important;
}

.drt-control:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.drt-count {
  min-width: 48px;
  color: var(--drt-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.drt-empty {
  padding: 20px;
  border-left: 3px solid #8075ff;
  background: #f4f4ff;
}

@media (min-width: 641px) and (max-width: 1024px) {
  .drt-timeline .drt-year {
    min-width: 58px;
    padding-inline: 6px;
    font-size: clamp(0.86rem, 2vw, 1.08rem);
  }

  .drt-timeline .drt-year.is-active {
    font-size: clamp(1.55rem, 3.6vw, 1.85rem);
  }

  .drt-detail {
    top: 35%;
    width: min(600px, calc(100% - 64px));
  }

  .drt-copy {
    font-size: clamp(0.94rem, 1.8vw, 1.04rem);
    line-height: 1.6;
  }

  .drt-timeline .drt-control {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 640px) {
  .drt-timeline:not(.drt-timeline--fullscreen) {
    min-height: clamp(430px, 122vw, 520px);
    border-radius: 12px;
  }

  .drt-timeline--fullscreen {
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    min-height: 0;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .drt-arc {
    bottom: auto;
    height: 82%;
  }

  .drt-timeline .drt-year {
    min-width: 52px;
    padding-inline: 5px;
    font-size: 0.78rem;
  }

  .drt-timeline .drt-year.is-active {
    font-size: 1.45rem;
  }

  .drt-year[data-mobile-hidden="true"] {
    pointer-events: none;
    opacity: 0;
  }

  .drt-detail {
    top: 34%;
    width: min(440px, calc(100% - 48px));
  }

  .drt-controls {
    right: 50%;
    bottom: max(32px, calc(env(safe-area-inset-bottom, 0px) + 24px));
    transform: translateX(50%);
  }

  .drt-timeline .drt-control {
    width: 44px;
    height: 44px;
  }

  .drt-copy {
    font-size: 0.92rem;
    line-height: 1.55;
  }
}

@media (max-width: 360px) {
  .drt-detail {
    width: calc(100% - 40px);
  }

  .drt-copy {
    font-size: 0.88rem;
  }

  .drt-controls {
    gap: 9px;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .drt-timeline--fullscreen {
    min-height: 0;
  }

  .drt-detail {
    top: 33%;
  }

  .drt-detail::before {
    height: 30px;
    margin-bottom: 14px;
  }

  .drt-copy {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .drt-controls {
    bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 12px));
  }
}

@media (max-width: 782px) {
  body.admin-bar .drt-timeline--fullscreen {
    height: calc(100svh - 46px);
    height: calc(100dvh - 46px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .drt-year,
  .drt-control {
    transition-duration: 1ms;
  }
}
