:root {
  --glass: rgba(8, 14, 27, 0.86);
  --glass-strong: rgba(12, 21, 39, 0.96);
  --blue-glow: rgba(84, 212, 255, 0.2);
  --red-glow: rgba(255, 94, 124, 0.2);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent 88%);
}

.page-header h1 {
  text-shadow: 0 0 34px rgba(128, 195, 255, 0.16);
}

.setup-panel,
.game-card,
.battle-tools,
.team-preview,
.option-card,
.fighter-card {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.setup-panel {
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255,255,255,0.035);
}

.team-preview {
  position: relative;
  overflow: hidden;
}

.team-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 10% 0%, rgba(255,255,255,0.08), transparent 42%);
}

.team-preview-blue {
  box-shadow: inset 0 0 34px var(--blue-glow);
}

.team-preview-red {
  box-shadow: inset 0 0 34px var(--red-glow);
}

.team-preview-title > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.team-settings-button {
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
}

.team-preview-blue .team-settings-button {
  border-color: rgba(93, 207, 255, 0.55);
  color: var(--blue);
  background: rgba(42, 144, 190, 0.12);
}

.team-preview-red .team-settings-button {
  border-color: rgba(255, 111, 134, 0.55);
  color: var(--red);
  background: rgba(188, 52, 80, 0.12);
}

.team-modifier-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 23px;
  margin: -2px 0 9px;
}

.modifier-chip {
  border: 1px solid rgba(190, 207, 232, 0.2);
  border-radius: 999px;
  background: rgba(5, 10, 20, 0.54);
  padding: 3px 7px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
}

.match-options {
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
}

.rule-card {
  background:
    radial-gradient(circle at 90% 0%, rgba(238, 190, 86, 0.12), transparent 45%),
    rgba(11, 19, 34, 0.86);
}

.rule-card .option-help {
  margin: 7px 0 0;
}

.fighter-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--ability-color) 16%, transparent), transparent 44%),
    linear-gradient(155deg, rgba(24, 36, 60, 0.92), rgba(8, 15, 28, 0.96));
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.fighter-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--ability-color) 60%, var(--line));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.fighter-card[data-team="both"] {
  border-image: linear-gradient(135deg, var(--blue), var(--red)) 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035);
}

.fighter-card .ultimate-preview {
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, #f4cb65 58%, var(--line));
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(208, 153, 49, 0.12), rgba(81, 38, 111, 0.12));
  padding: 8px;
}

.ultimate-preview .skill-line {
  color: #f7d67d;
}

.ultimate-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 22px;
  margin-right: 6px;
  border: 1px solid rgba(248, 213, 123, 0.48);
  border-radius: 999px;
  background: rgba(240, 183, 63, 0.12);
  color: #f8d77e;
  font-size: 0.65rem;
  font-weight: 900;
}

.team-slot.filled {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.team-settings-dialog {
  width: min(92vw, 430px);
  max-height: min(88vh, 640px);
  border: 1px solid rgba(126, 160, 207, 0.42);
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 0%, rgba(97, 165, 255, 0.16), transparent 40%),
    #0a1220;
  color: var(--text);
  padding: 0;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.62);
}

.team-settings-dialog::backdrop {
  background: rgba(1, 4, 10, 0.72);
  backdrop-filter: blur(6px);
}

.team-settings-form {
  padding: 18px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dialog-heading h2 {
  margin: 0;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
}

.modifier-control {
  display: block;
  margin-top: 12px;
  border: 1px solid rgba(129, 153, 191, 0.26);
  border-radius: 14px;
  background: rgba(6, 12, 23, 0.68);
  padding: 12px;
}

.modifier-control > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.modifier-control output {
  color: var(--gold);
  font-weight: 900;
}

.modifier-control input[type="range"] {
  width: 100%;
  accent-color: var(--focus);
}

.modifier-control small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.match-summary {
  display: grid;
  gap: 6px;
}

.match-summary span {
  border: 1px solid rgba(161, 180, 212, 0.18);
  border-radius: 9px;
  background: rgba(6, 11, 21, 0.58);
  padding: 7px;
}

.ultimate-meter {
  display: inline-grid;
  grid-template-columns: repeat(10, 5px);
  gap: 2px;
  margin-left: 5px;
  vertical-align: middle;
}

.ultimate-meter i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
}

.ultimate-meter i.filled {
  background: #f8d56f;
  box-shadow: 0 0 7px rgba(248, 213, 111, 0.7);
}

@media (max-width: 800px) {
  .match-options {
    grid-template-columns: 1fr;
  }

  .team-preview-title {
    align-items: flex-start;
  }

  .team-settings-button {
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .team-settings-dialog {
    width: calc(100vw - 18px);
  }

  .team-preview-title {
    gap: 6px;
  }

  .team-settings-button {
    font-size: 0.64rem;
    padding-inline: 7px;
  }
}
