.cd-main {
  --cd-text: #f0edf8;
  --cd-muted: #c4b8d1;
  --cd-line: #40364f;
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
  padding-block: 26px 40px;
  font: 16px/1.45 "Segoe UI", system-ui, sans-serif;
  color: var(--cd-text);
}

.cd-header { margin-bottom: 12px; }
.cd-header h1 { margin: 0 0 15px; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -.05em; }
.cd-header label { display: block; margin-bottom: 6px; color: #e0caff; font-weight: 670; }
.cd-header input {
  width: min(100%, 560px);
  padding: 9px 12px;
  color: inherit;
  background: #181525;
  border: 1px solid #625279;
  border-radius: 8px;
  font: inherit;
}

.cd-header input::placeholder { color: #b5a6c8; }
.cd-main :focus-visible { outline: 2px solid #d9c8ff; outline-offset: 3px; }
.cd-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 12px; }
.cd-summary p { margin: 9px 0 0; color: var(--cd-muted); font-size: .875rem; }
.cd-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 12px;
  margin: 11px 0 0;
  padding: 7px 10px;
  border: 1px solid var(--cd-line);
  border-radius: 8px;
  background: #1d192a;
  color: var(--cd-muted);
  font-size: .8rem;
}
.cd-legend h2 { margin: 0; color: var(--cd-text); font-size: .84rem; }
.cd-legend ul { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }

.cd-op { color: #e1b6ff; }
.cd-high { color: #a9ecc5; }
.cd-medium { color: #ffd09a; }
.cd-low { color: #ffabbc; }

#cd-results { display: grid; gap: 7px; }
.cd-row {
  display: grid;
  grid-template-columns: minmax(215px, 28%) minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--cd-line);
  border-radius: 10px;
  background: #1b1728;
}

.cd-row p { margin: 0; }
.cd-group { padding-right: 10px; border-right: 1px solid var(--cd-line); }
.cd-portraits { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.cd-portrait {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: #2a233b;
  border: 1px solid #564868;
  border-radius: 5px;
  color: #ded3ed;
  overflow: hidden;
  font-size: .71rem;
  font-weight: 700;
}

.cd-team-portraits .cd-portrait { width: 27px; height: 27px; }
.cd-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cd-open-slot { color: #c1afd8; border-style: dashed; font-size: 1rem; }
.cd-champs, .cd-team-list, .cd-field { color: var(--cd-muted); font-size: .83rem; }
.cd-group .cd-champs, .cd-build .cd-team-list { margin-top: 5px; }
.cd-build { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 9px; min-width: 0; }
.cd-build:has(.cd-preview[hidden]) { grid-template-columns: minmax(0, 1fr); }
.cd-build-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(122px, 30%);
  gap: 8px 12px;
  align-items: start;
  min-width: 0;
}
.cd-build-content, .cd-build-comment { min-width: 0; }
.cd-build-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 8px; margin-bottom: 5px; }
.cd-build-header h2 { font-size: 1rem; line-height: 1.22; margin: 0; }
.cd-build-header a { color: #e5d0ff; text-underline-offset: 3px; }
.cd-badge {
  border: 1px solid #51445f;
  border-radius: 5px;
  padding: 2px 6px;
  background: #262036;
  white-space: nowrap;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: help;
}

.cd-badge:hover, .cd-badge[aria-describedby] { border-color: currentColor; }
.cd-tooltip {
  position: fixed;
  inset: auto;
  margin: 0;
  width: max-content;
  max-width: min(240px, calc(100% - 16px));
  padding: 7px 9px;
  border: 1px solid #716087;
  border-radius: 7px;
  color: #f0e7fc;
  background: #231a34;
  box-shadow: 0 5px 16px #0009;
  font: inherit;
  font-size: .875rem;
}
.cd-preview { align-self: start; }
.cd-preview img { display: block; width: 105px; aspect-ratio: 1.64; object-fit: cover; border: 1px solid #544763; border-radius: 5px; }
.cd-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 9px; margin-top: 7px; }
.cd-code {
  width: min(25ch, calc(100% - 83px));
  min-width: 0;
  background: #151222;
  border: 1px solid #51445f;
  border-radius: 5px;
  padding: 4px;
  color: var(--cd-muted);
  font: .78rem ui-monospace, monospace;
}

.cd-copy {
  background: #2b2340;
  color: #eee0ff;
  border: 1px solid #51445f;
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}

.cd-copy:hover { border-color: #d1adee; }
.cd-field { display: flex; align-items: baseline; gap: 6px; margin: 0; min-width: 0; }
.cd-field dt { color: #e8dcf4; font-weight: 680; }
.cd-field dd { margin: 0; overflow-wrap: anywhere; }
.cd-notes {
  --cd-bubble: #272035;
  --cd-bubble-line: #5e4f72;
  position: relative;
  display: block;
  padding: 6px 8px;
  border: 1px solid var(--cd-bubble-line);
  border-radius: 8px;
  background: var(--cd-bubble);
}
.cd-notes::after {
  position: absolute;
  right: 15px;
  bottom: -5px;
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--cd-bubble-line);
  border-bottom: 1px solid var(--cd-bubble-line);
  background: var(--cd-bubble);
  content: "";
  transform: rotate(45deg);
}
.cd-notes dd { margin-top: 2px; white-space: pre-line; }
.cd-author { justify-content: flex-end; }
.cd-notes + .cd-author { margin-top: 7px; }
.cd-empty { align-self: center; font-size: .86rem; color: var(--cd-muted); }
.cd-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 700px) {
  .cd-row { grid-template-columns: 1fr; gap: 8px; }
  .cd-group { padding: 0 0 8px; border-right: 0; border-bottom: 1px solid var(--cd-line); }
}

@media (max-width: 520px) {
  .cd-build-main { grid-template-columns: minmax(0, 1fr); }
  .cd-build-comment { justify-self: end; width: min(100%, 235px); }
}

@media (max-width: 430px) {
  .cd-main { width: calc(100% - 22px); }
  .cd-preview img { width: 76px; }
}
