.ntd-app {
  --ntd-ink: #26008a;
  --ntd-muted: #6f6486;
  --ntd-line: #d8c194;
  --ntd-soft: #faf7f2;
  --ntd-panel: #ffffff;
  --ntd-accent: #b68436;
  --ntd-accent-2: #e23b78;
  --ntd-config-heading-size: 24px;
  --ntd-config-heading-bg: #26008a;
  --ntd-config-heading-ink: #fff;
  color: var(--ntd-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px;
  background: #fff;
}

.ntd-app * {
  box-sizing: border-box;
}

.ntd-header {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ntd-line);
}

.ntd-header h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.3;
  letter-spacing: 0;
}

.ntd-subtitle {
  margin: 4px 0 0;
  color: var(--ntd-muted);
  font-size: .95rem;
}

.ntd-control {
  display: grid;
  gap: 6px;
  max-width: 420px;
}

.ntd-control label {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ntd-config-heading-bg);
  color: var(--ntd-config-heading-ink);
  font-weight: 700;
  font-size: var(--ntd-config-heading-size);
  line-height: 1.25;
}

.ntd-control-grid .ntd-control {
  max-width: none;
}

.ntd-team-select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ntd-ink);
  font: inherit;
}

.ntd-readonly-value {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--ntd-soft);
  color: var(--ntd-ink);
  font: inherit;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.ntd-section {
  margin-top: 22px;
}

.ntd-section-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
  line-height: 1.35;
}

.ntd-summary-grid {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.ntd-summary-grid > * {
  grid-column: span var(--ntd-span, 5);
}

.ntd-summary-spacer {
  grid-column: span var(--ntd-span, 5);
  min-height: 1px;
}

.ntd-card {
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  background: var(--ntd-panel);
  padding: 14px;
  box-shadow: 0 2px 10px rgba(38, 0, 138, .08);
}

.ntd-summary-item {
  min-height: 82px;
}

.ntd-span-2 {
  grid-column: span 2;
}

.ntd-span-3 {
  grid-column: span 3;
}

.ntd-span-4 {
  grid-column: 1 / -1;
}

.ntd-summary-range {
  padding: 4px 0;
}

.ntd-summary-range .ntd-control {
  max-width: none;
}

.ntd-label {
  color: var(--ntd-muted);
  font-size: .82rem;
}

.ntd-value {
  margin-top: 4px;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ntd-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ntd-win-gauge-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
  justify-items: center;
  min-height: 360px;
}

.ntd-win-gauge-card > div:first-child {
  align-self: start;
  justify-self: stretch;
  text-align: left;
  width: 100%;
}

.ntd-win-gauge {
  width: min(340px, 92%);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  justify-self: center;
  align-self: center;
  cursor: pointer;
  background: conic-gradient(var(--ntd-accent) var(--win-rate), #efe5d6 0);
}

.ntd-win-gauge-core {
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ntd-line);
}

.ntd-win-gauge-core strong {
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.1;
}

.ntd-win-gauge-core span {
  color: var(--ntd-muted);
  font-size: .82rem;
}

.ntd-chart-box canvas {
  display: block;
  width: 100%;
  min-height: 280px;
  cursor: pointer;
  touch-action: manipulation;
}

#ntd-team-radar {
  min-height: 380px;
}

.ntd-radar-card {
  min-height: 100%;
}

.ntd-team-rank-trend {
  overflow: hidden;
}

.ntd-rank-chart {
  margin-top: 10px;
  overflow: hidden;
}

.ntd-rank-chart svg {
  aspect-ratio: 49 / 18;
  background: linear-gradient(180deg, #fff, var(--ntd-soft));
  border: 1px solid var(--ntd-line);
  display: block;
  max-width: 100%;
  width: 100%;
}

.ntd-rank-grid line {
  stroke: rgba(176, 170, 217, .42);
  stroke-width: 1;
}

.ntd-rank-axis text {
  fill: var(--ntd-muted);
  font-size: 13px;
  font-weight: 800;
  text-anchor: middle;
}

.ntd-rank-axis-y {
  text-anchor: start;
}

.ntd-rank-series > polyline {
  fill: none;
  stroke: var(--ntd-ink);
  stroke-dasharray: 2600;
  stroke-dashoffset: 2600;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  transition: stroke-dashoffset 5600ms cubic-bezier(.22, .61, .36, 1);
  vector-effect: non-scaling-stroke;
}

.ntd-rank-trend.is-visible .ntd-rank-series > polyline {
  stroke-dashoffset: 0;
}

.ntd-rank-point {
  opacity: 0;
  transform: scale(.55);
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 620ms ease var(--ntd-delay), transform 620ms ease var(--ntd-delay);
}

.ntd-rank-trend.is-visible .ntd-rank-point {
  opacity: 1;
  transform: scale(1);
}

.ntd-rank-trend.is-visible .ntd-rank-point--current {
  opacity: 0;
  transform: scale(.55);
  transition: none;
  animation: ntd-current-rank-blink 1900ms ease var(--ntd-delay) both;
}

@keyframes ntd-current-rank-blink {
  0% {
    opacity: 0;
    transform: scale(.55);
  }

  1%,
  18%,
  36%,
  54% {
    opacity: 1;
    transform: scale(1.65);
  }

  9%,
  27%,
  45% {
    opacity: .2;
    transform: scale(1.65);
  }

  78% {
    opacity: 1;
    transform: scale(1.65);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.ntd-rank-point circle {
  stroke: #fff;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.ntd-rank-point__minus,
.ntd-rank-point__check,
.ntd-rank-point__cross {
  fill: none;
  stroke: #fff !important;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5 !important;
  vector-effect: non-scaling-stroke;
}

.ntd-rank-point--win circle {
  fill: #16a05a;
}

.ntd-rank-point--draw circle {
  fill: #9ca3af;
}

.ntd-rank-point--loss circle {
  fill: #e2343f;
}

.ntd-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  background: #fff;
}

.ntd-lazy-table {
  max-height: 560px;
  overflow: auto;
}

.ntd-lazy-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.ntd-table-status {
  position: sticky;
  bottom: 0;
  padding: 8px 10px;
  border-top: 1px solid var(--ntd-line);
  background: rgba(250, 247, 242, .96);
  color: var(--ntd-muted);
  font-size: .84rem;
  text-align: right;
}

.ntd-app table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: .92rem;
}

.ntd-app th,
.ntd-app td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--ntd-line);
  text-align: left;
  white-space: nowrap;
}

.ntd-app th {
  background: var(--ntd-soft);
  font-weight: 800;
}

.ntd-app tr:last-child td {
  border-bottom: 0;
}

.ntd-rank-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ntd-rank-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  background: #fff;
}

.ntd-rank-no {
  color: var(--ntd-accent);
  font-weight: 800;
}

.ntd-rank-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.ntd-rank-meta {
  color: var(--ntd-muted);
  font-size: .84rem;
}

.ntd-empty,
.ntd-error,
.ntd-loading {
  padding: 18px;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  background: var(--ntd-soft);
}

.ntd-error {
  border-color: #f1a9c5;
  color: #9b1451;
  background: #fff3f8;
}

.ntd-chart-box {
  position: relative;
}

.ntd-chart-tooltip {
  position: absolute;
  z-index: 3;
  display: none;
  width: min(360px, calc(100% - 16px));
  max-height: min(420px, calc(100vh - 80px));
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 8px 24px rgba(38, 0, 138, .2);
  color: var(--ntd-ink);
  font-size: .86rem;
  line-height: 1.45;
  pointer-events: auto;
}

.ntd-chart-tooltip.is-visible {
  display: grid;
  gap: 4px;
}

.ntd-chart-tooltip span {
  color: var(--ntd-muted);
}

.ntd-chart-tooltip a {
  color: var(--ntd-accent);
  font-weight: 700;
  text-decoration: underline;
}

.ntd-chart-detail {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  background: var(--ntd-soft);
  color: var(--ntd-ink);
  font-size: .88rem;
  line-height: 1.5;
}

.ntd-chart-detail.is-visible {
  display: grid;
  gap: 10px;
}

.ntd-chart-detail span {
  color: var(--ntd-muted);
}

.ntd-chart-detail a {
  color: var(--ntd-accent);
  font-weight: 700;
}

.ntd-event-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ntd-event-card-list {
  display: grid;
  gap: 8px;
}

.ntd-event-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.ntd-event-card-top,
.ntd-event-card-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.ntd-event-card-top span,
.ntd-event-card-row span {
  color: var(--ntd-muted);
  font-size: .82rem;
}

.ntd-event-card-row strong {
  text-align: right;
}

.ntd-event-more {
  color: var(--ntd-muted);
  font-weight: 700;
}

@media (max-width: 840px) {
  .ntd-app {
    padding: 12px;
  }

  .ntd-header h1 {
    font-size: 1.28rem;
  }

  .ntd-summary-grid {
    grid-template-columns: 1fr;
  }

  .ntd-two-col {
    grid-template-columns: 1fr;
  }

  .ntd-summary-grid > * {
    grid-column: 1 / -1;
  }

  .ntd-chart-box canvas {
    min-height: 300px;
  }

  .ntd-win-gauge-card {
    grid-template-columns: 1fr;
  }

  .ntd-win-gauge {
    justify-self: center;
  }

  .ntd-control-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .ntd-summary-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 8px;
  }

  .ntd-summary-grid > * {
    grid-column: 1 / -1;
  }

  .ntd-value {
    font-size: 1.15rem;
  }

  .ntd-app table {
    font-size: .86rem;
  }

  .ntd-chart-controls {
    justify-content: stretch;
  }

  .ntd-chart-controls .ntd-control {
    width: 100%;
  }

  .ntd-chart-tooltip {
    left: 8px !important;
    width: calc(100% - 16px);
  }

  .ntd-rank-chart svg {
    aspect-ratio: 109 / 66;
  }

  .ntd-rank-axis text {
    font-size: 15px;
    font-weight: 900;
  }

  .ntd-rank-point__minus,
  .ntd-rank-point__check,
  .ntd-rank-point__cross {
    stroke-width: 5 !important;
  }

  .ntd-event-card-top,
  .ntd-event-card-row {
    display: grid;
    gap: 2px;
    justify-content: stretch;
  }

  .ntd-event-card-row strong {
    text-align: left;
  }

}

.ntd-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  width: 100%;
}

.ntd-inline-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.ntd-chart-controls {
  display: block;
  margin-top: 16px;
}

.ntd-chart-controls .ntd-control {
  width: 100%;
  max-width: none;
}

.ntd-accordion {
  padding: 0;
  overflow: hidden;
}

.ntd-accordion summary {
  min-height: 48px;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
  list-style-position: inside;
}

.ntd-accordion summary:hover {
  color: var(--ntd-accent);
}

.ntd-accordion-body {
  display: grid;
  gap: 18px;
  padding: 0 14px 14px;
  border-top: 1px solid var(--ntd-line);
}

.ntd-section-head,
.ntd-table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ntd-table-tools {
  justify-content: flex-start;
}

.ntd-table-tools .ntd-team-select {
  width: 50%;
  min-width: 220px;
  max-width: 100%;
}

.ntd-button {
  min-height: 36px;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  padding: 6px 12px;
  background: var(--ntd-ink);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ntd-button:hover {
  border-color: var(--ntd-accent);
  background: #fff;
  color: var(--ntd-accent);
}

.ntd-section-head .ntd-config-heading {
  flex: 0 0 100%;
  width: 100%;
}

.ntd-section-head .ntd-button {
  flex: 0 0 20%;
  width: 20%;
  margin-left: auto;
}

.ntd-config-heading {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ntd-config-heading-bg);
  color: var(--ntd-config-heading-ink);
  font-size: var(--ntd-config-heading-size);
}

.ntd-chart-box.is-pending canvas {
  opacity: 0;
}

.ntd-chart-box.is-visible canvas {
  opacity: 1;
  transition: opacity .24s ease;
}

@media (max-width: 840px) {
  .ntd-control-grid {
    grid-template-columns: 1fr;
  }

  .ntd-summary-spacer {
    display: none;
  }

  .ntd-section-head .ntd-button,
  .ntd-table-tools .ntd-team-select {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }
}


.ntd-review-link,
.ntd-rank-review-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 8px;
  background: #26008a;
  color: #fff !important;
  font-weight: 800;
  text-decoration: none;
}

.ntd-review-link:hover,
.ntd-rank-review-link:hover {
  background: #1d0068;
  color: #fff !important;
}

.ntd-rank-chart {
  position: relative;
}

.ntd-rank-tooltip {
  position: absolute;
  z-index: 8;
  display: none;
  width: min(260px, calc(100% - 16px));
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--ntd-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(23, 32, 51, .18);
  color: var(--ntd-ink);
  font-size: .88rem;
  line-height: 1.5;
}

.ntd-rank-tooltip.is-visible {
  display: grid;
}

.ntd-rank-tooltip.is-pinned {
  border-color: var(--ntd-purple);
  box-shadow: 0 14px 34px rgba(38, 0, 138, .26);
}

.ntd-rank-tooltip-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ntd-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.ntd-rank-tooltip-close:hover,
.ntd-rank-tooltip-close:focus {
  background: rgba(38, 0, 138, .08);
  color: var(--ntd-purple);
}

.ntd-rank-tooltip span {
  color: var(--ntd-muted);
  font-size: .82rem;
}

@media (max-width: 520px) {
  .ntd-rank-tooltip {
    left: 8px !important;
    width: calc(100% - 16px);
  }
}
