/* Subject details in the VS play layout. */
.compare-subject-strip {
  display: grid;
  grid-row: 4;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(100%, 720px);
  min-height: 80px;
  margin-inline: auto;
  padding: 12px 10px 4px;
}
.compare-subject-strip[hidden], body[data-phase=summary] .compare-subject-strip, .compare-subject [hidden] { display: none !important; }
.compare-subject {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  padding: 2px 0;
  gap: 10px;
  text-align: start;
}
.compare-subject-thumbnail { position: relative; flex: none; }
body[data-flow=compare][data-view=play]:not([data-phase=summary]) #play-view.vs-play .compare-subject :is(#compare-reward, #compare-reference-card) {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 57px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid #83977b;
  border-radius: 7px;
  background: #1c3429;
  box-shadow: 0 1px 2px #142b261a;
  color: #d8e4cd;
  cursor: pointer;
}
#play-view.vs-play .compare-subject .compare-subject-card:hover { border-color: var(--console-sage); box-shadow: 0 0 0 2px var(--console-sage-line); }
#play-view.vs-play .compare-subject .compare-subject-card:focus-visible,
#play-view.vs-play .compare-subject .compare-subject-info:focus-visible { outline: 2px solid #40624c; outline-offset: 2px; }
.compare-subject-new {
  position: absolute;
  z-index: 2;
  inset-block-start: -7px;
  inset-inline-start: -3px;
  padding: 2px 5px;
  border: 1px solid var(--console-brass-edge);
  border-radius: 5px;
  background: #f3dda7;
  color: #5d4727;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  pointer-events: none;
}
.compare-subject-copy { min-width: 0; }
.compare-subject-title { display: flex; min-width: 0; align-items: center; gap: 3px; }
body[data-flow=compare][data-view=play]:not([data-phase=summary]) #play-view.vs-play .compare-subject-title :is(#compare-reference-title, #compare-reward-title) {
  margin: 0;
  color: #f0eee4;
  font-size: clamp(13px, 2vw, 17px);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
#play-view.vs-play .compare-subject-copy p {
  margin: 2px 0 0;
  color: #b6c6b3;
  font-size: clamp(10px, 1.55vw, 12px);
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
#play-view.vs-play .compare-subject .compare-subject-info {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  min-height: 32px;
  margin: -5px -3px -5px 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #b6c6b3;
  box-shadow: none;
  font: 650 11px/1 'Outfit', sans-serif;
  cursor: help;
}
#play-view.vs-play .compare-subject .compare-subject-info::before {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: '';
  pointer-events: none;
}
#play-view.vs-play .compare-subject .compare-subject-info:hover { color: var(--console-text); }
.collection-dialog[data-reward=true][data-subject-preview=true] .collection-heading { display: block !important; margin: 0 40px 8px; color: #f6f1e4; }
.collection-dialog[data-reward=true][data-subject-preview=true] .collection-heading h2 { font-size: 18px; line-height: 1.3; }
.collection-dialog[data-reward=true][data-subject-preview=true] .collection-current-pack { display: none; }
.collection-dialog[data-reward=true][data-subject-preview=true] { --collection-card-width: min(72vw, calc(64dvh * 63 / 88), 380px); }
@media (max-width: 600px) {
  .compare-subject-strip { gap: 10px; }
  .compare-subject { justify-content: start; gap: 7px; }
  body[data-flow=compare][data-view=play]:not([data-phase=summary]) #play-view.vs-play .compare-subject :is(#compare-reward, #compare-reference-card) { height: 51px; }
  .compare-subject-title { gap: 0; }
}

.compare-subject-strip { grid-template-columns: minmax(0,1fr); gap: 4px; padding-top: 8px; }
.compare-subject[hidden] { display: none; }
.compare-subject-target { justify-self: center; align-items: center; }
.vs-owned-strip { min-width: 0; padding: 4px 0; border-top: 1px solid var(--console-line); }
.vs-owned-strip h3 { margin: 0 0 3px; font-size: 11px; color: var(--console-muted); }
#vs-owned-cards {
  display: flex; align-items: center; gap: 5px; overflow-x: auto; min-height: 68px;
  padding: 4px; border: 1px solid #356056; border-radius: 9px;
  background: #092721; box-shadow: inset 0 2px 4px #001a1670; scrollbar-width: thin;
}
/* Extend the empty wells from the end of the real card row. */
#vs-owned-cards::after {
  content: ''; flex: 1 0 44px; height: 58px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='49' height='58'%3E%3Crect x='.5' y='.5' width='43' height='57' rx='6' fill='%230c302a' stroke='%23426658'/%3E%3C/svg%3E") repeat-x;
}
.vs-card-in-flight { position: fixed; z-index: 32; pointer-events: none; border-radius: 6px; border: 2px solid var(--console-brass); box-sizing: border-box; }
#vs-owned-cards .collected-card { flex: 0 0 44px; width: 44px; height: 58px; min-height: 0; padding: 0; border-radius: 6px; border-width: 2px; }
#vs-owned-cards .collected-card-field { border-radius: 4px; }
#vs-owned-cards .collected-card-name { display: none; }

body[data-flow=compare][data-view=play]:not([data-phase=summary]) #play-view.vs-play .compare-feedback { display: none; }

.vs-earnings-heading { display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin-bottom:3px; }
.vs-earnings-heading h3 { margin:0; }
.vs-points-total { font-size:11px; color:var(--console-muted); }
.vs-points-total strong { margin-inline-start:3px; color:var(--console-brass); font-size:13px; font-variant-numeric:tabular-nums; white-space:nowrap; }
body[data-flow=compare] #play-view.vs-play #compare-outcome:empty { display:none; }

/* Place the reward preview above the arena, keeping the collection drawer below. */
body[data-flow=compare][data-view=play]:not([data-phase=summary]) #play-view.vs-play:has(#compare-subjects:not([hidden])) {
  --vs-hud-height: 60px;
  grid-template-rows: auto var(--vs-hud-height) var(--vs-scene-row, minmax(0, 1fr)) auto;
  & > #compare-subjects { display: contents; }
  & .compare-subject-target { grid-row: 1; grid-column: 1; margin-block: 5px; }
  & > .question { grid-row: 2; }
  /* Mirror the HUD above the canvas below it so its midpoint is the arena midpoint. */
  & > #stage { grid-row: 3; height: calc(100% - var(--vs-hud-height)); align-self: start; }
  /* Anchor the controls to the arena, independently of the fitted image bounds. */
  & > .interaction {
    position: absolute;
    grid-area: 2 / 1 / 4 / 2;
    inset: auto 0 clamp(14px, 7.5%, 40px);
    z-index: 3;
    transform: none;
    padding: 0 12px;
    gap: 0;
    pointer-events: none;
  }
  & .compare-action-controls { order: 1; }
  & .interaction :is(button, a, input, .compare-trial-panel) { pointer-events: auto; }
  & .vs-owned-strip { grid-row: 4; grid-column: 1; margin-inline: 8px; }
  &::before, & > .vs-result-track, & > #comparison-stage-versus { grid-area: 2 / 1 / 4 / 2; }
}

body[data-flow=compare][data-view=play][data-phase=question] #play-view {
  touch-action: pan-x pinch-zoom;
}
@media (max-width: 600px) and (min-height: 521px) {
  body[data-flow=compare][data-view=play][data-phase=question] #vs-owned-cards {
    touch-action: pan-x pinch-zoom;
  }
}

body[data-flow=compare][data-view=play]:not([data-phase=summary]) #play-view.vs-play {
  & > #comparison-stage-versus { grid-area: 1 / 1 / 4 / 2; top: 50%; }
  & > .question { min-height: 60px; }
  & #compare-season-feedback { bottom: 50%; }
  & #compare-adjust-hint {
    position: absolute;
    inset: 50% 42px auto;
    width: auto;
    text-align: center;
    pointer-events: none;
  }
}
@media (max-height: 520px) {
  body[data-flow=compare][data-view=play] #play-view.vs-play {
    --vs-scene-row: minmax(290px, 40dvh);
  }
}
.compare-subject-target:has(.compare-subject-new:not([hidden])) .compare-subject-thumbnail {
  border-radius: 7px;
  box-shadow: 0 0 0 2px #ffc149, 0 0 10px #ffbc3038;
}
.compare-subject-new {
  background: #ffc149;
  color: #392606;
  border-color: #694612;
  font-weight: 800;
}

/* The help frame describes the entire draggable surface. */
body[data-flow=compare][data-view=play]:not([data-phase=summary]) #play-view.vs-play > #scale-tutorial {
  background: #152e29f5;
  & .vs-help-target {
    inset: 7px;
    width: auto;
    height: auto;
    border: 1.5px dashed #dceae2;
    border-radius: 13px;
  }
  & #vs-tutorial-adjust {
    font-size: clamp(16px, 4vw, 22px);
    font-weight: 650;
    line-height: 1.45;
  }
  & .vs-help-reward {
    inset: 16px 52px auto;
    width: fit-content;
    max-width: calc(100% - 104px);
    height: auto;
    margin-inline: auto;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: #244c40;
    font-size: 13px;
    line-height: 1.45;
  }
  & #tutorial-rules-link { inset: auto auto 12px 50%; }
  & #tutorial-start { top: 10px; left: 10px; }
}
