/* Bans page (/bans/): cards with the time remaining on each measure, and the
   player page with a large face and each measure on its own timeline. */

.bans-page {
  --bn-card: #222222;
  --bn-line: rgba(255, 255, 255, 0.085);
  --bn-line-strong: rgba(255, 255, 255, 0.15);
  --bn-track: rgba(255, 255, 255, 0.08);
  --bn-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.bans-page .page-inner {
  width: min(100%, var(--container));
  max-width: var(--container);
}

/* Severity tones color the badge, a card's stripe, and its bar. */
.bn-tone-r { --tone: #e86f6b; }
.bn-tone-sr { --tone: #ed5f5d; }
.bn-tone-ssr { --tone: #f04d50; }
.bn-tone-ur { --tone: #f23848; }
.bn-tone-tm { --tone: #addb71; }
.bn-tone-m { --tone: #d7c36c; }
.bn-tone-lm { --tone: #e3a65e; }
.bn-tone-um { --tone: #ea815e; }

.bn-sev {
  display: inline-grid;
  flex: none;
  place-items: center;
  min-width: 38px;
  height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--tone, #888) 16%, transparent);
  color: var(--tone, #888);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
}

.bn-measure {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.bn-measure-ban {
  background: rgba(240, 77, 80, 0.14);
  color: #ff8b85;
}

.bn-measure-mute {
  background: rgba(227, 166, 94, 0.14);
  color: #f0c07c;
}

/* GeyserMC/Floodgate players: names start with a dot. */
.bn-be {
  display: inline-grid;
  place-items: center;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.78);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  vertical-align: 2px;
}

.bn-profile-name .bn-be {
  height: 22px;
  margin-left: 10px;
  font-size: 0.78rem;
  vertical-align: 0.5em;
}

/* ── List head and level guide ── */

.bn-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.bn-head-copy {
  min-width: 0;
}

.bn-guide {
  position: relative;
  z-index: 15;
  flex: none;
}

.bn-guide-trigger,
.bn-guide-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bn-line-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.bn-guide-trigger {
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.bn-guide-trigger svg,
.bn-guide-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.bn-guide-trigger:hover,
.bn-guide.is-open .bn-guide-trigger,
.bn-guide-close:hover {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.05);
}

.bn-guide-trigger:focus-visible,
.bn-guide-close:focus-visible,
.bn-card-link:focus-visible,
.bn-copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bn-guide-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 10px);
  right: 0;
  width: min(440px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--bn-line-strong);
  border-radius: 14px;
  background: #262626;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}

.bn-guide-popover[hidden],
.bn-guide-backdrop {
  display: none;
}

.bn-guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.bn-guide-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
}

.bn-guide-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.bn-guide-close {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
}

.bn-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.bn-guide-grid h3 {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.bn-guide-grid ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bn-guide-grid li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 700;
}

/* ── Cards ── */

.bn-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bn-card {
  min-width: 0;
}

.bn-card-link {
  position: relative;
  display: grid;
  gap: 12px;
  height: 100%;
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid var(--bn-line);
  border-radius: 14px;
  background: var(--bn-card);
  color: var(--text);
  text-decoration: none;
  transition: border-color 180ms ease;
}

.bn-card-link::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--tone, var(--bn-line-strong));
}

@media (hover: hover) {
  .bn-card-link:not(.ph-frame):hover {
    border-color: rgba(255, 255, 255, 0.45);
  }
}

.bn-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.bn-card-top .bn-sev {
  align-self: flex-start;
}

.bn-card-face {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: #2c2c2c;
  image-rendering: pixelated;
  object-fit: cover;
}

.bn-card-id {
  flex: 1;
  min-width: 0;
}

.bn-card-name {
  overflow: hidden;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bn-card-uuid {
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--bn-mono);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bn-card-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
}

.bn-card-left {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bn-card-since {
  flex: none;
  color: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bn-bar,
.bn-track {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bn-track);
}

.bn-bar i,
.bn-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--tone, var(--text-muted));
}

.bn-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.bn-source-icon {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  object-fit: cover;
}

/* A group without an icon: its initial on the same tile. */
.bn-source-initial {
  display: inline-grid;
  place-items: center;
  background: #2c2c2c;
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
}

.bn-source-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Player page ── */

.bn-detail .back-link {
  margin-bottom: 8px;
}

.bn-profile {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.bn-profile[hidden] {
  display: none;
}

.bn-profile-face {
  width: 128px;
  height: 128px;
  border-radius: 26px;
  background: #2c2c2c;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--bn-line-strong), 0 30px 80px rgba(0, 0, 0, 0.5);
  image-rendering: pixelated;
}

.bn-profile-kicker {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.bn-profile-name {
  max-width: 100%;
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.bn-profile-uuid {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 6px;
  max-width: 100%;
  margin: 0;
  color: var(--text-muted);
  font-family: var(--bn-mono);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.bn-copy {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.bn-copy:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.bn-copy.is-copied {
  color: var(--accent);
}

.bn-copy svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bn-copy-status {
  color: var(--accent);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
}

.bn-copy-status:empty {
  display: none;
}

.bn-measures {
  display: grid;
  gap: 14px;
  width: 100%;
  margin-top: 18px;
  text-align: left;
}

.bn-measure-card {
  display: grid;
  gap: 14px;
  padding: 20px 22px;
  border: 1px solid var(--bn-line);
  border-radius: 14px;
  background: var(--bn-card);
}

.bn-measure-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.bn-measure-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.bn-timeline {
  display: grid;
  gap: 8px;
}

.bn-timeline-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bn-timeline-row strong {
  color: var(--text);
  font-weight: 800;
}

.bn-track {
  height: 8px;
  border-radius: 4px;
}

.bn-measure-card .bn-source {
  gap: 8px;
  font-size: 0.82rem;
}

.bn-measure-card .bn-source-icon {
  width: 20px;
  height: 20px;
}

.bn-measure-card .bn-source-name {
  color: var(--text-secondary);
}

@media (max-width: 1100px) {
  .bn-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .bn-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .bn-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* The level guide becomes a bottom sheet over a dimmed page. */
  .bn-guide.is-open {
    z-index: 120;
  }

  .bn-guide-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(24, 24, 24, 0.62);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: bn-fade-in 0.24s ease-out;
  }

  .bn-guide-backdrop.is-closing { animation: bn-fade-out 0.18s ease-in both; }

  .bn-guide-popover {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: min(82vh, 600px);
    overflow-y: auto;
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    animation: bn-sheet-in 0.24s ease-out;
  }

  .bn-guide-popover.is-closing { animation: bn-sheet-out 0.18s ease-in both; }

  .bn-profile-face {
    width: 104px;
    height: 104px;
    border-radius: 22px;
  }

  .bn-measure-card {
    padding: 16px;
    border-radius: 14px;
  }

  .bn-measure-head h2 {
    font-size: 1rem;
  }

  .bn-timeline-row {
    font-size: 0.76rem;
  }
}

@keyframes bn-sheet-in {
  from { transform: translateY(24px); opacity: 0; }
}

@keyframes bn-sheet-out {
  to { transform: translateY(24px); opacity: 0; }
}

@keyframes bn-fade-in {
  from { opacity: 0; }
}

@keyframes bn-fade-out {
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bn-card-link,
  .bn-guide-popover,
  .bn-guide-popover.is-closing,
  .bn-guide-backdrop:not([hidden]),
  .bn-guide-backdrop.is-closing {
    transition: none;
    animation: none;
  }
}
