/* ---------- Compare two pets ---------- */
.cmp-head { align-items: flex-end; }
.cmp-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cmp-actions .btn { height: 44px; }

/* Duel: pet A, VS column, pet B */
.cmp-duel {
  display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  align-items: stretch; gap: 0;
}
.cmp-mid { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.cmp-mid::before {
  content: ''; position: absolute; top: 12%; bottom: 12%; left: 50%; width: 1px;
  background: linear-gradient(transparent, var(--line-3) 30%, var(--line-3) 70%, transparent);
}
.cmp-vs {
  position: relative; z-index: 1;
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  font: 900 15px/1 var(--font-display); letter-spacing: -0.02em; color: var(--text);
  background: radial-gradient(circle at 50% 30%, var(--surface-4), var(--surface-2));
  border: 1px solid var(--line-3);
  box-shadow: 0 0 0 6px var(--bg), 0 10px 30px -8px rgba(47, 140, 255, 0.45);
}
.cmp-swap { position: relative; z-index: 1; border-radius: 50%; width: 40px; height: 40px; box-shadow: 0 0 0 6px var(--bg); }
.cmp-swap:not([disabled]):hover svg { transform: rotate(180deg); }
.cmp-swap svg { transition: transform 0.35s var(--ease); }
.cmp-swap[disabled] { opacity: 0.4; pointer-events: none; }

.cmp-side {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 16px 20px 22px;
  border-radius: var(--radius-lg); border: 1px solid var(--line);
  background:
    radial-gradient(90% 55% at 50% 32%, color-mix(in srgb, var(--rc) 13%, transparent), transparent 72%),
    var(--surface);
}
.cmp-side.tier-secret { border-color: color-mix(in srgb, var(--rc) 24%, var(--line)); box-shadow: 0 24px 60px -36px color-mix(in srgb, var(--rc) 80%, transparent); }
.cmp-side.tier-legend { border-color: color-mix(in srgb, var(--rc) 40%, var(--line)); box-shadow: 0 0 50px -18px color-mix(in srgb, var(--rc) 70%, transparent); }
.cmp-side-top { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cmp-tag {
  display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-2);
}
.cmp-change {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--text-2); font: 600 13px var(--font); cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cmp-change svg { width: 14px; height: 14px; }
.cmp-change:hover { background: var(--surface-3); color: var(--text); border-color: var(--line-3); }

/* Big render that pops out of its tile */
.cmp-stage { display: block; width: min(100%, 260px); margin: 22px auto 0; border-radius: 22px; position: relative; }
.cmp-stage .art { width: 100%; border-radius: 22px; padding: 2px; }
.cmp-stage .art-inner { border-radius: 20px; }
.cmp-side.has-pic .cmp-stage .art-inner { overflow: visible; }
.cmp-side.has-pic .cmp-stage .art-inner img {
  inset: auto; left: -6%; top: -16%; width: 112%; height: 112%; padding: 4%;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1.2);
}
.cmp-side.has-pic .cmp-stage::after {
  content: ''; position: absolute; z-index: 1; pointer-events: none;
  left: 16%; right: 16%; bottom: 8%; height: 24%; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--rc) 75%, transparent), transparent);
  filter: blur(12px); opacity: 0.8;
}
.cmp-side.has-pic .cmp-stage:hover .art-inner img { transform: translateY(-8px) scale(1.05); }

.cmp-id { width: 100%; margin-top: 18px; min-width: 0; }
.cmp-name {
  display: block; color: var(--text); text-decoration: none;
  font: 800 clamp(20px, 2.4vw, 28px)/1.1 var(--font-display); letter-spacing: -0.03em;
  overflow-wrap: anywhere; border-radius: 6px;
}
.cmp-name:hover { color: var(--accent-hover); }
.cmp-tags { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cmp-tags .rarity { font-size: 12px; padding: 4px 10px 4px 9px; }
.cmp-tags .vtag { font-size: 10.5px; padding: 4px 8px; }

.cmp-big {
  margin-top: 18px; min-height: 56px; display: flex; align-items: center; justify-content: center;
  font: 900 clamp(36px, 4.6vw, 54px)/1 var(--font-display); letter-spacing: -0.045em; font-variant-numeric: tabular-nums;
}
.cmp-big .tok { width: 0.66em; height: 0.66em; margin-right: 0.14em; }
.cmp-big-oc .val-oc { font-size: 26px; padding: 9px 15px 8px; border-radius: 12px; letter-spacing: 0.04em; box-shadow: 0 0 36px -10px rgba(255, 170, 60, 0.7); }
.cmp-big-none { font-size: clamp(22px, 2.6vw, 30px); font-weight: 800; color: var(--muted); letter-spacing: -0.03em; }
.cmp-rank { margin-top: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cmp-rank b { color: var(--text-2); font-weight: 800; }

/* Empty slot */
.cmp-empty {
  justify-content: center; gap: 6px; min-height: 420px; cursor: pointer; font: inherit; color: inherit;
  background:
    radial-gradient(70% 50% at 50% 40%, rgba(47, 140, 255, 0.07), transparent 70%),
    transparent;
  border: 1.5px dashed var(--line-3);
  transition: border-color 0.2s, background-color 0.2s;
}
.cmp-empty:hover { border-color: var(--accent); background-color: rgba(47, 140, 255, 0.04); }
.cmp-empty-ring {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 12px;
  color: var(--accent); background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(47, 140, 255, 0.35), 0 0 0 10px rgba(47, 140, 255, 0.05), 0 0 40px -6px rgba(47, 140, 255, 0.45);
  transition: transform 0.3s var(--ease);
}
.cmp-empty:hover .cmp-empty-ring { transform: scale(1.06); }
.cmp-empty-ring svg { width: 34px; height: 34px; }
.cmp-empty-t { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.cmp-empty-s { font-size: 13.5px; color: var(--muted); }

/* Verdict */
.cmp-verdict { margin-top: 20px; padding: 22px 24px; display: flex; gap: 18px; align-items: flex-start; position: relative; overflow: hidden; }
.cmp-verdict::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 120% at 0% 0%, rgba(47, 140, 255, 0.12), transparent 60%);
}
.cmp-verdict-ico {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(47, 140, 255, 0.3);
}
.cmp-verdict-ico svg { width: 24px; height: 24px; }
.cmp-verdict.tone-flat .cmp-verdict-ico { color: var(--fair); background: rgba(255, 201, 77, 0.1); border-color: rgba(255, 201, 77, 0.3); }
.cmp-verdict.tone-flat::before { background: radial-gradient(60% 120% at 0% 0%, rgba(255, 201, 77, 0.08), transparent 60%); }
.cmp-verdict-body { position: relative; flex: 1; min-width: 0; }
.cmp-verdict h2 { font-size: clamp(20px, 2.4vw, 28px); font-weight: 800; line-height: 1.15; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.cmp-verdict h2 b { font-weight: 800; }
.cmp-x {
  display: inline-block; padding: 0 0.28em; border-radius: 0.3em; color: var(--win);
  background: rgba(46, 230, 160, 0.1); box-shadow: inset 0 0 0 1px rgba(46, 230, 160, 0.3);
  font-variant-numeric: tabular-nums;
}
.cmp-verdict p { margin: 8px 0 0; color: var(--text-2); font-size: 14.5px; max-width: 70ch; }
.cmp-verdict p b { color: var(--text); font-weight: 700; }
.cmp-verdict .tok { width: 1em; height: 1em; margin-right: 0.18em; vertical-align: -0.16em; }
.cmp-bar { display: flex; height: 10px; margin-top: 18px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 3px; }
.cmp-bar span { display: block; height: 100%; border-radius: 999px; min-width: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--rc) 70%, #fff 0%), var(--rc)); box-shadow: 0 0 14px -2px color-mix(in srgb, var(--rc) 60%, transparent); }
.cmp-bar-a { flex: 0 0 var(--w); transform-origin: left; animation: cmp-grow 0.8s var(--ease) both; }
.cmp-bar-b { flex: 1; }
@keyframes cmp-grow { from { transform: scaleX(0); } }
.cmp-bar-legend { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cmp-bar-legend span:first-child, .cmp-bar-legend span:last-child { color: var(--text-2); font-weight: 700; }

/* Stat rows: A | label | B */
.cmp-stats { margin-top: 20px; padding: 6px 0; overflow: hidden; }
.cmp-stats-head, .cmp-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr); align-items: center; }
.cmp-stats-head { padding: 10px 0 8px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.cmp-stats-head span { padding: 0 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-stats-head span:first-child { text-align: right; }
.cmp-stats-mid { text-align: center; }
.cmp-row { border-bottom: 1px solid var(--line); min-height: 58px; }
.cmp-row:last-child { border-bottom: 0; }
.cmp-k { text-align: center; display: flex; flex-direction: column; gap: 1px; padding: 8px 4px; }
.cmp-k span { font-size: 13px; font-weight: 700; color: var(--text-2); }
.cmp-k small { font-size: 11px; color: var(--faint); font-weight: 500; }
.cmp-k .cmp-even { color: var(--fair); font-weight: 700; }
.cmp-cell {
  position: relative; height: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 20px; min-width: 0;
  font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: background 0.2s;
}
.cmp-row > .cmp-cell:first-child { justify-content: flex-end; text-align: right; }
.cmp-cv { min-width: 0; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmp-row > .cmp-cell:first-child .cmp-cv { justify-content: flex-end; }
.cmp-cell.is-empty { color: var(--muted); font-weight: 600; font-size: 14px; }
.cmp-cell.win { color: var(--text); }
.cmp-row > .cmp-cell.win:first-child { background: linear-gradient(270deg, rgba(46, 230, 160, 0.12), transparent 85%); }
.cmp-row > .cmp-cell.win:last-child { background: linear-gradient(90deg, rgba(46, 230, 160, 0.12), transparent 85%); }
.cmp-row > .cmp-cell.win:first-child::after, .cmp-row > .cmp-cell.win:last-child::before {
  content: ''; position: absolute; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--win);
  box-shadow: 0 0 10px rgba(46, 230, 160, 0.6);
}
.cmp-row > .cmp-cell.win:first-child::after { right: 0; }
.cmp-row > .cmp-cell.win:last-child::before { left: 0; }
.cmp-win {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--win); color: #06281c;
}
.cmp-win svg { width: 12px; height: 12px; }
.cmp-row > .cmp-cell:first-child .cmp-win { order: 2; }
.cmp-sub { color: var(--muted); font-weight: 500; font-size: 13px; }
.cmp-rdot { width: 8px; height: 8px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 8px var(--rc); display: inline-block; flex-shrink: 0; }
.cmp-cell .val-none { font-size: 14px; }

/* Variants */
.cmp-section { margin-top: 32px; }
.cmp-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cmp-section-head h2 { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.03em; }
.cmp-section-head span { font-size: 13px; color: var(--muted); }
.cmp-vgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cmp-vgroup { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.cmp-vhead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-width: 0; }
.cmp-vhead b { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cmp-vhead > span:last-child { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.cmp-vars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cmp-var {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 8px 10px; min-width: 0;
  border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text); text-decoration: none; text-align: center;
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
}
.cmp-var .art { width: 100%; border-radius: 12px; }
.cmp-var .art-inner { border-radius: 11px; }
.cmp-var-n { font-size: 12px; font-weight: 600; color: var(--text-2); margin-top: 4px; }
.cmp-var-v { font-size: 14px; font-weight: 800; min-height: 20px; display: flex; align-items: center; max-width: 100%; }
.cmp-var-v .val-none { font-size: 11px; }
.cmp-var-v .val-oc { font-size: 11px; }
a.cmp-var:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--rc) 50%, transparent); background: var(--surface-2); }
.cmp-var.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 12px 30px -18px rgba(47, 140, 255, 0.7); }
.cmp-var.is-missing { background: transparent; border-style: dashed; border-color: var(--line-2); }
.cmp-var-ph { width: 100%; aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--line-2); background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(255, 255, 255, 0.02) 8px 16px); }
.cmp-var.is-missing .cmp-var-n { color: var(--muted); }
.cmp-var.is-missing .cmp-var-v { font-size: 11px; font-weight: 600; color: var(--faint); }

/* Hint card for empty / one-sided states */
.cmp-hint { margin-top: 20px; padding: 20px 22px; display: flex; align-items: center; gap: 16px; }
.cmp-hint-ico { flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.cmp-hint-ico svg { width: 22px; height: 22px; }
.cmp-hint > div:nth-child(2) { flex: 1; min-width: 0; }
.cmp-hint b { font-size: 16px; letter-spacing: -0.01em; }
.cmp-hint p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.cmp-hint .btn { flex-shrink: 0; }

/* Focus */
.cmp-side :focus-visible, .cmp-empty:focus-visible, .cmp-var:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 860px) {
  .cmp-stats-head, .cmp-row { grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1fr); }
  .cmp-vgrid { grid-template-columns: 1fr; }
}

/* Phone: pets stay side by side, everything else stacks */
@media (max-width: 640px) {
  .cmp-head { margin-bottom: 18px; }
  .cmp-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .cmp-actions .btn { height: 44px; padding: 0 10px; }
  .cmp-duel { grid-template-columns: minmax(0, 1fr) 0 minmax(0, 1fr); column-gap: 10px; }
  .cmp-mid { z-index: 2; }
  .cmp-mid::before { display: none; }
  .cmp-vs { position: absolute; top: 112px; left: 50%; transform: translateX(-50%); width: 38px; height: 38px; font-size: 12px; box-shadow: 0 0 0 5px var(--bg), 0 8px 20px -6px rgba(47, 140, 255, 0.5); }
  .cmp-swap { position: absolute; top: 162px; left: 50%; transform: translateX(-50%); width: 34px; height: 34px; box-shadow: 0 0 0 5px var(--bg); }
  .cmp-swap svg { width: 15px; height: 15px; }
  .cmp-side { padding: 10px 10px 16px; border-radius: var(--radius); }
  .cmp-tag { height: 22px; font-size: 10px; padding: 0 7px; }
  .cmp-change { height: 28px; padding: 0 9px; font-size: 12px; }
  .cmp-change span { display: none; }
  .cmp-stage { width: 100%; margin-top: 18px; }
  .cmp-id { margin-top: 12px; }
  .cmp-name { font-size: 16px; }
  .cmp-tags { gap: 4px; margin-top: 8px; }
  .cmp-tags .rarity { font-size: 10.5px; padding: 3px 7px; }
  .cmp-tags .rarity .r-ico { width: 10px; height: 10px; }
  .cmp-tags .vtag { font-size: 9.5px; padding: 3px 6px; }
  .cmp-big { margin-top: 12px; min-height: 36px; font-size: 26px; }
  .cmp-big-oc .val-oc { font-size: 16px; padding: 6px 10px 5px; border-radius: 9px; }
  .cmp-big-none { font-size: 16px; }
  .cmp-rank { font-size: 12px; margin-top: 4px; }
  .cmp-empty { min-height: 300px; padding: 10px; }
  .cmp-empty-ring { width: 60px; height: 60px; margin-bottom: 8px; }
  .cmp-empty-ring svg { width: 26px; height: 26px; }
  .cmp-empty-t { font-size: 15px; }
  .cmp-empty-s { font-size: 12px; }

  .cmp-verdict { padding: 18px 16px; gap: 12px; flex-direction: column; }
  .cmp-verdict-ico { width: 38px; height: 38px; border-radius: 11px; }
  .cmp-verdict-ico svg { width: 20px; height: 20px; }
  .cmp-verdict h2 { font-size: 20px; }
  .cmp-verdict p { font-size: 13.5px; }

  .cmp-stats-head, .cmp-row { grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr); }
  .cmp-stats-head span { padding: 0 12px; font-size: 10.5px; }
  .cmp-cell { padding: 10px 12px; font-size: 13.5px; gap: 6px; }
  .cmp-cell.is-empty, .cmp-cell .val-none { font-size: 12.5px; }
  .cmp-k { padding: 8px 2px; }
  .cmp-k span { font-size: 11.5px; }
  .cmp-k small { font-size: 10px; line-height: 1.2; }
  .cmp-win { width: 16px; height: 16px; }
  .cmp-win svg { width: 10px; height: 10px; }
  .cmp-cell .demand .dbars { display: none; }
  .cmp-sub { font-size: 11px; }

  .cmp-vgroup { padding: 12px; }
  .cmp-vars { gap: 6px; }
  .cmp-var { padding: 5px 5px 8px; }
  .cmp-var-n { font-size: 11px; }
  .cmp-var-v { font-size: 12px; }

  .cmp-hint { flex-wrap: wrap; padding: 16px; }
  .cmp-hint .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cmp-bar-a { animation: none; }
  .cmp-swap svg, .cmp-empty-ring, .cmp-side.has-pic .cmp-stage .art-inner img { transition: none; }
}
