:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #12161d;
  --panel-2: #181d26;
  --panel-3: #202734;
  --line: #303847;
  --line-soft: #202733;
  --text: #f2f5fa;
  --muted: #b7bfcc;
  --quiet: #747f90;
  --accent: #e43f4f;
  --accent-2: #ff6d42;
  --cyan: #47c8d4;
  --gold: #f0c45c;
  --green: #75d678;
  --blue: #4da3ff;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(228, 63, 79, 0.1), transparent 240px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 28px 28px, 28px 28px, auto;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.app-shell {
  display: block;
  min-height: 100vh;
  padding: 12px;
  overflow: visible;
}

.app-version {
  position: fixed;
  left: 12px;
  top: 8px;
  z-index: 20;
  padding: 3px 7px;
  border: 1px solid rgba(240, 196, 92, 0.42);
  border-radius: 4px;
  color: #fff7d7;
  background: rgba(9, 11, 16, 0.78);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.main-stage,
.workspace,
.team-workbench {
  min-width: 0;
  min-height: 0;
}

.main-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

.content-grid {
  display: grid;
  grid-template-columns: 520px minmax(0, 1fr);
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filters,
.list-header,
.charge-chart-panel,
.team-panel,
.result-panel {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(18, 22, 29, 0.96);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.summary-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #0d1016;
  text-align: right;
  font-size: 13px;
}

.summary-team {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 900;
  white-space: nowrap;
}

.summary-team strong {
  font-size: 16px;
}

.summary-defense {
  color: var(--blue);
}

.summary-attack {
  color: var(--accent);
}

.summary-vs {
  color: var(--quiet);
  font-size: 12px;
  font-weight: 900;
}

.filters {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 10px;
}

.search-field {
  flex: 1 1 auto;
  min-width: 0;
}

.filter-switch {
  position: relative;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border: 1px solid rgba(242, 245, 250, 0.22);
  border-radius: 6px;
  padding: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.filter-switch input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.filter-switch:has(input:checked) {
  color: #fff;
  border-color: rgba(77, 163, 255, 0.86);
  background: rgba(77, 163, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(77, 163, 255, 0.16) inset;
}

.filter-stage-button[aria-pressed="true"] {
  color: #fff;
  border-color: rgba(77, 163, 255, 0.86);
  background: rgba(77, 163, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(77, 163, 255, 0.16) inset;
}

.filter-switch:hover {
  color: #fff;
  border-color: rgba(71, 200, 212, 0.8);
  background: rgba(71, 200, 212, 0.12);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0;
  color: var(--quiet);
  font-size: 12px;
}

select,
input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  color: var(--text);
  background: #0b0e14;
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(228, 63, 79, 0.15);
}

.list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  color: var(--quiet);
  font-size: 13px;
  border-left: 3px solid var(--accent);
}

.list-header strong {
  color: var(--text);
}

.list-divider {
  color: var(--line);
  font-weight: 900;
}

#listCount {
  margin-left: auto;
}

.character-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, 68px);
  grid-auto-rows: 68px;
  align-content: start;
  align-items: start;
  justify-content: start;
  gap: 7px;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
  padding-bottom: 8px;
}

.character-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid #2b303a;
  border-radius: 6px;
  padding: 0;
  color: var(--text);
  background: #0e1118;
  box-shadow: inset 0 -18px 32px rgba(0, 0, 0, 0.24);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.character-tile.rarity-ssr {
  border-color: #d9a441;
}

.character-tile.rarity-sr {
  border-color: #9b66ff;
}

.character-tile.rarity-r {
  border-color: #7f8794;
}

.character-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(228, 63, 79, 0.85);
  box-shadow:
    inset 0 -18px 32px rgba(0, 0, 0, 0.24),
    0 8px 18px rgba(0, 0, 0, 0.34);
}

.character-tile.is-picked {
  border-color: var(--blue);
  background: #182333;
  box-shadow:
    0 0 0 2px rgba(77, 163, 255, 0.5),
    0 10px 22px rgba(0, 0, 0, 0.38);
}

.character-tile.is-picked .tile-avatar img {
  filter: grayscale(0.45) brightness(0.82);
}

.character-tile.is-picked .tile-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(45, 61, 80, 0.14);
}

.tile-check {
  position: absolute;
  right: 3px;
  top: 3px;
  z-index: 2;
  display: none;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.character-tile.is-picked .tile-check {
  display: grid;
}

.tile-avatar {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.tile-avatar img {
  width: 100%;
  height: calc(100% + 15px);
  object-fit: cover;
  object-position: top center;
  transform: translateY(-15px);
}

.tile-avatar span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--text);
  background: linear-gradient(145deg, #303541, #151820);
  font-size: 11px;
  font-weight: 900;
}

.tile-icon {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 4px;
  background: rgba(7, 9, 13, 0.82);
}

.tile-icon img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.weapon-icon {
  left: 2px;
  top: 2px;
}

.burst-icon {
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.element-icon {
  right: 2px;
  bottom: 2px;
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
}

.element-icon img {
  width: 18px;
  height: 18px;
}

.tile-charge {
  position: absolute;
  left: 2px;
  bottom: 2px;
  z-index: 1;
  min-width: 24px;
  min-height: 15px;
  padding: 1px 4px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 4px;
  color: var(--green);
  background: rgba(7, 9, 13, 0.86);
  font-size: 9px;
  font-weight: 900;
  line-height: 13px;
  text-align: center;
}

.character-hover-tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  padding: 10px;
  border: 1px solid rgba(242, 245, 250, 0.28);
  border-radius: 6px;
  color: var(--text);
  background: rgba(10, 13, 19, 0.96);
  box-shadow:
    0 0 0 1px rgba(71, 200, 212, 0.1) inset,
    var(--shadow);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.character-hover-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.character-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 5px;
}

.character-tooltip-head strong {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-tooltip-head span {
  flex: 0 0 auto;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.character-tooltip-meta {
  margin-bottom: 7px;
  color: var(--quiet);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.character-tooltip-main {
  margin-bottom: 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.character-tooltip-lines {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
}

.avatar {
  display: grid;
  place-items: center;
  width: 50px;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: linear-gradient(145deg, #303541, #151820);
  font-size: 12px;
  font-weight: 900;
}

.avatar img {
  width: 100%;
  height: calc(100% + 15px);
  object-fit: cover;
  object-position: top center;
  transform: translateY(-15px);
}

.avatar.small {
  width: 42px;
  height: 50px;
  flex: 0 0 auto;
}

.efficiency {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.timing,
.efficiency span {
  overflow: hidden;
  color: var(--quiet);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-copy .finish-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 217, 220, 0.82);
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #121620;
  font-size: 12px;
}

.pill.weapon {
  color: #fff;
  border-color: rgba(242, 85, 98, 0.5);
  background: rgba(242, 85, 98, 0.16);
}

.efficiency {
  align-items: flex-end;
}

.efficiency strong {
  color: var(--green);
  font-size: 19px;
}

.team-workbench {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.charge-chart-panel,
.team-panel,
.result-panel {
  padding: 12px;
}

.result-panel:empty {
  display: none;
}

.charge-chart-panel {
  padding: 8px;
  min-height: 50vh;
  border-top: 3px solid var(--accent);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.panel-heading.compact {
  margin-bottom: 6px;
}

.team-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.icon-toggle,
.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(242, 245, 250, 0.22);
  border-radius: 6px;
  padding: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.icon-toggle:hover,
.icon-button:hover {
  border-color: rgba(71, 200, 212, 0.8);
  color: #fff;
  background: rgba(71, 200, 212, 0.12);
  transform: translateY(-1px);
}

.miss-toggle {
  cursor: pointer;
}

.miss-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.miss-icon {
  position: relative;
  width: 17px;
  height: 17px;
  border: 2px dashed currentColor;
  border-radius: 999px;
}

.miss-icon::before,
.miss-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.miss-icon::before {
  left: 50%;
  top: -5px;
  width: 0;
  height: 23px;
  border-left: 2px dashed currentColor;
  background: transparent;
  transform: translateX(-50%);
}

.miss-icon::after {
  left: -5px;
  top: 50%;
  width: 23px;
  height: 0;
  border-top: 2px dashed currentColor;
  background: transparent;
  transform: translateY(-50%);
}

.miss-toggle:has(input:checked) {
  border-color: rgba(77, 163, 255, 0.86);
  color: #9dccff;
  background: rgba(77, 163, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(77, 163, 255, 0.16) inset;
}

.copy-team-button,
.swap-team-button,
.clear-team-button {
  cursor: pointer;
}

.app-help-button {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 60;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(71, 200, 212, 0.64);
  border-radius: 999px;
  padding: 0;
  color: #dffbff;
  background:
    linear-gradient(180deg, rgba(20, 49, 63, 0.94), rgba(7, 11, 17, 0.94)),
    var(--panel);
  box-shadow:
    0 0 0 1px rgba(221, 251, 255, 0.08) inset,
    0 8px 22px rgba(0, 0, 0, 0.32);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.app-help-button:hover {
  border-color: rgba(71, 200, 212, 0.95);
  color: #fff;
  background:
    linear-gradient(180deg, rgba(30, 74, 92, 0.98), rgba(11, 18, 28, 0.98)),
    var(--panel);
  transform: translateY(-1px);
}

.copy-icon {
  position: relative;
  width: 17px;
  height: 17px;
}

.copy-icon::before,
.copy-icon::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.copy-icon::before {
  left: 1px;
  top: 5px;
  opacity: 0.72;
}

.copy-icon::after {
  right: 1px;
  top: 1px;
  background: rgba(11, 14, 20, 0.92);
}

.swap-icon {
  position: relative;
  width: 18px;
  height: 16px;
}

.swap-icon::before,
.swap-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  width: 16px;
  height: 6px;
  border-color: currentColor;
  border-style: solid;
}

.swap-icon::before {
  top: 1px;
  border-width: 2px 2px 0 0;
}

.swap-icon::after {
  bottom: 1px;
  border-width: 0 0 2px 2px;
}

.swap-team-button:hover .swap-icon::before {
  transform: translateX(1px);
}

.swap-team-button:hover .swap-icon::after {
  transform: translateX(-1px);
}

.clear-icon {
  position: relative;
  width: 16px;
  height: 16px;
}

.clear-icon::before,
.clear-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: -1px;
  width: 2px;
  height: 18px;
  border-radius: 2px;
  background: currentColor;
}

.clear-icon::before {
  transform: rotate(45deg);
}

.clear-icon::after {
  transform: rotate(-45deg);
}

.charge-chart {
  position: relative;
  height: calc(50vh - 19px);
  min-height: 360px;
  max-height: calc(100vh - 170px);
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: #0b0e14;
}

.charge-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-hover-tooltip {
  position: absolute;
  z-index: 5;
  width: max-content;
  max-width: min(360px, calc(100% - 16px));
  padding: 8px 10px;
  border: 1px solid rgba(242, 245, 250, 0.28);
  border-radius: 6px;
  color: var(--text);
  background: rgba(10, 13, 19, 0.94);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 100ms ease, transform 100ms ease;
  white-space: pre-line;
}

.chart-hover-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.chart-hover-guide-x,
.chart-hover-guide-y {
  position: absolute;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
}

.chart-hover-guide-x {
  height: 0;
  border-top: 1px dashed rgba(242, 245, 250, 0.72);
}

.chart-hover-guide-y {
  width: 0;
  border-left: 1px dashed rgba(242, 245, 250, 0.72);
}

.chart-hover-guide-x.show,
.chart-hover-guide-y.show {
  opacity: 1;
}

.chart-bg {
  fill: #0b0e14;
}

.chart-grid line {
  stroke: rgba(92, 109, 132, 0.38);
  stroke-width: 1;
}

.chart-grid text {
  fill: #d8dee9;
  font-size: 13px;
  font-weight: 800;
}

.chart-grid.is-full line {
  stroke: rgba(228, 63, 79, 0.88);
  stroke-dasharray: none;
}

.chart-grid.is-full text {
  fill: #ff8e92;
}

.chart-standard line {
  stroke: #f0c45c;
  stroke-dasharray: 4 6;
  stroke-width: 1.6;
}

.chart-standard text {
  fill: #fff7d7;
  font-size: 14px;
  font-weight: 900;
}

.chart-standard.is-full line {
  stroke: var(--accent);
  stroke-dasharray: none;
}

.chart-standard.is-full.team-defense line {
  stroke: var(--blue);
}

.chart-standard.is-full.team-attack line {
  stroke: var(--accent);
}

.chart-standard.is-full text {
  fill: #ffd9dc;
}

.chart-position-line {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1;
}

.chart-team-separator {
  stroke: rgba(242, 245, 250, 0.42);
  stroke-dasharray: 8 8;
  stroke-width: 1.2;
}

.chart-track {
  stroke: var(--cyan);
  stroke-linecap: round;
  stroke-width: 2.4;
}

.chart-track.team-defense {
  stroke: var(--blue);
}

.chart-track.team-attack {
  stroke: var(--accent);
}

.chart-reload-track {
  stroke: var(--cyan);
  stroke-dasharray: 5 6;
  stroke-linecap: round;
  stroke-width: 2.2;
  cursor: pointer;
}

.chart-reload-track.team-defense {
  stroke: var(--blue);
}

.chart-reload-track.team-attack {
  stroke: var(--accent);
}

.chart-flight-track {
  stroke: rgba(255, 255, 255, 0.94);
  stroke-linecap: round;
  stroke-width: 2.8;
  cursor: pointer;
}

.chart-scarlet-counter-track {
  stroke-dasharray: none;
}

.chart-scarlet-counter-track.team-defense {
  stroke: #9dccff;
}

.chart-scarlet-counter-track.team-attack {
  stroke: #ff9ba5;
}

.chart-standard-track {
  stroke: var(--gold);
}

.chart-standard-reference {
  stroke: rgba(240, 196, 92, 0.58);
  stroke-dasharray: 4 6;
  stroke-width: 1.3;
}

.chart-standard-point {
  fill: var(--gold);
  stroke: rgba(7, 9, 13, 0.95);
  stroke-width: 1.6;
  cursor: pointer;
}

.chart-standard-label {
  fill: #fff7d7;
  font-size: 12px;
  font-weight: 900;
}

.chart-point {
  fill: var(--gold);
  stroke: rgba(7, 9, 13, 0.95);
  stroke-width: 1.3;
}

.chart-point.team-defense {
  fill: var(--blue);
}

.chart-point.team-attack {
  fill: var(--accent);
}

.chart-point,
.chart-total-point {
  cursor: pointer;
}

.chart-point.is-finisher {
  fill: var(--accent);
  stroke: #ffd9dc;
  stroke-width: 1.8;
}

.chart-missed-point {
  fill: #8a9099;
  stroke: rgba(7, 9, 13, 0.95);
  stroke-width: 1.6;
  cursor: pointer;
}

.chart-stun-point {
  fill: #8a9099;
  stroke: rgba(7, 9, 13, 0.95);
  stroke-width: 1.3;
  cursor: pointer;
}

.chart-total-point {
  stroke: rgba(7, 9, 13, 0.95);
  stroke-width: 1.3;
}

.chart-total-point.team-defense {
  fill: var(--blue);
}

.chart-total-point.team-attack {
  fill: var(--accent);
}

.chart-scarlet-counter-point {
  stroke: rgba(7, 9, 13, 0.95);
  stroke-width: 1.5;
}

.chart-scarlet-counter-point.team-defense {
  fill: #9dccff;
}

.chart-scarlet-counter-point.team-attack {
  fill: #ff9ba5;
}

.chart-universal-point {
  stroke: rgba(7, 9, 13, 0.95);
  stroke-width: 1.3;
  cursor: pointer;
}

.chart-universal-point.team-defense {
  fill: #9dccff;
}

.chart-universal-point.team-attack {
  fill: #ff9ba5;
}

.chart-burst-point {
  stroke: rgba(7, 9, 13, 0.95);
  stroke-width: 1.7;
  cursor: pointer;
}

.chart-burst-point.team-defense {
  fill: var(--blue);
}

.chart-burst-point.team-attack {
  fill: var(--accent);
}

.chart-burst-label {
  fill: #b9dcff;
  font-size: 12px;
  font-weight: 900;
}

.chart-name {
  fill: #f2f5fa;
  font-size: 14px;
  font-weight: 900;
}

.chart-total-name {
  fill: var(--accent);
}

.chart-total-name.team-defense,
.chart-burst-label.team-defense {
  fill: #9dccff;
}

.chart-total-name.team-attack,
.chart-burst-label.team-attack {
  fill: #ff9ba5;
}

.chart-scarlet-counter-name.team-defense {
  fill: #9dccff;
}

.chart-scarlet-counter-name.team-attack {
  fill: #ff9ba5;
}

.chart-standard-name {
  fill: var(--gold);
}

.chart-axis-label {
  fill: #f2f5fa;
  font-size: 14px;
  font-weight: 900;
}

.ghost-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 12px;
  color: var(--text);
  background: #11141a;
}

.ghost-button:hover {
  border-color: var(--accent);
}

.team-slots {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.lineup-slots {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.lineup-slot-button {
  min-width: 0;
  height: 30px;
  border: 1px solid rgba(242, 245, 250, 0.22);
  border-radius: 6px;
  padding: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 900;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.lineup-slot-button.has-lineup {
  color: var(--text);
  border-color: rgba(71, 200, 212, 0.42);
}

.lineup-slot-button.is-active {
  color: #fff;
  border-color: var(--blue);
  background: rgba(77, 163, 255, 0.24);
  box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.18);
}

.lineup-slot-button:hover {
  color: #fff;
  border-color: rgba(71, 200, 212, 0.82);
  background: rgba(71, 200, 212, 0.14);
  transform: translateY(-1px);
}

.team-row {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.team-row.is-active {
  border-color: var(--blue);
  background: rgba(77, 163, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.16);
}

.team-slots-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.team-slot {
  position: relative;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 7px;
  color: var(--muted);
  background: #0f131a;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.team-slot.filled {
  border-style: solid;
  color: var(--text);
  background: #161b24;
  cursor: grab;
}

.team-slot.has-universal {
  border-style: solid;
  border-color: rgba(77, 163, 255, 0.55);
  background: rgba(77, 163, 255, 0.08);
}

.team-slot.is-finisher {
  border-color: rgba(228, 63, 79, 0.92);
  background: rgba(228, 63, 79, 0.12);
  box-shadow: 0 0 0 2px rgba(228, 63, 79, 0.18);
}

.team-slot.filled:active {
  cursor: grabbing;
}

.team-slot.filled {
  touch-action: none;
}

.team-slot.is-dragging {
  opacity: 0.55;
  transform: scale(0.98);
  border-color: var(--blue);
}

.team-slot.drag-image {
  z-index: 9999;
  opacity: 0.96;
  transform: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.team-slot.is-drop-target {
  border-color: var(--blue);
  background: rgba(77, 163, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.24);
}

.slot-remove,
.slot-empty {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.position {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border-radius: 4px;
  color: var(--gold);
  background: rgba(7, 9, 13, 0.82);
  border: 1px solid rgba(229, 184, 93, 0.42);
  font-size: 12px;
  font-weight: 900;
}

.team-avatar {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 2px solid rgba(127, 135, 148, 0.72);
  border-radius: 5px;
  background: #0b0e14;
}

.team-slot.rarity-ssr .team-avatar {
  border-color: #d9a441;
  box-shadow: 0 0 0 1px rgba(217, 164, 65, 0.2) inset;
}

.team-slot.rarity-sr .team-avatar {
  border-color: #9b66ff;
  box-shadow: 0 0 0 1px rgba(155, 102, 255, 0.22) inset;
}

.team-slot.rarity-r .team-avatar {
  border-color: #7f8794;
  box-shadow: 0 0 0 1px rgba(127, 135, 148, 0.18) inset;
}

.team-avatar img {
  width: 100%;
  height: calc(100% + 15px);
  object-fit: cover;
  object-position: top center;
  transform: translateY(-15px);
}

.empty-avatar {
  color: var(--quiet);
  border: 1px dashed var(--line);
  font-size: 28px;
  font-weight: 900;
}

.universal-charge-field {
  display: grid;
  place-items: center;
  align-content: center;
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px dashed var(--line);
  border-radius: 5px;
  color: var(--quiet);
  background: #0b0e14;
  font-size: 11px;
  font-weight: 900;
  box-sizing: border-box;
}

.universal-charge-label {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(77, 163, 255, 0.42);
  border-radius: 4px;
  color: #dff7ff;
  background: rgba(7, 9, 13, 0.78);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.universal-charge-field input {
  position: absolute;
  left: 50%;
  bottom: 5px;
  transform: translateX(-50%);
  width: min(48px, 72%);
  min-height: 18px;
  border: 1px solid rgba(77, 163, 255, 0.42);
  border-radius: 3px;
  padding: 1px 3px;
  color: var(--text);
  background: rgba(7, 9, 13, 0.8);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  outline: none;
}

.universal-charge-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.18);
}

.slot-copy {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.slot-speed-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  min-width: 22px;
  padding: 1px 4px;
  border: 1px solid rgba(221, 251, 255, 0.5);
  border-radius: 4px;
  color: #fff;
  background: rgba(7, 9, 13, 0.72);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.slot-cube-badge {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  transform: translate(-28%, 28%);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.slot-cube-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slot-settings-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.62));
  transition: filter 140ms ease, transform 140ms ease;
}

.slot-settings-toggle:hover,
.slot-settings-toggle.is-open {
  filter: drop-shadow(0 0 7px rgba(71, 200, 212, 0.95)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.62));
  transform: translateY(-1px);
}

.slot-settings-toggle img {
  width: 28px;
  height: 28px;
}

.slot-link-toggle,
.slot-link-target {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(235, 241, 248, 0.44);
  border-radius: 6px;
  padding: 0;
  color: #f2f5fa;
  background: rgba(60, 65, 72, 0.9);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.48);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, filter 140ms ease;
}

.slot-link-toggle {
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
}

.slot-link-target {
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
}

.slot-link-toggle:hover,
.slot-link-target:hover {
  filter: brightness(1.12);
}

.slot-link-toggle:hover,
.slot-link-target:hover {
  transform: translateX(-50%) translateY(-1px);
}

.slot-link-toggle.is-active {
  border-color: rgba(127, 211, 255, 0.9);
  background: rgba(34, 137, 223, 0.94);
}

.slot-link-target.is-selected {
  border-color: rgba(255, 184, 193, 0.92);
  background: rgba(228, 63, 79, 0.95);
}

.slot-link-target span {
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.slot-link-toggle img,
.slot-link-target img {
  width: 16px;
  height: 16px;
}

.slot-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(2px);
}

.slot-settings-modal {
  width: min(320px, calc(100vw - 44px));
  padding: 14px;
  border: 1px solid rgba(71, 200, 212, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(19, 37, 49, 0.98), rgba(8, 12, 18, 0.98)),
    var(--panel);
  box-shadow:
    0 0 0 1px rgba(221, 251, 255, 0.1) inset,
    0 18px 42px rgba(0, 0, 0, 0.48),
    0 0 28px rgba(71, 200, 212, 0.18);
}

.slot-settings-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.slot-settings-modal-head div {
  display: grid;
  gap: 3px;
}

.slot-settings-modal-head strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.slot-settings-team {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

.slot-settings-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(235, 241, 248, 0.34);
  border-radius: 6px;
  padding: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.slot-settings-close:hover {
  border-color: rgba(71, 200, 212, 0.9);
  color: #fff;
  background: rgba(71, 200, 212, 0.16);
}

.slot-settings-reset {
  width: 100%;
  min-height: 30px;
  margin-top: 14px;
  border: 1px solid rgba(242, 85, 98, 0.42);
  border-radius: 6px;
  color: #ffd8dd;
  background: rgba(242, 85, 98, 0.12);
  font-size: 12px;
  font-weight: 900;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.slot-settings-reset:hover {
  border-color: rgba(242, 85, 98, 0.82);
  color: #fff;
  background: rgba(242, 85, 98, 0.2);
}

.settings-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.settings-field input {
  min-height: 28px;
  padding: 0 6px;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.settings-field input::-webkit-inner-spin-button,
.settings-field input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.settings-check-field {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.settings-check-field input {
  width: 15px;
  height: 15px;
  justify-self: end;
  accent-color: var(--blue);
}

.settings-check-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.help-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

.help-modal {
  width: min(760px, calc(100vw - 44px));
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(71, 200, 212, 0.82);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(19, 37, 49, 0.98), rgba(8, 12, 18, 0.98)),
    var(--panel);
  box-shadow:
    0 0 0 1px rgba(221, 251, 255, 0.1) inset,
    0 18px 46px rgba(0, 0, 0, 0.52),
    0 0 32px rgba(71, 200, 212, 0.18);
}

.help-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px 13px;
  border-bottom: 1px solid rgba(242, 245, 250, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

.help-modal-head div {
  display: grid;
  gap: 3px;
}

.help-modal-head strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.help-modal-kicker {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.help-modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(235, 241, 248, 0.34);
  border-radius: 6px;
  padding: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.help-modal-close:hover {
  border-color: rgba(71, 200, 212, 0.9);
  color: #fff;
  background: rgba(71, 200, 212, 0.16);
}

.help-modal-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  overflow: auto;
}

.help-section {
  min-width: 0;
  border: 1px solid rgba(242, 245, 250, 0.1);
  border-radius: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.help-section h2 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 14px;
  line-height: 1.25;
}

.help-section ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 17px;
}

.help-section li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.speed-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 11px;
}

.speed-control input {
  min-height: 26px;
  padding: 0 6px;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.speed-control input::-webkit-inner-spin-button,
.speed-control input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.empty-result {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.result-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 10px;
}

.metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 11px;
  background: #0f131a;
}

.metric span {
  display: block;
  color: var(--quiet);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 20px;
}

.metric em {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 7px;
  border: 1px solid rgba(228, 63, 79, 0.38);
  border-radius: 4px;
  padding: 2px 8px;
  color: #ff8e92;
  background: rgba(228, 63, 79, 0.1);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.metric.primary strong {
  color: var(--green);
}

.result-copy-target {
  cursor: copy;
}

.sub-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.sub-metrics div {
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 8px;
  color: var(--muted);
  background: #131822;
  font-size: 13px;
}

details {
  border-top: 1px solid var(--line-soft);
  padding-top: 11px;
}

summary {
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 900;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.detail-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  color: var(--muted);
  font-size: 13px;
}

.detail-item strong {
  color: var(--text);
}

.detail-item small {
  grid-column: 1 / -1;
  color: var(--quiet);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(242, 85, 98, 0.46);
  border-radius: 8px;
  color: var(--text);
  background: #20151a;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .main-stage,
  .workspace,
  .team-workbench {
    overflow: visible;
  }

  .team-slots-row {
    grid-template-columns: repeat(5, minmax(84px, 1fr));
  }

  .character-list {
    grid-template-columns: repeat(auto-fill, 68px);
    flex: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .filters {
    gap: 4px;
    padding: 8px;
  }

  .filter-switch {
    flex-basis: 30px;
    width: 30px;
    min-width: 30px;
    height: 32px;
    min-height: 32px;
    font-size: 12px;
  }

  .search-field input {
    min-height: 32px;
    padding: 0 7px;
    font-size: 12px;
  }

  .app-help-button {
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .workspace,
  .team-workbench,
  .team-panel,
  .charge-chart-panel {
    margin-bottom: 12px;
  }

  .charge-chart-panel {
    min-height: 50svh;
  }

  .content-grid {
    display: flex;
    flex-direction: column;
  }

  .charge-chart {
    height: calc(50svh - 19px);
    min-height: 330px;
    max-height: 460px;
    overflow: hidden;
  }

  .charge-chart svg {
    min-width: 0;
    height: 100%;
  }

  .list-header,
  .result-main,
  .sub-metrics {
    grid-template-columns: 1fr;
  }

  .help-modal-backdrop {
    padding: 12px;
  }

  .help-modal {
    width: calc(100vw - 24px);
    max-height: calc(100svh - 24px);
  }

  .help-modal-content {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .help-modal-head {
    padding: 13px 12px 11px;
  }

  .panel-heading {
    display: flex;
    min-width: 0;
    width: 100%;
  }

  .team-actions {
    display: flex;
  }

  .summary-strip {
    justify-content: flex-start;
    text-align: left;
  }

  .team-slots-row {
    grid-template-columns: repeat(5, minmax(66px, 72px));
    justify-content: center;
    gap: 4px;
  }

  .team-slot {
    padding: 4px;
  }

  .position {
    left: 1px;
    top: 3px;
    width: 24px;
    height: 21px;
    font-size: 10px;
  }

  .universal-charge-label {
    right: 1px;
    top: 3px;
    width: 24px;
    height: 21px;
    font-size: 10px;
  }

  .slot-settings-toggle {
    top: 1px;
    right: 1px;
    width: 22px;
    height: 22px;
  }

  .slot-settings-toggle img {
    width: 22px;
    height: 22px;
  }

  .slot-link-toggle,
  .slot-link-target {
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 5px;
  }

  .slot-link-toggle img,
  .slot-link-target img {
    width: 12px;
    height: 12px;
  }

  .slot-link-target span {
    font-size: 13px;
  }

  .slot-copy .finish-mark {
    width: 18px;
    height: 18px;
    font-size: 11px;
  }

  .speed-control {
    grid-template-columns: 1fr;
  }

  .character-list {
    grid-template-columns: repeat(auto-fill, 62px);
    grid-auto-rows: 62px;
    gap: 7px;
  }
}
