:root {
  color-scheme: dark;
  --bg: #080b10;
  --bg-soft: #0b1017;
  --panel: #101720;
  --panel-high: #151f2b;
  --panel-hover: #192534;
  --line: #263342;
  --line-soft: #1b2632;
  --text: #eef4f8;
  --muted: #92a2b2;
  --faint: #5d6b79;
  --mint: #8ce8ca;
  --mint-strong: #42d9ad;
  --gold: #f5c76a;
  --red: #ff746f;
  --blue: #70b8ff;
  --violet: #b89cff;
  --trash: #65c7b2;
  --boss: #e97078;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgb(0 0 0 / 28%);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -10%, rgb(66 217 173 / 9%), transparent 30rem),
    radial-gradient(circle at 94% 8%, rgb(112 184 255 / 7%), transparent 27rem),
    var(--bg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button,
input,
select {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

::selection {
  color: #06100d;
  background: var(--mint);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 9px 13px;
  color: #07100d;
  background: var(--mint);
  border-radius: 8px;
  font-weight: 800;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 108px;
}

.topbar {
  display: flex;
  align-items: center;
  min-height: 68px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line-soft);
  background: rgb(8 11 16 / 78%);
  backdrop-filter: blur(20px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  width: 31px;
  height: 31px;
  padding: 6px;
  border: 1px solid rgb(140 232 202 / 40%);
  border-radius: 9px;
  background: rgb(140 232 202 / 6%);
}

.brand-mark i {
  display: block;
  width: 4px;
  border-radius: 3px;
  background: var(--mint);
}

.brand-mark i:nth-child(1) { height: 8px; opacity: 0.55; }
.brand-mark i:nth-child(2) { height: 17px; }
.brand-mark i:nth-child(3) { height: 12px; opacity: 0.75; }

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.17em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.prototype-badge {
  margin-left: 13px;
  padding: 2px 7px;
  border: 1px solid #344455;
  border-radius: 999px;
  color: #a7b5c3;
  font: 700 9px/1.5 var(--mono);
  letter-spacing: 0.1em;
}

.topbar-note {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
}

.command-bar {
  display: grid;
  grid-template-columns: minmax(210px, 0.65fr) minmax(410px, 1.4fr) minmax(210px, 0.62fr);
  gap: clamp(24px, 3.5vw, 56px);
  align-items: end;
  padding: 30px clamp(20px, 4vw, 64px) 32px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(17 24 33 / 72%), rgb(11 16 23 / 88%));
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--mint);
  font: 700 10px/1.3 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.command-copy h1 {
  margin: 0;
  font-size: clamp(24px, 2.3vw, 35px);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.report-form label,
.player-control label {
  display: block;
  margin-bottom: 7px;
  color: #bdc8d3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.input-row {
  position: relative;
  display: flex;
}

.input-icon {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--faint);
  border-radius: 50%;
  transform: translateY(-57%);
  pointer-events: none;
}

.input-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--faint);
  transform: rotate(45deg);
}

#report-url {
  width: 100%;
  min-width: 0;
  height: 47px;
  padding: 0 154px 0 43px;
  border: 1px solid #344354;
  border-radius: 10px;
  color: var(--text);
  background: #090e14;
  font-family: var(--mono);
  font-size: 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

#report-url:hover {
  border-color: #46586b;
}

#report-url:focus {
  border-color: var(--mint-strong);
  box-shadow: 0 0 0 3px rgb(66 217 173 / 11%);
}

#report-url.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgb(255 116 111 / 10%);
}

#report-url::placeholder {
  color: #53606d;
}

.primary-button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 37px;
  padding: 0 14px 0 17px;
  border: 0;
  border-radius: 7px;
  color: #06110e;
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
  transition: background 150ms ease, transform 150ms ease;
}

.primary-button:hover:not(:disabled) {
  background: #abf4dc;
}

.primary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.button-arrow {
  font-size: 17px;
  line-height: 0;
}

.field-hint {
  display: block;
  margin: 7px 2px 0;
  color: var(--faint);
  font-size: 10px;
}

.command-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.quiet-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid #344354;
  border-radius: 9px;
  color: #d4dee6;
  background: #111923;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 150ms ease, background 150ms ease;
}

.quiet-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  border-color: #53677a;
  background: #17222e;
}

.play-icon {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--mint);
}

.player-control {
  flex: 1 1 150px;
  min-width: 140px;
}

#player-select {
  width: 100%;
  height: 42px;
  padding: 0 33px 0 12px;
  border: 1px solid #344354;
  border-radius: 9px;
  color: var(--text);
  background-color: #111923;
  font-size: 12px;
  font-weight: 650;
}

.status-region {
  position: relative;
  z-index: 20;
  height: 0;
}

.status-toast {
  position: absolute;
  top: 16px;
  right: clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(440px, calc(100vw - 40px));
  padding: 10px 14px;
  border: 1px solid #334353;
  border-radius: 10px;
  color: #cbd5de;
  background: rgb(16 23 32 / 96%);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.status-toast.error {
  border-color: rgb(255 116 111 / 46%);
  color: #ffd0ce;
}

.status-toast button {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-decoration: underline;
}

.spinner {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid rgb(140 232 202 / 22%);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#main-content {
  min-height: 360px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 630px;
  margin: 0 auto;
  padding: clamp(72px, 9vw, 130px) 24px 90px;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  font-size: clamp(27px, 4vw, 42px);
  font-weight: 630;
  letter-spacing: -0.045em;
}

.empty-state > p:not(.eyebrow) {
  max-width: 540px;
  margin: 14px auto 23px;
  color: var(--muted);
}

.empty-graphic {
  position: relative;
  width: min(420px, 78vw);
  height: 100px;
  margin-bottom: 32px;
}

.empty-route {
  position: absolute;
  top: 44px;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #344557 8%, #344557 92%, transparent);
}

.empty-route::before,
.empty-route::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 18px rgb(140 232 202 / 65%);
}

.empty-route::before { left: 4%; }
.empty-route::after { right: 4%; }

.empty-pull {
  position: absolute;
  top: 31px;
  height: 28px;
  border: 1px solid rgb(101 199 178 / 50%);
  border-radius: 5px;
  background: rgb(101 199 178 / 14%);
}

.pull-one { left: 14%; width: 15%; }
.pull-two { left: 35%; width: 23%; }
.pull-three { right: 12%; width: 17%; border-color: rgb(233 112 120 / 55%); background: rgb(233 112 120 / 15%); }

.empty-cd {
  position: absolute;
  top: 76px;
  height: 4px;
  border-radius: 4px;
  background: var(--gold);
}

.empty-cd::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -1px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--gold);
}

.cd-one { left: 21%; width: 26%; }
.cd-two { left: 58%; width: 31%; background: var(--violet); }
.cd-two::before { background: var(--violet); }

.results {
  padding: clamp(26px, 3.5vw, 48px) clamp(20px, 4vw, 64px) 52px;
  transition: opacity 120ms ease, filter 120ms ease;
}

.results.is-updating {
  opacity: 0.45;
  filter: saturate(0.5);
  pointer-events: none;
}

.run-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.run-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.run-title-line h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: clamp(24px, 3.1vw, 38px);
  font-weight: 640;
  line-height: 1.15;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-badge,
.kind-badge,
.result-badge,
.estimate-badge,
.category-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 700 9px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.demo-badge {
  padding: 3px 7px;
  color: var(--gold);
  border-color: rgb(245 199 106 / 35%);
  background: rgb(245 199 106 / 8%);
}

.run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 17px;
  color: var(--muted);
  font-size: 12px;
}

.run-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.meta-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--faint);
}

.report-code {
  font-family: var(--mono);
}

.run-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, auto));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(16 23 32 / 72%);
  overflow: hidden;
}

.run-stat {
  min-width: 94px;
  padding: 12px 16px;
  border-left: 1px solid var(--line);
}

.run-stat:first-child {
  border-left: 0;
}

.run-stat small,
.run-stat strong {
  display: block;
}

.run-stat small {
  margin-bottom: 2px;
  color: var(--faint);
  font: 700 9px/1.4 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.run-stat strong {
  font-size: 18px;
  font-weight: 650;
}

.estimate-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  padding: 11px 14px;
  border: 1px solid rgb(245 199 106 / 18%);
  border-radius: 10px;
  color: #c6b689;
  background: rgb(245 199 106 / 5%);
  font-size: 11px;
}

.estimate-note .info-glyph {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border: 1px solid rgb(245 199 106 / 38%);
  border-radius: 50%;
  color: var(--gold);
  font: 800 10px/1 var(--mono);
}

.estimate-note strong {
  color: #e3d09c;
}

.view-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.view-heading h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 680;
}

.view-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #dbe4eb;
  font-size: 12px;
  font-weight: 650;
}

.player-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aeb8c2;
  box-shadow: 0 0 0 3px rgb(174 184 194 / 10%);
}

.class-warrior .player-dot, .player-dot.class-warrior { background: #c79c6e; }
.class-paladin .player-dot, .player-dot.class-paladin { background: #f58cba; }
.class-hunter .player-dot, .player-dot.class-hunter { background: #abd473; }
.class-rogue .player-dot, .player-dot.class-rogue { background: #fff569; }
.class-priest .player-dot, .player-dot.class-priest { background: #f3f3f3; }
.class-shaman .player-dot, .player-dot.class-shaman { background: #5f94ff; }
.class-mage .player-dot, .player-dot.class-mage { background: #69ccf0; }
.class-warlock .player-dot, .player-dot.class-warlock { background: #9482c9; }
.class-druid .player-dot, .player-dot.class-druid { background: #ff7d0a; }

.route-legend,
.matrix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
}

.route-legend {
  margin-bottom: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 15px;
  height: 7px;
  border-radius: 2px;
  background: var(--trash);
}

.legend-swatch.boss { background: var(--boss); }
.legend-swatch.cooldown { height: 3px; background: var(--gold); }
.legend-swatch.ready { width: 7px; height: 7px; border: 1px solid var(--mint); background: transparent; transform: rotate(45deg); }

/* Variant A: continuous route rail */
.rail-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgb(17 25 34 / 94%), rgb(11 16 23 / 94%));
  box-shadow: 0 24px 70px rgb(0 0 0 / 17%);
  overflow: hidden;
}

.rail-scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: #334557 #0c1219;
  scrollbar-width: thin;
}

.rail-grid {
  min-width: 1100px;
}

.rail-row {
  display: grid;
  grid-template-columns: 194px minmax(900px, 1fr);
  min-height: 54px;
  border-top: 1px solid var(--line-soft);
}

.rail-row:first-child {
  border-top: 0;
}

.rail-label {
  position: sticky;
  left: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 14px;
  border-right: 1px solid var(--line);
  background: #111923;
  box-shadow: 9px 0 18px rgb(0 0 0 / 12%);
}

.rail-label.axis-label {
  color: var(--faint);
  font: 700 9px/1.4 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.rail-label-copy {
  min-width: 0;
}

.rail-label-copy strong,
.rail-label-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-label-copy strong {
  font-size: 11px;
  font-weight: 670;
}

.rail-label-copy small {
  margin-top: 2px;
  color: var(--faint);
  font: 9px/1.3 var(--mono);
}

.ability-icon {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  margin-right: 9px;
  border: 1px solid #3a4958;
  border-radius: 7px;
  color: #07100d;
  background: linear-gradient(145deg, var(--mint), #5bb39e);
  font: 800 10px/1 var(--mono);
  overflow: hidden;
}

.ability-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.icon-fallback {
  position: relative;
  z-index: 0;
}

.axis-track,
.fight-track,
.cooldown-track,
.mini-track {
  position: relative;
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), rgb(90 108 124 / 11%) calc(10% - 1px), rgb(90 108 124 / 11%) 10%);
}

.axis-track {
  min-height: 43px;
  background-color: #0d141c;
}

.axis-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--left);
  width: 1px;
  background: rgb(120 138 154 / 13%);
}

.axis-tick span {
  position: absolute;
  top: 13px;
  left: 7px;
  color: #687786;
  font: 9px/1 var(--mono);
  white-space: nowrap;
}

.axis-tick:last-child span {
  right: 7px;
  left: auto;
}

.fight-row {
  min-height: 76px;
}

.fight-track {
  min-height: 76px;
  background-color: #0a1017;
}

.fight-block {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: var(--left);
  width: max(var(--width), 4px);
  min-width: 4px;
  padding: 7px 8px;
  border: 1px solid rgb(101 199 178 / 34%);
  border-radius: 5px;
  color: #d5f3eb;
  background: linear-gradient(180deg, rgb(101 199 178 / 24%), rgb(101 199 178 / 12%));
  overflow: hidden;
  transition: z-index 0s, border-color 130ms ease, background 130ms ease;
}

.fight-block.boss {
  border-color: rgb(233 112 120 / 42%);
  color: #ffdadd;
  background: linear-gradient(180deg, rgb(233 112 120 / 25%), rgb(233 112 120 / 12%));
}

.fight-block:hover,
.fight-block:focus-visible {
  z-index: 5;
  border-color: var(--mint);
  background-color: #21312e;
}

.fight-block.boss:hover,
.fight-block.boss:focus-visible {
  border-color: #ff9ca3;
}

.fight-block strong,
.fight-block small {
  display: block;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fight-block strong {
  font-size: 9px;
  font-weight: 750;
}

.fight-block small {
  margin-top: 3px;
  color: rgb(213 243 235 / 62%);
  font: 8px/1.2 var(--mono);
}

.fight-block.boss small {
  color: rgb(255 218 221 / 62%);
}

.cooldown-row {
  min-height: 58px;
}

.cooldown-track {
  min-height: 58px;
  background-color: rgb(10 16 23 / 82%);
}

.cooldown-window {
  position: absolute;
  top: 28px;
  left: var(--left);
  width: max(var(--width), 2px);
  height: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, var(--gold), rgb(245 199 106 / 38%));
}

.cooldown-window.estimated::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 5px, rgb(8 11 16 / 45%) 5px 7px);
}

.cooldown-window.continues {
  border-radius: 0;
}

.cooldown-window.continues::before {
  content: ">";
  position: absolute;
  top: -7px;
  right: 2px;
  color: var(--gold);
  font: 700 10px/1 var(--mono);
}

.usage-pin {
  position: absolute;
  z-index: 3;
  top: 20px;
  left: var(--left);
  width: 19px;
  height: 19px;
  border: 3px solid #0a1017;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 1px rgb(245 199 106 / 42%);
  transform: translateX(-50%);
}

.ready-pin {
  position: absolute;
  z-index: 3;
  top: 24px;
  left: var(--left);
  width: 10px;
  height: 10px;
  border: 2px solid var(--mint);
  background: #0a1017;
  transform: translateX(-50%) rotate(45deg);
}

.usage-pin:hover,
.usage-pin:focus-visible,
.ready-pin:hover,
.ready-pin:focus-visible {
  z-index: 5;
  filter: brightness(1.2);
}

.no-cooldowns {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.no-cooldowns strong,
.no-cooldowns span {
  display: block;
}

.no-cooldowns strong {
  color: var(--text);
  font-size: 13px;
}

.no-cooldowns span {
  margin-top: 4px;
  font-size: 11px;
}

.rail-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  background: #0d141c;
  font-size: 9px;
}

/* Variant B: chronological pull ledger */
.ledger-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(285px, 340px);
  gap: 24px;
  align-items: start;
}

.pull-ledger {
  min-width: 0;
}

.ledger-sequence {
  position: relative;
}

.ledger-sequence::before {
  content: "";
  position: absolute;
  top: 23px;
  bottom: 23px;
  left: 102px;
  width: 1px;
  background: linear-gradient(180deg, var(--mint), var(--line) 7%, var(--line) 93%, var(--mint));
}

.pull-entry {
  position: relative;
  display: grid;
  grid-template-columns: 83px minmax(0, 1fr);
  gap: 38px;
  margin-bottom: 12px;
}

.pull-time {
  padding-top: 16px;
  color: var(--muted);
  font: 10px/1.3 var(--mono);
  text-align: right;
}

.pull-time strong {
  display: block;
  color: #c2cdd7;
  font-size: 11px;
  font-weight: 600;
}

.pull-time small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
}

.pull-card {
  position: relative;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgb(16 23 32 / 78%);
  transition: border-color 140ms ease, background 140ms ease;
}

.pull-card::before {
  content: "";
  position: absolute;
  top: 20px;
  left: -24px;
  width: 9px;
  height: 9px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--trash);
  box-shadow: 0 0 0 1px rgb(101 199 178 / 55%);
}

.pull-card.boss::before {
  background: var(--boss);
  box-shadow: 0 0 0 1px rgb(233 112 120 / 55%);
}

.pull-card:hover {
  border-color: #3d4d5e;
  background: rgb(21 31 43 / 90%);
}

.pull-card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.pull-number {
  display: block;
  margin-bottom: 3px;
  color: var(--faint);
  font: 700 9px/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pull-card h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 680;
}

.pull-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.kind-badge,
.result-badge,
.estimate-badge,
.category-badge {
  padding: 3px 7px;
}

.kind-badge.trash {
  color: #a7e5d7;
  border-color: rgb(101 199 178 / 30%);
  background: rgb(101 199 178 / 7%);
}

.kind-badge.boss {
  color: #ffb5ba;
  border-color: rgb(233 112 120 / 32%);
  background: rgb(233 112 120 / 8%);
}

.result-badge.kill {
  color: var(--mint);
  border-color: rgb(140 232 202 / 28%);
}

.result-badge.wipe {
  color: #ff9b97;
  border-color: rgb(255 116 111 / 28%);
}

.enemy-list {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.pull-cooldowns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}

.usage-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 8px 5px 5px;
  border: 1px solid #344355;
  border-radius: 7px;
  color: #d4dde5;
  background: #0b1118;
  font-size: 10px;
}

.usage-chip .ability-icon {
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 5px;
  font-size: 8px;
}

.usage-chip strong {
  font-size: 10px;
}

.usage-chip time {
  color: var(--gold);
  font-family: var(--mono);
}

.no-use-label {
  color: var(--faint);
  font-size: 10px;
}

.gap-entry {
  position: relative;
  display: grid;
  grid-template-columns: 83px minmax(0, 1fr);
  gap: 38px;
  min-height: 32px;
  margin: -3px 0 4px;
}

.gap-entry::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 99px;
  width: 7px;
  height: 7px;
  border: 1px solid #536170;
  border-radius: 50%;
  background: var(--bg);
}

.gap-time {
  padding-top: 7px;
  color: #697785;
  font: 9px/1 var(--mono);
  text-align: right;
}

.gap-label {
  align-self: center;
  color: #596674;
  font-size: 9px;
  font-style: italic;
}

.cooldown-sidebar {
  position: sticky;
  top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #121a24, #0d141c);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--mint);
  font: 700 9px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-head h3 {
  margin: 0;
  font-size: 16px;
}

.sidebar-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.ability-summary-list {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  scrollbar-color: #334557 transparent;
  scrollbar-width: thin;
}

.ability-summary {
  padding: 13px 15px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.ability-summary:last-child {
  border-bottom: 0;
}

.ability-summary-head {
  display: flex;
  align-items: center;
}

.ability-summary-head .ability-icon {
  width: 30px;
  height: 30px;
}

.ability-summary-copy {
  min-width: 0;
  flex: 1;
}

.ability-summary-copy strong,
.ability-summary-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ability-summary-copy strong {
  font-size: 11px;
}

.ability-summary-copy small {
  color: var(--faint);
  font: 9px/1.3 var(--mono);
}

.use-count {
  color: var(--gold);
  font: 700 10px/1 var(--mono);
}

.mini-track {
  height: 15px;
  margin-top: 10px;
  border-radius: 3px;
  background-color: #0a1017;
}

.mini-use,
.mini-ready {
  position: absolute;
  top: 4px;
  left: var(--left);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  transform: translateX(-50%);
}

.mini-ready {
  top: 5px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--mint);
  border-radius: 1px;
  background: #0a1017;
  transform: translateX(-50%) rotate(45deg);
}

.ability-next {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--faint);
  font: 8px/1.3 var(--mono);
}

.ability-next strong {
  color: #9bacbc;
  font-weight: 600;
}

/* Variant C: cooldown availability matrix */
.matrix-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.matrix-stat {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(16 23 32 / 76%);
}

.matrix-stat .ability-summary-head {
  margin-bottom: 10px;
}

.matrix-stat .ability-icon {
  width: 27px;
  height: 27px;
}

.matrix-stat-metrics {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font: 9px/1.3 var(--mono);
}

.matrix-stat-metrics strong {
  color: #c5d0d9;
  font-size: 10px;
}

.matrix-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d141c;
  overflow: hidden;
}

.matrix-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #111923;
}

.matrix-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.matrix-scroll {
  max-height: min(680px, calc(100vh - 250px));
  overflow: auto;
  scrollbar-color: #334557 #0c1219;
  scrollbar-width: thin;
}

.availability-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.availability-table th,
.availability-table td {
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.availability-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  width: 126px;
  min-width: 126px;
  height: 66px;
  padding: 8px;
  color: #bcc8d2;
  background: #131c26;
  font-size: 9px;
  text-align: left;
  vertical-align: bottom;
}

.availability-table thead th:first-child {
  left: 0;
  z-index: 8;
  width: 210px;
  min-width: 210px;
  padding-left: 14px;
  color: var(--faint);
  box-shadow: 8px 0 18px rgb(0 0 0 / 13%);
}

.matrix-pull-head strong,
.matrix-pull-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-pull-head strong {
  margin-top: 4px;
  font-size: 9px;
}

.matrix-pull-head small {
  margin-top: 3px;
  color: var(--faint);
  font: 8px/1.2 var(--mono);
}

.matrix-kind-line {
  width: 24px;
  height: 3px;
  border-radius: 3px;
  background: var(--trash);
}

.matrix-kind-line.boss {
  background: var(--boss);
}

.availability-table tbody th {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 210px;
  min-width: 210px;
  padding: 9px 12px;
  background: #111923;
  text-align: left;
  box-shadow: 8px 0 18px rgb(0 0 0 / 13%);
}

.matrix-ability {
  display: flex;
  align-items: center;
}

.matrix-ability .ability-icon {
  width: 29px;
  height: 29px;
  margin-right: 9px;
}

.matrix-ability-copy {
  min-width: 0;
}

.matrix-ability-copy strong,
.matrix-ability-copy small {
  display: block;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-ability-copy strong {
  color: #dae3ea;
  font-size: 10px;
}

.matrix-ability-copy small {
  margin-top: 2px;
  color: var(--faint);
  font: 8px/1.2 var(--mono);
}

.availability-table td {
  width: 126px;
  min-width: 126px;
  height: 58px;
  padding: 7px;
  background: #0c1219;
}

.matrix-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
}

.matrix-cell strong,
.matrix-cell small {
  display: block;
}

.matrix-cell strong {
  font: 700 9px/1.2 var(--mono);
}

.matrix-cell small {
  margin-top: 3px;
  color: var(--faint);
  font: 8px/1.2 var(--mono);
}

.matrix-cell.ready {
  color: #8fd9c6;
  border-color: rgb(101 199 178 / 13%);
  background: rgb(101 199 178 / 5%);
}

.matrix-cell.used {
  color: #ffe0a0;
  border-color: rgb(245 199 106 / 27%);
  background: rgb(245 199 106 / 8%);
}

.matrix-cell.cooling {
  color: #b9a7ee;
  border-color: rgb(184 156 255 / 20%);
  background: rgb(184 156 255 / 6%);
}

.matrix-cell.unseen {
  color: #5b6874;
}

.matrix-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.matrix-empty {
  padding: 45px 20px;
  color: var(--muted);
  text-align: center;
}

.app-footer {
  padding: 0 clamp(20px, 4vw, 64px) 20px;
}

.app-footer p {
  margin: 0;
  color: #505e6b;
  font-size: 9px;
  text-align: center;
}

.app-footer span {
  margin-right: 4px;
  color: #7a6e4e;
}

.failure-state {
  padding-top: clamp(58px, 7vw, 92px);
}

.error-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  border: 1px solid rgb(255 116 111 / 42%);
  border-radius: 50%;
  color: #ff9c98;
  background: rgb(255 116 111 / 8%);
  font: 700 20px/1 var(--mono);
}

.variant-switcher {
  position: fixed;
  right: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 50;
  display: grid;
  grid-template-columns: 38px minmax(168px, auto) 38px;
  align-items: center;
  padding: 5px;
  border: 1px solid #425365;
  border-radius: 999px;
  color: #eef4f8;
  background: rgb(20 29 39 / 96%);
  box-shadow: 0 14px 44px rgb(0 0 0 / 48%), 0 0 0 1px rgb(255 255 255 / 3%) inset;
  backdrop-filter: blur(18px);
  transform: translateX(50%);
}

.variant-switcher button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #d9e2e9;
  background: transparent;
  font-size: 18px;
  transition: color 130ms ease, background 130ms ease;
}

.variant-switcher button:hover {
  color: #06110e;
  background: var(--mint);
}

.variant-readout {
  padding: 0 14px;
  border-right: 1px solid #354555;
  border-left: 1px solid #354555;
  text-align: center;
}

.variant-readout small,
.variant-readout strong {
  display: block;
}

.variant-readout small {
  margin-bottom: 1px;
  color: #738392;
  font: 700 8px/1.2 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.variant-readout strong {
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .command-bar {
    grid-template-columns: minmax(180px, 0.55fr) minmax(390px, 1.35fr);
  }

  .command-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .player-control {
    max-width: 240px;
  }
}

@media (max-width: 860px) {
  .topbar-note {
    display: none;
  }

  .command-bar {
    grid-template-columns: 1fr;
    gap: 19px;
  }

  .command-actions {
    grid-column: auto;
    justify-content: flex-start;
  }

  .player-control {
    max-width: none;
  }

  .run-header {
    grid-template-columns: 1fr;
  }

  .run-stat-grid {
    width: 100%;
  }

  .run-stat {
    flex: 1;
  }

  .ledger-layout {
    grid-template-columns: 1fr;
  }

  .cooldown-sidebar {
    position: static;
    grid-row: 1;
  }

  .pull-ledger {
    grid-row: 2;
  }

  .ability-summary-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    max-height: none;
  }

  .ability-summary {
    border-right: 1px solid var(--line-soft);
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 61px;
  }

  .prototype-badge {
    margin-left: auto;
  }

  .command-bar {
    padding-top: 24px;
  }

  .input-row {
    display: block;
  }

  #report-url {
    height: 48px;
    padding-right: 14px;
  }

  .primary-button {
    position: static;
    width: 100%;
    height: 42px;
    margin-top: 8px;
  }

  .command-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
  }

  .results {
    padding-right: 14px;
    padding-left: 14px;
  }

  .run-title-line {
    align-items: flex-start;
    flex-direction: column-reverse;
  }

  .run-title-line h2 {
    max-width: 100%;
    white-space: normal;
  }

  .run-stat {
    min-width: 0;
    padding: 10px;
  }

  .run-stat strong {
    font-size: 15px;
  }

  .view-heading {
    display: block;
  }

  .route-legend,
  .matrix-legend,
  .view-heading .player-chip {
    margin-top: 10px;
  }

  .ledger-sequence::before {
    left: 12px;
  }

  .pull-entry {
    display: block;
    padding-left: 30px;
  }

  .pull-time {
    display: flex;
    gap: 7px;
    padding: 0 0 5px;
    text-align: left;
  }

  .pull-time strong,
  .pull-time small {
    display: inline;
  }

  .pull-card::before {
    top: 17px;
    left: -22px;
  }

  .gap-entry {
    display: block;
    min-height: 28px;
    padding-left: 30px;
  }

  .gap-entry::after {
    left: 9px;
  }

  .gap-time {
    display: inline;
    padding: 0 5px 0 0;
  }

  .gap-label {
    display: inline;
  }

  .matrix-overview {
    display: flex;
    overflow-x: auto;
  }

  .matrix-stat {
    flex: 0 0 190px;
  }

  .variant-switcher {
    grid-template-columns: 36px minmax(145px, auto) 36px;
  }

  .variant-readout {
    padding: 0 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Passwordless sign-in ---------- */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% -8%, rgb(66 217 173 / 10%), transparent 34rem),
    radial-gradient(circle at 90% 6%, rgb(112 184 255 / 8%), transparent 30rem),
    var(--bg);
}

.auth-card {
  width: min(430px, 100%);
  padding: 32px 32px 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Hide the form while the existing session is still being checked so a
   signed-in user never sees the login card flash. */
.auth-overlay.is-checking .auth-card {
  visibility: hidden;
}

.auth-card h2 {
  margin: 4px 0 8px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.auth-copy {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.auth-copy strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.auth-field {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.auth-input {
  width: 100%;
  padding: 11px 13px;
  margin-bottom: 12px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 140ms ease;
}

.auth-input:focus {
  border-color: var(--mint-strong);
}

.auth-input::placeholder {
  color: var(--faint);
}

.auth-code-input {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.35em;
  text-align: center;
}

.auth-step .primary-button,
#invite-form .primary-button {
  position: static;
  height: 42px;
}

.auth-step .primary-button {
  width: 100%;
  justify-content: center;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.auth-message {
  min-height: 1.5em;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-message.is-error {
  color: var(--red);
}

.auth-message.is-success {
  color: var(--mint);
}

.account-menu {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  margin-left: 18px;
}

.account-email {
  max-width: 220px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-dialog {
  width: min(470px, calc(100vw - 32px));
  padding: 26px 26px 20px;
  color: var(--text);
  background: var(--panel-high);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.invite-dialog::backdrop {
  background: rgb(4 6 9 / 72%);
  backdrop-filter: blur(3px);
}

.invite-dialog h2 {
  margin: 4px 0 8px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

#invite-form {
  display: flex;
  gap: 10px;
}

#invite-form .auth-input {
  flex: 1;
  margin-bottom: 0;
}

.invite-list-title {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.user-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  padding: 0;
  margin: 10px 0 0;
  overflow-y: auto;
  list-style: none;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.user-row-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-badge {
  flex-shrink: 0;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.user-badge.admin {
  color: #06100d;
  background: var(--mint);
}

.user-badge.pending {
  color: var(--gold);
  border: 1px solid rgb(245 199 106 / 45%);
}

.invite-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .account-email {
    display: none;
  }
}
