/* Artwork and canonical rules share the inspector; tokens carry live state. */
#inspect {
  width: min(520px, calc(100vw - 32px));
  max-width: none; max-height: calc(100dvh - 24px); padding: 38px 10px 10px; overflow: hidden;
  background: transparent; box-shadow: none; border-radius: 14px;
}
#inspect-close {
  position: absolute; right: 10px; top: 0; float: none;
  width: 30px; height: 34px; padding: 0; color: #fff1cb;
  background: #111b24; border: 1px solid #c5a55c; border-radius: 8px;
}
#inspect .inspect { display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; min-width: 0; max-height: calc(100dvh - 76px); overflow: hidden; padding: 0; }
#inspect-art { display: block; flex: 1 1 auto; min-height: 0; width: auto; max-width: 100%; height: auto; max-height: calc(100dvh - 190px); object-fit: contain; border-radius: 12px; }
#inspect img[hidden], #inspect-fallback[hidden] { display: none; }
#inspect-details { flex: 0 0 auto; width: 100%; min-width: 0; color: #e5d7ae; background: #13202d; border-radius: 8px; }
#inspect-details summary { cursor: pointer; padding: 10px 14px; }
#inspect-fallback { margin: 0; padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: calc(100dvh - 210px); overflow-y: auto; }
#inspect .inspect:has(#inspect-details[open]) { overflow-y: auto; overflow-x: hidden; }
#inspect .inspect:has(#inspect-details[open]) > #inspect-art { flex: 0 0 auto; }
#inspect-details[open] #inspect-fallback { max-height: none; overflow: visible; }
#inspect-effects { position: static; display: flex; flex: 0 0 auto; flex-flow: row wrap; justify-content: center; gap: 7px; max-width: 100%; padding: 3px; order: -1; }
#inspect-effects:empty { display: none; }
.card-hover-preview.card-face {
  width: min(400px, 42vw, calc((100dvh - 36px) * .716));
  padding: 0; overflow: visible; border: 0; background: transparent;
  max-height: none; border-radius: 12px; box-shadow: 0 12px 40px #000c;
}
.card-hover-preview.card-face img { width: 100%; height: auto; display: block; border-radius: 12px; }
.card-effects {
  position: absolute; right: -15px; top: 10%; bottom: 5%;
  display: flex; flex-flow: column wrap-reverse; align-content: flex-start; gap: 7px;
}
.effect-token {
  position: relative; cursor: help;
  display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid #e3c578;
  color: #fff3cf; background: radial-gradient(circle at 35% 25%, #506078, #142131 75%);
  box-shadow: inset 0 0 0 2px #0b1422, 0 2px 5px #000b;
  font: 700 13px/1 var(--ui); text-shadow: 0 1px 2px #000;
}
.effect-token__icon { width: 74% !important; height: 74% !important; object-fit: contain; border-radius: 0 !important; pointer-events: none; }
.effect-token__value { position: absolute; right: -4px; bottom: -3px; padding: 1px 3px; border-radius: 4px; background: #101b29; color: #fff1c6; font: 700 10px/1.1 var(--ui); }
.effect-token:focus-visible { outline: 2px solid #fff1c6; outline-offset: 3px; }
.effect-token:hover { border-color: #fff1c6; filter: brightness(1.15); }
.effect-tooltip {
  position: fixed; inset: auto; margin: 0; box-sizing: border-box;
  width: min(260px, calc(100vw - 16px)); padding: 13px 15px 14px 55px;
  background: linear-gradient(135deg, #203347, #0c1725 80%);
  border: 1px solid #b99a56; border-radius: 9px;
  box-shadow: 0 8px 24px #0009, inset 0 0 0 3px #101c2a;
  color: #dbe4ed; pointer-events: none; text-align: left;
  font: 400 12px/1.5 var(--ui); text-shadow: none;
}
.effect-tooltip::backdrop { background: transparent; pointer-events: none; }
.effect-tooltip img { position: absolute; left: 13px; top: 14px; width: 30px; height: 30px; }
.effect-tooltip strong { display: block; margin-bottom: 4px; color: #f5d991; font-size: 14px; line-height: 1.25; }
.effect-tooltip span { display: block; }
.effect-token--damage, .effect-token--restriction { background: radial-gradient(circle at 35% 25%, #b8414b, #531d29 75%); }
.effect-token--buff, .effect-token--empowered { background: radial-gradient(circle at 35% 25%, #47886e, #15392f 75%); }
.effect-token--barrier { background: radial-gradient(circle at 35% 25%, #65b8d5, #194561 75%); }
.effect-token--stunned { background: radial-gradient(circle at 35% 25%, #bc963d, #624017 75%); }
#stage .unit .flags {
  display: flex; opacity: 1; left: auto; right: 2%; top: 10%; bottom: 20%;
  flex-flow: column wrap-reverse; align-content: flex-start; gap: 2px; z-index: 5;
}
.unit .effect-token { width: clamp(12px, 1.05cqw, 22px); height: clamp(12px, 1.05cqw, 22px); font-size: clamp(8px, .65cqw, 12px); border-width: 1px; }
/* Scoring/contest state remains available on the battlefield's accessible label
   and score tooltip, without covering its name and score with another label. */
#stage .field__state { display: none; }

/* Identity slots show the full card, with room to turn sideways when spent. */
#stage .slot__space { display: grid; place-items: center; width: 100%; aspect-ratio: 1; }
#stage .slot__card {
  width: 71.6%; height: 100%; min-width: 0; min-height: 0;
  aspect-ratio: .716; transform-origin: center;
}
#stage .slot__card img { width: 100%; height: 100%; margin: 0; object-fit: contain; }
#stage .slot__card--exhausted { transform: rotate(90deg); }
/* Keep canonical rules alongside the printed battlefield artwork. */
.field__details .field__card-image { max-height: 22vh; height: auto; margin-bottom: .5rem; }
.field__details .field__card-name, .field__details .field__card-type, .field__details .field__card-rules { display: block; }
.field__details .field__card-rules { font-size: clamp(12px, .9cqw, 16px); }

/* Legal chain targets share the board's gold target treatment. */
.chain__item.is-legal { outline: 3px solid #f6d477; outline-offset: 2px; box-shadow: 0 0 16px #f6d47780; }
.chain__item.is-legal::after { content: "Legal target"; color: #f6d477; font-weight: 700; }
.unit.is-damage-preview { outline: 3px solid #f6d477; overflow: visible; }
.damage-preview { position: absolute; z-index: 20; left: 0; bottom: 0; padding: 3px 6px; background: #18151a; color: #ffe39b; font: bold 12px/1.3 sans-serif; pointer-events: none; white-space: nowrap; }

.chain__detail { white-space: normal; overflow: visible; overflow-wrap: anywhere; font-size: max(11px, .62cqw); }

/* Keep wrapped trigger intent in the scrollable chain instead of shrinking its list to zero. */
.chain { top: auto; bottom: 19%; max-height: max(140px, 21%); }
.chain__items { flex-shrink: 0; overflow: visible; }
.chain__item { flex-shrink: 0; }
